advpack: Set hexe to a non-NULL value to test that the handle is NULL on return.

oldstable
James Hawkins 2006-03-26 21:38:40 -06:00 committed by Alexandre Julliard
parent 05eaadc1f7
commit 2fb1ac8611
2 changed files with 12 additions and 5 deletions

View File

@ -231,5 +231,12 @@ HRESULT WINAPI RunSetupCommandW(HWND hWnd, LPCWSTR szCmdName,
hWnd, debugstr_w(szCmdName), debugstr_w(szInfSection), hWnd, debugstr_w(szCmdName), debugstr_w(szInfSection),
debugstr_w(szDir), debugstr_w(lpszTitle), debugstr_w(szDir), debugstr_w(lpszTitle),
phEXE, dwFlags, pvReserved); phEXE, dwFlags, pvReserved);
if (!szCmdName || !szDir)
return E_INVALIDARG;
if (!(dwFlags & RSC_FLAG_INF))
*phEXE = NULL;
return E_UNEXPECTED; return E_UNEXPECTED;
} }

View File

@ -55,7 +55,7 @@ static void test_RunSetupCommand()
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %ld\n", hr); ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %ld\n", hr);
/* try to run a non-existent exe */ /* try to run a non-existent exe */
hexe = NULL; hexe = (HANDLE)0xdeadbeef;
hr = pRunSetupCommand(NULL, "idontexist.exe", "Install", "c:\\windows\\system32", "Title", &hexe, 0, NULL); hr = pRunSetupCommand(NULL, "idontexist.exe", "Install", "c:\\windows\\system32", "Title", &hexe, 0, NULL);
todo_wine todo_wine
{ {
@ -66,7 +66,7 @@ static void test_RunSetupCommand()
ok(!TerminateProcess(hexe, 0), "Expected TerminateProcess to fail\n"); ok(!TerminateProcess(hexe, 0), "Expected TerminateProcess to fail\n");
/* try a bad directory */ /* try a bad directory */
hexe = NULL; hexe = (HANDLE)0xdeadbeef;
hr = pRunSetupCommand(NULL, "winver.exe", "Install", "windows\\system32", "Title", &hexe, 0, NULL); hr = pRunSetupCommand(NULL, "winver.exe", "Install", "windows\\system32", "Title", &hexe, 0, NULL);
todo_wine todo_wine
{ {
@ -77,17 +77,17 @@ static void test_RunSetupCommand()
ok(!TerminateProcess(hexe, 0), "Expected TerminateProcess to fail\n"); ok(!TerminateProcess(hexe, 0), "Expected TerminateProcess to fail\n");
/* try to run an exe with the RSC_FLAG_INF flag */ /* try to run an exe with the RSC_FLAG_INF flag */
hexe = NULL; hexe = (HANDLE)0xdeadbeef;
hr = pRunSetupCommand(NULL, "winver.exe", "Install", "c:\\windows\\system32", "Title", &hexe, RSC_FLAG_INF, NULL); hr = pRunSetupCommand(NULL, "winver.exe", "Install", "c:\\windows\\system32", "Title", &hexe, RSC_FLAG_INF, NULL);
todo_wine todo_wine
{ {
ok(hr == SPAPI_E_WRONG_INF_STYLE, "Expected SPAPI_E_WRONG_INF_STYLE, got %ld\n", hr); ok(hr == SPAPI_E_WRONG_INF_STYLE, "Expected SPAPI_E_WRONG_INF_STYLE, got %ld\n", hr);
} }
ok(hexe == NULL, "Expected hexe to be NULL\n"); ok(hexe == (HANDLE)0xdeadbeef, "Expected hexe to be 0xdeadbeef\n");
ok(!TerminateProcess(hexe, 0), "Expected TerminateProcess to fail\n"); ok(!TerminateProcess(hexe, 0), "Expected TerminateProcess to fail\n");
/* run winver.exe */ /* run winver.exe */
hexe = NULL; hexe = (HANDLE)0xdeadbeef;
hr = pRunSetupCommand(NULL, "winver.exe", "Install", "c:\\windows\\system32", "Title", &hexe, 0, NULL); hr = pRunSetupCommand(NULL, "winver.exe", "Install", "c:\\windows\\system32", "Title", &hexe, 0, NULL);
todo_wine todo_wine
{ {