Damjan Jovanovic : setupapi: Brace the guid in
SetupDiOpenClassRegKeyExW.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Sep 26 15:04:51 CDT 2006
Module: wine
Branch: master
Commit: e6e96d3ea114790aabcdcbdcfa104fa393d07760
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=e6e96d3ea114790aabcdcbdcfa104fa393d07760
Author: Damjan Jovanovic <damjan.jov at gmail.com>
Date: Thu Sep 21 16:15:14 2006 +0200
setupapi: Brace the guid in SetupDiOpenClassRegKeyExW.
---
dlls/setupapi/devinst.c | 10 +++++++---
dlls/setupapi/tests/Makefile.in | 2 +-
dlls/setupapi/tests/devinst.c | 25 +++++++++++++++++++++++++
3 files changed, 33 insertions(+), 4 deletions(-)
diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c
index 37a7302..35fa409 100644
--- a/dlls/setupapi/devinst.c
+++ b/dlls/setupapi/devinst.c
@@ -1413,6 +1413,7 @@ HKEY WINAPI SetupDiOpenClassRegKeyExW(
PVOID Reserved)
{
LPWSTR lpGuidString;
+ WCHAR bracedGuidString[39];
HKEY hClassesKey;
HKEY hClassKey;
LPCWSTR lpKeyName;
@@ -1455,19 +1456,22 @@ HKEY WINAPI SetupDiOpenClassRegKeyExW(
RegCloseKey(hClassesKey);
return INVALID_HANDLE_VALUE;
}
+ bracedGuidString[0] = '{';
+ memcpy(&bracedGuidString[1], lpGuidString, 36*sizeof(WCHAR));
+ bracedGuidString[37] = '}';
+ bracedGuidString[38] = 0;
+ RpcStringFreeW(&lpGuidString);
if (RegOpenKeyExW(hClassesKey,
- lpGuidString,
+ bracedGuidString,
0,
KEY_ALL_ACCESS,
&hClassKey))
{
- RpcStringFreeW(&lpGuidString);
RegCloseKey(hClassesKey);
return INVALID_HANDLE_VALUE;
}
- RpcStringFreeW(&lpGuidString);
RegCloseKey(hClassesKey);
return hClassKey;
diff --git a/dlls/setupapi/tests/Makefile.in b/dlls/setupapi/tests/Makefile.in
index 2efcdbf..51e28fd 100644
--- a/dlls/setupapi/tests/Makefile.in
+++ b/dlls/setupapi/tests/Makefile.in
@@ -3,7 +3,7 @@ TOPOBJDIR = ../../..
SRCDIR = @srcdir@
VPATH = @srcdir@
TESTDLL = setupapi.dll
-IMPORTS = setupapi kernel32
+IMPORTS = setupapi advapi32 kernel32
CTESTS = \
devinst.c \
diff --git a/dlls/setupapi/tests/devinst.c b/dlls/setupapi/tests/devinst.c
index 703cfd9..5f02991 100644
--- a/dlls/setupapi/tests/devinst.c
+++ b/dlls/setupapi/tests/devinst.c
@@ -87,6 +87,7 @@ static void test_SetupDiOpenClassRegKeyE
/* This is a unique guid for testing purposes */
GUID guid = {0x6a55b5a4, 0x3f65, 0x11db, {0xb7,0x04,
0x00,0x11,0x95,0x5c,0x2b,0xdb}};
+ static const CHAR guidString[] = "{6a55b5a4-3f65-11db-b704-0011955c2bdb}";
HKEY hkey;
/* Check return value for non-existent key */
@@ -94,6 +95,30 @@ static void test_SetupDiOpenClassRegKeyE
DIOCR_INSTALLER, NULL, NULL);
ok(hkey == INVALID_HANDLE_VALUE,
"returned %p (expected INVALID_HANDLE_VALUE)\n", hkey);
+
+ /* Test it for a key that exists */
+ hkey = SetupDiOpenClassRegKey(NULL, KEY_ALL_ACCESS);
+ if (hkey != INVALID_HANDLE_VALUE)
+ {
+ HKEY classKey;
+ if (RegCreateKeyA(hkey, guidString, &classKey) == ERROR_SUCCESS)
+ {
+ RegCloseKey(classKey);
+ SetLastError(0xdeadbeef);
+ classKey = pSetupDiOpenClassRegKeyExA(&guid, KEY_ALL_ACCESS,
+ DIOCR_INSTALLER, NULL, NULL);
+ ok(classKey != INVALID_HANDLE_VALUE,
+ "opening class registry key failed with error %ld\n",
+ GetLastError());
+ if (classKey != INVALID_HANDLE_VALUE)
+ RegCloseKey(classKey);
+ RegDeleteKeyA(hkey, guidString);
+ }
+ else
+ trace("failed to create registry key for test\n");
+ }
+ else
+ trace("failed to open classes key\n");
}
START_TEST(devinst)
More information about the wine-cvs
mailing list