setupapi/tests: Fix some test failures on W2K.

This commit is contained in:
Paul Vriens 2008-06-11 14:57:42 +02:00 committed by Alexandre Julliard
parent 189603a995
commit 5cd4cbc49c
1 changed files with 16 additions and 6 deletions

View File

@ -814,6 +814,8 @@ static void testGetDeviceInterfaceDetail(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_w2k[] =
"\\\\?\\root#legacy_bogus#0000#{6a55b5a4-3f65-11db-b704-0011955c2bdb}\\";
LPBYTE buf = HeapAlloc(GetProcessHeap(), 0, size); LPBYTE buf = HeapAlloc(GetProcessHeap(), 0, size);
SP_DEVICE_INTERFACE_DETAIL_DATA_A *detail = SP_DEVICE_INTERFACE_DETAIL_DATA_A *detail =
(SP_DEVICE_INTERFACE_DETAIL_DATA_A *)buf; (SP_DEVICE_INTERFACE_DETAIL_DATA_A *)buf;
@ -845,14 +847,19 @@ static void testGetDeviceInterfaceDetail(void)
size, &size, NULL); size, &size, NULL);
ok(ret, "SetupDiGetDeviceInterfaceDetailA failed: %d\n", ok(ret, "SetupDiGetDeviceInterfaceDetailA failed: %d\n",
GetLastError()); GetLastError());
ok(!lstrcmpiA(path, detail->DevicePath), "Unexpected path %s\n", ok(!lstrcmpiA(path, detail->DevicePath) ||
detail->DevicePath); !lstrcmpiA(path_w2k, detail->DevicePath), "Unexpected path %s\n",
detail->DevicePath);
/* Check SetupDiGetDeviceInterfaceDetailW */ /* Check SetupDiGetDeviceInterfaceDetailW */
if (pSetupDiGetDeviceInterfaceDetailW) if (pSetupDiGetDeviceInterfaceDetailW)
{ {
ret = pSetupDiGetDeviceInterfaceDetailW(set, &interfaceData, NULL, 0, &size, NULL); ret = pSetupDiGetDeviceInterfaceDetailW(set, &interfaceData, NULL, 0, &size, NULL);
ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Expected ERROR_INSUFFICIENT_BUFFER, got error code: %d\n", GetLastError()); ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER,
ok(expectedsize == size, "SetupDiGetDeviceInterfaceDetailW returned wrong reqsize: expected %d, got %d\n", expectedsize, size); "Expected ERROR_INSUFFICIENT_BUFFER, got error code: %d\n", GetLastError());
ok(expectedsize == size ||
(expectedsize + sizeof(WCHAR)) == size /* W2K adds a backslash */,
"SetupDiGetDeviceInterfaceDetailW returned wrong reqsize, got %d\n",
size);
} }
else else
skip("SetupDiGetDeviceInterfaceDetailW is not available\n"); skip("SetupDiGetDeviceInterfaceDetailW is not available\n");
@ -1097,6 +1104,8 @@ 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_w2k[] =
"\\\\?\\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 = (PSP_DEVICE_INTERFACE_DETAIL_DATA_A)HeapAlloc(GetProcessHeap(), 0, dwSize); detail = (PSP_DEVICE_INTERFACE_DETAIL_DATA_A)HeapAlloc(GetProcessHeap(), 0, dwSize);
@ -1111,8 +1120,9 @@ static void testRegisterAndGetDetail(void)
* 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 todo_wine
ok(!lstrcmpiA(path, detail->DevicePath), "Unexpected path %s\n", ok(!lstrcmpiA(path, detail->DevicePath) ||
detail->DevicePath); !lstrcmpiA(path_w2k, detail->DevicePath), "Unexpected path %s\n",
detail->DevicePath);
HeapFree(GetProcessHeap(), 0, detail); HeapFree(GetProcessHeap(), 0, detail);
} }
} }