Commit 9b57a950 authored by Alexandre Julliard's avatar Alexandre Julliard

Avoid accessing the htask16 TEB field from ntdll.

parent 73f67181
......@@ -79,7 +79,7 @@ THHOOK *pThhook = &DefaultThhook;
static UINT16 nTaskCount = 0;
static HTASK16 initial_task;
static HTASK16 initial_task, main_task;
/***********************************************************************
* TASK_InstallTHHook
......@@ -419,11 +419,10 @@ void TASK_CreateMainTask(void)
pTask->hPrevInstance = 0;
pTask->teb = NtCurrentTeb();
NtCurrentTeb()->htask16 = pTask->hSelf;
/* Add the task to the linked list */
/* (no need to get the win16 lock, we are the only thread at this point) */
TASK_LinkTask( pTask->hSelf );
main_task = pTask->hSelf;
}
......@@ -1177,7 +1176,9 @@ void WINAPI GetTaskQueueES16(void)
*/
HTASK16 WINAPI GetCurrentTask(void)
{
return NtCurrentTeb()->htask16;
HTASK16 ret = NtCurrentTeb()->htask16;
if (!ret) ret = main_task;
return ret;
}
/***********************************************************************
......
......@@ -266,7 +266,6 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, const SECURITY_DESCRIPTOR *
teb->reply_fd = -1;
teb->wait_fd[0] = -1;
teb->wait_fd[1] = -1;
teb->htask16 = NtCurrentTeb()->htask16;
info->pthread_info.teb_base = teb;
NtAllocateVirtualMemory( NtCurrentProcess(), &info->pthread_info.teb_base, 0, &size,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment