Dylan Smith : hhctrl.ocx: Handle quoted filenames in doWinMain.

Alexandre Julliard julliard at winehq.org
Tue Feb 17 08:49:09 CST 2009


Module: wine
Branch: master
Commit: 68e887004a40db5442a73c71780ae07eca3d0a5a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=68e887004a40db5442a73c71780ae07eca3d0a5a

Author: Dylan Smith <dylan.ah.smith at gmail.com>
Date:   Mon Feb 16 12:35:56 2009 -0500

hhctrl.ocx: Handle quoted filenames in doWinMain.

---

 dlls/hhctrl.ocx/hhctrl.c |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/dlls/hhctrl.ocx/hhctrl.c b/dlls/hhctrl.ocx/hhctrl.c
index a224b64..5e707b9 100644
--- a/dlls/hhctrl.ocx/hhctrl.c
+++ b/dlls/hhctrl.ocx/hhctrl.c
@@ -249,11 +249,28 @@ HWND WINAPI HtmlHelpA(HWND caller, LPCSTR filename, UINT command, DWORD_PTR data
 int WINAPI doWinMain(HINSTANCE hInstance, LPSTR szCmdLine)
 {
     MSG msg;
+    int len, buflen;
+    WCHAR *filename;
+    char *endq = NULL;
 
     hh_process = TRUE;
 
     /* FIXME: Check szCmdLine for bad arguments */
-    HtmlHelpA(GetDesktopWindow(), szCmdLine, HH_DISPLAY_TOPIC, 0);
+    if (*szCmdLine == '\"')
+        endq = strchr(++szCmdLine, '\"');
+
+    if (endq)
+        len = endq - szCmdLine;
+    else
+        len = strlen(szCmdLine);
+    buflen = MultiByteToWideChar(CP_ACP, 0, szCmdLine, len, NULL, 0) + 1;
+    filename = heap_alloc(buflen * sizeof(WCHAR));
+    MultiByteToWideChar(CP_ACP, 0, szCmdLine, len, filename, buflen);
+    filename[buflen-1] = 0;
+
+    HtmlHelpW(GetDesktopWindow(), filename, HH_DISPLAY_TOPIC, 0);
+
+    heap_free(filename);
 
     while (GetMessageW(&msg, 0, 0, 0))
     {




More information about the wine-cvs mailing list