Avoid accessing the htask16 TEB field from ntdll.
This commit is contained in:
parent
73f6718134
commit
9b57a950d7
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue