ntdll/tests: Return early if ThreadHideFromDebugger isn't supported.

We're not testing anything interesting in this case.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2020-07-17 19:12:32 -05:00 committed by Alexandre Julliard
parent 519f86d5aa
commit 9dd1eaab44
1 changed files with 15 additions and 16 deletions

View File

@ -2367,19 +2367,20 @@ static void test_HideFromDebugger(void)
dummy = 0; dummy = 0;
status = NtQueryInformationThread( GetCurrentThread(), ThreadHideFromDebugger, &dummy, sizeof(ULONG), NULL ); status = NtQueryInformationThread( GetCurrentThread(), ThreadHideFromDebugger, &dummy, sizeof(ULONG), NULL );
if (status == STATUS_INVALID_INFO_CLASS) if (status == STATUS_INVALID_INFO_CLASS)
win_skip("ThreadHideFromDebugger not available\n");
else
{ {
ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status ); win_skip("ThreadHideFromDebugger not available\n");
dummy = 0; return;
status = NtQueryInformationThread( (HANDLE)0xdeadbeef, ThreadHideFromDebugger, &dummy, sizeof(ULONG), NULL );
ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status );
dummy = 0;
status = NtQueryInformationThread( GetCurrentThread(), ThreadHideFromDebugger, &dummy, 1, NULL );
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status );
if (status == STATUS_SUCCESS) ok( dummy == 1, "Expected dummy == 1, got %08x\n", dummy );
} }
ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status );
dummy = 0;
status = NtQueryInformationThread( (HANDLE)0xdeadbeef, ThreadHideFromDebugger, &dummy, sizeof(ULONG), NULL );
ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status );
dummy = 0;
status = NtQueryInformationThread( GetCurrentThread(), ThreadHideFromDebugger, &dummy, 1, NULL );
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status );
ok( dummy == 1, "Expected dummy == 1, got %08x\n", dummy );
stop_event = CreateEventA( NULL, FALSE, FALSE, NULL ); stop_event = CreateEventA( NULL, FALSE, FALSE, NULL );
ok( stop_event != NULL, "CreateEvent failed\n" ); ok( stop_event != NULL, "CreateEvent failed\n" );
thread = CreateThread( NULL, 0, hide_from_debugger_thread, stop_event, 0, NULL ); thread = CreateThread( NULL, 0, hide_from_debugger_thread, stop_event, 0, NULL );
@ -2387,18 +2388,16 @@ static void test_HideFromDebugger(void)
dummy = 0; dummy = 0;
status = NtQueryInformationThread( thread, ThreadHideFromDebugger, &dummy, 1, NULL ); status = NtQueryInformationThread( thread, ThreadHideFromDebugger, &dummy, 1, NULL );
ok( status == STATUS_SUCCESS || status == STATUS_INVALID_INFO_CLASS, ok( status == STATUS_SUCCESS, "got %#x\n", status );
"Expected STATUS_SUCCESS, got %08x\n", status ); ok( dummy == 0, "Expected dummy == 0, got %08x\n", dummy );
if (status == STATUS_SUCCESS) ok( dummy == 0, "Expected dummy == 0, got %08x\n", dummy );
status = pNtSetInformationThread( thread, ThreadHideFromDebugger, NULL, 0 ); status = pNtSetInformationThread( thread, ThreadHideFromDebugger, NULL, 0 );
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status ); ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status );
dummy = 0; dummy = 0;
status = NtQueryInformationThread( thread, ThreadHideFromDebugger, &dummy, 1, NULL ); status = NtQueryInformationThread( thread, ThreadHideFromDebugger, &dummy, 1, NULL );
ok( status == STATUS_SUCCESS || status == STATUS_INVALID_INFO_CLASS, ok( status == STATUS_SUCCESS, "got %#x\n", status );
"Expected STATUS_SUCCESS, got %08x\n", status ); ok( dummy == 1, "Expected dummy == 1, got %08x\n", dummy );
if (status == STATUS_SUCCESS) ok( dummy == 1, "Expected dummy == 1, got %08x\n", dummy );
SetEvent( stop_event ); SetEvent( stop_event );
WaitForSingleObject( thread, INFINITE ); WaitForSingleObject( thread, INFINITE );