Jacek Caban : oleaut32: Try both SYS_WIN64 and SYS_WIN32 syskind in QueryPathOfRegTypeLib on win64 .

Alexandre Julliard julliard at winehq.org
Fri Aug 20 10:19:09 CDT 2010


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Aug 19 18:13:43 2010 +0200

oleaut32: Try both SYS_WIN64 and SYS_WIN32 syskind in QueryPathOfRegTypeLib on win64.

---

 dlls/oleaut32/tests/typelib.c |   26 +++++++++++++++-----------
 dlls/oleaut32/typelib.c       |    5 +++++
 2 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c
index 0c7e9ab..63b982b 100644
--- a/dlls/oleaut32/tests/typelib.c
+++ b/dlls/oleaut32/tests/typelib.c
@@ -692,10 +692,10 @@ cleanup:
     return ret;
 }
 
-static BOOL do_typelib_reg_key(GUID *uid, WORD maj, WORD min, LPCWSTR base, BOOL remove)
+static BOOL do_typelib_reg_key(GUID *uid, WORD maj, WORD min, DWORD arch, LPCWSTR base, BOOL remove)
 {
     static const WCHAR typelibW[] = {'T','y','p','e','l','i','b','\\',0};
-    static const WCHAR formatW[] = {'\\','%','u','.','%','u','\\','0','\\','w','i','n','3','2',0};
+    static const WCHAR formatW[] = {'\\','%','u','.','%','u','\\','0','\\','w','i','n','%','u',0};
     static const WCHAR format2W[] = {'%','s','_','%','u','_','%','u','.','d','l','l',0};
     WCHAR buf[128];
     HKEY hkey;
@@ -711,7 +711,7 @@ static BOOL do_typelib_reg_key(GUID *uid, WORD maj, WORD min, LPCWSTR base, BOOL
         return TRUE;
     }
 
-    wsprintfW(buf + lstrlenW(buf), formatW, maj, min );
+    wsprintfW(buf + lstrlenW(buf), formatW, maj, min, arch);
 
     SetLastError(0xdeadbeef);
     res = RegCreateKeyExW(HKEY_CLASSES_ROOT, buf, 0, NULL, 0,
@@ -724,7 +724,7 @@ static BOOL do_typelib_reg_key(GUID *uid, WORD maj, WORD min, LPCWSTR base, BOOL
 
     if (res != ERROR_SUCCESS)
     {
-        trace("RegCreateKeyExW failed\n");
+        trace("RegCreateKeyExW failed: %u\n", res);
         return FALSE;
     }
 
@@ -739,7 +739,7 @@ static BOOL do_typelib_reg_key(GUID *uid, WORD maj, WORD min, LPCWSTR base, BOOL
     return ret;
 }
 
-static void test_QueryPathOfRegTypeLib(void)
+static void test_QueryPathOfRegTypeLib(DWORD arch)
 {
     static const struct test_data
     {
@@ -760,6 +760,7 @@ static void test_QueryPathOfRegTypeLib(void)
         { 4, 0, TYPE_E_LIBNOTREGISTERED, { 0 } }
     };
     static const WCHAR base[] = {'f','a','k','e',0};
+    static const WCHAR wrongW[] = {'w','r','o','n','g',0};
     UINT i;
     RPC_STATUS status;
     GUID uid;
@@ -773,10 +774,11 @@ static void test_QueryPathOfRegTypeLib(void)
     StringFromGUID2(&uid, uid_str, 40);
     /*trace("GUID: %s\n", wine_dbgstr_w(uid_str));*/
 
-    if (!do_typelib_reg_key(&uid, 3, 0, base, 0)) return;
-    if (!do_typelib_reg_key(&uid, 3, 1, base, 0)) return;
-    if (!do_typelib_reg_key(&uid, 3, 37, base, 0)) return;
-    if (!do_typelib_reg_key(&uid, 5, 37, base, 0)) return;
+    if (!do_typelib_reg_key(&uid, 3, 0, arch, base, 0)) return;
+    if (!do_typelib_reg_key(&uid, 3, 1, arch, base, 0)) return;
+    if (!do_typelib_reg_key(&uid, 3, 37, arch, base, 0)) return;
+    if (!do_typelib_reg_key(&uid, 5, 37, arch, base, 0)) return;
+    if (arch == 64 && !do_typelib_reg_key(&uid, 5, 37, 32, wrongW, 0)) return;
 
     for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
     {
@@ -789,7 +791,7 @@ static void test_QueryPathOfRegTypeLib(void)
         }
     }
 
-    do_typelib_reg_key(&uid, 0, 0, NULL, 1);
+    do_typelib_reg_key(&uid, 0, 0, arch, NULL, 1);
 }
 
 static void test_inheritance(void)
@@ -2340,7 +2342,9 @@ START_TEST(typelib)
     test_TypeComp();
     test_CreateDispTypeInfo();
     test_TypeInfo();
-    test_QueryPathOfRegTypeLib();
+    test_QueryPathOfRegTypeLib(32);
+    if(sizeof(void*) == 8)
+        test_QueryPathOfRegTypeLib(64);
     test_inheritance();
     test_CreateTypeLib();
 
diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c
index 46c0d28..da0d43d 100644
--- a/dlls/oleaut32/typelib.c
+++ b/dlls/oleaut32/typelib.c
@@ -367,6 +367,11 @@ static HRESULT query_typelib_path( REFGUID guid, WORD wMaj, WORD wMin,
  */
 HRESULT WINAPI QueryPathOfRegTypeLib( REFGUID guid, WORD wMaj, WORD wMin, LCID lcid, LPBSTR path )
 {
+#ifdef _WIN64
+    HRESULT hres = query_typelib_path( guid, wMaj, wMin, SYS_WIN64, lcid, path );
+    if(SUCCEEDED(hres))
+        return hres;
+#endif
     return query_typelib_path( guid, wMaj, wMin, SYS_WIN32, lcid, path );
 }
 




More information about the wine-cvs mailing list