From f72f8e5c4036ed3344ef9aa5df8f000b1634c664 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sun, 10 Feb 2019 21:20:35 -0600 Subject: [PATCH] oleaut32: Register non-dual dispinterfaces using the correct proxy. Fixes a bug where NetLinx Studio 4 would fail to compile files. Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- dlls/oleaut32/tests/typelib.c | 22 +++++++++++++++++++++- dlls/oleaut32/typelib.c | 20 +++++++++++++++----- 2 files changed, 36 insertions(+), 6 deletions(-) diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c index 90f0cb256e5..857100e884d 100644 --- a/dlls/oleaut32/tests/typelib.c +++ b/dlls/oleaut32/tests/typelib.c @@ -4963,6 +4963,7 @@ static void test_register_typelib(BOOL system_registration) HKEY hkey; REGSAM opposite = (sizeof(void*) == 8 ? KEY_WOW64_32KEY : KEY_WOW64_64KEY); BOOL is_wow64 = FALSE; + LONG size; struct { TYPEKIND kind; @@ -5071,7 +5072,26 @@ static void test_register_typelib(BOOL system_registration) ret = RegOpenKeyExA(HKEY_CLASSES_ROOT, key_name, 0, KEY_READ, &hkey); ok(ret == expect_ret, "%d: got %d\n", i, ret); - if(ret == ERROR_SUCCESS) RegCloseKey(hkey); + if (ret == ERROR_SUCCESS) + { + size = sizeof(uuid); + ret = RegQueryValueA(hkey, "ProxyStubClsid32", uuid, &size); + ok(!ret, "Failed to get proxy GUID, error %u.\n", ret); + + if (attrs[i].kind == TKIND_INTERFACE || (attrs[i].flags & TYPEFLAG_FDUAL)) + { + ok(!strcasecmp(uuid, "{00020424-0000-0000-c000-000000000046}"), + "Got unexpected proxy CLSID %s.\n", uuid); + } + else + { + ok(!strcasecmp(uuid, "{00020420-0000-0000-c000-000000000046}"), + "Got unexpected proxy CLSID %s.\n", uuid); + } + + RegCloseKey(hkey); + } + /* 32-bit typelibs should be registered into both registry bit modes */ if (is_win64 || is_wow64) diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c index f17a9267b7b..acd4d07c89e 100644 --- a/dlls/oleaut32/typelib.c +++ b/dlls/oleaut32/typelib.c @@ -578,14 +578,24 @@ static void TLB_register_interface(TLIBATTR *libattr, LPOLESTR name, TYPEATTR *t WCHAR keyName[60]; HKEY key, subKey; - static const WCHAR PSOA[] = {'{','0','0','0','2','0','4','2','4','-', - '0','0','0','0','-','0','0','0','0','-','C','0','0','0','-', - '0','0','0','0','0','0','0','0','0','0','4','6','}',0}; + static const WCHAR typelib_proxy_clsid[] = {'{','0','0','0','2','0','4','2','4','-', + '0','0','0','0','-','0','0','0','0','-','C','0','0','0','-', + '0','0','0','0','0','0','0','0','0','0','4','6','}',0}; + static const WCHAR dispatch_proxy_clsid[] = {'{','0','0','0','2','0','4','2','0','-', + '0','0','0','0','-','0','0','0','0','-','C','0','0','0','-', + '0','0','0','0','0','0','0','0','0','0','4','6','}',0}; get_interface_key( &tattr->guid, keyName ); if (RegCreateKeyExW(HKEY_CLASSES_ROOT, keyName, 0, NULL, 0, KEY_WRITE | flag, NULL, &key, NULL) == ERROR_SUCCESS) { + const WCHAR *proxy_clsid; + + if (tattr->typekind == TKIND_INTERFACE || (tattr->wTypeFlags & TYPEFLAG_FDUAL)) + proxy_clsid = typelib_proxy_clsid; + else + proxy_clsid = dispatch_proxy_clsid; + if (name) RegSetValueExW(key, NULL, 0, REG_SZ, (BYTE *)name, (strlenW(name)+1) * sizeof(OLECHAR)); @@ -593,14 +603,14 @@ static void TLB_register_interface(TLIBATTR *libattr, LPOLESTR name, TYPEATTR *t if (RegCreateKeyExW(key, ProxyStubClsidW, 0, NULL, 0, KEY_WRITE | flag, NULL, &subKey, NULL) == ERROR_SUCCESS) { RegSetValueExW(subKey, NULL, 0, REG_SZ, - (const BYTE *)PSOA, sizeof PSOA); + (const BYTE *)proxy_clsid, sizeof(typelib_proxy_clsid)); RegCloseKey(subKey); } if (RegCreateKeyExW(key, ProxyStubClsid32W, 0, NULL, 0, KEY_WRITE | flag, NULL, &subKey, NULL) == ERROR_SUCCESS) { RegSetValueExW(subKey, NULL, 0, REG_SZ, - (const BYTE *)PSOA, sizeof PSOA); + (const BYTE *)proxy_clsid, sizeof(typelib_proxy_clsid)); RegCloseKey(subKey); }