Author: dchapyshev Date: Sat Jul 25 17:57:18 2009 New Revision: 42214
URL: http://svn.reactos.org/svn/reactos?rev=42214&view=rev Log: - Add stubs for AppCleanup and videoThunk32 - Partially implement capCreateCaptureWindowW and capGetDriverDescriptionW
Modified: trunk/reactos/dll/win32/avicap32/avicap32.c trunk/reactos/dll/win32/avicap32/avicap32.spec
Modified: trunk/reactos/dll/win32/avicap32/avicap32.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/avicap32/avicap32... ============================================================================== --- trunk/reactos/dll/win32/avicap32/avicap32.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/avicap32/avicap32.c [iso-8859-1] Sat Jul 25 17:57:18 2009 @@ -8,6 +8,7 @@ #include <windows.h> #include <winternl.h> #include <vfw.h> +#include <wchar.h>
#include "wine/debug.h"
@@ -16,8 +17,35 @@ WINE_DEFAULT_DEBUG_CHANNEL(avicap32);
-/* - * unimplemented +HINSTANCE hInstance; + + +/* INTRENAL FUNCTIONS **************************************************/ + +LRESULT +CALLBACK +CaptureWindowProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam) +{ + switch (Msg) + { + case WM_CREATE: + break; + + case WM_PAINT: + break; + + case WM_DESTROY: + break; + } + + return DefWindowProc(hwnd, Msg, wParam, lParam); +} + + +/* FUNCTIONS ***********************************************************/ + +/* + * implemented */ HWND VFWAPI @@ -30,8 +58,37 @@ HWND hWnd, INT nID) { - UNIMPLEMENTED; - return NULL; + WCHAR szWindowClass[] = L"ClsCapWin"; + WNDCLASSEXW WndClass = {0}; + DWORD dwExStyle = 0; + + FIXME("capCreateCaptureWindowW() not fully implemented!\n"); + + WndClass.cbSize = sizeof(WNDCLASSEXW); + WndClass.lpszClassName = szWindowClass; + WndClass.lpfnWndProc = CaptureWindowProc; /* TODO: Implement CaptureWindowProc */ + WndClass.hInstance = hInstance; + WndClass.style = CS_HREDRAW | CS_VREDRAW; + WndClass.hCursor = LoadCursorW(0, IDC_ARROW); + WndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); + + if (RegisterClassExW(&WndClass) == (ATOM)0) + { + if (GetLastError() != ERROR_ALREADY_EXISTS) + return NULL; + } + + return CreateWindowExW(dwExStyle, + szWindowClass, + lpszWindowName, + dwStyle, + x, y, + nWidth, + nHeight, + hWnd, + (HMENU)nID, + hInstance, + NULL); }
/* @@ -70,7 +127,7 @@
/* - * unimplemented + * implemented */ BOOL VFWAPI @@ -80,7 +137,112 @@ LPWSTR lpszVer, INT cbVer) { - UNIMPLEMENTED; + DWORD dwSize, dwIndex = 0; + WCHAR szDriver[MAX_PATH]; + WCHAR szDriverName[MAX_PATH]; + WCHAR szFileName[MAX_PATH]; + WCHAR szVersion[MAX_PATH]; + HKEY hKey, hSubKey; + + /* TODO: Add support of data acquisition from system.ini */ + FIXME("capGetDriverDescriptionW() not fully implemented!\n"); + + if (lpszName && cbName) + lpszName[0] = L'\0'; + + if (lpszVer && cbVer) + lpszVer[0] = L'\0'; + + if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, + L"SYSTEM\CurrentControlSet\Control\MediaResources\msvideo", + 0, + KEY_READ, + &hKey) != ERROR_SUCCESS) + { + return FALSE; + } + + dwSize = sizeof(szDriver) / sizeof(WCHAR); + + while (RegEnumKeyExW(hKey, dwIndex, + szDriver, &dwSize, + NULL, NULL, + NULL, NULL) == ERROR_SUCCESS) + { + if (RegOpenKeyW(hKey, szDriver, &hSubKey) == ERROR_SUCCESS) + { + dwSize = sizeof(szFileName) / sizeof(WCHAR); + + if (RegQueryValueExW(hSubKey, + L"Driver", + NULL, + NULL, + (LPBYTE)&szFileName, + &dwSize) == ERROR_SUCCESS) + { + dwSize = sizeof(szDriverName) / sizeof(WCHAR); + + if (RegQueryValueExW(hSubKey, + L"FriendlyName", + NULL, + NULL, + (LPBYTE)&szDriverName, + &dwSize) != ERROR_SUCCESS) + { + wcscpy(szDriverName, L"Unknown Driver Name"); + } + + if (dwIndex == (DWORD)wDriverIndex) + { + if (lpszName && cbName) + { + lstrcpynW(lpszName, szDriverName, cbName); + } + + if (lpszVer && cbVer) + { + LPVOID Version, Ms; + DWORD dwInfoSize; + VS_FIXEDFILEINFO FileInfo; + UINT Ls; + + dwInfoSize = GetFileVersionInfoSize(szFileName, NULL); + if (dwInfoSize) + { + Version = HeapAlloc(GetProcessHeap(), 0, dwInfoSize); + + GetFileVersionInfo(szFileName, 0, dwInfoSize, Version); + + if (VerQueryValueW(Version, L"\", &Ms, &Ls)) + { + memmove(&FileInfo, Ms, Ls); + swprintf(szVersion, L"Version: %d.%d.%d.%d", + HIWORD(FileInfo.dwFileVersionMS), + LOWORD(FileInfo.dwFileVersionMS), + HIWORD(FileInfo.dwFileVersionLS), + LOWORD(FileInfo.dwFileVersionLS)); + + lstrcpynW(lpszVer, szVersion, cbVer); + } + HeapFree(GetProcessHeap(), 0, Version); + } + } + + RegCloseKey(hSubKey); + RegCloseKey(hKey); + return TRUE; + } + } + + RegCloseKey(hSubKey); + } + + dwSize = sizeof(szDriver) / sizeof(WCHAR); + dwIndex++; + } + + RegCloseKey(hKey); + return FALSE; }
@@ -110,6 +272,29 @@ }
+/* + * unimplemented + */ +VOID +VFWAPI +AppCleanup(HINSTANCE hInst) +{ + UNIMPLEMENTED; +} + + +/* + * unimplemented + */ +DWORD +VFWAPI +videoThunk32(DWORD dwUnknown1, DWORD dwUnknown2, DWORD dwUnknown3, DWORD dwUnknown4, DWORD dwUnknown5) +{ + UNIMPLEMENTED; + return 0; +} + + BOOL WINAPI DllMain(IN HINSTANCE hinstDLL, @@ -119,6 +304,8 @@ switch (dwReason) { case DLL_PROCESS_ATTACH: + TRACE("avicap32 attached!\n"); + hInstance = hinstDLL; break; }
Modified: trunk/reactos/dll/win32/avicap32/avicap32.spec URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/avicap32/avicap32... ============================================================================== --- trunk/reactos/dll/win32/avicap32/avicap32.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/avicap32/avicap32.spec [iso-8859-1] Sat Jul 25 17:57:18 2009 @@ -1,6 +1,6 @@ -@ stub AppCleanup -@ stdcall capCreateCaptureWindowA(str long long long long long long long) +@ stdcall AppCleanup(ptr) +@ stdcall capCreateCaptureWindowA(str long long long long long long long) @ stdcall capCreateCaptureWindowW(wstr long long long long long long long) @ stdcall capGetDriverDescriptionA(long ptr long ptr long) @ stdcall capGetDriverDescriptionW(long ptr long ptr long) -@ stub videoThunk32 +@ stdcall videoThunk32(long long long long long)