Rob Shearman : kernel32: Don' t run the CreateRemoteThread tests if the child process isn' t mapped at the same address as the parent process.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Feb 20 05:25:01 CST 2007


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

Author: Rob Shearman <rob at codeweavers.com>
Date:   Mon Feb 19 15:45:54 2007 +0000

kernel32: Don't run the CreateRemoteThread tests if the child process isn't mapped at the same address as the parent process.

---

 dlls/kernel32/tests/thread.c |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/dlls/kernel32/tests/thread.c b/dlls/kernel32/tests/thread.c
index 98d50f8..69861de 100644
--- a/dlls/kernel32/tests/thread.c
+++ b/dlls/kernel32/tests/thread.c
@@ -203,15 +203,37 @@ static DWORD WINAPI threadFunc_CloseHandle(LPVOID p)
     return 0;
 }
 
+static void create_function_addr_events(HANDLE events[2])
+{
+    char buffer[256];
+
+    sprintf(buffer, "threadFunc_SetEvent %p", threadFunc_SetEvent);
+    events[0] = CreateEvent(NULL, FALSE, FALSE, buffer);
+
+    sprintf(buffer, "threadFunc_CloseHandle %p", threadFunc_CloseHandle);
+    events[1] = CreateEvent(NULL, FALSE, FALSE, buffer);
+}
+
 /* check CreateRemoteThread */
 static VOID test_CreateRemoteThread(void)
 {
     HANDLE hProcess, hThread, hEvent, hRemoteEvent;
     DWORD tid, ret, exitcode;
+    HANDLE hAddrEvents[2];
 
     hProcess = create_target_process("sleep");
     ok(hProcess != NULL, "Can't start process\n");
 
+    /* ensure threadFunc_SetEvent & threadFunc_CloseHandle are the same
+     * address as in the child process */
+    create_function_addr_events(hAddrEvents);
+    ret = WaitForMultipleObjects(2, hAddrEvents, TRUE, 5000);
+    if (ret == WAIT_TIMEOUT)
+    {
+        skip("child process wasn't mapped at same address, so can't do CreateRemoteThread tests.\n");
+        return;
+    }
+
     hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
     ok(hEvent != NULL, "Can't create event, err=%u\n", GetLastError());
     ret = DuplicateHandle(GetCurrentProcess(), hEvent, hProcess, &hRemoteEvent,
@@ -843,6 +865,10 @@ START_TEST(thread)
    {
        if (!strcmp(argv[2], "sleep"))
        {
+           HANDLE hAddrEvents[2];
+           create_function_addr_events(hAddrEvents);
+           SetEvent(hAddrEvents[0]);
+           SetEvent(hAddrEvents[1]);
            Sleep(5000); /* spawned process runs for at most 5 seconds */
            return;
        }




More information about the wine-cvs mailing list