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

James Hawkins truiken at gmail.com
Wed Nov 1 13:52:58 CST 2006


Hi,

Changelog:
* 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(-)

-- 
James Hawkins
-------------- next part --------------
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");
 }
-- 
1.4.2.4



More information about the wine-patches mailing list