Commit 2c911147 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

oleaut32: Fix crash in LoadTypeLib if typelib name is not specified.

parent 16785efc
......@@ -968,6 +968,33 @@ if(use_midl_tlb) {
return;
}
static void test_CreateTypeLib(void) {
char filename[MAX_PATH];
WCHAR filenameW[MAX_PATH];
ICreateTypeLib2 *createtl;
ITypeLib *tl;
HRESULT hres;
trace("CreateTypeLib tests\n");
GetTempFileNameA(".", "tlb", 0, filename);
MultiByteToWideChar(CP_ACP, 0, filename, -1, filenameW, MAX_PATH);
hres = CreateTypeLib2(SYS_WIN32, filenameW, &createtl);
ok(hres == S_OK, "got %08x\n", hres);
hres = ICreateTypeLib2_SaveAllChanges(createtl);
ok(hres == S_OK, "got %08x\n", hres);
ICreateTypeLib2_Release(createtl);
hres = LoadTypeLib(filenameW, &tl);
ok(hres == S_OK, "got %08x\n", hres);
ITypeLib_Release(tl);
DeleteFileA(filename);
}
#if 0 /* use this to generate more tests */
#define OLE_CHECK(x) { HRESULT hr = x; if (FAILED(hr)) { printf(#x "failed - %x\n", hr); return; } }
......@@ -1480,6 +1507,7 @@ START_TEST(typelib)
test_TypeInfo();
test_QueryPathOfRegTypeLib();
test_inheritance();
test_CreateTypeLib();
if ((filename = create_test_typelib()))
{
......
......@@ -552,7 +552,9 @@ HRESULT WINAPI RegisterTypeLib(
LPOLESTR doc;
/* Set the human-readable name of the typelib */
if (SUCCEEDED(ITypeLib_GetDocumentation(ptlib, -1, NULL, &doc, NULL, NULL)))
if (FAILED(ITypeLib_GetDocumentation(ptlib, -1, NULL, &doc, NULL, NULL)))
res = E_FAIL;
else if (doc)
{
if (RegSetValueExW(key, NULL, 0, REG_SZ,
(BYTE *)doc, (lstrlenW(doc)+1) * sizeof(OLECHAR)) != ERROR_SUCCESS)
......@@ -560,8 +562,6 @@ HRESULT WINAPI RegisterTypeLib(
SysFreeString(doc);
}
else
res = E_FAIL;
/* Make up the name of the typelib path subkey */
if (!get_lcid_subkey( attr->lcid, attr->syskind, tmp )) res = E_FAIL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment