ntoskrnl.exe: Return error codes compatible with recent Windows versions in PsLookupThreadByThreadId.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
c448550e74
commit
95bd82eee5
|
@ -2558,13 +2558,18 @@ PRKTHREAD WINAPI KeGetCurrentThread(void)
|
|||
*/
|
||||
NTSTATUS WINAPI PsLookupThreadByThreadId( HANDLE threadid, PETHREAD *thread )
|
||||
{
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
CLIENT_ID cid;
|
||||
NTSTATUS status;
|
||||
HANDLE handle;
|
||||
|
||||
TRACE( "(%p %p)\n", threadid, thread );
|
||||
|
||||
if (!(handle = OpenThread( THREAD_QUERY_INFORMATION, FALSE, HandleToUlong(threadid) )))
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
cid.UniqueProcess = 0;
|
||||
cid.UniqueThread = threadid;
|
||||
InitializeObjectAttributes( &attr, NULL, 0, NULL, NULL );
|
||||
status = NtOpenThread( &handle, THREAD_QUERY_INFORMATION, &attr, &cid );
|
||||
if (status) return status;
|
||||
|
||||
status = ObReferenceObjectByHandle( handle, THREAD_ALL_ACCESS, PsThreadType, KernelMode, (void**)thread, NULL );
|
||||
|
||||
|
|
|
@ -170,6 +170,11 @@ static void winetest_end_todo(void)
|
|||
todo_level >>= 1;
|
||||
}
|
||||
|
||||
static int broken(int condition)
|
||||
{
|
||||
return !running_under_wine && condition;
|
||||
}
|
||||
|
||||
#define ok(condition, ...) ok_(__FILE__, __LINE__, condition, __VA_ARGS__)
|
||||
#define todo_if(is_todo) for (winetest_start_todo(is_todo); \
|
||||
winetest_loop_todo(); \
|
||||
|
@ -1179,7 +1184,8 @@ static void test_lookup_thread(void)
|
|||
if (thread) ObDereferenceObject(thread);
|
||||
|
||||
status = PsLookupThreadByThreadId(NULL, &thread);
|
||||
ok(status == STATUS_INVALID_PARAMETER, "PsLookupThreadByThreadId returned %#x\n", status);
|
||||
ok(status == STATUS_INVALID_CID || broken(status == STATUS_INVALID_PARAMETER) /* winxp */,
|
||||
"PsLookupThreadByThreadId returned %#x\n", status);
|
||||
}
|
||||
|
||||
static NTSTATUS main_test(DEVICE_OBJECT *device, IRP *irp, IO_STACK_LOCATION *stack, ULONG_PTR *info)
|
||||
|
|
Loading…
Reference in New Issue