mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-06 17:02:08 +00:00
server: Enumerate process in reverse.
This commit is contained in:
parent
83300893a2
commit
3bf54c2950
|
@ -106,6 +106,7 @@ static void test_process(DWORD curr_pid, DWORD sub_pcs_pid)
|
||||||
MODULEENTRY32 me;
|
MODULEENTRY32 me;
|
||||||
unsigned found = 0;
|
unsigned found = 0;
|
||||||
int num = 0;
|
int num = 0;
|
||||||
|
int childpos = -1;
|
||||||
|
|
||||||
hSnapshot = pCreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
|
hSnapshot = pCreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
|
||||||
ok(hSnapshot != NULL, "Cannot create snapshot\n");
|
ok(hSnapshot != NULL, "Cannot create snapshot\n");
|
||||||
|
@ -117,7 +118,7 @@ static void test_process(DWORD curr_pid, DWORD sub_pcs_pid)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (pe.th32ProcessID == curr_pid) found++;
|
if (pe.th32ProcessID == curr_pid) found++;
|
||||||
if (pe.th32ProcessID == sub_pcs_pid) found++;
|
if (pe.th32ProcessID == sub_pcs_pid) { childpos = num; found++; }
|
||||||
trace("PID=%x %s\n", pe.th32ProcessID, pe.szExeFile);
|
trace("PID=%x %s\n", pe.th32ProcessID, pe.szExeFile);
|
||||||
num++;
|
num++;
|
||||||
} while (pProcess32Next( hSnapshot, &pe ));
|
} while (pProcess32Next( hSnapshot, &pe ));
|
||||||
|
@ -139,6 +140,10 @@ static void test_process(DWORD curr_pid, DWORD sub_pcs_pid)
|
||||||
ok(found == 2, "couldn't find self and/or sub-process in process list\n");
|
ok(found == 2, "couldn't find self and/or sub-process in process list\n");
|
||||||
ok(!num, "mismatch in counting\n");
|
ok(!num, "mismatch in counting\n");
|
||||||
|
|
||||||
|
/* one broken program does Process32First() and does not expect anything
|
||||||
|
* interesting to be there, especially not the just forked off child */
|
||||||
|
ok (childpos !=0, "child is not expected to be at position 0.\n");
|
||||||
|
|
||||||
te.dwSize = sizeof(te);
|
te.dwSize = sizeof(te);
|
||||||
ok(!pThread32First( hSnapshot, &te ), "shouldn't return a thread\n");
|
ok(!pThread32First( hSnapshot, &te ), "shouldn't return a thread\n");
|
||||||
|
|
||||||
|
|
|
@ -344,7 +344,7 @@ struct thread *create_process( int fd, struct thread *parent_thread, int inherit
|
||||||
|
|
||||||
process->start_time = current_time;
|
process->start_time = current_time;
|
||||||
process->end_time = 0;
|
process->end_time = 0;
|
||||||
list_add_head( &process_list, &process->entry );
|
list_add_tail( &process_list, &process->entry );
|
||||||
|
|
||||||
if (!(process->id = process->group_id = alloc_ptid( process )))
|
if (!(process->id = process->group_id = alloc_ptid( process )))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue