From a27ae7929566f42ee3dd420af7f284b57510d98b Mon Sep 17 00:00:00 2001 From: James Hawkins Date: Wed, 1 Nov 2006 11:52:58 -0800 Subject: [PATCH] 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 b86c70a0759..0c12d9db2f9 100644 --- a/dlls/advpack/install.c +++ b/dlls/advpack/install.c @@ -833,7 +833,7 @@ HRESULT WINAPI LaunchINFSectionExW(HWND hWnd, HINSTANCE hInst, LPWSTR cmdline, I 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 hWnd, HINSTANCE hInst, LPWSTR cmdline, I 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 96c09a3bfb8..bc987ddfbbb 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"); }