setupapi/tests: Fix wow64 failures.

This commit is contained in:
André Hentschel 2010-10-12 21:34:24 +02:00 committed by Alexandre Julliard
parent 6cbb8fc200
commit 9c02760647
1 changed files with 33 additions and 17 deletions

View File

@ -31,8 +31,9 @@
#include "wine/test.h" #include "wine/test.h"
static BOOL is_wow64;
/* function pointers */ /* function pointers */
static HMODULE hSetupAPI;
static HDEVINFO (WINAPI *pSetupDiCreateDeviceInfoList)(GUID*,HWND); static HDEVINFO (WINAPI *pSetupDiCreateDeviceInfoList)(GUID*,HWND);
static HDEVINFO (WINAPI *pSetupDiCreateDeviceInfoListExW)(GUID*,HWND,PCWSTR,PVOID); static HDEVINFO (WINAPI *pSetupDiCreateDeviceInfoListExW)(GUID*,HWND,PCWSTR,PVOID);
static BOOL (WINAPI *pSetupDiCreateDeviceInterfaceA)(HDEVINFO, PSP_DEVINFO_DATA, const GUID *, PCSTR, DWORD, PSP_DEVICE_INTERFACE_DATA); static BOOL (WINAPI *pSetupDiCreateDeviceInterfaceA)(HDEVINFO, PSP_DEVINFO_DATA, const GUID *, PCSTR, DWORD, PSP_DEVICE_INTERFACE_DATA);
@ -57,13 +58,15 @@ static BOOL (WINAPI *pSetupDiSetDeviceRegistryPropertyA)(HDEVINFO, PSP_DEVIN
static BOOL (WINAPI *pSetupDiSetDeviceRegistryPropertyW)(HDEVINFO, PSP_DEVINFO_DATA, DWORD, const BYTE *, DWORD); static BOOL (WINAPI *pSetupDiSetDeviceRegistryPropertyW)(HDEVINFO, PSP_DEVINFO_DATA, DWORD, const BYTE *, DWORD);
static BOOL (WINAPI *pSetupDiGetDeviceRegistryPropertyA)(HDEVINFO, PSP_DEVINFO_DATA, DWORD, PDWORD, PBYTE, DWORD, PDWORD); static BOOL (WINAPI *pSetupDiGetDeviceRegistryPropertyA)(HDEVINFO, PSP_DEVINFO_DATA, DWORD, PDWORD, PBYTE, DWORD, PDWORD);
static BOOL (WINAPI *pSetupDiGetDeviceRegistryPropertyW)(HDEVINFO, PSP_DEVINFO_DATA, DWORD, PDWORD, PBYTE, DWORD, PDWORD); static BOOL (WINAPI *pSetupDiGetDeviceRegistryPropertyW)(HDEVINFO, PSP_DEVINFO_DATA, DWORD, PDWORD, PBYTE, DWORD, PDWORD);
static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
/* This is a unique guid for testing purposes */ /* This is a unique guid for testing purposes */
static GUID guid = {0x6a55b5a4, 0x3f65, 0x11db, {0xb7,0x04,0x00,0x11,0x95,0x5c,0x2b,0xdb}}; static GUID guid = {0x6a55b5a4, 0x3f65, 0x11db, {0xb7,0x04,0x00,0x11,0x95,0x5c,0x2b,0xdb}};
static void init_function_pointers(void) static void init_function_pointers(void)
{ {
hSetupAPI = GetModuleHandleA("setupapi.dll"); HMODULE hSetupAPI = GetModuleHandleA("setupapi.dll");
HMODULE hKernel32 = GetModuleHandleA("kernel32.dll");
pSetupDiCreateDeviceInfoA = (void *)GetProcAddress(hSetupAPI, "SetupDiCreateDeviceInfoA"); pSetupDiCreateDeviceInfoA = (void *)GetProcAddress(hSetupAPI, "SetupDiCreateDeviceInfoA");
pSetupDiCreateDeviceInfoW = (void *)GetProcAddress(hSetupAPI, "SetupDiCreateDeviceInfoW"); pSetupDiCreateDeviceInfoW = (void *)GetProcAddress(hSetupAPI, "SetupDiCreateDeviceInfoW");
@ -89,6 +92,7 @@ static void init_function_pointers(void)
pSetupDiSetDeviceRegistryPropertyW = (void *)GetProcAddress(hSetupAPI, "SetupDiSetDeviceRegistryPropertyW"); pSetupDiSetDeviceRegistryPropertyW = (void *)GetProcAddress(hSetupAPI, "SetupDiSetDeviceRegistryPropertyW");
pSetupDiGetDeviceRegistryPropertyA = (void *)GetProcAddress(hSetupAPI, "SetupDiGetDeviceRegistryPropertyA"); pSetupDiGetDeviceRegistryPropertyA = (void *)GetProcAddress(hSetupAPI, "SetupDiGetDeviceRegistryPropertyA");
pSetupDiGetDeviceRegistryPropertyW = (void *)GetProcAddress(hSetupAPI, "SetupDiGetDeviceRegistryPropertyW"); pSetupDiGetDeviceRegistryPropertyW = (void *)GetProcAddress(hSetupAPI, "SetupDiGetDeviceRegistryPropertyW");
pIsWow64Process = (void *)GetProcAddress(hKernel32, "IsWow64Process");
} }
static void change_reg_permissions(const WCHAR *regkey) static void change_reg_permissions(const WCHAR *regkey)
@ -141,8 +145,12 @@ static BOOL remove_device(void)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = pSetupDiCallClassInstaller(DIF_REMOVE, set, &devInfo); ret = pSetupDiCallClassInstaller(DIF_REMOVE, set, &devInfo);
todo_wine if(is_wow64)
ok(ret, "SetupDiCallClassInstaller(DIF_REMOVE...) failed: %08x\n", GetLastError()); todo_wine ok(!ret && GetLastError() == ERROR_IN_WOW64,
"SetupDiCallClassInstaller(DIF_REMOVE...) succeeded: %08x\n", GetLastError());
else
todo_wine ok(ret,
"SetupDiCallClassInstaller(DIF_REMOVE...) failed: %08x\n", GetLastError());
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ok(pSetupDiDestroyDeviceInfoList(set), ok(pSetupDiDestroyDeviceInfoList(set),
@ -1007,8 +1015,8 @@ static void testDevRegKey(void)
/* Cleanup */ /* Cleanup */
ret = remove_device(); ret = remove_device();
todo_wine if(!is_wow64)
ok(ret, "Expected the device to be removed: %08x\n", GetLastError()); todo_wine ok(ret, "Expected the device to be removed: %08x\n", GetLastError());
/* FIXME: Only do the RegDeleteKey, once Wine is fixed */ /* FIXME: Only do the RegDeleteKey, once Wine is fixed */
if (!ret) if (!ret)
@ -1091,8 +1099,10 @@ static void testRegisterAndGetDetail(void)
{ {
static const char path[] = static const char path[] =
"\\\\?\\root#legacy_bogus#0000#{6a55b5a4-3f65-11db-b704-0011955c2bdb}"; "\\\\?\\root#legacy_bogus#0000#{6a55b5a4-3f65-11db-b704-0011955c2bdb}";
static const char path_wow64[] =
"\\\\?\\root#legacy_bogus#0001#{6a55b5a4-3f65-11db-b704-0011955c2bdb}";
static const char path_w2k[] = static const char path_w2k[] =
"\\\\?\\root#legacy_bogus#0000#{6a55b5a4-3f65-11db-b704-0011955c2bdb}\\"; "\\\\?\\root#legacy_bogus#0000#{6a55b5a4-3f65-11db-b704-0011955c2bdb}\\";
PSP_DEVICE_INTERFACE_DETAIL_DATA_A detail = NULL; PSP_DEVICE_INTERFACE_DETAIL_DATA_A detail = NULL;
detail = HeapAlloc(GetProcessHeap(), 0, dwSize); detail = HeapAlloc(GetProcessHeap(), 0, dwSize);
@ -1106,10 +1116,13 @@ static void testRegisterAndGetDetail(void)
/* FIXME: This one only worked because old data wasn't removed properly. As soon /* FIXME: This one only worked because old data wasn't removed properly. As soon
* as all the tests are cleaned up correctly this has to be (or should be) fixed * as all the tests are cleaned up correctly this has to be (or should be) fixed
*/ */
todo_wine if(is_wow64)
ok(!lstrcmpiA(path, detail->DevicePath) || ok(!lstrcmpiA(path_wow64, detail->DevicePath),
!lstrcmpiA(path_w2k, detail->DevicePath), "Unexpected path %s\n", "Unexpected path %s\n", detail->DevicePath);
detail->DevicePath); else
todo_wine ok(!lstrcmpiA(path, detail->DevicePath) ||
!lstrcmpiA(path_w2k, detail->DevicePath),
"Unexpected path %s\n", detail->DevicePath);
HeapFree(GetProcessHeap(), 0, detail); HeapFree(GetProcessHeap(), 0, detail);
} }
} }
@ -1118,8 +1131,8 @@ static void testRegisterAndGetDetail(void)
/* Cleanup */ /* Cleanup */
ret = remove_device(); ret = remove_device();
todo_wine if(!is_wow64)
ok(ret, "Expected the device to be removed: %08x\n", GetLastError()); todo_wine ok(ret, "Expected the device to be removed: %08x\n", GetLastError());
/* FIXME: Only do the RegDeleteKey, once Wine is fixed */ /* FIXME: Only do the RegDeleteKey, once Wine is fixed */
if (!ret) if (!ret)
@ -1228,8 +1241,8 @@ static void testDeviceRegistryPropertyA(void)
pSetupDiDestroyDeviceInfoList(set); pSetupDiDestroyDeviceInfoList(set);
res = RegOpenKeyA(HKEY_LOCAL_MACHINE, bogus, &key); res = RegOpenKeyA(HKEY_LOCAL_MACHINE, bogus, &key);
todo_wine if(!is_wow64)
ok(res == ERROR_FILE_NOT_FOUND, "Expected key to not exist\n"); todo_wine ok(res == ERROR_FILE_NOT_FOUND, "Expected key to not exist\n");
/* FIXME: Remove when Wine is fixed */ /* FIXME: Remove when Wine is fixed */
if (res == ERROR_SUCCESS) if (res == ERROR_SUCCESS)
{ {
@ -1334,8 +1347,8 @@ static void testDeviceRegistryPropertyW(void)
pSetupDiDestroyDeviceInfoList(set); pSetupDiDestroyDeviceInfoList(set);
res = RegOpenKeyW(HKEY_LOCAL_MACHINE, bogus, &key); res = RegOpenKeyW(HKEY_LOCAL_MACHINE, bogus, &key);
todo_wine if(!is_wow64)
ok(res == ERROR_FILE_NOT_FOUND, "Expected key to not exist\n"); todo_wine ok(res == ERROR_FILE_NOT_FOUND, "Expected key to not exist\n");
/* FIXME: Remove when Wine is fixed */ /* FIXME: Remove when Wine is fixed */
if (res == ERROR_SUCCESS) if (res == ERROR_SUCCESS)
{ {
@ -1533,6 +1546,9 @@ START_TEST(devinst)
return; return;
} }
if (pIsWow64Process)
pIsWow64Process(GetCurrentProcess(), &is_wow64);
if (pSetupDiCreateDeviceInfoListExW) if (pSetupDiCreateDeviceInfoListExW)
test_SetupDiCreateDeviceInfoListEx(); test_SetupDiCreateDeviceInfoListEx();
else else