Only do unicode conversion in HTML Help control when filename is specified

Mike Hearn mike at navi.cx
Fri Apr 1 16:26:55 CST 2005


Only do unicode conversion in HTML Help control when filename is specified

Index: dlls/hhctrl.ocx/hhctrl.c
===================================================================
RCS file: /home/wine/wine/dlls/hhctrl.ocx/hhctrl.c,v
retrieving revision 1.5
diff -u -p -d -r1.5 hhctrl.c
--- dlls/hhctrl.ocx/hhctrl.c	8 Oct 2004 20:49:09 -0000	1.5
+++ dlls/hhctrl.ocx/hhctrl.c	1 Apr 2005 22:16:24 -0000
@@ -32,7 +32,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(htmlhelp);
 
 HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD data)
 {
-    FIXME("(%p, %s, %d, %ld): stub\n", caller, debugstr_w(filename), command, data);
+    FIXME("(%p, %s, command=%d, data=%ld): stub\n", caller, debugstr_w(filename), command, data);
 
     /* if command is HH_DISPLAY_TOPIC just display an informative message for now */
     if (command == HH_DISPLAY_TOPIC)
@@ -45,12 +45,16 @@ HWND WINAPI HtmlHelpW(HWND caller, LPCWS
 HWND WINAPI HtmlHelpA(HWND caller, LPCSTR filename, UINT command, DWORD data)
 {
     WCHAR *wfile = NULL;
-    DWORD len = MultiByteToWideChar( CP_ACP, 0, filename, -1, NULL, 0 );
     HWND result;
 
-    wfile = HeapAlloc( GetProcessHeap(), 0, len  * sizeof(WCHAR));
-    MultiByteToWideChar( CP_ACP, 0, filename, -1, wfile, len );
-
+    if (filename)
+    {
+        DWORD len = MultiByteToWideChar( CP_ACP, 0, filename, -1, NULL, 0 );
+    
+        wfile = HeapAlloc( GetProcessHeap(), 0, (len+1) * sizeof(WCHAR));
+        MultiByteToWideChar( CP_ACP, 0, filename, -1, wfile, len );
+    }
+    
     result = HtmlHelpW( caller, wfile, command, data );
 
     HeapFree( GetProcessHeap(), 0, wfile );



More information about the wine-patches mailing list