Commit ed78e4f3 authored by Dimitrie O. Paun's avatar Dimitrie O. Paun Committed by Alexandre Julliard

Look up driver info in the registry as well as in system.ini.

Cleanup handling of driver enumeration and fourCC.
parent 6e160f14
...@@ -3,7 +3,7 @@ TOPOBJDIR = ../.. ...@@ -3,7 +3,7 @@ TOPOBJDIR = ../..
SRCDIR = @srcdir@ SRCDIR = @srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
MODULE = msvfw32.dll MODULE = msvfw32.dll
IMPORTS = winmm comctl32 version user32 gdi32 kernel32 ntdll IMPORTS = winmm comctl32 version user32 gdi32 advapi32 kernel32 ntdll
ALTNAMES = msvideo.dll ALTNAMES = msvideo.dll
EXTRALIBS = $(LIBUNICODE) EXTRALIBS = $(LIBUNICODE)
......
...@@ -26,11 +26,14 @@ ...@@ -26,11 +26,14 @@
#include "msvideo_private.h" #include "msvideo_private.h"
#include "winver.h" #include "winver.h"
#include "winnls.h" #include "winnls.h"
#include "winreg.h"
#include "vfw16.h" #include "vfw16.h"
#include "wine/debug.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(msvideo); WINE_DEFAULT_DEBUG_CHANNEL(msvideo);
/* Drivers32 settings */
#define HKLM_DRIVERS32 "Software\\Microsoft\\Windows NT\\CurrentVersion\\Drivers32"
/*********************************************************************** /***********************************************************************
* DrawDibOpen [MSVIDEO.102] * DrawDibOpen [MSVIDEO.102]
...@@ -760,35 +763,55 @@ DWORD WINAPI VideoCapDriverDescAndVer16(WORD nr, LPSTR buf1, WORD buf1len, ...@@ -760,35 +763,55 @@ DWORD WINAPI VideoCapDriverDescAndVer16(WORD nr, LPSTR buf1, WORD buf1len,
LPSTR buf2, WORD buf2len) LPSTR buf2, WORD buf2len)
{ {
DWORD verhandle; DWORD verhandle;
WORD xnr = nr;
DWORD infosize; DWORD infosize;
UINT subblocklen; UINT subblocklen;
char *s, buf[2000], fn[260]; char *s, buf[2048], fn[260];
LPBYTE infobuf; LPBYTE infobuf;
LPVOID subblock; LPVOID subblock;
DWORD i, cnt = 0, lRet;
DWORD bufLen, fnLen;
FILETIME lastWrite;
HKEY hKey;
BOOL found = FALSE;
TRACE("(%d,%p,%d,%p,%d)\n", nr, buf1, buf1len, buf2, buf2len); TRACE("(%d,%p,%d,%p,%d)\n", nr, buf1, buf1len, buf2, buf2len);
if (GetPrivateProfileStringA("drivers32", NULL, NULL, buf, sizeof(buf), "system.ini")) lRet = RegOpenKeyExA(HKEY_LOCAL_MACHINE, HKLM_DRIVERS32, 0, KEY_QUERY_VALUE, &hKey);
if (lRet == ERROR_SUCCESS)
{ {
s = buf; RegQueryInfoKeyA( hKey, 0, 0, 0, &cnt, 0, 0, 0, 0, 0, 0, 0);
while (*s) for (i = 0; i < cnt; i++)
{ {
if (!strncasecmp(s, "vid", 3)) bufLen = sizeof(buf) / sizeof(buf[0]);
{ lRet = RegEnumKeyExA(hKey, i, buf, &bufLen, 0, 0, 0, &lastWrite);
if (!xnr) break; if (lRet != ERROR_SUCCESS) continue;
xnr--; if (strncasecmp(buf, "vid", 3)) continue;
} if (nr--) continue;
s = s + strlen(s) + 1; /* either next char or \0 */ fnLen = sizeof(fn);
} lRet = RegQueryValueExA(hKey, buf, 0, 0, fn, &fnLen);
if (lRet == ERROR_SUCCESS) found = TRUE;
break;
}
RegCloseKey( hKey );
}
/* search system.ini if not found in the registry */
if (!found && GetPrivateProfileStringA("drivers32", NULL, NULL, buf, sizeof(buf), "system.ini"))
{
for (s = buf; *s; s += strlen(s) + 1)
{
if (strncasecmp(s, "vid", 3)) continue;
if (nr--) continue;
if (GetPrivateProfileStringA("drivers32", s, NULL, fn, sizeof(fn), "system.ini"))
found = TRUE;
break;
}
} }
else
return 20; /* hmm, out of entries even if we don't have any */ if (nr || !found)
if (xnr)
{ {
FIXME("No more VID* entries found\n"); TRACE("No more VID* entries found nr=%d\n", nr);
return 20; return 20;
} }
GetPrivateProfileStringA("drivers32", s, NULL, fn, sizeof(fn), "system.ini");
infosize = GetFileVersionInfoSizeA(fn, &verhandle); infosize = GetFileVersionInfoSizeA(fn, &verhandle);
if (!infosize) if (!infosize)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment