[HHCTRL.OCX]
authorAmine Khaldi <amine.khaldi@reactos.org>
Tue, 22 Apr 2014 16:12:47 +0000 (16:12 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Tue, 22 Apr 2014 16:12:47 +0000 (16:12 +0000)
* Sync with Wine 1.7.17.
CORE-8080

svn path=/trunk/; revision=62890

reactos/dll/win32/hhctrl.ocx/hhctrl.c
reactos/dll/win32/hhctrl.ocx/hhctrl_tlb.idl
reactos/dll/win32/hhctrl.ocx/stream.c
reactos/media/doc/README.WINE

index a73d078..5e97c8c 100644 (file)
@@ -188,7 +188,20 @@ HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD_PTR dat
         case HH_DISPLAY_TOPIC:
         case HH_DISPLAY_TOC:
             if (data)
-                index = (const WCHAR *)data;
+            {
+                static const WCHAR delimW[] = {':',':',0};
+                const WCHAR *i = (const WCHAR *)data;
+
+                index = strstrW(i, delimW);
+                if(index)
+                {
+                    if(memcmp(info->pCHMInfo->szFile, i, index-i))
+                        FIXME("Opening a CHM file in the context of another is not supported.\n");
+                    index += strlenW(delimW);
+                }
+                else
+                    index = i;
+            }
             break;
         }
 
@@ -258,6 +271,8 @@ HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD_PTR dat
         url = FindContextAlias(info->pCHMInfo, data);
         if(!url)
         {
+            if(!data) /* there may legitimately be no context alias for id 0 */
+                return info->WinType.hwndHelp;
             ReleaseHelpViewer(info);
             return NULL;
         }
index c2f8a24..58a4b1e 100644 (file)
@@ -18,6 +18,8 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#pragma makedep regtypelib
+
 import "unknwn.idl";
 import "objidl.idl";
 import "oaidl.idl";
index 828c8d4..cdefef7 100644 (file)
@@ -105,12 +105,52 @@ BOOL next_content(stream_t *stream, strbuf_t *buf)
     return TRUE;
 }
 
+static BOOL find_node_end(stream_t *stream, strbuf_t *buf)
+{
+    int tag_count = 0, b = buf->len;
+    char *p;
+
+    while(1)
+    {
+        if(!stream_chr(stream, buf, '>'))
+            return FALSE;
+        if(buf->len == 0)
+            break;
+        p = &buf->buf[b];
+        while((p = memchr(p+1, '"', buf->len-(p-buf->buf))) != NULL)
+            tag_count++;
+        b = buf->len;
+        if(tag_count % 2 != 0)
+        {
+            if(!stream_chr(stream, buf, '"'))
+                return FALSE;
+            tag_count++;
+        }
+        else
+            break;
+    }
+    return TRUE;
+}
+
 BOOL next_node(stream_t *stream, strbuf_t *buf)
 {
+    strbuf_t tmpbuf;
+
+    /* search through the end of the current node */
+    strbuf_init(&tmpbuf);
+    if(!find_node_end(stream, &tmpbuf))
+    {
+        strbuf_free(&tmpbuf);
+        return FALSE;
+    }
+    strbuf_free(&tmpbuf);
+
+    /* find the beginning of the next node */
     if(!stream_chr(stream, NULL, '<'))
         return FALSE;
 
-    if(!stream_chr(stream, buf, '>'))
+    /* read out the data of the next node */
+    if(!find_node_end(stream, buf))
         return FALSE;
 
     strbuf_append(buf, ">", 2);
index 89cfc86..b162b26 100644 (file)
@@ -75,7 +75,7 @@ reactos/dll/win32/dwmapi           # Synced to Wine-1.7.17
 reactos/dll/win32/faultrep         # Synced to Wine-1.7.1
 reactos/dll/win32/fusion           # Synced to Wine-1.7.1
 reactos/dll/win32/gdiplus          # Synced to Wine-1.7.17
-reactos/dll/win32/hhctrl.ocx       # Synced to Wine-1.7.1
+reactos/dll/win32/hhctrl.ocx       # Synced to Wine-1.7.17
 reactos/dll/win32/hlink            # Synced to Wine-1.7.1
 reactos/dll/win32/hnetcfg          # Synced to Wine-1.7.1
 reactos/dll/win32/httpapi          # Synced to Wine-1.7.1