oleaut32: Also register typelibs in the opposite registry mode.

This commit is contained in:
Andrew Eikum 2013-10-16 08:21:10 -05:00 committed by Alexandre Julliard
parent 49b98891e5
commit fbffa8935e
2 changed files with 65 additions and 42 deletions

View File

@ -4084,6 +4084,7 @@ static void test_register_typelib(BOOL system_registration)
{
ITypeInfo *typeinfo;
TYPEATTR *attr;
REGSAM opposite = (sizeof(void*) == 8 ? KEY_WOW64_32KEY : KEY_WOW64_64KEY);
hr = ITypeLib_GetTypeInfo(typelib, i, &typeinfo);
ok(hr == S_OK, "got %08x\n", hr);
@ -4133,6 +4134,11 @@ static void test_register_typelib(BOOL system_registration)
ok(ret == expect_ret, "%d: got %d\n", i, ret);
if(ret == ERROR_SUCCESS) RegCloseKey(hkey);
/* 32-bit typelibs should be registered into both registry bit modes */
ret = RegOpenKeyExA(HKEY_CLASSES_ROOT, key_name, 0, KEY_READ | opposite, &hkey);
ok(ret == expect_ret, "%d: got %d\n", i, ret);
if(ret == ERROR_SUCCESS) RegCloseKey(hkey);
ITypeInfo_ReleaseTypeAttr(typeinfo, attr);
ITypeInfo_Release(typeinfo);
}

View File

@ -565,6 +565,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
@ -583,9 +634,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];
@ -758,47 +806,16 @@ HRESULT WINAPI RegisterTypeLib(
if ((kind == TKIND_INTERFACE && (tattr->wTypeFlags & TYPEFLAG_FOLEAUTOMATION)) ||
kind == TKIND_DISPATCH)
{
BOOL is_wow64;
DWORD opposite = (sizeof(void*) == 8 ? KEY_WOW64_32KEY : KEY_WOW64_64KEY);
/* 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));
TLB_register_interface(attr, name, tattr, 0);
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);
}
/* 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);