ReactOS  0.4.14-dev-998-g623dd26
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:114

◆ 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 }
HWND hWnd
Definition: settings.c:17
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
HWND VFWAPI capCreateCaptureWindowW(LPCWSTR lpszWindowName, DWORD dwStyle, INT x, INT y, INT nWidth, INT nHeight, HWND hWnd, INT nID)
Definition: avicap32.c:60
struct NameRec_ * Name
Definition: cdprocs.h:464
smooth NULL
Definition: ftsmooth.c:416
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

◆ 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";
70  WNDCLASSEXW WndClass = {0};
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;
79  WndClass.style = CS_HREDRAW | CS_VREDRAW;
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),
98  hInstance,
99  NULL);
100 }
#define ULongToHandle(h)
Definition: basetsd.h:81
WORD ATOM
Definition: dimm.idl:113
HWND hWnd
Definition: settings.c:17
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define CS_HREDRAW
Definition: winuser.h:648
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
struct _WNDCLASSEXW WNDCLASSEXW
LRESULT CALLBACK CaptureWindowProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: avicap32.c:35
ATOM WINAPI RegisterClassExW(_In_ CONST WNDCLASSEXW *)
const TCHAR szWindowClass[]
Definition: magnifier.c:28
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define CS_VREDRAW
Definition: winuser.h:653
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2074
static const WCHAR L[]
Definition: oid.c:1250
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)
#define COLOR_BTNFACE
Definition: winuser.h:918
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define IDC_ARROW
Definition: winuser.h:682
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
HINSTANCE hInstance
Definition: avicap32.c:28
WCHAR WndClass[]
Definition: capicon.c:23

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 WideCharToMultiByte
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:99
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
_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:426
__wchar_t WCHAR
Definition: xmlstorage.h:180
#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

◆ 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,
178  NULL, NULL) == ERROR_SUCCESS)
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,
189  &dwSize) == ERROR_SUCCESS)
190  {
191  dwSize = sizeof(szDriverName);
192 
193  if (RegQueryValueExW(hSubKey,
194  L"FriendlyName",
195  NULL,
196  NULL,
198  &dwSize) != ERROR_SUCCESS)
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);
243  RegCloseKey(hKey);
244  return TRUE;
245  }
246  }
247 
248  RegCloseKey(hSubKey);
249  }
250 
251  dwSize = sizeof(szDriver) / sizeof(WCHAR);
252  dwIndex++;
253  }
254 
255  RegCloseKey(hKey);
256 
257  return FALSE;
258 }
#define GetFileVersionInfo
Definition: winver.h:54
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
#define TRUE
Definition: types.h:120
IN PVOID IN PVOID IN USHORT Version
Definition: pci.h:359
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
#define GetFileVersionInfoSize
Definition: winver.h:53
#define lstrcpynW
Definition: compat.h:405
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:53
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3296
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR szDriverName[]
Definition: provider.c:69
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
#define swprintf(buf, format,...)
Definition: sprintf.c:56
unsigned long DWORD
Definition: ntddk_ex.h:95
static LPCWSTR szVersion
Definition: asmcache.c:748
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
void Ls(const char *const item, int listmode, const char *const options, FILE *stream)
Definition: ls.c:465
unsigned int UINT
Definition: ndis.h:50
struct FileInfo FileInfo
#define HIWORD(l)
Definition: typedefs.h:247
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
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:2527
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:402
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
BOOL WINAPI VerQueryValueW(LPCVOID pBlock, LPCWSTR lpSubBlock, LPVOID *lplpBuffer, PUINT puLen)
Definition: version.c:1049
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

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 
49  return DefWindowProc(hwnd, Msg, wParam, lParam);
50 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
WPARAM wParam
Definition: combotst.c:138
#define DefWindowProc
Definition: ros2win.h:31
#define WM_DESTROY
Definition: winuser.h:1591
#define WM_PAINT
Definition: winuser.h:1602
struct @1587 Msg[]
#define WM_CREATE
Definition: winuser.h:1590
LPARAM lParam
Definition: combotst.c:139

Referenced by capCreateCaptureWindowW().

◆ DllMain()

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

Definition at line 311 of file avicap32.c.

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

◆ 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 }
#define UNIMPLEMENTED
Definition: debug.h:114

◆ 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().