[2/2] advpack: Handle quoted arguments to rundll exports.
Vincent Povirk
madewokherd at gmail.com
Tue May 28 18:18:54 CDT 2013
-------------- next part --------------
From c9366cd671cbf25ef51ac80f7e0e1baee5088204 Mon Sep 17 00:00:00 2001
From: Vincent Povirk <vincent at codeweavers.com>
Date: Tue, 28 May 2013 18:01:50 -0500
Subject: [PATCH 2/2] 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..630c94a 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, ',', 0)))
{
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, ',', 1);
if (!ocx_filename || !*ocx_filename)
goto done;
- str_flags = get_parameter(&cmdline_ptr, ',');
- param = get_parameter(&cmdline_ptr, ',');
+ str_flags = get_parameter(&cmdline_ptr, ',', 1);
+ param = get_parameter(&cmdline_ptr, ',', 1);
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..dd9a9e3 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, int 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..82cc8d8 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, ',', 1);
+ szFlags = get_parameter(&cmdline_ptr, ',', 1);
if (szFlags)
dwFlags = atolW(szFlags);
diff --git a/dlls/advpack/install.c b/dlls/advpack/install.c
index 6079625..b9d79e5 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, int 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, ',', 1);
+ install_sec = get_parameter(&cmdline_ptr, ',', 1);
- str_flags = get_parameter(&cmdline_ptr, ',');
+ str_flags = get_parameter(&cmdline_ptr, ',', 1);
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, ',', 1);
+ cabinfo.pszSection = get_parameter(&cmdline_ptr, ',', 1);
+ cabinfo.pszCab = get_parameter(&cmdline_ptr, ',', 1);
*cabinfo.szSrcPath = '\0';
- flags = get_parameter(&cmdline_ptr, ',');
+ flags = get_parameter(&cmdline_ptr, ',', 1);
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.
--
1.7.10.4
More information about the wine-patches
mailing list