Commit 3b7c6420 authored by Porot Mo's avatar Porot Mo Committed by Alexandre Julliard

oleaut32/tests: Add tests for ITypeInfo::GetDllEntry().

parent e9eb274d
......@@ -163,4 +163,17 @@ library register_test
UINT32 field;
HRESULT hr;
};
[
uuid(f073cd92-a199-11ea-bb37-0242ac130002),
dllname("test.dll")
]
module TestGetDllEntry
{
[propget, entry(1)]
int test1([out] int *i);
[propput, entry(2)]
int test1([in] int i);
};
}
......@@ -831,18 +831,22 @@ static void test_TypeInfo(void)
static WCHAR wszBogus[] = { 'b','o','g','u','s',0 };
static WCHAR wszGetTypeInfo[] = { 'G','e','t','T','y','p','e','I','n','f','o',0 };
static WCHAR wszClone[] = {'C','l','o','n','e',0};
static WCHAR wszTestDll[] = {'t','e','s','t','.','d','l','l',0};
OLECHAR* bogus = wszBogus;
OLECHAR* pwszGetTypeInfo = wszGetTypeInfo;
OLECHAR* pwszClone = wszClone;
DISPID dispidMember;
DISPPARAMS dispparams;
GUID bogusguid = {0x806afb4f,0x13f7,0x42d2,{0x89,0x2c,0x6c,0x97,0xc3,0x6a,0x36,0xc1}};
static const GUID moduleTestGetDllEntryGuid = {0xf073cd92,0xa199,0x11ea,{0xbb,0x37,0x02,0x42,0xac,0x13,0x00,0x02}};
VARIANT var, res, args[2];
UINT count, i;
TYPEKIND kind;
const WCHAR *filename;
TYPEATTR *attr;
LONG l;
WORD ordinal;
BSTR bstrDllName, bstrName;
hr = LoadTypeLib(wszStdOle2, &pTypeLib);
ok_ole_success(hr, LoadTypeLib);
......@@ -1025,6 +1029,52 @@ static void test_TypeInfo(void)
hr = LoadTypeLib(filename, &pTypeLib);
ok(hr == S_OK, "got 0x%08x\n", hr);
/* test GetDllEntry */
hr = ITypeLib_GetTypeInfoOfGuid(pTypeLib, &moduleTestGetDllEntryGuid, &pTypeInfo);
ok_ole_success(hr, ITypeLib_GetTypeInfoOfGuid);
ok(pTypeInfo != NULL, "got NULL typeinfo\n");
/* wrong memberid -- wrong invkind */
hr = ITypeInfo_GetDllEntry(pTypeInfo, 0x6000000d, INVOKE_FUNC, &bstrDllName, &bstrName, &ordinal);
ok(hr == TYPE_E_ELEMENTNOTFOUND, "ITypeInfo_GetDllEntry should have returned TYPE_E_ELEMENTNOTFOUND instead of 0x%08x\n", hr);
hr = ITypeInfo_GetDllEntry(pTypeInfo, 0x6000000d, INVOKE_PROPERTYPUTREF, &bstrDllName, &bstrName, &ordinal);
ok(hr == TYPE_E_ELEMENTNOTFOUND, "ITypeInfo_GetDllEntry should have returned TYPE_E_ELEMENTNOTFOUND instead of 0x%08x\n", hr);
/* wrong memberid -- correct invkind */
hr = ITypeInfo_GetDllEntry(pTypeInfo, 0x6000000d, INVOKE_PROPERTYGET, &bstrDllName, &bstrName, &ordinal);
ok(hr == TYPE_E_ELEMENTNOTFOUND, "ITypeInfo_GetDllEntry should have returned TYPE_E_ELEMENTNOTFOUND instead of 0x%08x\n", hr);
hr = ITypeInfo_GetDllEntry(pTypeInfo, 0x6000000d, INVOKE_PROPERTYPUT, &bstrDllName, &bstrName, &ordinal);
ok(hr == TYPE_E_ELEMENTNOTFOUND, "ITypeInfo_GetDllEntry should have returned TYPE_E_ELEMENTNOTFOUND instead of 0x%08x\n", hr);
/* correct memberid -- wrong invkind */
hr = ITypeInfo_GetDllEntry(pTypeInfo, 0x60000000, INVOKE_FUNC, &bstrDllName, &bstrName, &ordinal);
todo_wine
ok(hr == TYPE_E_ELEMENTNOTFOUND, "ITypeInfo_GetDllEntry should have returned TYPE_E_ELEMENTNOTFOUND instead of 0x%08x\n", hr);
hr = ITypeInfo_GetDllEntry(pTypeInfo, 0x60000000, INVOKE_PROPERTYPUTREF, &bstrDllName, &bstrName, &ordinal);
todo_wine
ok(hr == TYPE_E_ELEMENTNOTFOUND, "ITypeInfo_GetDllEntry should have returned TYPE_E_ELEMENTNOTFOUND instead of 0x%08x\n", hr);
/* correct memberid -- correct invkind */
hr = ITypeInfo_GetDllEntry(pTypeInfo, 0x60000000, INVOKE_PROPERTYGET, &bstrDllName, &bstrName, &ordinal);
ok_ole_success(hr, ITypeInfo_GetDllEntry);
ok(!lstrcmpW(bstrDllName, wszTestDll), "got %s\n", wine_dbgstr_w(bstrDllName));
ok(bstrName == NULL, "got %s\n", wine_dbgstr_w(bstrName));
ok(ordinal == 1, "got ordinal: %04x\n", ordinal);
SysFreeString(bstrDllName);
hr = ITypeInfo_GetDllEntry(pTypeInfo, 0x60000000, INVOKE_PROPERTYPUT, &bstrDllName, &bstrName, &ordinal);
ok_ole_success(hr, ITypeInfo_GetDllEntry);
ok(!lstrcmpW(bstrDllName, wszTestDll), "got %s\n", wine_dbgstr_w(bstrDllName));
ok(bstrName == NULL, "got %s\n", wine_dbgstr_w(bstrName));
todo_wine
ok(ordinal == 2, "got ordinal: %04x\n", ordinal);
SysFreeString(bstrDllName);
ITypeInfo_Release(pTypeInfo);
hr = ITypeLib_GetTypeInfoOfGuid(pTypeLib, &IID_IInvokeTest, &pTypeInfo);
ok(hr == S_OK, "got 0x%08x\n", hr);
......@@ -5092,7 +5142,8 @@ static void test_register_typelib(BOOL system_registration)
{ TKIND_DISPATCH, TYPEFLAG_FDISPATCHABLE },
{ TKIND_INTERFACE, TYPEFLAG_FDISPATCHABLE },
{ TKIND_INTERFACE, TYPEFLAG_FDISPATCHABLE },
{ TKIND_RECORD, 0 }
{ TKIND_RECORD, 0 },
{ TKIND_MODULE, 0 },
};
trace("Starting %s typelib registration tests\n",
......@@ -5126,7 +5177,7 @@ static void test_register_typelib(BOOL system_registration)
ok(hr == S_OK, "got %08x\n", hr);
count = ITypeLib_GetTypeInfoCount(typelib);
ok(count == 14, "got %d\n", count);
ok(count == 15, "got %d\n", count);
for(i = 0; i < count; i++)
{
......
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