server: Calling ResumeThread() on a terminated thread is valid.

This commit is contained in:
H. Verbeet 2008-07-22 23:54:39 +02:00 committed by Alexandre Julliard
parent 9a70306c53
commit ff870e0132
2 changed files with 9 additions and 2 deletions

View File

@ -450,6 +450,7 @@ static VOID test_CreateThread_suspended(void)
{ {
HANDLE thread; HANDLE thread;
DWORD threadId; DWORD threadId;
DWORD suspend_count;
int error; int error;
thread = CreateThread(NULL,0,threadFunc2,NULL, thread = CreateThread(NULL,0,threadFunc2,NULL,
@ -471,6 +472,13 @@ static VOID test_CreateThread_suspended(void)
if(error!=WAIT_OBJECT_0) { if(error!=WAIT_OBJECT_0) {
TerminateThread(thread,1); TerminateThread(thread,1);
} }
suspend_count = SuspendThread(thread);
ok(suspend_count == -1, "SuspendThread returned %d, expected -1\n", suspend_count);
suspend_count = ResumeThread(thread);
ok(suspend_count == 0, "ResumeThread returned %d, expected 0\n", suspend_count);
ok(CloseHandle(thread)!=0,"CloseHandle failed\n"); ok(CloseHandle(thread)!=0,"CloseHandle failed\n");
} }

View File

@ -1160,8 +1160,7 @@ DECL_HANDLER(resume_thread)
if ((thread = get_thread_from_handle( req->handle, THREAD_SUSPEND_RESUME ))) if ((thread = get_thread_from_handle( req->handle, THREAD_SUSPEND_RESUME )))
{ {
if (thread->state == TERMINATED) set_error( STATUS_ACCESS_DENIED ); reply->count = resume_thread( thread );
else reply->count = resume_thread( thread );
release_object( thread ); release_object( thread );
} }
} }