ReactOS 0.4.15-dev-7924-g5949c20
avicap32.c File Reference
#include <stdio.h>
#include <windef.h>
#include <winbase.h>
#include <winreg.h>
#include <winver.h>
#include <winnls.h>
#include <wingdi.h>
#include <winternl.h>
#include <vfw.h>
#include <wine/debug.h>
Include dependency graph for avicap32.c:

Go to the source code of this file.

Macros

#define WIN32_NO_STATUS
 
#define _INC_WINDOWS
 
#define COM_NO_WINDOWS_H
 
#define CAP_DESC_MAX   32
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (avicap32)
 
LRESULT CALLBACK CaptureWindowProc (HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
 
HWND VFWAPI capCreateCaptureWindowW (LPCWSTR lpszWindowName, DWORD dwStyle, INT x, INT y, INT nWidth, INT nHeight, HWND hWnd, INT nID)
 
HWND VFWAPI capCreateCaptureWindowA (LPCSTR lpszWindowName, DWORD dwStyle, INT x, INT y, INT nWidth, INT nHeight, HWND hWnd, INT nID)
 
BOOL VFWAPI capGetDriverDescriptionW (WORD wDriverIndex, LPWSTR lpszName, INT cbName, LPWSTR lpszVer, INT cbVer)
 
BOOL VFWAPI capGetDriverDescriptionA (WORD wDriverIndex, LPSTR lpszName, INT cbName, LPSTR lpszVer, INT cbVer)
 
VOID VFWAPI AppCleanup (HINSTANCE hInst)
 
DWORD VFWAPI videoThunk32 (DWORD dwUnknown1, DWORD dwUnknown2, DWORD dwUnknown3, DWORD dwUnknown4, DWORD dwUnknown5)
 
BOOL WINAPI DllMain (IN HINSTANCE hinstDLL, IN DWORD dwReason, IN LPVOID lpvReserved)
 

Variables

HINSTANCE hInstance
 

Macro Definition Documentation

◆ _INC_WINDOWS

#define _INC_WINDOWS

Definition at line 9 of file avicap32.c.

◆ CAP_DESC_MAX

#define CAP_DESC_MAX   32

Definition at line 23 of file avicap32.c.

◆ COM_NO_WINDOWS_H

#define COM_NO_WINDOWS_H

Definition at line 10 of file avicap32.c.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 8 of file avicap32.c.

Function Documentation

◆ AppCleanup()

VOID VFWAPI AppCleanup ( HINSTANCE  hInst)

Definition at line 291 of file avicap32.c.

292{
294}
#define UNIMPLEMENTED
Definition: debug.h:115

◆ capCreateCaptureWindowA()

HWND VFWAPI capCreateCaptureWindowA ( LPCSTR  lpszWindowName,
DWORD  dwStyle,
INT  x,
INT  y,
INT  nWidth,
INT  nHeight,
HWND  hWnd,
INT  nID 
)

Definition at line 107 of file avicap32.c.

115{
117 HWND Wnd;
118
119 if (lpszWindowName)
120 RtlCreateUnicodeStringFromAsciiz(&Name, lpszWindowName);
121 else
122 Name.Buffer = NULL;
123
124 Wnd = capCreateCaptureWindowW(Name.Buffer,
125 dwStyle,
126 x, y,
127 nWidth,
128 nHeight,
129 hWnd,
130 nID);
131
133 return Wnd;
134}
struct NameRec_ * Name
Definition: cdprocs.h:460
HWND VFWAPI capCreateCaptureWindowW(LPCWSTR lpszWindowName, DWORD dwStyle, INT x, INT y, INT nWidth, INT nHeight, HWND hWnd, INT nID)
Definition: avicap32.c:60
HWND hWnd
Definition: settings.c:17
#define NULL
Definition: types.h:112
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)

◆ capCreateCaptureWindowW()

HWND VFWAPI capCreateCaptureWindowW ( LPCWSTR  lpszWindowName,
DWORD  dwStyle,
INT  x,
INT  y,
INT  nWidth,
INT  nHeight,
HWND  hWnd,
INT  nID 
)

Definition at line 60 of file avicap32.c.

68{
69 WCHAR szWindowClass[] = L"ClsCapWin";
71 DWORD dwExStyle = 0;
72
73 FIXME("capCreateCaptureWindowW() not fully implemented!\n");
74
75 WndClass.cbSize = sizeof(WNDCLASSEXW);
76 WndClass.lpszClassName = szWindowClass;
77 WndClass.lpfnWndProc = CaptureWindowProc; /* TODO: Implement CaptureWindowProc */
78 WndClass.hInstance = hInstance;
80 WndClass.hCursor = LoadCursorW(0, IDC_ARROW);
81 WndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
82
83 if (RegisterClassExW(&WndClass) == (ATOM)0)
84 {
86 return NULL;
87 }
88
89 return CreateWindowExW(dwExStyle,
91 lpszWindowName,
92 dwStyle,
93 x, y,
94 nWidth,
95 nHeight,
96 hWnd,
97 ULongToHandle(nID),
99 NULL);
100}
LRESULT CALLBACK CaptureWindowProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: avicap32.c:35
HINSTANCE hInstance
Definition: avicap32.c:28
#define ULongToHandle(h)
Definition: basetsd.h:81
#define FIXME(fmt,...)
Definition: debug.h:111
WCHAR WndClass[]
Definition: capicon.c:23
WORD ATOM
Definition: dimm.idl:113
unsigned long DWORD
Definition: ntddk_ex.h:95
const TCHAR szWindowClass[]
Definition: magnifier.c:28
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
#define L(x)
Definition: ntvdm.h:50
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define CS_VREDRAW
Definition: winuser.h:658
#define CS_HREDRAW
Definition: winuser.h:653
#define IDC_ARROW
Definition: winuser.h:687
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2105
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
ATOM WINAPI RegisterClassExW(_In_ CONST WNDCLASSEXW *)
struct _WNDCLASSEXW WNDCLASSEXW
#define COLOR_BTNFACE
Definition: winuser.h:928
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by capCreateCaptureWindowA().

◆ capGetDriverDescriptionA()

BOOL VFWAPI capGetDriverDescriptionA ( WORD  wDriverIndex,
LPSTR  lpszName,
INT  cbName,
LPSTR  lpszVer,
INT  cbVer 
)

Definition at line 266 of file avicap32.c.

271{
272 WCHAR DevName[CAP_DESC_MAX], DevVer[CAP_DESC_MAX];
273 BOOL Result;
274
275 Result = capGetDriverDescriptionW(wDriverIndex, DevName, CAP_DESC_MAX, DevVer, CAP_DESC_MAX);
276 if (Result)
277 {
278 WideCharToMultiByte(CP_ACP, 0, DevName, -1, lpszName, cbName, NULL, NULL);
279 WideCharToMultiByte(CP_ACP, 0, DevVer, -1, lpszVer, cbVer, NULL, NULL);
280 }
281
282 return Result;
283}
#define CAP_DESC_MAX
Definition: avicap32.c:23
BOOL VFWAPI capGetDriverDescriptionW(WORD wDriverIndex, LPWSTR lpszName, INT cbName, LPWSTR lpszVer, INT cbVer)
Definition: avicap32.c:142
#define CP_ACP
Definition: compat.h:109
#define WideCharToMultiByte
Definition: compat.h:111
unsigned int BOOL
Definition: ntddk_ex.h:94
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409

◆ capGetDriverDescriptionW()

BOOL VFWAPI capGetDriverDescriptionW ( WORD  wDriverIndex,
LPWSTR  lpszName,
INT  cbName,
LPWSTR  lpszVer,
INT  cbVer 
)

Definition at line 142 of file avicap32.c.

