Piotr Caban : oleaut32: Return TYPE_E_NAMECONFLICT in ICreateTypeLib2:: CreateTypeInfo.

Alexandre Julliard julliard at winehq.org
Wed Feb 17 10:12:05 CST 2010


Module: wine
Branch: master
Commit: 1f2590be9be377bf130bbb25d5427c23669e90d4
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1f2590be9be377bf130bbb25d5427c23669e90d4

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Wed Feb 17 13:02:06 2010 +0100

oleaut32: Return TYPE_E_NAMECONFLICT in ICreateTypeLib2::CreateTypeInfo.

---

 dlls/oleaut32/tests/typelib.c |   10 ++++++++++
 dlls/oleaut32/typelib2.c      |    5 +++++
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c
index 843af08..ff85320 100644
--- a/dlls/oleaut32/tests/typelib.c
+++ b/dlls/oleaut32/tests/typelib.c
@@ -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);
diff --git a/dlls/oleaut32/typelib2.c b/dlls/oleaut32/typelib2.c
index 0f641d4..4c90f61 100644
--- a/dlls/oleaut32/typelib2.c
+++ b/dlls/oleaut32/typelib2.c
@@ -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;




More information about the wine-cvs mailing list