advpack/tests: Don't hardcode the system directory.
This commit is contained in:
parent
be55a4bbe2
commit
437a3aab9d
|
@ -86,6 +86,9 @@ static void test_RunSetupCommand(void)
|
|||
HANDLE hexe;
|
||||
char path[MAX_PATH];
|
||||
char dir[MAX_PATH];
|
||||
char systemdir[MAX_PATH];
|
||||
|
||||
GetSystemDirectoryA(systemdir, sizeof(systemdir));
|
||||
|
||||
/* try an invalid cmd name */
|
||||
hr = pRunSetupCommand(NULL, NULL, "Install", "Dir", "Title", NULL, 0, NULL);
|
||||
|
@ -97,7 +100,7 @@ static void test_RunSetupCommand(void)
|
|||
|
||||
/* try to run a nonexistent exe */
|
||||
hexe = (HANDLE)0xdeadbeef;
|
||||
hr = pRunSetupCommand(NULL, "idontexist.exe", "Install", "c:\\windows\\system32", "Title", &hexe, 0, NULL);
|
||||
hr = pRunSetupCommand(NULL, "idontexist.exe", "Install", systemdir, "Title", &hexe, 0, NULL);
|
||||
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
|
||||
"Expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got %d\n", hr);
|
||||
ok(hexe == NULL, "Expcted hexe to be NULL\n");
|
||||
|
@ -113,14 +116,14 @@ static void test_RunSetupCommand(void)
|
|||
|
||||
/* try to run an exe with the RSC_FLAG_INF flag */
|
||||
hexe = (HANDLE)0xdeadbeef;
|
||||
hr = pRunSetupCommand(NULL, "winver.exe", "Install", "c:\\windows\\system32", "Title", &hexe, RSC_FLAG_INF | RSC_FLAG_QUIET, NULL);
|
||||
hr = pRunSetupCommand(NULL, "winver.exe", "Install", systemdir, "Title", &hexe, RSC_FLAG_INF | RSC_FLAG_QUIET, NULL);
|
||||
ok(is_spapi_err(hr), "Expected a setupapi error, got %d\n", hr);
|
||||
ok(hexe == (HANDLE)0xdeadbeef, "Expected hexe to be 0xdeadbeef\n");
|
||||
ok(!TerminateProcess(hexe, 0), "Expected TerminateProcess to fail\n");
|
||||
|
||||
/* run winver.exe */
|
||||
hexe = (HANDLE)0xdeadbeef;
|
||||
hr = pRunSetupCommand(NULL, "winver.exe", "Install", "c:\\windows\\system32", "Title", &hexe, 0, NULL);
|
||||
hr = pRunSetupCommand(NULL, "winver.exe", "Install", systemdir, "Title", &hexe, 0, NULL);
|
||||
ok(hr == S_ASYNCHRONOUS, "Expected S_ASYNCHRONOUS, got %d\n", hr);
|
||||
ok(hexe != NULL, "Expected hexe to be non-NULL\n");
|
||||
ok(TerminateProcess(hexe, 0), "Expected TerminateProcess to succeed\n");
|
||||
|
|
Loading…
Reference in New Issue