[PATCH v5 2/2] kernel32: Adjust toolhelp thread return order.

Changping Yu dead.ash at hotmail.com
Sun Jun 28 03:56:35 CDT 2020


>From 8ad35c14c981b4a56357b968fb2c2b03124aed26 Mon Sep 17 00:00:00 2001
From: Changping Yu <dead.ash at hotmail.com>
Date: Sun, 28 Jun 2020 16:33:41 +0800
Subject: [PATCH v5 2/2] kernel32: Adjust toolhelp thread return order.

v5: Changed the patch location so that the nt function changed

Some software incorrectly uses the way to get the main thread id.
Coincidentally, the threads of wine and windows return differently.
The list of threads returned by flipping can be consistent with windows.

Signed-off-by: Changping Yu <dead.ash at hotmail.com>
---
 dlls/kernel32/tests/toolhelp.c | 4 ----
 server/thread.c                | 2 +-
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/dlls/kernel32/tests/toolhelp.c b/dlls/kernel32/tests/toolhelp.c
index 61df560179..b975339b50 100644
--- a/dlls/kernel32/tests/toolhelp.c
+++ b/dlls/kernel32/tests/toolhelp.c
@@ -223,7 +223,6 @@ static DWORD WINAPI get_id_thread(void* curr_pid)
             break;
         }
     }
-    todo_wine
     ok(found==FALSE, "The thread order is not strictly consistent\n");
 
     /* Determine the order by NtQuerySystemInformation function */
@@ -284,7 +283,6 @@ static DWORD WINAPI get_id_thread(void* curr_pid)
                 break;
             }
         }
-        todo_wine
         ok(found==FALSE, "Judge the failure of traversing thread by NtQuerySystemInformation function\n");
     }
 
@@ -305,7 +303,6 @@ static void test_main_thread(DWORD curr_pid, DWORD main_tid)
 
     /* check that the main thread id is first one in this thread. */
     first_tid = get_id_thread((void *)curr_pid);
-    todo_wine
     ok(first_tid == main_tid, "check main thread is error, main is %d, %d\n", main_tid, first_tid);
 
     /* check that the main thread id is first one in other thread. */
@@ -314,7 +311,6 @@ static void test_main_thread(DWORD curr_pid, DWORD main_tid)
     ok(error == WAIT_OBJECT_0, "Thread did not complete within timelimit\n");
 
     ok(GetExitCodeThread(thread, &first_tid), "Could not retrieve ext code\n");
-    todo_wine
     ok(first_tid == main_tid, "check main thread is error, main is %d, %d\n", main_tid, first_tid);
 }
 
diff --git a/server/thread.c b/server/thread.c
index e2bfa50c7b..f8c8443ba0 100644
--- a/server/thread.c
+++ b/server/thread.c
@@ -329,7 +329,7 @@ struct thread *create_thread( int fd, struct process *process, const struct secu
     thread->affinity = process->affinity;
     if (!current) current = thread;
 
-    list_add_head( &thread_list, &thread->entry );
+    list_add_tail( &thread_list, &thread->entry );
 
     if (sd && !set_sd_defaults_from_token( &thread->obj, sd,
                                            OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION |
-- 
2.27.0.windows.1



More information about the wine-devel mailing list