From 2fb1ac86119510764a8bf8ab92a4618c53a87be3 Mon Sep 17 00:00:00 2001 From: James Hawkins Date: Sun, 26 Mar 2006 21:38:40 -0600 Subject: [PATCH] advpack: Set hexe to a non-NULL value to test that the handle is NULL on return. --- dlls/advpack/install.c | 7 +++++++ dlls/advpack/tests/install.c | 10 +++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/dlls/advpack/install.c b/dlls/advpack/install.c index 55c7703cd17..ecf8a18a503 100644 --- a/dlls/advpack/install.c +++ b/dlls/advpack/install.c @@ -231,5 +231,12 @@ HRESULT WINAPI RunSetupCommandW(HWND hWnd, LPCWSTR szCmdName, hWnd, debugstr_w(szCmdName), debugstr_w(szInfSection), debugstr_w(szDir), debugstr_w(lpszTitle), phEXE, dwFlags, pvReserved); + + if (!szCmdName || !szDir) + return E_INVALIDARG; + + if (!(dwFlags & RSC_FLAG_INF)) + *phEXE = NULL; + return E_UNEXPECTED; } diff --git a/dlls/advpack/tests/install.c b/dlls/advpack/tests/install.c index b8a14eb8e53..6d0daaeebba 100644 --- a/dlls/advpack/tests/install.c +++ b/dlls/advpack/tests/install.c @@ -55,7 +55,7 @@ static void test_RunSetupCommand() ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %ld\n", hr); /* 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); todo_wine { @@ -66,7 +66,7 @@ static void test_RunSetupCommand() ok(!TerminateProcess(hexe, 0), "Expected TerminateProcess to fail\n"); /* try a bad directory */ - hexe = NULL; + hexe = (HANDLE)0xdeadbeef; hr = pRunSetupCommand(NULL, "winver.exe", "Install", "windows\\system32", "Title", &hexe, 0, NULL); todo_wine { @@ -77,17 +77,17 @@ static void test_RunSetupCommand() ok(!TerminateProcess(hexe, 0), "Expected TerminateProcess to fail\n"); /* 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); todo_wine { 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"); /* run winver.exe */ - hexe = NULL; + hexe = (HANDLE)0xdeadbeef; hr = pRunSetupCommand(NULL, "winver.exe", "Install", "c:\\windows\\system32", "Title", &hexe, 0, NULL); todo_wine {