Module: wine Branch: master Commit: 055c883ee0e9362d134db14ea57f47c87a30737d URL: http://source.winehq.org/git/wine.git/?a=commit;h=055c883ee0e9362d134db14ea5...
Author: Alexandre Julliard julliard@winehq.org Date: Fri May 6 13:06:52 2011 +0200
server: Fix the status code for get/set_thread_context on a terminated thread.
---
dlls/kernel32/tests/thread.c | 16 ++++++++++++++++ server/thread.c | 4 ++-- 2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/dlls/kernel32/tests/thread.c b/dlls/kernel32/tests/thread.c index 25b55ac..8376575 100644 --- a/dlls/kernel32/tests/thread.c +++ b/dlls/kernel32/tests/thread.c @@ -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__ */ diff --git a/server/thread.c b/server/thread.c index 4388847..d0fdc30 100644 --- a/server/thread.c +++ b/server/thread.c @@ -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) {