Hi,
I have a game (Last Chaos USA by AeriaGames) which does not start up the main game due to a bug in its toolhelp snaphot handling.
It does: h = CreateToolhelp32Snapshot(); Process32First(h, &x); while (Process32Next(h,&x)) { /* check x */ }
So it discards the very first entry we return from the snapshot. However it is looking for itself here and in current Wine it is in the first entry, ... so failure.
So I reorder the list to be backwards and it works better then.
BUT I would like to test run it on windows first, so can someone please run following patch against a real Windows?
Thanks & Ciao, Marcus
diff --git a/dlls/kernel32/tests/toolhelp.c b/dlls/kernel32/tests/toolhelp.c index ca9c06c..f135abb 100644 --- a/dlls/kernel32/tests/toolhelp.c +++ b/dlls/kernel32/tests/toolhelp.c @@ -108,6 +108,7 @@ static void test_process(DWORD curr_pid, MODULEENTRY32 me; unsigned found = 0; int num = 0; + int pos1 = -1 , pos2 = -1;
hSnapshot = pCreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 ); ok(hSnapshot != NULL, "Cannot create snapshot\n"); @@ -118,8 +119,8 @@ static void test_process(DWORD curr_pid, { do { - if (pe.th32ProcessID == curr_pid) found++; - if (pe.th32ProcessID == sub_pcs_pid) found++; + if (pe.th32ProcessID == curr_pid) { pos1 = num; found++; } + if (pe.th32ProcessID == sub_pcs_pid) { pos2 = num; found++; } trace("PID=%x %s\n", pe.th32ProcessID, pe.szExeFile); num++; } while (pProcess32Next( hSnapshot, &pe )); @@ -141,6 +142,9 @@ static void test_process(DWORD curr_pid, ok(found == 2, "couldn't find self and/or sub-process in process list\n"); ok(!num, "mismatch in counting\n");
+ ok (pos2 == 1, "new process at position %d in snapshot, expected 1.\n", pos2); + ok (pos1 == 0, "this process at position %d in snapshot, expected 0.\n", pos1); + te.dwSize = sizeof(te); ok(!pThread32First( hSnapshot, &te ), "shouldn't return a thread\n");