Module: wine Branch: master Commit: 066060a520958fc64bf903cc7109f4f25519ebaa URL: http://source.winehq.org/git/wine.git/?a=commit;h=066060a520958fc64bf903cc71...
Author: Alexandre Julliard julliard@winehq.org Date: Wed Jun 3 16:48:48 2009 +0200
rpcrt4/tests: Add tests for the contents of virtual table for delegated proxies.
---
dlls/rpcrt4/tests/cstub.c | 76 ++++++++++++++++++++++++++++++++++++++------ 1 files changed, 65 insertions(+), 11 deletions(-)
diff --git a/dlls/rpcrt4/tests/cstub.c b/dlls/rpcrt4/tests/cstub.c index 4ef70c2..e3edee7 100644 --- a/dlls/rpcrt4/tests/cstub.c +++ b/dlls/rpcrt4/tests/cstub.c @@ -259,13 +259,14 @@ static CInterfaceStubVtbl if2_stub_vtbl = { CStdStubBuffer_DELEGATING_METHODS } };
-static CINTERFACE_PROXY_VTABLE(4) if3_proxy_vtbl = +static CINTERFACE_PROXY_VTABLE(5) if3_proxy_vtbl = { { &IID_if3 }, { IUnknown_QueryInterface_Proxy, IUnknown_AddRef_Proxy, IUnknown_Release_Proxy , - if1_fn1_Proxy + if1_fn1_Proxy, + 0 } };
@@ -298,7 +299,7 @@ static CInterfaceStubVtbl if3_stub_vtbl = { &IID_if3, &if3_server_info, - 4, + 5, &if1_table[-3] }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } @@ -430,9 +431,14 @@ static const ProxyFileInfo *proxy_file_list[] = {
static IPSFactoryBuffer *test_NdrDllGetClassObject(void) { + HMODULE rpcrt4 = GetModuleHandleA("rpcrt4.dll"); IPSFactoryBuffer *ppsf = NULL; + const PCInterfaceProxyVtblList* proxy_vtbl; + const PCInterfaceStubVtblList* stub_vtbl; const CLSID PSDispatch = {0x20420, 0, 0, {0xc0, 0, 0, 0, 0, 0, 0, 0x46}}; const CLSID CLSID_Unknown = {0x45678, 0x1234, 0x6666, {0xff, 0x67, 0x45, 0x98, 0x76, 0x12, 0x34, 0x56}}; + static const GUID * const interfaces[] = { &IID_if1, &IID_if2, &IID_if3, &IID_if4 }; + UINT i; HRESULT r; HMODULE hmod = GetModuleHandleA("rpcrt4.dll"); void *CStd_QueryInterface = GetProcAddress(hmod, "CStdStubBuffer_QueryInterface"); @@ -457,22 +463,26 @@ static IPSFactoryBuffer *test_NdrDllGetClassObject(void) ok(r == S_OK, "ret %08x\n", r); ok(ppsf != NULL, "ppsf == NULL\n");
+ proxy_vtbl = PSFactoryBuffer.pProxyFileList[0]->pProxyVtblList; + stub_vtbl = PSFactoryBuffer.pProxyFileList[0]->pStubVtblList; ok(PSFactoryBuffer.pProxyFileList == proxy_file_list, "pfl not the same\n"); - ok(PSFactoryBuffer.pProxyFileList[0]->pStubVtblList == (PCInterfaceStubVtblList *) &cstub_StubVtblList, "stub vtbllist not the same\n"); + ok(proxy_vtbl == (PCInterfaceProxyVtblList *) &cstub_ProxyVtblList, "proxy vtbllist not the same\n"); + ok(stub_vtbl == (PCInterfaceStubVtblList *) &cstub_StubVtblList, "stub vtbllist not the same\n");
/* if1 is non-delegating, if2 is delegating, if3 is non-delegating but I've zero'ed the vtbl entries, similarly if4 is delegating with zero'ed vtbl entries */
#define VTBL_TEST_NOT_CHANGE_TO(name, i) \ - ok(PSFactoryBuffer.pProxyFileList[0]->pStubVtblList[i]->Vtbl.name != CStd_##name, #name "vtbl %d updated %p %p\n", \ - i, PSFactoryBuffer.pProxyFileList[0]->pStubVtblList[i]->Vtbl.name, CStd_##name ); + ok(stub_vtbl[i]->Vtbl.name != CStd_##name, #name "vtbl %d updated %p %p\n", \ + i, stub_vtbl[i]->Vtbl.name, CStd_##name ) #define VTBL_TEST_CHANGE_TO(name, i) \ - ok(PSFactoryBuffer.pProxyFileList[0]->pStubVtblList[i]->Vtbl.name == CStd_##name, #name "vtbl %d not updated %p %p\n", \ - i, PSFactoryBuffer.pProxyFileList[0]->pStubVtblList[i]->Vtbl.name, CStd_##name ); + ok(stub_vtbl[i]->Vtbl.name == CStd_##name, #name "vtbl %d not updated %p %p\n", \ + i, stub_vtbl[i]->Vtbl.name, CStd_##name ) #define VTBL_TEST_ZERO(name, i) \ - ok(PSFactoryBuffer.pProxyFileList[0]->pStubVtblList[i]->Vtbl.name == NULL, #name "vtbl %d not null %p\n", \ - i, PSFactoryBuffer.pProxyFileList[0]->pStubVtblList[i]->Vtbl.name ); + ok(stub_vtbl[i]->Vtbl.name == NULL, #name "vtbl %d not null %p\n", \ + i, stub_vtbl[i]->Vtbl.name ) + VTBL_TEST_NOT_CHANGE_TO(QueryInterface, 0); VTBL_TEST_NOT_CHANGE_TO(AddRef, 0); VTBL_TEST_NOT_CHANGE_TO(Release, 0); @@ -517,11 +527,55 @@ static IPSFactoryBuffer *test_NdrDllGetClassObject(void) VTBL_TEST_CHANGE_TO(DebugServerQueryInterface, 3); VTBL_TEST_CHANGE_TO(DebugServerRelease, 3);
- +#define VTBL_PROXY_TEST(i,num,ptr) \ + ok( proxy_vtbl[i]->Vtbl[num] == (ptr), "wrong proxy %u func %u %p/%p\n", \ + (i), (num), proxy_vtbl[i]->Vtbl[num], (ptr) ) +#define VTBL_PROXY_TEST_NOT_ZERO(i,num) \ + ok( proxy_vtbl[i]->Vtbl[num] != NULL, "wrong proxy %u func %u is NULL\n", (i), (num)) + + VTBL_PROXY_TEST(0, 0, IUnknown_QueryInterface_Proxy); + VTBL_PROXY_TEST(0, 1, IUnknown_AddRef_Proxy); + VTBL_PROXY_TEST(0, 2, IUnknown_Release_Proxy); + VTBL_PROXY_TEST(0, 3, if1_fn1_Proxy); + VTBL_PROXY_TEST(0, 4, if1_fn2_Proxy); + + VTBL_PROXY_TEST(1, 0, GetProcAddress(rpcrt4,"IUnknown_QueryInterface_Proxy")); + VTBL_PROXY_TEST(1, 1, GetProcAddress(rpcrt4,"IUnknown_AddRef_Proxy")); + VTBL_PROXY_TEST(1, 2, GetProcAddress(rpcrt4,"IUnknown_Release_Proxy")); + VTBL_PROXY_TEST_NOT_ZERO(1, 3); + VTBL_PROXY_TEST_NOT_ZERO(1, 4); + VTBL_PROXY_TEST_NOT_ZERO(1, 5); + VTBL_PROXY_TEST_NOT_ZERO(1, 6); + VTBL_PROXY_TEST_NOT_ZERO(1, 7); + VTBL_PROXY_TEST_NOT_ZERO(1, 8); + VTBL_PROXY_TEST_NOT_ZERO(1, 9); + VTBL_PROXY_TEST_NOT_ZERO(1, 10); + VTBL_PROXY_TEST_NOT_ZERO(1, 11); + VTBL_PROXY_TEST_NOT_ZERO(1, 12); + + VTBL_PROXY_TEST(2, 0, IUnknown_QueryInterface_Proxy); + VTBL_PROXY_TEST(2, 1, IUnknown_AddRef_Proxy); + VTBL_PROXY_TEST(2, 2, IUnknown_Release_Proxy); + VTBL_PROXY_TEST(2, 3, if1_fn1_Proxy); + todo_wine VTBL_PROXY_TEST_NOT_ZERO(2, 4); + + VTBL_PROXY_TEST(3, 0, GetProcAddress(rpcrt4,"IUnknown_QueryInterface_Proxy")); + VTBL_PROXY_TEST(3, 1, GetProcAddress(rpcrt4,"IUnknown_AddRef_Proxy")); + VTBL_PROXY_TEST(3, 2, GetProcAddress(rpcrt4,"IUnknown_Release_Proxy")); + VTBL_PROXY_TEST_NOT_ZERO(3, 3); + VTBL_PROXY_TEST_NOT_ZERO(3, 4); + VTBL_PROXY_TEST_NOT_ZERO(3, 5); + VTBL_PROXY_TEST_NOT_ZERO(3, 6);
#undef VTBL_TEST_NOT_CHANGE_TO #undef VTBL_TEST_CHANGE_TO #undef VTBL_TEST_ZERO +#undef VTBL_PROXY_TEST +#undef VTBL_PROXY_TEST_NOT_ZERO + + for (i = 0; i < sizeof(interfaces)/sizeof(interfaces[0]); i++) + ok( proxy_vtbl[i]->header.piid == interfaces[i], + "wrong proxy %u iid %p/%p\n", i, proxy_vtbl[i]->header.piid, interfaces[i] );
ok(PSFactoryBuffer.RefCount == 1, "ref count %d\n", PSFactoryBuffer.RefCount); IPSFactoryBuffer_Release(ppsf);