setupapi/tests: Don't test function directly when reporting GetLastError().

This commit is contained in:
André Hentschel 2010-12-29 18:52:36 +01:00 committed by Alexandre Julliard
parent b9b0bcbf3f
commit c7cb92f1f2
2 changed files with 20 additions and 13 deletions

View File

@ -132,7 +132,7 @@ static BOOL remove_device(void)
{
HDEVINFO set;
SP_DEVINFO_DATA devInfo = { sizeof(devInfo), { 0 } };
BOOL ret;
BOOL ret, retval;
SetLastError(0xdeadbeef);
set = pSetupDiGetClassDevsA(&guid, NULL, 0, 0);
@ -140,23 +140,23 @@ static BOOL remove_device(void)
GetLastError());
SetLastError(0xdeadbeef);
ok(pSetupDiEnumDeviceInfo(set, 0, &devInfo),
"SetupDiEnumDeviceInfo failed: %08x\n", GetLastError());
ret = pSetupDiEnumDeviceInfo(set, 0, &devInfo);
ok(ret, "SetupDiEnumDeviceInfo failed: %08x\n", GetLastError());
SetLastError(0xdeadbeef);
ret = pSetupDiCallClassInstaller(DIF_REMOVE, set, &devInfo);
retval = pSetupDiCallClassInstaller(DIF_REMOVE, set, &devInfo);
if(is_wow64)
todo_wine ok(!ret && GetLastError() == ERROR_IN_WOW64,
todo_wine ok(!retval && GetLastError() == ERROR_IN_WOW64,
"SetupDiCallClassInstaller(DIF_REMOVE...) succeeded: %08x\n", GetLastError());
else
todo_wine ok(ret,
todo_wine ok(retval,
"SetupDiCallClassInstaller(DIF_REMOVE...) failed: %08x\n", GetLastError());
SetLastError(0xdeadbeef);
ok(pSetupDiDestroyDeviceInfoList(set),
"SetupDiDestroyDeviceInfoList failed: %08x\n", GetLastError());
ret = pSetupDiDestroyDeviceInfoList(set);
ok(ret, "SetupDiDestroyDeviceInfoList failed: %08x\n", GetLastError());
return ret;
return retval;
}
/* RegDeleteTreeW from dlls/advapi32/registry.c */

View File

@ -120,12 +120,14 @@ static void test_cmdline(void)
{
static const char infwithspaces[] = "test file.inf";
char path[MAX_PATH];
BOOL ret;
create_inf_file(inffile, cmdline_inf);
sprintf(path, "%s\\%s", CURR_DIR, inffile);
run_cmdline("DefaultInstall", 128, path);
ok_registry(TRUE);
ok(DeleteFile(inffile), "Expected source inf to exist, last error was %d\n", GetLastError());
ret = DeleteFile(inffile);
ok(ret, "Expected source inf to exist, last error was %d\n", GetLastError());
/* Test handling of spaces in path, unquoted and quoted */
create_inf_file(infwithspaces, cmdline_inf);
@ -138,7 +140,8 @@ static void test_cmdline(void)
run_cmdline("DefaultInstall", 128, path);
ok_registry(FALSE);
ok(DeleteFile(infwithspaces), "Expected source inf to exist, last error was %d\n", GetLastError());
ret = DeleteFile(infwithspaces);
ok(ret, "Expected source inf to exist, last error was %d\n", GetLastError());
}
static const char *cmdline_inf_reg = "[Version]\n"
@ -153,6 +156,7 @@ static void test_registry(void)
HKEY key;
LONG res;
char path[MAX_PATH];
BOOL ret;
/* First create a registry structure we would like to be deleted */
ok(!RegCreateKeyA(HKEY_CURRENT_USER, "Software\\Wine\\setupapitest\\setupapitest", &key),
@ -176,7 +180,8 @@ static void test_registry(void)
RegDeleteKeyA(HKEY_CURRENT_USER, "Software\\Wine\\setupapitest\\setupapitest");
RegDeleteKeyA(HKEY_CURRENT_USER, "Software\\Wine\\setupapitest");
}
ok(DeleteFile(inffile), "Expected source inf to exist, last error was %d\n", GetLastError());
ret = DeleteFile(inffile);
ok(ret, "Expected source inf to exist, last error was %d\n", GetLastError());
}
static void test_install_svc_from(void)
@ -724,6 +729,7 @@ START_TEST(install)
/* Check if pInstallHinfSectionA sets last error or is a stub (as on WinXP) */
static const char *minimal_inf = "[Version]\nSignature=\"$Chicago$\"\n";
char cmdline[MAX_PATH*2];
BOOL ret;
create_inf_file(inffile, minimal_inf);
sprintf(cmdline, "DefaultInstall 128 %s\\%s", CURR_DIR, inffile);
SetLastError(0xdeadbeef);
@ -733,7 +739,8 @@ START_TEST(install)
skip("InstallHinfSectionA is broken (stub)\n");
pInstallHinfSectionA = NULL;
}
ok(DeleteFile(inffile), "Expected source inf to exist, last error was %d\n", GetLastError());
ret = DeleteFile(inffile);
ok(ret, "Expected source inf to exist, last error was %d\n", GetLastError());
}
if (!pInstallHinfSectionW && !pInstallHinfSectionA)
win_skip("InstallHinfSectionA and InstallHinfSectionW are not available\n");