Akihiro Sagawa : oleaut32: Use the alternate interface key if not present on current view.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Jul 15 15:52:44 CDT 2014


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

Author: Akihiro Sagawa <sagawa.aki at gmail.com>
Date:   Tue Jul 15 19:34:46 2014 +0900

oleaut32: Use the alternate interface key if not present on current view.

---

 dlls/oleaut32/tests/typelib.c |  6 +-----
 dlls/oleaut32/tmarshal.c      | 15 +++++++++++----
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c
index eb0c6e6..49057a4 100644
--- a/dlls/oleaut32/tests/typelib.c
+++ b/dlls/oleaut32/tests/typelib.c
@@ -5493,11 +5493,7 @@ static void test_stub(void)
         ok(hr == S_OK, "got: %x, side: %04x\n", hr, side);
 
         hr = IPSFactoryBuffer_CreateStub(factory, &interfaceguid, &uk, &base_stub);
-        if ((is_win64 && side == KEY_WOW64_32KEY)
-            || (is_wow64 && side == KEY_WOW64_64KEY))
-            todo_wine ok(hr == S_OK, "got: %x, side: %04x\n", hr, side);
-        else
-            ok(hr == S_OK, "got: %x, side: %04x\n", hr, side);
+        ok(hr == S_OK, "got: %x, side: %04x\n", hr, side);
 
         IPSFactoryBuffer_Release(factory);
     next:
diff --git a/dlls/oleaut32/tmarshal.c b/dlls/oleaut32/tmarshal.c
index ee2a95b..b812215 100644
--- a/dlls/oleaut32/tmarshal.c
+++ b/dlls/oleaut32/tmarshal.c
@@ -270,11 +270,13 @@ static HRESULT
 _get_typeinfo_for_iid(REFIID riid, ITypeInfo**ti) {
     HRESULT	hres;
     HKEY	ikey;
+    REGSAM	opposite = (sizeof(void*) == 8) ? KEY_WOW64_32KEY : KEY_WOW64_64KEY;
+    BOOL	is_wow64;
     char	tlguid[200],typelibkey[300],interfacekey[300],ver[100];
     char	tlfn[260];
     OLECHAR	tlfnW[260];
     DWORD	tlguidlen, verlen, type;
-    LONG	tlfnlen;
+    LONG	tlfnlen, err;
     ITypeLib	*tl;
 
     sprintf( interfacekey, "Interface\\{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\\Typelib",
@@ -283,9 +285,14 @@ _get_typeinfo_for_iid(REFIID riid, ITypeInfo**ti) {
 	riid->Data4[4], riid->Data4[5], riid->Data4[6], riid->Data4[7]
     );
 
-    if (RegOpenKeyA(HKEY_CLASSES_ROOT,interfacekey,&ikey)) {
-	ERR("No %s key found.\n",interfacekey);
-       	return E_FAIL;
+    err = RegOpenKeyExA(HKEY_CLASSES_ROOT,interfacekey,0,KEY_READ,&ikey);
+    if (err && (opposite == KEY_WOW64_32KEY || (IsWow64Process(GetCurrentProcess(), &is_wow64)
+                                                && is_wow64))) {
+        err = RegOpenKeyExA(HKEY_CLASSES_ROOT,interfacekey,0,KEY_READ|opposite,&ikey);
+    }
+    if (err) {
+        ERR("No %s key found.\n",interfacekey);
+        return E_FAIL;
     }
     tlguidlen = sizeof(tlguid);
     if (RegQueryValueExA(ikey,NULL,NULL,&type,(LPBYTE)tlguid,&tlguidlen)) {




More information about the wine-cvs mailing list