- Add stubs for AppCleanup and videoThunk32

- Partially implement capCreateCaptureWindowW and capGetDriverDescriptionW

svn path=/trunk/; revision=42214
This commit is contained in:
Dmitry Chapyshev 2009-07-25 15:57:18 +00:00
parent 50eda0f7b9
commit 0f8b51f5ac
2 changed files with 195 additions and 8 deletions

View file

@ -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);
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 ***********************************************************/
/*
* unimplemented
* implemented
*/
HWND
VFWAPI
@ -30,8 +58,37 @@ capCreateCaptureWindowW(LPCWSTR lpszWindowName,
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 @@ capCreateCaptureWindowA(LPCSTR lpszWindowName,
/*
* unimplemented
* implemented
*/
BOOL
VFWAPI
@ -80,7 +137,112 @@ capGetDriverDescriptionW(WORD wDriverIndex,
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 @@ capGetDriverDescriptionA(WORD wDriverIndex,
}
/*
* 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 @@ DllMain(IN HINSTANCE hinstDLL,
switch (dwReason)
{
case DLL_PROCESS_ATTACH:
TRACE("avicap32 attached!\n");
hInstance = hinstDLL;
break;
}

View file

@ -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)