Andrew Eikum : oleaut32: Also register typelibs in the opposite registry mode.
Alexandre Julliard
julliard at winehq.org
Fri Jan 10 14:44:52 CST 2014
Module: wine
Branch: stable
Commit: b3f73b46b3c559d77251cc3f96e3b2da69d0f68e
URL: http://source.winehq.org/git/wine.git/?a=commit;h=b3f73b46b3c559d77251cc3f96e3b2da69d0f68e
Author: Andrew Eikum <aeikum at codeweavers.com>
Date: Wed Oct 16 08:21:10 2013 -0500
oleaut32: Also register typelibs in the opposite registry mode.
(cherry picked from commit fbffa8935e8c2c392418e6d91fa5424fc157a25b)
---
dlls/oleaut32/typelib.c | 105 +++++++++++++++++++++++++++--------------------
1 file changed, 61 insertions(+), 44 deletions(-)
diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c
index 73f2ec4..18522a0 100644
--- a/dlls/oleaut32/typelib.c
+++ b/dlls/oleaut32/typelib.c
@@ -511,6 +511,57 @@ static const WCHAR HELPDIRW[] = {'H','E','L','P','D','I','R',0};
static const WCHAR ProxyStubClsidW[] = {'P','r','o','x','y','S','t','u','b','C','l','s','i','d',0};
static const WCHAR ProxyStubClsid32W[] = {'P','r','o','x','y','S','t','u','b','C','l','s','i','d','3','2',0};
+static void TLB_register_interface(TLIBATTR *libattr, LPOLESTR name, TYPEATTR *tattr, DWORD flag)
+{
+ 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};
+
+ get_interface_key( &tattr->guid, keyName );
+ if (RegCreateKeyExW(HKEY_CLASSES_ROOT, keyName, 0, NULL, 0,
+ KEY_WRITE | flag, NULL, &key, NULL) == ERROR_SUCCESS)
+ {
+ if (name)
+ RegSetValueExW(key, NULL, 0, REG_SZ,
+ (BYTE *)name, (strlenW(name)+1) * sizeof(OLECHAR));
+
+ 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);
+ 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);
+ RegCloseKey(subKey);
+ }
+
+ if (RegCreateKeyExW(key, TypeLibW, 0, NULL, 0,
+ KEY_WRITE | flag, NULL, &subKey, NULL) == ERROR_SUCCESS)
+ {
+ WCHAR buffer[40];
+ static const WCHAR fmtver[] = {'%','x','.','%','x',0 };
+ static const WCHAR VersionW[] = {'V','e','r','s','i','o','n',0};
+
+ StringFromGUID2(&libattr->guid, buffer, 40);
+ RegSetValueExW(subKey, NULL, 0, REG_SZ,
+ (BYTE *)buffer, (strlenW(buffer)+1) * sizeof(WCHAR));
+ sprintfW(buffer, fmtver, libattr->wMajorVerNum, libattr->wMinorVerNum);
+ RegSetValueExW(subKey, VersionW, 0, REG_SZ,
+ (BYTE*)buffer, (strlenW(buffer)+1) * sizeof(WCHAR));
+ RegCloseKey(subKey);
+ }
+
+ RegCloseKey(key);
+ }
+}
+
/******************************************************************************
* RegisterTypeLib [OLEAUT32.163]
* Adds information about a type library to the System Registry
@@ -529,9 +580,6 @@ HRESULT WINAPI RegisterTypeLib(
OLECHAR * szHelpDir) /* [in] dir to the helpfile for the library,
may be NULL*/
{
- 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};
HRESULT res;
TLIBATTR *attr;
WCHAR keyName[60];
@@ -706,47 +754,16 @@ HRESULT WINAPI RegisterTypeLib(
if ((kind == TKIND_INTERFACE && (tattr->wTypeFlags & TYPEFLAG_FOLEAUTOMATION)) ||
kind == TKIND_DISPATCH)
{
- /* register interface<->typelib coupling */
- get_interface_key( &tattr->guid, keyName );
- if (RegCreateKeyExW(HKEY_CLASSES_ROOT, keyName, 0, NULL, 0,
- KEY_WRITE, NULL, &key, NULL) == ERROR_SUCCESS)
- {
- if (name)
- RegSetValueExW(key, NULL, 0, REG_SZ,
- (BYTE *)name, (strlenW(name)+1) * sizeof(OLECHAR));
-
- if (RegCreateKeyExW(key, ProxyStubClsidW, 0, NULL, 0,
- KEY_WRITE, NULL, &subKey, NULL) == ERROR_SUCCESS) {
- RegSetValueExW(subKey, NULL, 0, REG_SZ,
- (const BYTE *)PSOA, sizeof PSOA);
- RegCloseKey(subKey);
- }
-
- if (RegCreateKeyExW(key, ProxyStubClsid32W, 0, NULL, 0,
- KEY_WRITE, NULL, &subKey, NULL) == ERROR_SUCCESS) {
- RegSetValueExW(subKey, NULL, 0, REG_SZ,
- (const BYTE *)PSOA, sizeof PSOA);
- RegCloseKey(subKey);
- }
-
- if (RegCreateKeyExW(key, TypeLibW, 0, NULL, 0,
- KEY_WRITE, NULL, &subKey, NULL) == ERROR_SUCCESS)
- {
- WCHAR buffer[40];
- static const WCHAR fmtver[] = {'%','x','.','%','x',0 };
- static const WCHAR VersionW[] = {'V','e','r','s','i','o','n',0};
-
- StringFromGUID2(&attr->guid, buffer, 40);
- RegSetValueExW(subKey, NULL, 0, REG_SZ,
- (BYTE *)buffer, (strlenW(buffer)+1) * sizeof(WCHAR));
- sprintfW(buffer, fmtver, attr->wMajorVerNum, attr->wMinorVerNum);
- RegSetValueExW(subKey, VersionW, 0, REG_SZ,
- (BYTE*)buffer, (strlenW(buffer)+1) * sizeof(WCHAR));
- RegCloseKey(subKey);
- }
-
- RegCloseKey(key);
- }
+ BOOL is_wow64;
+ DWORD opposite = (sizeof(void*) == 8 ? KEY_WOW64_32KEY : KEY_WOW64_64KEY);
+
+ /* register interface<->typelib coupling */
+ TLB_register_interface(attr, name, tattr, 0);
+
+ /* register TLBs into the opposite registry view, too */
+ if(opposite == KEY_WOW64_32KEY ||
+ (IsWow64Process(GetCurrentProcess(), &is_wow64) && is_wow64))
+ TLB_register_interface(attr, name, tattr, opposite);
}
ITypeInfo_ReleaseTypeAttr(tinfo, tattr);
More information about the wine-cvs
mailing list