Michael Stefaniuc : transl: Add support to parse MENUEX resources.

Alexandre Julliard julliard at winehq.org
Tue Jan 17 05:56:11 CST 2017


Module: tools
Branch: master
Commit: 5e3de6104cd9457679c56833eb03a8fb8baf6e8d
URL:    http://source.winehq.org/git/tools.git/?a=commit;h=5e3de6104cd9457679c56833eb03a8fb8baf6e8d

Author: Michael Stefaniuc <mstefani at redhat.de>
Date:   Tue Jan 17 10:12:58 2017 +0100

transl: Add support to parse MENUEX resources.

Signed-off-by: Michael Stefaniuc <mstefani at redhat.de>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 transl/lib_res.php | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/transl/lib_res.php b/transl/lib_res.php
index caa87b4..317c411 100644
--- a/transl/lib_res.php
+++ b/transl/lib_res.php
@@ -270,6 +270,7 @@ function load_resource(&$resources, $type, $id, $langid, &$res)
     switch ($type)
     {
         case 4:   /* RT_MENU */
+        case 260: /* MENUEX */
             $res = new MenuResource($resdata[0], $resdata[1]);
             return TRUE;
         case 5:   /* RT_DIALOG */
@@ -611,6 +612,32 @@ class MenuResource extends Resource
         while (!($item["resinfo"] & $CONSTS["MF_END"]));
     }
 
+    function parse_menuex(&$data, $level)
+    {
+        global $CONSTS;
+        do
+        {
+            $item = array();
+            $item["level"] = $level;
+            $item["type"] = get_dword($data);
+            $item["state"] = get_dword($data);
+            $item["id"] = get_dword($data);
+            $len = strlen($data);
+            $item["resinfo"] = get_word($data);
+            $item["text"] = get_string_nul($data);
+            if (($len - strlen($data)) & 3)  /* DWORD padding */
+                $data = substr($data, 2);
+
+            $this->items[] = $item;
+            if ($item["resinfo"] & 0x01)
+            {
+                $dummy = get_dword($data);  /* HelpId */
+                $this->parse_menuex($data, $level + 1);
+            }
+        }
+        while (!($item["resinfo"] & $CONSTS["MF_END"]));
+    }
+
     function MenuResource($header, $data)
     {
         $this->Resource($header);
@@ -622,8 +649,10 @@ class MenuResource extends Resource
 
         if ($version == 0)
             $this->parse_menu($data, 0);
+        else if ($version == 1)
+            $this->parse_menuex($data, 0);
         else
-            die("Unsupported version $version");
+            die("Unsupported version $version\n");
 
 //        echo urlencode($data);
         if (strlen($data) > 0)




More information about the wine-cvs mailing list