[PATCH] shell32: Implement ShellExec_RunDLL.
Alex Henrie
alexhenrie24 at gmail.com
Mon Sep 25 23:52:52 CDT 2017
Fixes https://bugs.winehq.org/show_bug.cgi?id=37321
This function is undocumented, but a quick google search shows plenty of
examples of people using it as a rundll entry point for calling
ShellExecute:
https://www.experts-exchange.com/questions/25098857/Use-of-ShellExec-RunDLL-under-Windows-Server-2008-to-launch-Excel.html
https://stackoverflow.com/questions/13412845/cant-launch-exe-from-java
https://stackoverflow.com/questions/7840278/how-to-open-and-view-a-filesimilar-to-that-of-double-clicking-a-file-using-jav#answer-12355642\
https://coderanch.com/t/272315/java/Open-multiple-files-Winamp-rundll
Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
dlls/shell32/shell32.spec | 6 +++---
dlls/shell32/shlexec.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 55 insertions(+), 3 deletions(-)
diff --git a/dlls/shell32/shell32.spec b/dlls/shell32/shell32.spec
index 6974332a06..6d2c61b4d8 100644
--- a/dlls/shell32/shell32.spec
+++ b/dlls/shell32/shell32.spec
@@ -440,9 +440,9 @@
@ stub SheShortenPathW
@ stdcall ShellAboutA(long str str long)
@ stdcall ShellAboutW(long wstr wstr long)
-@ stub ShellExec_RunDLL
-@ stub ShellExec_RunDLLA
-@ stub ShellExec_RunDLLW
+@ stdcall ShellExec_RunDLL(long long str long) ShellExec_RunDLLA
+@ stdcall ShellExec_RunDLLA(long long str long)
+@ stdcall ShellExec_RunDLLW(long long wstr long)
@ stdcall ShellExecuteA(long str str str str long)
@ stdcall ShellExecuteEx (long) ShellExecuteExA
@ stdcall ShellExecuteExA (long)
diff --git a/dlls/shell32/shlexec.c b/dlls/shell32/shlexec.c
index c0ef53ab8e..7a432c6eb0 100644
--- a/dlls/shell32/shlexec.c
+++ b/dlls/shell32/shlexec.c
@@ -2015,6 +2015,58 @@ HINSTANCE WINAPI WOWShellExecute(HWND hWnd, LPCSTR lpVerb,LPCSTR lpFile,
return seiW.hInstApp;
}
+/*************************************************************************
+ * ShellExec_RunDLLW [SHELL32.@]
+ */
+void WINAPI ShellExec_RunDLLW(HWND hwnd, HINSTANCE instance, WCHAR *cmdline, int cmdshow)
+{
+ BOOL in_single_quotes = FALSE, in_double_quotes = FALSE;
+ WCHAR *args;
+
+ TRACE("%p, %p, %s, %d\n", hwnd, instance, debugstr_w(cmdline), cmdshow);
+
+ /* Replace the first whitespace character in the command line string with a
+ null terminator to separate the program name from the program arguments */
+ for (args = cmdline; *args; args++)
+ {
+ switch (*args)
+ {
+ case '\\':
+ args++; /* skip the next character */
+ break;
+ case '\'':
+ if (!in_double_quotes)
+ in_single_quotes = !in_single_quotes;
+ break;
+ case '"':
+ if (!in_single_quotes)
+ in_double_quotes = !in_double_quotes;
+ break;
+ case ' ':
+ case '\t':
+ if (!in_single_quotes && !in_double_quotes)
+ {
+ *args = 0;
+ args++;
+ goto execute;
+ }
+ }
+ }
+
+execute:
+ ShellExecuteW(hwnd, NULL, cmdline, args, NULL, cmdshow);
+}
+
+/*************************************************************************
+ * ShellExec_RunDLLA [SHELL32.@]
+ */
+void WINAPI ShellExec_RunDLLA(HWND hwnd, HINSTANCE instance, CHAR *cmdline, int cmdshow)
+{
+ WCHAR *cmdlineW;
+ ShellExec_RunDLLW(hwnd, instance, __SHCloneStrAtoW(&cmdlineW, cmdline), cmdshow);
+ SHFree(cmdlineW);
+}
+
/*************************************************************************
* OpenAs_RunDLLA [SHELL32.@]
*/
--
2.14.1
More information about the wine-patches
mailing list