[TRY 6] test and patch for SetupDiOpenClassRegKeyExW
Damjan Jovanovic
dj015 at yahoo.com
Sat Sep 9 06:25:30 CDT 2006
wine's SetupDiOpenClassRegKeyExW returns FALSE instead
of INVALID_HANDLE_VALUE for some failures. Test to
prove it and patch to fix it are included.
ChangeLog:
* Fixed returns values and added a test for
SetupDiOpenClassRegKeyExW.
Damjan Jovanovic (dj015 at yahoo.com)
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
-------------- next part --------------
--- a/dlls/setupapi/devinst.c 2006-08-28 20:35:44.000000000 +0200
+++ b/dlls/setupapi/devinst.c 2006-09-08 21:14:40.000000000 +0200
@@ -1453,7 +1453,7 @@
if (UuidToStringW((UUID*)ClassGuid, &lpGuidString) != RPC_S_OK)
{
RegCloseKey(hClassesKey);
- return FALSE;
+ return INVALID_HANDLE_VALUE;
}
if (RegOpenKeyExW(hClassesKey,
@@ -1464,7 +1464,7 @@
{
RpcStringFreeW(&lpGuidString);
RegCloseKey(hClassesKey);
- return FALSE;
+ return INVALID_HANDLE_VALUE;
}
RpcStringFreeW(&lpGuidString);
--- a/dlls/setupapi/tests/devinst.c 2006-08-28 20:35:53.000000000 +0200
+++ b/dlls/setupapi/tests/devinst.c 2006-09-08 21:18:25.000000000 +0200
@@ -26,6 +26,7 @@
#include "wingdi.h"
#include "winuser.h"
#include "winreg.h"
+#include "guiddef.h"
#include "setupapi.h"
#include "wine/test.h"
@@ -34,6 +35,7 @@
static HMODULE hSetupAPI;
static HDEVINFO (WINAPI *pSetupDiCreateDeviceInfoListExW)(GUID*,HWND,PCWSTR,PVOID);
static BOOL (WINAPI *pSetupDiDestroyDeviceInfoList)(HDEVINFO);
+static HKEY (WINAPI *pSetupDiOpenClassRegKeyExA)(GUID*,REGSAM,DWORD,PCSTR,PVOID);
static void init_function_pointers(void)
{
@@ -43,6 +45,7 @@
{
pSetupDiCreateDeviceInfoListExW = (void *)GetProcAddress(hSetupAPI, "SetupDiCreateDeviceInfoListExW");
pSetupDiDestroyDeviceInfoList = (void *)GetProcAddress(hSetupAPI, "SetupDiDestroyDeviceInfoList");
+ pSetupDiOpenClassRegKeyExA = (void *)GetProcAddress(hSetupAPI, "SetupDiOpenClassRegKeyExA");
}
}
@@ -79,6 +82,20 @@
ok(ret, "SetupDiDestroyDeviceInfoList failed : %ld\n", error);
}
+static void test_SetupDiOpenClassRegKeyExA(void)
+{
+ /* This is a unique guid for testing purposes */
+ GUID guid = {0x6a55b5a4, 0x3f65, 0x11db, {0xb7,0x04,
+ 0x00,0x11,0x95,0x5c,0x2b,0xdb}};
+ HKEY hkey;
+
+ /* Check return value for non-existent key */
+ hkey = SetupDiOpenClassRegKeyExA(&guid, KEY_ALL_ACCESS,
+ DIOCR_INSTALLER, NULL, NULL);
+ ok(hkey == INVALID_HANDLE_VALUE,
+ "returned %p (expected INVALID_HANDLE_VALUE)\n", hkey);
+}
+
START_TEST(devinst)
{
init_function_pointers();
@@ -88,5 +105,10 @@
if (pSetupDiCreateDeviceInfoListExW && pSetupDiDestroyDeviceInfoList)
test_SetupDiCreateDeviceInfoListEx();
else
- trace("Needed calls not all available, skipping tests.\n");
+ trace("Needed calls for SetupDiCreateDeviceInfoListEx not all available, skipping test.\n");
+
+ if (pSetupDiOpenClassRegKeyExA)
+ test_SetupDiOpenClassRegKeyExA();
+ else
+ trace("Needed call for SetupDiOpenClassRegKeyExA not available, skipping test.\n");
}
More information about the wine-patches
mailing list