James Hawkins : advpack: Use the full path of the INF file as the source directory if the CAB file is invalid .

Alexandre Julliard julliard at wine.codeweavers.com
Thu Nov 2 05:46:44 CST 2006


Module: wine
Branch: master
Commit: a27ae7929566f42ee3dd420af7f284b57510d98b
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a27ae7929566f42ee3dd420af7f284b57510d98b

Author: James Hawkins <truiken at gmail.com>
Date:   Wed Nov  1 11:52:58 2006 -0800

advpack: Use the full path of the INF file as the source directory if the CAB file is invalid.

---

 dlls/advpack/install.c       |   16 ++++++++++------
 dlls/advpack/tests/install.c |    3 +--
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/dlls/advpack/install.c b/dlls/advpack/install.c
index b86c70a..0c12d9d 100644
--- a/dlls/advpack/install.c
+++ b/dlls/advpack/install.c
@@ -833,7 +833,7 @@ HRESULT WINAPI LaunchINFSectionExW(HWND
     LPWSTR cmdline_copy, cmdline_ptr;
     LPWSTR flags, ptr;
     CABINFOW cabinfo;
-    HRESULT hr = S_OK;
+    HRESULT hr;
 
     TRACE("(%p, %p, %s, %d)\n", hWnd, hInst, debugstr_w(cmdline), show);
 
@@ -853,22 +853,26 @@ HRESULT WINAPI LaunchINFSectionExW(HWND
     if (flags)
         cabinfo.dwFlags = atolW(flags);
 
+    if (!is_full_path(cabinfo.pszCab) && !is_full_path(cabinfo.pszInf))
+    {
+        HeapFree(GetProcessHeap(), 0, cmdline_copy);
+        return E_INVALIDARG;
+    }
+
     /* get the source path from the cab filename */
     if (cabinfo.pszCab && *cabinfo.pszCab)
     {
         if (!is_full_path(cabinfo.pszCab))
-            goto done;
+            lstrcpyW(cabinfo.szSrcPath, cabinfo.pszInf);
+        else
+            lstrcpyW(cabinfo.szSrcPath, cabinfo.pszCab);
 
-        lstrcpyW(cabinfo.szSrcPath, cabinfo.pszCab);
         ptr = strrchrW(cabinfo.szSrcPath, '\\');
         *(++ptr) = '\0';
     }
 
     hr = ExecuteCabW(hWnd, &cabinfo, NULL);
-
-done:
     HeapFree(GetProcessHeap(), 0, cmdline_copy);
-
     return SUCCEEDED(hr) ? ADV_SUCCESS : ADV_FAILURE;
 }
 
diff --git a/dlls/advpack/tests/install.c b/dlls/advpack/tests/install.c
index 96c09a3..bc987dd 100644
--- a/dlls/advpack/tests/install.c
+++ b/dlls/advpack/tests/install.c
@@ -243,8 +243,7 @@ static void test_LaunchINFSectionEx()
     /* try an invalid CAB filename with a relative INF name */
     lstrcpy(cmdline, "test.inf,DefaultInstall,c:imacab.cab,4");
     hr = pLaunchINFSectionEx(NULL, NULL, cmdline, 0);
-    todo_wine
-        ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %d\n", hr);
+    ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %d\n", hr);
 
     DeleteFileA("test.inf");
 }




More information about the wine-cvs mailing list