[PATCH v3 2/4] ole32/tests: Only test the original SChannelHookCallInfo structure.

Huw Davies huw at codeweavers.com
Thu Jan 2 05:25:00 CST 2020


From: Zebediah Figura <z.figura12 at gmail.com>

This in some sense reverts most of edaf60d71ad1b12315f512c65b3b8c8536e70935.
Unless an application depends on the new hook structure, this seems far too
much like testing internal behaviour. That the structure seems to have
changed multiple times in Windows 10 makes this unlikely.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
---
 dlls/ole32/tests/marshal.c | 84 ++++----------------------------------
 1 file changed, 7 insertions(+), 77 deletions(-)

diff --git a/dlls/ole32/tests/marshal.c b/dlls/ole32/tests/marshal.c
index 582b63f484..e31a89a075 100644
--- a/dlls/ole32/tests/marshal.c
+++ b/dlls/ole32/tests/marshal.c
@@ -4325,19 +4325,9 @@ static ULONG WINAPI TestChannelHook_Release(IChannelHook *iface)
     return 1;
 }
 
-static BOOL new_hook_struct;
-static int method, server_tid;
+static int method;
 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,
@@ -4347,12 +4337,9 @@ static void WINAPI TestChannelHook_ClientGetSize(
     SChannelHookCallInfo *info = (SChannelHookCallInfo *)riid;
     trace("TestChannelHook_ClientGetSize\n");
     trace("\t%s\n", debugstr_iid(riid));
-    if (info->cbSize != sizeof(*info))
-        new_hook_struct = TRUE;
 
-    if (!new_hook_struct)
+    if (info->cbSize == sizeof(*info))
     {
-        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");
@@ -4361,19 +4348,6 @@ static void WINAPI TestChannelHook_ClientGetSize(
         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");
 
@@ -4390,24 +4364,13 @@ static void WINAPI TestChannelHook_ClientFillBuffer(
     SChannelHookCallInfo *info = (SChannelHookCallInfo *)riid;
     trace("TestChannelHook_ClientFillBuffer\n");
 
-    if (!new_hook_struct)
+    if (info->cbSize == sizeof(*info))
     {
-        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");
 
@@ -4427,9 +4390,8 @@ static void WINAPI TestChannelHook_ClientNotify(
     SChannelHookCallInfo *info = (SChannelHookCallInfo *)riid;
     trace("TestChannelHook_ClientNotify hrFault = 0x%08x\n", hrFault);
 
-    if (!new_hook_struct)
+    if (info->cbSize == sizeof(*info))
     {
-        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 {
@@ -4437,16 +4399,6 @@ static void WINAPI TestChannelHook_ClientNotify(
         }
         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");
 }
@@ -4462,24 +4414,13 @@ static void WINAPI TestChannelHook_ServerNotify(
     SChannelHookCallInfo *info = (SChannelHookCallInfo *)riid;
     trace("TestChannelHook_ServerNotify\n");
 
-    if (!new_hook_struct)
+    if (info->cbSize == sizeof(*info))
     {
-        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);
@@ -4496,24 +4437,14 @@ static void WINAPI TestChannelHook_ServerGetSize(
     SChannelHookCallInfo *info = (SChannelHookCallInfo *)riid;
     trace("TestChannelHook_ServerGetSize\n");
     trace("\t%s\n", debugstr_iid(riid));
-    if (!new_hook_struct)
+
+    if (info->cbSize == sizeof(*info))
     {
-        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)
@@ -4571,7 +4502,6 @@ static void test_channel_hook(void)
     hr = CreateStreamOnHGlobal(NULL, TRUE, &object_data.stream);
     ok_ole_success(hr, CreateStreamOnHGlobal);
     tid = start_host_object2(&object_data, &thread);
-    server_tid = tid;
 
     ok_more_than_one_lock();
 
-- 
2.23.0




More information about the wine-devel mailing list