Module: wine Branch: master Commit: 531f795623659c77380ff4e79c7445731e2976da URL: http://source.winehq.org/git/wine.git/?a=commit;h=531f795623659c77380ff4e79c...
Author: Vincent Povirk vincent@codeweavers.com Date: Mon Jul 22 16:48:19 2013 -0500
advpack: Handle quoted arguments to rundll exports.
---
dlls/advpack/advpack.c | 8 ++++---- dlls/advpack/advpack_private.h | 2 +- dlls/advpack/files.c | 4 ++-- dlls/advpack/install.c | 27 +++++++++++++++++++-------- dlls/advpack/tests/install.c | 2 +- 5 files changed, 27 insertions(+), 16 deletions(-)
diff --git a/dlls/advpack/advpack.c b/dlls/advpack/advpack.c index 919c0bc..296abb5 100644 --- a/dlls/advpack/advpack.c +++ b/dlls/advpack/advpack.c @@ -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) diff --git a/dlls/advpack/advpack_private.h b/dlls/advpack/advpack_private.h index 5d74897..205cc60 100644 --- a/dlls/advpack/advpack_private.h +++ b/dlls/advpack/advpack_private.h @@ -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; diff --git a/dlls/advpack/files.c b/dlls/advpack/files.c index a1d52f8..1e555f7 100644 --- a/dlls/advpack/files.c +++ b/dlls/advpack/files.c @@ -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); diff --git a/dlls/advpack/install.c b/dlls/advpack/install.c index 6079625..f75eb01 100644 --- a/dlls/advpack/install.c +++ b/dlls/advpack/install.c @@ -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);
diff --git a/dlls/advpack/tests/install.c b/dlls/advpack/tests/install.c index 932f2da..ea479fd 100644 --- a/dlls/advpack/tests/install.c +++ b/dlls/advpack/tests/install.c @@ -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.