Commit a27ae792 authored by James Hawkins's avatar James Hawkins Committed by Alexandre Julliard

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

parent 313d93e4
......@@ -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;
}
......
......@@ -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");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment