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

oldstable
James Hawkins 2006-11-01 11:52:58 -08:00 committed by Alexandre Julliard
parent 313d93e491
commit a27ae79295
2 changed files with 11 additions and 8 deletions

View File

@ -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;
}

View File

@ -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");
}