Commit 1f2590be authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

oleaut32: Return TYPE_E_NAMECONFLICT in ICreateTypeLib2::CreateTypeInfo.

parent 2c911147
......@@ -969,9 +969,12 @@ if(use_midl_tlb) {
}
static void test_CreateTypeLib(void) {
static OLECHAR interface1W[] = {'i','n','t','e','r','f','a','c','e','1',0};
char filename[MAX_PATH];
WCHAR filenameW[MAX_PATH];
ICreateTypeLib2 *createtl;
ICreateTypeInfo *createti;
ITypeLib *tl;
HRESULT hres;
......@@ -983,6 +986,13 @@ static void test_CreateTypeLib(void) {
hres = CreateTypeLib2(SYS_WIN32, filenameW, &createtl);
ok(hres == S_OK, "got %08x\n", hres);
hres = ICreateTypeLib_CreateTypeInfo(createtl, interface1W, TKIND_INTERFACE, &createti);
ok(hres == S_OK, "got %08x\n", hres);
ICreateTypeInfo_Release(createti);
hres = ICreateTypeLib_CreateTypeInfo(createtl, interface1W, TKIND_INTERFACE, &createti);
ok(hres == TYPE_E_NAMECONFLICT, "got %08x\n", hres);
hres = ICreateTypeLib2_SaveAllChanges(createtl);
ok(hres == S_OK, "got %08x\n", hres);
ICreateTypeLib2_Release(createtl);
......
......@@ -3073,9 +3073,14 @@ static HRESULT WINAPI ICreateTypeLib2_fnCreateTypeInfo(
ICreateTypeInfo **ppCTInfo)
{
ICreateTypeLib2Impl *This = (ICreateTypeLib2Impl *)iface;
char *name;
TRACE("(%p,%s,%d,%p)\n", iface, debugstr_w(szName), tkind, ppCTInfo);
ctl2_encode_name(This, szName, &name);
if(ctl2_find_name(This, name) != -1)
return TYPE_E_NAMECONFLICT;
*ppCTInfo = (ICreateTypeInfo *)ICreateTypeInfo2_Constructor(This, szName, tkind);
if (!*ppCTInfo) return E_OUTOFMEMORY;
......
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