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

Alexandre Julliard julliard at wine.codeweavers.com
Mon Mar 27 05:29:05 CST 2006


Module: wine
Branch: refs/heads/master
Commit: 2fb1ac86119510764a8bf8ab92a4618c53a87be3
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=2fb1ac86119510764a8bf8ab92a4618c53a87be3

Author: James Hawkins <truiken at gmail.com>
Date:   Sun Mar 26 21:38:40 2006 -0600

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 55c7703..ecf8a18 100644
--- a/dlls/advpack/install.c
+++ b/dlls/advpack/install.c
@@ -231,5 +231,12 @@ HRESULT WINAPI RunSetupCommandW(HWND hWn
            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 b8a14eb..6d0daae 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
     {




More information about the wine-cvs mailing list