Alex Henrie : shell32: Implement ShellExec_RunDLL.

Alexandre Julliard julliard at winehq.org
Tue Jan 2 15:01:23 CST 2018


Module: wine
Branch: stable
Commit: afd8c13c7585a4a3d4a8e4d20513bed39803d803
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=afd8c13c7585a4a3d4a8e4d20513bed39803d803

Author: Alex Henrie <alexhenrie24 at gmail.com>
Date:   Mon Sep 25 22:52:52 2017 -0600

shell32: Implement ShellExec_RunDLL.

Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit 67826491a69f9cddfea6feef0ba27ddd0efe384a)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>

---

 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 cd4f24a..4f8d6cd 100644
--- a/dlls/shell32/shell32.spec
+++ b/dlls/shell32/shell32.spec
@@ -436,9 +436,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 6aa3eec..1c2f1a4 100644
--- a/dlls/shell32/shlexec.c
+++ b/dlls/shell32/shlexec.c
@@ -2014,6 +2014,58 @@ HINSTANCE WINAPI WOWShellExecute(HWND hWnd, LPCSTR lpVerb,LPCSTR lpFile,
 }
 
 /*************************************************************************
+ * 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.@]
  */
 void WINAPI OpenAs_RunDLLA(HWND hwnd, HINSTANCE hinst, LPCSTR cmdline, int cmdshow)




More information about the wine-cvs mailing list