advpack: Handle quoted arguments to rundll exports.

This commit is contained in:
Vincent Povirk 2013-07-22 16:48:19 -05:00 committed by Alexandre Julliard
parent 17f6609702
commit 531f795623
5 changed files with 27 additions and 16 deletions

View File

@ -175,7 +175,7 @@ void set_ldids(HINF hInf, LPCWSTR pszInstallSection, LPCWSTR pszWorkingDir)
FIXME("Need to support changing paths - default will be used\n");
/* set all ldids to dest */
while ((ptr = get_parameter(&key, ',')))
while ((ptr = get_parameter(&key, ',', FALSE)))
{
ldid = atolW(ptr);
SetupSetDirectoryIdW(hInf, ldid, dest);
@ -508,12 +508,12 @@ HRESULT WINAPI RegisterOCX(HWND hWnd, HINSTANCE hInst, LPCSTR cmdline, INT show)
cmdline_ptr = cmdline_copy;
lstrcpyW(cmdline_copy, cmdlineW.Buffer);
ocx_filename = get_parameter(&cmdline_ptr, ',');
ocx_filename = get_parameter(&cmdline_ptr, ',', TRUE);
if (!ocx_filename || !*ocx_filename)
goto done;
str_flags = get_parameter(&cmdline_ptr, ',');
param = get_parameter(&cmdline_ptr, ',');
str_flags = get_parameter(&cmdline_ptr, ',', TRUE);
param = get_parameter(&cmdline_ptr, ',', TRUE);
hm = LoadLibraryExW(ocx_filename, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
if (!hm)

View File

@ -22,7 +22,7 @@
#define __ADVPACK_PRIVATE_H
HRESULT do_ocx_reg(HMODULE hocx, BOOL do_reg, const WCHAR *flags, const WCHAR *param) DECLSPEC_HIDDEN;
LPWSTR get_parameter(LPWSTR *params, WCHAR separator) DECLSPEC_HIDDEN;
LPWSTR get_parameter(LPWSTR *params, WCHAR separator, BOOL quoted) DECLSPEC_HIDDEN;
void set_ldids(HINF hInf, LPCWSTR pszInstallSection, LPCWSTR pszWorkingDir) DECLSPEC_HIDDEN;
HRESULT launch_exe(LPCWSTR cmd, LPCWSTR dir, HANDLE *phEXE) DECLSPEC_HIDDEN;

View File

@ -501,8 +501,8 @@ HRESULT WINAPI DelNodeRunDLL32W(HWND hWnd, HINSTANCE hInst, LPWSTR cmdline, INT
lstrcpyW(cmdline_copy, cmdline);
/* get the parameters at indexes 0 and 1 respectively */
szFilename = get_parameter(&cmdline_ptr, ',');
szFlags = get_parameter(&cmdline_ptr, ',');
szFilename = get_parameter(&cmdline_ptr, ',', TRUE);
szFlags = get_parameter(&cmdline_ptr, ',', TRUE);
if (szFlags)
dwFlags = atolW(szFlags);

View File

@ -205,13 +205,24 @@ static HRESULT run_setup_commands_callback(HINF hinf, PCWSTR field, const void *
/* sequentially returns pointers to parameters in a parameter list
* returns NULL if the parameter is empty, e.g. one,,three */
LPWSTR get_parameter(LPWSTR *params, WCHAR separator)
LPWSTR get_parameter(LPWSTR *params, WCHAR separator, BOOL quoted)
{
LPWSTR token = *params;
if (!*params)
return NULL;
if (quoted && *token == '"')
{
WCHAR *end = strchrW(token + 1, '"');
if (end)
{
*end = 0;
*params = end + 1;
token = token + 1;
}
}
*params = strchrW(*params, separator);
if (*params)
*(*params)++ = '\0';
@ -760,10 +771,10 @@ INT WINAPI LaunchINFSectionW(HWND hWnd, HINSTANCE hInst, LPWSTR cmdline, INT sho
cmdline_ptr = cmdline_copy;
lstrcpyW(cmdline_copy, cmdline);
inf_filename = get_parameter(&cmdline_ptr, ',');
install_sec = get_parameter(&cmdline_ptr, ',');
inf_filename = get_parameter(&cmdline_ptr, ',', TRUE);
install_sec = get_parameter(&cmdline_ptr, ',', TRUE);
str_flags = get_parameter(&cmdline_ptr, ',');
str_flags = get_parameter(&cmdline_ptr, ',', TRUE);
if (str_flags)
flags = atolW(str_flags);
@ -853,12 +864,12 @@ HRESULT WINAPI LaunchINFSectionExW(HWND hWnd, HINSTANCE hInst, LPWSTR cmdline, I
cmdline_ptr = cmdline_copy;
lstrcpyW(cmdline_copy, cmdline);
cabinfo.pszInf = get_parameter(&cmdline_ptr, ',');
cabinfo.pszSection = get_parameter(&cmdline_ptr, ',');
cabinfo.pszCab = get_parameter(&cmdline_ptr, ',');
cabinfo.pszInf = get_parameter(&cmdline_ptr, ',', TRUE);
cabinfo.pszSection = get_parameter(&cmdline_ptr, ',', TRUE);
cabinfo.pszCab = get_parameter(&cmdline_ptr, ',', TRUE);
*cabinfo.szSrcPath = '\0';
flags = get_parameter(&cmdline_ptr, ',');
flags = get_parameter(&cmdline_ptr, ',', TRUE);
if (flags)
cabinfo.dwFlags = atolW(flags);

View File

@ -242,7 +242,7 @@ static void test_LaunchINFSectionEx(void)
lstrcat(cmdline, CURR_DIR);
lstrcat(cmdline, "\\test.inf\",\"DefaultInstall\",\"c:,imacab.cab\",\"4\"");
hr = pLaunchINFSectionEx(NULL, NULL, cmdline, 0);
todo_wine ok(hr == 0, "Expected 0, got %d\n", hr);
ok(hr == 0, "Expected 0, got %d\n", hr);
/* The 'No UI' flag seems to have no effect whatsoever on Windows.
* So only do this test in interactive mode.