hhctrl.ocx: Handle quoted filenames in doWinMain.

Dylan Smith dylan.ah.smith at gmail.com
Wed Feb 11 20:16:57 CST 2009


The bug can be seen by trying to open a chm file from the command line.

  wine hh "test file.chm"

The filename will be quoted when passed into doWinMain, so the quotes
need to be removed from the filename string before being used to open
the file.  I found that native hhctrl was stripping the quaotes when
called through doWinMain, but not when this method was bypassed by
calling HtmlHelpA directly.  I tested this by using a modified hh
program.

I also tested using a command line string that only starts with a quote,
and found that the leading quote was removed properly by native controls
as well.
---
 dlls/hhctrl.ocx/hhctrl.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
-------------- next part --------------
diff --git a/dlls/hhctrl.ocx/hhctrl.c b/dlls/hhctrl.ocx/hhctrl.c
index a224b64..206aa3c 100644
--- a/dlls/hhctrl.ocx/hhctrl.c
+++ b/dlls/hhctrl.ocx/hhctrl.c
@@ -253,6 +253,12 @@ int WINAPI doWinMain(HINSTANCE hInstance, LPSTR szCmdLine)
     hh_process = TRUE;
 
     /* FIXME: Check szCmdLine for bad arguments */
+    if (*szCmdLine == '\"')
+    {
+        char *endq = strchr(++szCmdLine, '\"');
+        if (endq)
+            *endq = '\0';
+    }
     HtmlHelpA(GetDesktopWindow(), szCmdLine, HH_DISPLAY_TOPIC, 0);
 
     while (GetMessageW(&msg, 0, 0, 0))


More information about the wine-patches mailing list