147{
148 DWORD dwSize, dwIndex = 0;
149 WCHAR szDriver[MAX_PATH];
151 WCHAR szFileName[MAX_PATH];
153 HKEY hKey, hSubKey;
154
155 /* TODO: Add support of data acquisition from system.ini */
156 FIXME("capGetDriverDescriptionW() not fully implemented!\n");
157
158 if (lpszName && cbName)
159 lpszName[0] = L'\0';
160
161 if (lpszVer && cbVer)
162 lpszVer[0] = L'\0';
163
165 L"SYSTEM\\CurrentControlSet\\Control\\MediaResources\\msvideo",
166 0,
167 KEY_READ,
168 &hKey) != ERROR_SUCCESS)
169 {
170 return FALSE;
171 }
172
173 dwSize = sizeof(szDriver) / sizeof(WCHAR);
174
175 while (RegEnumKeyExW(hKey, dwIndex,
176 szDriver, &dwSize,
177 NULL, NULL,
179 {
180 if (RegOpenKeyW(hKey, szDriver, &hSubKey) == ERROR_SUCCESS)
181 {
182 dwSize = sizeof(szFileName);
183
184 if (RegQueryValueExW(hSubKey,
185 L"Driver",
186 NULL,
187 NULL,
188 (LPBYTE)&szFileName,
190 {
191 dwSize = sizeof(szDriverName);
192
193 if (RegQueryValueExW(hSubKey,
194 L"FriendlyName",
195 NULL,
196 NULL,
199 {
200 wcscpy(szDriverName, L"Unknown Driver Name");
201 }
202
203 if (dwIndex == (DWORD)wDriverIndex)
204 {
205 if (lpszName && cbName)
206 {
207 lstrcpynW(lpszName, szDriverName, cbName);
208 }
209
210 if (lpszVer && cbVer)
211 {
212 LPVOID Version, Ms;
213 DWORD dwInfoSize;
215 UINT Ls;
216
217 dwInfoSize = GetFileVersionInfoSize(szFileName, NULL);
218 if (dwInfoSize)
219 {
220 Version = HeapAlloc(GetProcessHeap(), 0, dwInfoSize);
221
222 if (Version != NULL)
223 {
224 GetFileVersionInfo(szFileName, 0, dwInfoSize, Version);
225
226 if (VerQueryValueW(Version, L"\\", &Ms, &Ls))
227 {
228 memmove(&FileInfo, Ms, Ls);
229 swprintf(szVersion, L"Version: %d.%d.%d.%d",
230 HIWORD(FileInfo.dwFileVersionMS),
231 LOWORD(FileInfo.dwFileVersionMS),
232 HIWORD(FileInfo.dwFileVersionLS),
233 LOWORD(FileInfo.dwFileVersionLS));
234
235 lstrcpynW(lpszVer, szVersion, cbVer);
236 }
238 }
239 }
240 }
241
242 RegCloseKey(hSubKey);
244 return TRUE;
245 }
246 }
247
248 RegCloseKey(hSubKey);
249 }
250
251 dwSize = sizeof(szDriver) / sizeof(WCHAR);
252 dwIndex++;
253 }
254
256
257 return FALSE;
258}
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_SUCCESS
Definition: deptool.c:10
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static const WCHAR szDriverName[]
Definition: provider.c:69
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2504
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3268
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define lstrcpynW
Definition: compat.h:738
BOOL WINAPI VerQueryValueW(LPCVOID pBlock, LPCWSTR lpSubBlock, LPVOID *lplpBuffer, PUINT puLen)
Definition: version.c:1049
#define swprintf
Definition: precomp.h:40
FxAutoRegKey hKey
void Ls(const char *const item, int listmode, const char *const options, FILE *stream)
Definition: ls.c:465
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
static LPCWSTR szVersion
Definition: asmcache.c:748
unsigned int UINT
Definition: ndis.h:50
#define KEY_READ
Definition: nt_native.h:1023
#define LOWORD(l)
Definition: pedump.c:82
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
unsigned char * LPBYTE
Definition: typedefs.h:53
#define HIWORD(l)
Definition: typedefs.h:247
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE _In_ USHORT _In_ USHORT Version
Definition: wdffdo.h:469
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define GetFileVersionInfo
Definition: winver.h:54
#define GetFileVersionInfoSize
Definition: winver.h:53

Referenced by capGetDriverDescriptionA(), and register_avicap_devices().

◆ CaptureWindowProc()

LRESULT CALLBACK CaptureWindowProc ( HWND  hwnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 35 of file avicap32.c.

36{
37 switch (Msg)
38 {
39 case WM_CREATE:
40 break;
41
42 case WM_PAINT:
43 break;
44
45 case WM_DESTROY:
46 break;
47 }
48
50}
struct @1632 Msg[]
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define DefWindowProc
Definition: ros2win.h:31
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define WM_PAINT
Definition: winuser.h:1620
#define WM_CREATE
Definition: winuser.h:1608
#define WM_DESTROY
Definition: winuser.h:1609

Referenced by capCreateCaptureWindowW().

◆ DllMain()

BOOL WINAPI DllMain ( IN HINSTANCE  hinstDLL,
IN DWORD  dwReason,
IN LPVOID  lpvReserved 
)

@DllMain

Core routine of the Utility Manager's library.

Parameters
[in]hDllInstanceThe entry point instance of the library.
[in]fdwReasonThe reason argument to indicate the motive DllMain is being called.
[in]lpvReservedReserved.
Returns
Returns TRUE when main call initialization has succeeded, FALSE otherwise.

Definition at line 311 of file avicap32.c.

314{
315 switch (dwReason)
316 {
318 TRACE("avicap32 attached!\n");
319 hInstance = hinstDLL;
320 break;
321 }
322
323 return TRUE;
324}
DWORD dwReason
Definition: misc.cpp:154
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define TRACE(s)
Definition: solgame.cpp:4

◆ videoThunk32()

DWORD VFWAPI videoThunk32 ( DWORD  dwUnknown1,
DWORD  dwUnknown2,
DWORD  dwUnknown3,
DWORD  dwUnknown4,
DWORD  dwUnknown5 
)

Definition at line 302 of file avicap32.c.

303{
305 return 0;
306}

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( avicap32  )

Variable Documentation

◆ hInstance

HINSTANCE hInstance

Definition at line 28 of file avicap32.c.

Referenced by capCreateCaptureWindowW(), and DllMain().