Allow passing task handles to GetThreadQueue() and SetFastQueue().
diff --git a/loader/task.c b/loader/task.c
index 3f742d2..0f0e0d4 100644
--- a/loader/task.c
+++ b/loader/task.c
@@ -1244,7 +1244,14 @@
*/
HQUEUE16 WINAPI GetThreadQueue( DWORD thread )
{
- THDB *thdb = thread? THREAD_IdToTHDB( thread ) : THREAD_Current();
+ THDB *thdb = NULL;
+ if ( !thread )
+ thdb = THREAD_Current();
+ else if ( HIWORD(thread) )
+ thdb = THREAD_IdToTHDB( thread );
+ else if ( IsTask( (HTASK16)thread ) )
+ thdb = ((TDB *)GlobalLock16( (HANDLE16)thread ))->thdb;
+
return (HQUEUE16)(thdb? thdb->teb.queue : 0);
}
@@ -1253,7 +1260,14 @@
*/
VOID WINAPI SetFastQueue( DWORD thread, HANDLE32 hQueue )
{
- THDB *thdb = thread? THREAD_IdToTHDB( thread ) : THREAD_Current();
+ THDB *thdb = NULL;
+ if ( !thread )
+ thdb = THREAD_Current();
+ else if ( HIWORD(thread) )
+ thdb = THREAD_IdToTHDB( thread );
+ else if ( IsTask( (HTASK16)thread ) )
+ thdb = ((TDB *)GlobalLock16( (HANDLE16)thread ))->thdb;
+
if ( thdb ) thdb->teb.queue = (HQUEUE16) hQueue;
}