[PATCH 2/2] ole32/tests: Update tests to the new channel hook info structure.
Huw Davies
huw at codeweavers.com
Fri Sep 2 05:32:02 CDT 2016
Also add tests for method number and causality.
Signed-off-by: Huw Davies <huw at codeweavers.com>
---
dlls/ole32/tests/marshal.c | 143 +++++++++++++++++++++++++++++++++++++++------
1 file changed, 126 insertions(+), 17 deletions(-)
diff --git a/dlls/ole32/tests/marshal.c b/dlls/ole32/tests/marshal.c
index afa58a5..26efae9 100644
--- a/dlls/ole32/tests/marshal.c
+++ b/dlls/ole32/tests/marshal.c
@@ -3460,6 +3460,19 @@ static ULONG WINAPI TestChannelHook_Release(IChannelHook *iface)
return 1;
}
+static BOOL new_hook_struct;
+static int method, server_tid;
+static GUID causality;
+
+struct new_hook_info
+{
+ IID iid;
+ GUID causality;
+ DWORD server_pid;
+ DWORD server_tid;
+ WORD method;
+};
+
static void WINAPI TestChannelHook_ClientGetSize(
IChannelHook *iface,
REFGUID uExtent,
@@ -3467,12 +3480,37 @@ static void WINAPI TestChannelHook_ClientGetSize(
ULONG *pDataSize )
{
SChannelHookCallInfo *info = (SChannelHookCallInfo *)riid;
- trace("TestChannelHook_ClientGetBuffer\n");
+ trace("TestChannelHook_ClientGetSize\n");
trace("\t%s method %d\n", debugstr_iid(riid), info->iMethod);
trace("\tcid: %s\n", debugstr_iid(&info->uCausality));
- ok(info->cbSize == sizeof(*info), "info->cbSize was %d instead of %d\n", info->cbSize, (int)sizeof(*info));
- ok(info->dwServerPid == GetCurrentProcessId(), "info->dwServerPid was 0x%x instead of 0x%x\n", info->dwServerPid, GetCurrentProcessId());
- ok(!info->pObject, "info->pObject should be NULL\n");
+ if (info->cbSize != sizeof(*info))
+ new_hook_struct = TRUE;
+
+ if (!new_hook_struct)
+ {
+ ok(info->cbSize == sizeof(*info), "cbSize was %d instead of %d\n", info->cbSize, (int)sizeof(*info));
+ ok(info->dwServerPid == GetCurrentProcessId(), "dwServerPid was 0x%x instead of 0x%x\n", info->dwServerPid, GetCurrentProcessId());
+ ok(info->iMethod == method, "iMethod was %d should be %d\n", info->iMethod, method);
+ ok(!info->pObject, "pObject should be NULL\n");
+ if (method == 3)
+ causality = info->uCausality;
+ else
+ ok(IsEqualGUID(&info->uCausality, &causality), "causality wasn't correct\n");
+ }
+ else
+ {
+ struct new_hook_info *new_info = (struct new_hook_info *)riid;
+ ok(new_info->server_pid == GetCurrentProcessId(), "server pid was 0x%x instead of 0x%x\n", new_info->server_pid,
+ GetCurrentProcessId());
+ ok(new_info->server_tid == server_tid, "server tid was 0x%x instead of 0x%x\n", new_info->server_tid,
+ server_tid);
+ ok(new_info->method == method, "method was %d instead of %d\n", new_info->method, method);
+ if (method == 3)
+ causality = new_info->causality;
+ else
+ ok(IsEqualGUID(&new_info->causality, &causality), "causality wasn't correct\n");
+ }
+
ok(IsEqualGUID(uExtent, &EXTENTID_WineTest), "uExtent wasn't correct\n");
*pDataSize = 1;
@@ -3487,9 +3525,26 @@ static void WINAPI TestChannelHook_ClientFillBuffer(
{
SChannelHookCallInfo *info = (SChannelHookCallInfo *)riid;
trace("TestChannelHook_ClientFillBuffer\n");
- ok(info->cbSize == sizeof(*info), "info->cbSize was %d instead of %d\n", info->cbSize, (int)sizeof(*info));
- ok(info->dwServerPid == GetCurrentProcessId(), "info->dwServerPid was 0x%x instead of 0x%x\n", info->dwServerPid, GetCurrentProcessId());
- ok(!info->pObject, "info->pObject should be NULL\n");
+
+ if (!new_hook_struct)
+ {
+ ok(info->cbSize == sizeof(*info), "cbSize was %d instead of %d\n", info->cbSize, (int)sizeof(*info));
+ ok(info->dwServerPid == GetCurrentProcessId(), "dwServerPid was 0x%x instead of 0x%x\n", info->dwServerPid, GetCurrentProcessId());
+ ok(info->iMethod == method, "iMethod was %d should be %d\n", info->iMethod, method);
+ ok(!info->pObject, "pObject should be NULL\n");
+ ok(IsEqualGUID(&info->uCausality, &causality), "causality wasn't correct\n");
+ }
+ else
+ {
+ struct new_hook_info *new_info = (struct new_hook_info *)riid;
+ ok(new_info->server_pid == GetCurrentProcessId(), "server pid was 0x%x instead of 0x%x\n", new_info->server_pid,
+ GetCurrentProcessId());
+ ok(new_info->server_tid == server_tid, "server tid was 0x%x instead of 0x%x\n", new_info->server_tid,
+ server_tid);
+ ok(new_info->method == method, "method was %d instead of %d\n", new_info->method, method);
+ ok(IsEqualGUID(&new_info->causality, &causality), "causality wasn't correct\n");
+ }
+
ok(IsEqualGUID(uExtent, &EXTENTID_WineTest), "uExtent wasn't correct\n");
*(unsigned char *)pDataBuffer = 0xcc;
@@ -3507,11 +3562,28 @@ static void WINAPI TestChannelHook_ClientNotify(
{
SChannelHookCallInfo *info = (SChannelHookCallInfo *)riid;
trace("TestChannelHook_ClientNotify hrFault = 0x%08x\n", hrFault);
- ok(info->cbSize == sizeof(*info), "info->cbSize was %d instead of %d\n", info->cbSize, (int)sizeof(*info));
- ok(info->dwServerPid == GetCurrentProcessId(), "info->dwServerPid was 0x%x instead of 0x%x\n", info->dwServerPid, GetCurrentProcessId());
- todo_wine {
- ok(info->pObject != NULL, "info->pObject shouldn't be NULL\n");
+
+ if (!new_hook_struct)
+ {
+ ok(info->cbSize == sizeof(*info), "cbSize was %d instead of %d\n", info->cbSize, (int)sizeof(*info));
+ ok(info->dwServerPid == GetCurrentProcessId(), "dwServerPid was 0x%x instead of 0x%x\n", info->dwServerPid, GetCurrentProcessId());
+ ok(info->iMethod == method, "iMethod was %d should be %d\n", info->iMethod, method);
+ todo_wine {
+ ok(info->pObject != NULL, "pObject shouldn't be NULL\n");
+ }
+ ok(IsEqualGUID(&info->uCausality, &causality), "causality wasn't correct\n");
+ }
+ else
+ {
+ struct new_hook_info *new_info = (struct new_hook_info *)riid;
+ ok(new_info->server_pid == GetCurrentProcessId(), "server pid was 0x%x instead of 0x%x\n", new_info->server_pid,
+ GetCurrentProcessId());
+ ok(new_info->server_tid == server_tid, "server tid was 0x%x instead of 0x%x\n", new_info->server_tid,
+ server_tid);
+ ok(new_info->method == method, "method was %d instead of %d\n", new_info->method, method);
+ ok(IsEqualGUID(&new_info->causality, &causality), "causality wasn't correct\n");
}
+
ok(IsEqualGUID(uExtent, &EXTENTID_WineTest), "uExtent wasn't correct\n");
}
@@ -3525,9 +3597,26 @@ static void WINAPI TestChannelHook_ServerNotify(
{
SChannelHookCallInfo *info = (SChannelHookCallInfo *)riid;
trace("TestChannelHook_ServerNotify\n");
- ok(info->cbSize == sizeof(*info), "info->cbSize was %d instead of %d\n", info->cbSize, (int)sizeof(*info));
- ok(info->dwServerPid == GetCurrentProcessId(), "info->dwServerPid was 0x%x instead of 0x%x\n", info->dwServerPid, GetCurrentProcessId());
- ok(info->pObject != NULL, "info->pObject shouldn't be NULL\n");
+
+ if (!new_hook_struct)
+ {
+ ok(info->cbSize == sizeof(*info), "cbSize was %d instead of %d\n", info->cbSize, (int)sizeof(*info));
+ ok(info->dwServerPid == GetCurrentProcessId(), "dwServerPid was 0x%x instead of 0x%x\n", info->dwServerPid, GetCurrentProcessId());
+ ok(info->iMethod == method, "iMethod was %d should be %d\n", info->iMethod, method);
+ ok(info->pObject != NULL, "pObject shouldn't be NULL\n");
+ ok(IsEqualGUID(&info->uCausality, &causality), "causality wasn't correct\n");
+ }
+ else
+ {
+ struct new_hook_info *new_info = (struct new_hook_info *)riid;
+ ok(new_info->server_pid == GetCurrentProcessId(), "server pid was 0x%x instead of 0x%x\n", new_info->server_pid,
+ GetCurrentProcessId());
+ ok(new_info->server_tid == server_tid, "server tid was 0x%x instead of 0x%x\n", new_info->server_tid,
+ server_tid);
+ ok(new_info->method == method, "method was %d instead of %d\n", new_info->method, method);
+ ok(IsEqualGUID(&new_info->causality, &causality), "causality wasn't correct\n");
+ }
+
ok(cbDataSize == 1, "cbDataSize should have been 1 instead of %d\n", cbDataSize);
ok(*(unsigned char *)pDataBuffer == 0xcc, "pDataBuffer should have contained 0xcc instead of 0x%x\n", *(unsigned char *)pDataBuffer);
ok(IsEqualGUID(uExtent, &EXTENTID_WineTest), "uExtent wasn't correct\n");
@@ -3543,9 +3632,25 @@ static void WINAPI TestChannelHook_ServerGetSize(
SChannelHookCallInfo *info = (SChannelHookCallInfo *)riid;
trace("TestChannelHook_ServerGetSize\n");
trace("\t%s method %d\n", debugstr_iid(riid), info->iMethod);
- ok(info->cbSize == sizeof(*info), "info->cbSize was %d instead of %d\n", info->cbSize, (int)sizeof(*info));
- ok(info->dwServerPid == GetCurrentProcessId(), "info->dwServerPid was 0x%x instead of 0x%x\n", info->dwServerPid, GetCurrentProcessId());
- ok(info->pObject != NULL, "info->pObject shouldn't be NULL\n");
+ if (!new_hook_struct)
+ {
+ ok(info->cbSize == sizeof(*info), "cbSize was %d instead of %d\n", info->cbSize, (int)sizeof(*info));
+ ok(info->dwServerPid == GetCurrentProcessId(), "dwServerPid was 0x%x instead of 0x%x\n", info->dwServerPid, GetCurrentProcessId());
+ ok(info->iMethod == method, "iMethod was %d should be %d\n", info->iMethod, method);
+ ok(info->pObject != NULL, "pObject shouldn't be NULL\n");
+ ok(IsEqualGUID(&info->uCausality, &causality), "causality wasn't correct\n");
+ }
+ else
+ {
+ struct new_hook_info *new_info = (struct new_hook_info *)riid;
+ ok(new_info->server_pid == GetCurrentProcessId(), "server pid was 0x%x instead of 0x%x\n", new_info->server_pid,
+ GetCurrentProcessId());
+ ok(new_info->server_tid == server_tid, "server tid was 0x%x instead of 0x%x\n", new_info->server_tid,
+ server_tid);
+ ok(new_info->method == method, "method was %d instead of %d\n", new_info->method, method);
+ ok(IsEqualGUID(&new_info->causality, &causality), "causality wasn't correct\n");
+ }
+
ok(IsEqualGUID(uExtent, &EXTENTID_WineTest), "uExtent wasn't correct\n");
if (hrFault != S_OK)
trace("\thrFault = 0x%08x\n", hrFault);
@@ -3600,6 +3705,7 @@ static void test_channel_hook(void)
hr = CreateStreamOnHGlobal(NULL, TRUE, &pStream);
ok_ole_success(hr, CreateStreamOnHGlobal);
tid = start_host_object2(pStream, &IID_IClassFactory, (IUnknown*)&Test_ClassFactory, MSHLFLAGS_NORMAL, &MessageFilter, &thread);
+ server_tid = tid;
ok_more_than_one_lock();
@@ -3610,8 +3716,11 @@ static void test_channel_hook(void)
ok_more_than_one_lock();
+ method = 3;
hr = IClassFactory_CreateInstance(cf, NULL, &IID_IUnknown, (LPVOID*)&proxy);
ok_ole_success(hr, IClassFactory_CreateInstance);
+
+ method = 5;
IUnknown_Release(proxy);
IClassFactory_Release(cf);
--
2.8.2
More information about the wine-patches
mailing list