mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-14 20:53:35 +00:00
oleaut32: Register a typelib's name if a documentation is not available.
Windows writes a typelib's name into the registry when the typelib doesn't provide a documentation. Signed-off-by: Bernhard Kölbl <besentv@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
c159f5438a
commit
fdc2d415b0
|
@ -6850,6 +6850,7 @@ static void test_register_typelib(BOOL system_registration)
|
|||
|
||||
static void test_register_typelib_64(void)
|
||||
{
|
||||
REGSAM opposite = (sizeof(void*) == 8 ? KEY_WOW64_32KEY : KEY_WOW64_64KEY);
|
||||
ICreateTypeInfo *createti, *createti_co;
|
||||
ELEMDESC elemdesc[5], elemdesc2[5];
|
||||
FUNCDESC funcdesc, funcdesc2;
|
||||
|
@ -6857,6 +6858,7 @@ static void test_register_typelib_64(void)
|
|||
ITypeLib *stdole, *typelib;
|
||||
ICreateTypeLib2 *createtl;
|
||||
WCHAR filename[MAX_PATH];
|
||||
BOOL is_wow64 = FALSE;
|
||||
HREFTYPE hreftype;
|
||||
HRESULT hr;
|
||||
|
||||
|
@ -6879,6 +6881,9 @@ static void test_register_typelib_64(void)
|
|||
|
||||
static const SYSKIND sys = SYS_WIN64;
|
||||
|
||||
if (pIsWow64Process)
|
||||
pIsWow64Process(GetCurrentProcess(), &is_wow64);
|
||||
|
||||
hr = LoadTypeLib(wszStdOle2, &stdole);
|
||||
ok(hr == S_OK, "got %08x\n", hr);
|
||||
|
||||
|
@ -7011,6 +7016,11 @@ static void test_register_typelib_64(void)
|
|||
|
||||
if(typelib)
|
||||
{
|
||||
WCHAR key_name[MAX_PATH], uuid[40];
|
||||
OLECHAR tlb_name[16];
|
||||
HKEY hkey;
|
||||
LONG size;
|
||||
|
||||
hr = RegisterTypeLib(typelib, filename, NULL);
|
||||
if (hr == TYPE_E_REGISTRYACCESS)
|
||||
{
|
||||
|
@ -7022,6 +7032,35 @@ static void test_register_typelib_64(void)
|
|||
ok(hr == S_OK, "got: %08x\n", hr);
|
||||
|
||||
ITypeLib_Release(typelib);
|
||||
|
||||
StringFromGUID2(&tlcustguid, uuid, ARRAY_SIZE(uuid));
|
||||
swprintf(key_name, sizeof(key_name), L"TypeLib\\%ls\\1.0", uuid);
|
||||
|
||||
hr = RegOpenKeyExW(HKEY_CLASSES_ROOT, key_name, 0, KEY_READ, &hkey);
|
||||
ok(hr == S_OK, "got %08x\n", hr);
|
||||
|
||||
size = sizeof(tlb_name);
|
||||
hr = RegQueryValueW(hkey, L"", tlb_name, &size);
|
||||
ok(hr == S_OK, "got %08x\n", hr);
|
||||
|
||||
/* The typelib should be registered in WoW64_32 and WoW64_64 mode */
|
||||
if(is_win64 || is_wow64)
|
||||
{
|
||||
hr = RegOpenKeyExW(HKEY_CLASSES_ROOT, key_name, 0, KEY_READ | opposite, &hkey);
|
||||
ok(hr == S_OK, "got %08x\n", hr);
|
||||
|
||||
if(hkey)
|
||||
{
|
||||
size = sizeof(tlb_name);
|
||||
hr = RegQueryValueW(hkey, L"", tlb_name, &size);
|
||||
ok(hr == S_OK, "got %08x\n", hr);
|
||||
|
||||
RegCloseKey(hkey);
|
||||
}
|
||||
}
|
||||
|
||||
ok(!wcscmp(tlb_name, typelibW),
|
||||
"Got unexpected TypLib description: %ls\n", tlb_name);
|
||||
}
|
||||
|
||||
DeleteFileW(filename);
|
||||
|
|
|
@ -636,17 +636,22 @@ HRESULT WINAPI RegisterTypeLib(ITypeLib *ptlib, const WCHAR *szFullPath, const W
|
|||
KEY_WRITE, NULL, &key, NULL) == ERROR_SUCCESS)
|
||||
{
|
||||
LPOLESTR doc;
|
||||
LPOLESTR libName;
|
||||
|
||||
/* Set the human-readable name of the typelib */
|
||||
if (FAILED(ITypeLib_GetDocumentation(ptlib, -1, NULL, &doc, NULL, NULL)))
|
||||
/* Set the human-readable name of the typelib to
|
||||
the typelib's doc, if it exists, else to the typelib's name. */
|
||||
if (FAILED(ITypeLib_GetDocumentation(ptlib, -1, &libName, &doc, NULL, NULL)))
|
||||
res = E_FAIL;
|
||||
else if (doc)
|
||||
else if (doc || libName)
|
||||
{
|
||||
WCHAR *name = doc ? doc : libName;
|
||||
|
||||
if (RegSetValueExW(key, NULL, 0, REG_SZ,
|
||||
(BYTE *)doc, (lstrlenW(doc)+1) * sizeof(OLECHAR)) != ERROR_SUCCESS)
|
||||
(BYTE *)name, (lstrlenW(name)+1) * sizeof(OLECHAR)) != ERROR_SUCCESS)
|
||||
res = E_FAIL;
|
||||
|
||||
SysFreeString(doc);
|
||||
SysFreeString(libName);
|
||||
}
|
||||
|
||||
/* Make up the name of the typelib path subkey */
|
||||
|
|
Loading…
Reference in a new issue