server: Fix the status code for get/set_thread_context on a terminated thread.

This commit is contained in:
Alexandre Julliard 2011-05-06 13:06:52 +02:00
parent 5dc9c73c31
commit 055c883ee0
2 changed files with 18 additions and 2 deletions

View File

@ -955,6 +955,22 @@ static void test_SetThreadContext(void)
WaitForSingleObject( thread, INFINITE );
ok( test_value == 20, "test_value %d instead of 20\n", test_value );
ctx.ContextFlags = CONTEXT_FULL;
SetLastError(0xdeadbeef);
ret = GetThreadContext( thread, &ctx );
ok( !ret, "GetThreadContext succeeded\n" );
ok( GetLastError() == ERROR_GEN_FAILURE || broken(GetLastError() == ERROR_INVALID_HANDLE), /* win2k */
"wrong error %u\n", GetLastError() );
SetLastError(0xdeadbeef);
ret = SetThreadContext( thread, &ctx );
ok( !ret, "SetThreadContext succeeded\n" );
ok( GetLastError() == ERROR_GEN_FAILURE || GetLastError() == ERROR_ACCESS_DENIED ||
broken(GetLastError() == ERROR_INVALID_HANDLE), /* win2k */
"wrong error %u\n", GetLastError() );
CloseHandle( thread );
}
#endif /* __i386__ */

View File

@ -1493,7 +1493,7 @@ DECL_HANDLER(get_thread_context)
suspend_thread( thread );
}
}
else set_error( STATUS_ACCESS_DENIED );
else set_error( STATUS_UNSUCCESSFUL );
}
else if ((context = set_reply_data_size( sizeof(context_t) )))
{
@ -1535,7 +1535,7 @@ DECL_HANDLER(set_thread_context)
suspend_thread( thread );
}
}
else set_error( STATUS_ACCESS_DENIED );
else set_error( STATUS_UNSUCCESSFUL );
}
else if (context->cpu == thread->process->cpu)
{