[WIN32K]: Rework a bit the initialization code to modularize it a bit (some parts to be reused in other places). Part 1/x

svn path=/trunk/; revision=65858
This commit is contained in:
Hermès Bélusca-Maïto 2014-12-28 13:00:28 +00:00
parent 594d5a3366
commit 37f198c7d6
4 changed files with 204 additions and 119 deletions

View file

@ -2,7 +2,7 @@
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Win32k subsystem * PROJECT: ReactOS Win32k subsystem
* PURPOSE: Driver entry and initialization of win32k * PURPOSE: Driver entry and initialization of win32k
* FILE: subsystems/win32/win32k/main/main.c * FILE: win32ss/user/ntuser/main.c
* PROGRAMER: * PROGRAMER:
*/ */
@ -17,7 +17,9 @@ HANDLE hModuleWin;
PGDI_HANDLE_TABLE NTAPI GDIOBJ_iAllocHandleTable(OUT PVOID *SectionObject); PGDI_HANDLE_TABLE NTAPI GDIOBJ_iAllocHandleTable(OUT PVOID *SectionObject);
BOOL NTAPI GDI_CleanupForProcess (struct _EPROCESS *Process); BOOL NTAPI GDI_CleanupForProcess (struct _EPROCESS *Process);
NTSTATUS NTAPI UserDestroyThreadInfo(struct _ETHREAD *Thread);
NTSTATUS DestroyProcessCallback(PEPROCESS Process);
NTSTATUS NTAPI DestroyThreadCallback(PETHREAD Thread);
HANDLE GlobalUserHeap = NULL; HANDLE GlobalUserHeap = NULL;
PVOID GlobalUserHeapSection = NULL; PVOID GlobalUserHeapSection = NULL;
@ -51,9 +53,78 @@ DbgPostServiceHook(ULONG ulSyscallId, ULONG_PTR ulResult)
} }
#endif #endif
static
NTSTATUS NTSTATUS
UserCreateProcessInfo(PEPROCESS Process) AllocW32Process(IN PEPROCESS Process,
OUT PPROCESSINFO* W32Process)
{
PPROCESSINFO ppiCurrent;
TRACE_CH(UserProcess, "In AllocW32Process(0x%p)\n", Process);
/* Check that we were not called with an already existing Win32 process info */
ppiCurrent = PsGetProcessWin32Process(Process);
if (ppiCurrent) return STATUS_SUCCESS;
/* Allocate a new Win32 process info */
ppiCurrent = ExAllocatePoolWithTag(NonPagedPool,
sizeof(*ppiCurrent),
USERTAG_PROCESSINFO);
if (ppiCurrent == NULL)
{
ERR_CH(UserProcess, "Failed to allocate ppi for PID:0x%lx\n",
HandleToUlong(Process->UniqueProcessId));
return STATUS_NO_MEMORY;
}
TRACE_CH(UserProcess,"Allocated ppi 0x%p for PID:0x%lx\n",
ppiCurrent, HandleToUlong(Process->UniqueProcessId));
RtlZeroMemory(ppiCurrent, sizeof(*ppiCurrent));
PsSetProcessWin32Process(Process, ppiCurrent, NULL);
IntReferenceProcessInfo(ppiCurrent);
*W32Process = ppiCurrent;
return STATUS_SUCCESS;
}
#define FreeW32Process(/*Process*/ W32Process) \
do { \
/*PPROCESSINFO W32Process = PsGetProcessWin32Process(Process);*/ \
/*ASSERT(W32Process);*/ \
IntDereferenceProcessInfo(W32Process); \
} while(0)
/*
* Called from IntDereferenceProcessInfo
*/
VOID
UserDeleteW32Process(PPROCESSINFO ppiCurrent)
{
if (ppiCurrent->InputIdleEvent)
{
EngDeleteEvent((PEVENT)ppiCurrent->InputIdleEvent);
}
/* Close the startup desktop */
if (ppiCurrent->rpdeskStartup)
ObDereferenceObject(ppiCurrent->rpdeskStartup);
#if DBG
if (DBG_IS_CHANNEL_ENABLED(ppiCurrent, DbgChUserObj, WARN_LEVEL))
{
TRACE_PPI(ppiCurrent, UserObj, "Dumping user handles now that process info %p is gets freed.\n", ppiCurrent);
DbgUserDumpHandleTable();
}
#endif
/* Free the PROCESSINFO */
ExFreePoolWithTag(ppiCurrent, USERTAG_PROCESSINFO);
}
NTSTATUS
CreateProcessCallback(PEPROCESS Process)
{ {
PPROCESSINFO ppiCurrent; PPROCESSINFO ppiCurrent;
NTSTATUS Status; NTSTATUS Status;
@ -70,21 +141,15 @@ UserCreateProcessInfo(PEPROCESS Process)
return STATUS_ALREADY_WIN32; return STATUS_ALREADY_WIN32;
} }
/* Allocate a new win32 process */ /* Allocate a new Win32 process info */
ppiCurrent = ExAllocatePoolWithTag(NonPagedPool, Status = AllocW32Process(Process, &ppiCurrent);
sizeof(PROCESSINFO), if (!NT_SUCCESS(Status))
USERTAG_PROCESSINFO);
if (ppiCurrent == NULL)
{ {
ERR_CH(UserProcess, "Failed to allocate ppi for PID:0x%lx\n", ERR_CH(UserProcess, "Failed to allocate ppi for PID:0x%lx\n",
HandleToUlong(Process->UniqueProcessId)); HandleToUlong(Process->UniqueProcessId));
return STATUS_NO_MEMORY; return Status;
} }
RtlZeroMemory(ppiCurrent, sizeof(PROCESSINFO));
PsSetProcessWin32Process(Process, ppiCurrent, NULL);
#if DBG #if DBG
DbgInitDebugChannels(); DbgInitDebugChannels();
#if KDBG #if KDBG
@ -92,8 +157,6 @@ UserCreateProcessInfo(PEPROCESS Process)
#endif #endif
#endif #endif
TRACE_CH(UserProcess,"Allocated ppi 0x%p for PID:0x%lx\n", ppiCurrent, HandleToUlong(Process->UniqueProcessId));
/* Map the global heap into the process */ /* Map the global heap into the process */
Offset.QuadPart = 0; Offset.QuadPart = 0;
Status = MmMapViewOfSection(GlobalUserHeapSection, Status = MmMapViewOfSection(GlobalUserHeapSection,
@ -109,7 +172,7 @@ UserCreateProcessInfo(PEPROCESS Process)
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
TRACE_CH(UserProcess,"Failed to map the global heap! 0x%x\n", Status); TRACE_CH(UserProcess,"Failed to map the global heap! 0x%x\n", Status);
return Status; goto error;
} }
ppiCurrent->HeapMappings.Next = NULL; ppiCurrent->HeapMappings.Next = NULL;
ppiCurrent->HeapMappings.KernelMapping = (PVOID)GlobalUserHeap; ppiCurrent->HeapMappings.KernelMapping = (PVOID)GlobalUserHeap;
@ -163,20 +226,23 @@ UserCreateProcessInfo(PEPROCESS Process)
/* Add the process to the global list */ /* Add the process to the global list */
ppiCurrent->ppiNext = gppiList; ppiCurrent->ppiNext = gppiList;
gppiList = ppiCurrent; gppiList = ppiCurrent;
IntReferenceProcessInfo(ppiCurrent);
return STATUS_SUCCESS; return STATUS_SUCCESS;
error:
ERR_CH(UserProcess,"CreateProcessCallback failed! Freeing ppi 0x%p for PID:0x%lx\n",
ppiCurrent, HandleToUlong(Process->UniqueProcessId));
DestroyProcessCallback(Process);
return Status;
} }
static
NTSTATUS NTSTATUS
UserDestroyProcessInfo(PEPROCESS Process) DestroyProcessCallback(PEPROCESS Process)
{ {
PPROCESSINFO ppiCurrent, *pppi; PPROCESSINFO ppiCurrent, *pppi;
/* Get the Win32 Process */ /* Get the Win32 Process */
ppiCurrent = PsGetProcessWin32Process(Process); ppiCurrent = PsGetProcessWin32Process(Process);
ASSERT(ppiCurrent); ASSERT(ppiCurrent);
TRACE_CH(UserProcess, "Destroying ppi 0x%p\n", ppiCurrent); TRACE_CH(UserProcess, "Destroying ppi 0x%p\n", ppiCurrent);
@ -229,7 +295,7 @@ UserDestroyProcessInfo(PEPROCESS Process)
*pppi = ppiCurrent->ppiNext; *pppi = ppiCurrent->ppiNext;
if(ppiCurrent->hdeskStartup) if (ppiCurrent->hdeskStartup)
{ {
ZwClose(ppiCurrent->hdeskStartup); ZwClose(ppiCurrent->hdeskStartup);
ppiCurrent->hdeskStartup = NULL; ppiCurrent->hdeskStartup = NULL;
@ -244,64 +310,116 @@ UserDestroyProcessInfo(PEPROCESS Process)
PsSetProcessWin32Process(Process, NULL, ppiCurrent); PsSetProcessWin32Process(Process, NULL, ppiCurrent);
ppiCurrent->peProcess = NULL; ppiCurrent->peProcess = NULL;
/* At last, dereference */ /* Finally, dereference */
IntDereferenceProcessInfo(ppiCurrent); FreeW32Process(/*Process*/ ppiCurrent); // IntDereferenceProcessInfo(ppiCurrent);
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
VOID
UserDeleteW32Process(PPROCESSINFO ppiCurrent)
{
if (ppiCurrent->InputIdleEvent)
{
EngDeleteEvent((PEVENT)ppiCurrent->InputIdleEvent);
}
/* Close the startup desktop */
if(ppiCurrent->rpdeskStartup)
ObDereferenceObject(ppiCurrent->rpdeskStartup);
#if DBG
if (DBG_IS_CHANNEL_ENABLED(ppiCurrent, DbgChUserObj, WARN_LEVEL))
{
TRACE_PPI(ppiCurrent, UserObj, "Dumping user handles now that process info %p is gets freed.\n", ppiCurrent);
DbgUserDumpHandleTable();
}
#endif
/* Free the PROCESSINFO */
ExFreePoolWithTag(ppiCurrent, USERTAG_PROCESSINFO);
}
NTSTATUS NTSTATUS
APIENTRY APIENTRY
Win32kProcessCallback(struct _EPROCESS *Process, Win32kProcessCallback(PEPROCESS Process,
BOOLEAN Create) BOOLEAN Create)
{ {
NTSTATUS Status; NTSTATUS Status;
ASSERT(Process->Peb); ASSERT(Process->Peb);
TRACE_CH(UserProcess,"Win32kProcessCallback -->\n");
UserEnterExclusive(); UserEnterExclusive();
if (Create) if (Create)
{ {
Status = UserCreateProcessInfo(Process); Status = CreateProcessCallback(Process);
} }
else else
{ {
Status = UserDestroyProcessInfo(Process); Status = DestroyProcessCallback(Process);
} }
UserLeave(); UserLeave();
TRACE_CH(UserProcess,"<-- Win32kProcessCallback\n");
return Status; return Status;
} }
NTSTATUS NTAPI
UserCreateThreadInfo(struct _ETHREAD *Thread)
NTSTATUS
AllocW32Thread(IN PETHREAD Thread,
OUT PTHREADINFO* W32Thread)
{ {
struct _EPROCESS *Process; PTHREADINFO ptiCurrent;
TRACE_CH(UserThread, "In AllocW32Thread(0x%p)\n", Thread);
/* Check that we were not called with an already existing Win32 thread info */
ptiCurrent = PsGetThreadWin32Thread(Thread);
if (ptiCurrent)
{
ERR_CH(UserThread, "PsGetThreadWin32Thread returned non-NULL thread info!!\n");
// return STATUS_SUCCESS;
}
/* Allocate a new Win32 thread info */
ptiCurrent = ExAllocatePoolWithTag(NonPagedPool,
sizeof(*ptiCurrent),
USERTAG_THREADINFO);
if (ptiCurrent == NULL)
{
ERR_CH(UserThread, "Failed to allocate pti for TID:0x%lx\n",
HandleToUlong(Thread->Cid.UniqueThread));
return STATUS_NO_MEMORY;
}
TRACE_CH(UserThread,"Allocated pti 0x%p for TID:0x%lx\n",
ptiCurrent, HandleToUlong(Thread->Cid.UniqueThread));
RtlZeroMemory(ptiCurrent, sizeof(*ptiCurrent));
PsSetThreadWin32Thread(Thread, ptiCurrent, NULL);
IntReferenceThreadInfo(ptiCurrent);
*W32Thread = ptiCurrent;
return STATUS_SUCCESS;
}
#define FreeW32Thread(/*Thread*/ W32Thread) \
do { \
/*PTHREADINFO W32Thread = PsGetThreadWin32Thread(Thread);*/ \
/*ASSERT(W32Thread);*/ \
IntDereferenceThreadInfo(W32Thread); \
} while(0)
/*
Called from IntDereferenceThreadInfo.
*/
VOID
UserDeleteW32Thread(PTHREADINFO pti)
{
PPROCESSINFO ppi = pti->ppi;
TRACE_CH(UserThread,"UserDeleteW32Thread pti 0x%p\n",pti);
/* Free the message queue */
if (pti->MessageQueue)
{
MsqDestroyMessageQueue(pti);
}
MsqCleanupThreadMsgs(pti);
ExFreePoolWithTag(pti, USERTAG_THREADINFO);
IntDereferenceProcessInfo(ppi);
}
NTSTATUS NTAPI
CreateThreadCallback(PETHREAD Thread)
{
PEPROCESS Process;
PCLIENTINFO pci; PCLIENTINFO pci;
PTHREADINFO ptiCurrent; PTHREADINFO ptiCurrent;
int i; int i;
@ -312,34 +430,24 @@ UserCreateThreadInfo(struct _ETHREAD *Thread)
Process = Thread->ThreadsProcess; Process = Thread->ThreadsProcess;
pTeb = NtCurrentTeb(); pTeb = NtCurrentTeb();
ASSERT(pTeb); ASSERT(pTeb);
ptiCurrent = ExAllocatePoolWithTag(NonPagedPool, /* Allocate a new Win32 thread info */
sizeof(THREADINFO), Status = AllocW32Thread(Thread, &ptiCurrent);
USERTAG_THREADINFO); if (!NT_SUCCESS(Status))
if (ptiCurrent == NULL)
{ {
ERR_CH(UserThread, "Failed to allocate pti for TID %p\n", Thread->Cid.UniqueThread); ERR_CH(UserThread, "Failed to allocate pti for TID:0x%lx\n",
return STATUS_NO_MEMORY; HandleToUlong(Thread->Cid.UniqueThread));
return Status;
} }
TRACE_CH(UserThread,"Create pti 0x%p eThread 0x%p\n", ptiCurrent, Thread);
RtlZeroMemory(ptiCurrent, sizeof(THREADINFO));
/* Initialize the THREADINFO */ /* Initialize the THREADINFO */
PsSetThreadWin32Thread(Thread, ptiCurrent, NULL);
IntReferenceThreadInfo(ptiCurrent);
ptiCurrent->pEThread = Thread; ptiCurrent->pEThread = Thread;
ptiCurrent->ppi = PsGetProcessWin32Process(Process); ptiCurrent->ppi = PsGetProcessWin32Process(Process);
IntReferenceProcessInfo(ptiCurrent->ppi); IntReferenceProcessInfo(ptiCurrent->ppi);
pTeb->Win32ThreadInfo = ptiCurrent; pTeb->Win32ThreadInfo = ptiCurrent;
ptiCurrent->pClientInfo = (PCLIENTINFO)pTeb->Win32ClientInfo; ptiCurrent->pClientInfo = (PCLIENTINFO)pTeb->Win32ClientInfo;
TRACE_CH(UserThread, "Allocated pti 0x%p for TID %p\n", ptiCurrent, Thread->Cid.UniqueThread);
InitializeListHead(&ptiCurrent->WindowListHead); InitializeListHead(&ptiCurrent->WindowListHead);
InitializeListHead(&ptiCurrent->W32CallbackListHead); InitializeListHead(&ptiCurrent->W32CallbackListHead);
InitializeListHead(&ptiCurrent->PostedMessagesListHead); InitializeListHead(&ptiCurrent->PostedMessagesListHead);
@ -378,7 +486,7 @@ UserCreateThreadInfo(struct _ETHREAD *Thread)
ptiCurrent->timeLast = LargeTickCount.u.LowPart; ptiCurrent->timeLast = LargeTickCount.u.LowPart;
ptiCurrent->MessageQueue = MsqCreateMessageQueue(ptiCurrent); ptiCurrent->MessageQueue = MsqCreateMessageQueue(ptiCurrent);
if(ptiCurrent->MessageQueue == NULL) if (ptiCurrent->MessageQueue == NULL)
{ {
ERR_CH(UserThread,"Failed to allocate message loop\n"); ERR_CH(UserThread,"Failed to allocate message loop\n");
Status = STATUS_NO_MEMORY; Status = STATUS_NO_MEMORY;
@ -428,11 +536,11 @@ UserCreateThreadInfo(struct _ETHREAD *Thread)
ProcessParams = pTeb->ProcessEnvironmentBlock->ProcessParameters; ProcessParams = pTeb->ProcessEnvironmentBlock->ProcessParameters;
Status = STATUS_UNSUCCESSFUL; Status = STATUS_UNSUCCESSFUL;
if(ProcessParams && ProcessParams->DesktopInfo.Length > 0) if (ProcessParams && ProcessParams->DesktopInfo.Length > 0)
{ {
Status = IntSafeCopyUnicodeStringTerminateNULL(&DesktopPath, &ProcessParams->DesktopInfo); Status = IntSafeCopyUnicodeStringTerminateNULL(&DesktopPath, &ProcessParams->DesktopInfo);
} }
if(!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
RtlInitUnicodeString(&DesktopPath, NULL); RtlInitUnicodeString(&DesktopPath, NULL);
} }
@ -445,13 +553,13 @@ UserCreateThreadInfo(struct _ETHREAD *Thread)
if (DesktopPath.Buffer) if (DesktopPath.Buffer)
ExFreePoolWithTag(DesktopPath.Buffer, TAG_STRING); ExFreePoolWithTag(DesktopPath.Buffer, TAG_STRING);
if(!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
ERR_CH(UserThread, "Failed to assign default dekstop and winsta to process\n"); ERR_CH(UserThread, "Failed to assign default dekstop and winsta to process\n");
goto error; goto error;
} }
if(!UserSetProcessWindowStation(hWinSta)) if (!UserSetProcessWindowStation(hWinSta))
{ {
Status = STATUS_UNSUCCESSFUL; Status = STATUS_UNSUCCESSFUL;
ERR_CH(UserThread,"Failed to set initial process winsta\n"); ERR_CH(UserThread,"Failed to set initial process winsta\n");
@ -460,7 +568,7 @@ UserCreateThreadInfo(struct _ETHREAD *Thread)
/* Validate the new desktop. */ /* Validate the new desktop. */
Status = IntValidateDesktopHandle(hDesk, UserMode, 0, &pdesk); Status = IntValidateDesktopHandle(hDesk, UserMode, 0, &pdesk);
if(!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
ERR_CH(UserThread,"Failed to validate initial desktop handle\n"); ERR_CH(UserThread,"Failed to validate initial desktop handle\n");
goto error; goto error;
@ -513,49 +621,26 @@ UserCreateThreadInfo(struct _ETHREAD *Thread)
return STATUS_SUCCESS; return STATUS_SUCCESS;
error: error:
ERR_CH(UserThread,"UserCreateThreadInfo failed! Freeing pti 0x%p for TID %p\n", ptiCurrent, Thread->Cid.UniqueThread); ERR_CH(UserThread,"CreateThreadCallback failed! Freeing pti 0x%p for TID:0x%lx\n",
UserDestroyThreadInfo(Thread); ptiCurrent, HandleToUlong(Thread->Cid.UniqueThread));
DestroyThreadCallback(Thread);
return Status; return Status;
} }
/*
Called from IntDereferenceThreadInfo.
*/
VOID
UserDeleteW32Thread(PTHREADINFO pti)
{
PPROCESSINFO ppi = pti->ppi;
TRACE_CH(UserThread,"UserDeleteW32Thread pti 0x%p\n",pti);
/* Free the message queue */
if (pti->MessageQueue)
{
MsqDestroyMessageQueue(pti);
}
MsqCleanupThreadMsgs(pti);
ExFreePoolWithTag(pti, USERTAG_THREADINFO);
IntDereferenceProcessInfo(ppi);
}
NTSTATUS NTSTATUS
NTAPI NTAPI
UserDestroyThreadInfo(struct _ETHREAD *Thread) DestroyThreadCallback(PETHREAD Thread)
{ {
PTHREADINFO *ppti; PTHREADINFO *ppti;
PSINGLE_LIST_ENTRY psle; PSINGLE_LIST_ENTRY psle;
PPROCESSINFO ppiCurrent; PPROCESSINFO ppiCurrent;
struct _EPROCESS *Process; PEPROCESS Process;
PTHREADINFO ptiCurrent; PTHREADINFO ptiCurrent;
Process = Thread->ThreadsProcess; Process = Thread->ThreadsProcess;
/* Get the Win32 Thread */ /* Get the Win32 Thread */
ptiCurrent = PsGetThreadWin32Thread(Thread); ptiCurrent = PsGetThreadWin32Thread(Thread);
ASSERT(ptiCurrent); ASSERT(ptiCurrent);
TRACE_CH(UserThread,"Destroying pti 0x%p eThread 0x%p\n", ptiCurrent, Thread); TRACE_CH(UserThread,"Destroying pti 0x%p eThread 0x%p\n", ptiCurrent, Thread);
@ -574,22 +659,22 @@ UserDestroyThreadInfo(struct _ETHREAD *Thread)
/* Decrement thread count and check if its 0 */ /* Decrement thread count and check if its 0 */
ppiCurrent->cThreads--; ppiCurrent->cThreads--;
if(ptiCurrent->TIF_flags & TIF_GUITHREADINITIALIZED) if (ptiCurrent->TIF_flags & TIF_GUITHREADINITIALIZED)
{ {
/* Do now some process cleanup that requires a valid win32 thread */ /* Do now some process cleanup that requires a valid win32 thread */
if(ptiCurrent->ppi->cThreads == 0) if (ptiCurrent->ppi->cThreads == 0)
{ {
/* Check if we have registered the user api hook */ /* Check if we have registered the user api hook */
if(ptiCurrent->ppi == ppiUahServer) if (ptiCurrent->ppi == ppiUahServer)
{ {
/* Unregister the api hook */ /* Unregister the api hook */
UserUnregisterUserApiHook(); UserUnregisterUserApiHook();
} }
/* Notify logon application to restart shell if needed */ /* Notify logon application to restart shell if needed */
if(ptiCurrent->pDeskInfo) if (ptiCurrent->pDeskInfo)
{ {
if(ptiCurrent->pDeskInfo->ppiShellProcess == ppiCurrent) if (ptiCurrent->pDeskInfo->ppiShellProcess == ppiCurrent)
{ {
DWORD ExitCode = PsGetProcessExitStatus(Process); DWORD ExitCode = PsGetProcessExitStatus(Process);
@ -687,35 +772,35 @@ UserDestroyThreadInfo(struct _ETHREAD *Thread)
ptiCurrent->hEventQueueClient = NULL; ptiCurrent->hEventQueueClient = NULL;
/* The thread is dying */ /* The thread is dying */
PsSetThreadWin32Thread(ptiCurrent->pEThread, NULL, ptiCurrent); PsSetThreadWin32Thread(Thread /*ptiCurrent->pEThread*/, NULL, ptiCurrent);
ptiCurrent->pEThread = NULL; ptiCurrent->pEThread = NULL;
/* Free the THREADINFO */ /* Free the THREADINFO */
IntDereferenceThreadInfo(ptiCurrent); FreeW32Thread(/*Thread*/ ptiCurrent); // IntDereferenceThreadInfo(ptiCurrent);
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
NTSTATUS NTSTATUS
APIENTRY APIENTRY
Win32kThreadCallback(struct _ETHREAD *Thread, Win32kThreadCallback(PETHREAD Thread,
PSW32THREADCALLOUTTYPE Type) PSW32THREADCALLOUTTYPE Type)
{ {
NTSTATUS Status; NTSTATUS Status;
UserEnterExclusive();
ASSERT(NtCurrentTeb()); ASSERT(NtCurrentTeb());
UserEnterExclusive();
if (Type == PsW32ThreadCalloutInitialize) if (Type == PsW32ThreadCalloutInitialize)
{ {
ASSERT(PsGetThreadWin32Thread(Thread) == NULL); ASSERT(PsGetThreadWin32Thread(Thread) == NULL);
Status = UserCreateThreadInfo(Thread); Status = CreateThreadCallback(Thread);
} }
else else
{ {
ASSERT(PsGetThreadWin32Thread(Thread) != NULL); ASSERT(PsGetThreadWin32Thread(Thread) != NULL);
Status = UserDestroyThreadInfo(Thread); Status = DestroyThreadCallback(Thread);
} }
UserLeave(); UserLeave();

View file

@ -123,7 +123,7 @@ UserInitialize(VOID)
// { // {
/* Initialize the current thread */ /* Initialize the current thread */
Status = UserCreateThreadInfo(PsGetCurrentThread()); Status = CreateThreadCallback(PsGetCurrentThread());
if (!NT_SUCCESS(Status)) return Status; if (!NT_SUCCESS(Status)) return Status;
// } // }

View file

@ -42,7 +42,7 @@ PWND FASTCALL IntGetWindowObject(HWND hWnd);
/*************** MAIN.C ***************/ /*************** MAIN.C ***************/
NTSTATUS NTAPI UserCreateThreadInfo(struct _ETHREAD *Thread); NTSTATUS NTAPI CreateThreadCallback(PETHREAD Thread);
/*************** WINSTA.C ***************/ /*************** WINSTA.C ***************/

View file

@ -216,7 +216,7 @@ ClientThreadSetupHelper(BOOL IsCallback)
{ {
/* /*
* Normally we are called by win32k so the win32 thread pointers * Normally we are called by win32k so the win32 thread pointers
* should be valid as they are set in win32k::UserCreateThreadInfo. * should be valid as they are set in win32k::CreateThreadCallback.
*/ */
PCLIENTINFO ClientInfo = GetWin32ClientInfo(); PCLIENTINFO ClientInfo = GetWin32ClientInfo();
BOOLEAN IsFirstThread = _InterlockedExchange8((PCHAR)&gfFirstThread, FALSE); BOOLEAN IsFirstThread = _InterlockedExchange8((PCHAR)&gfFirstThread, FALSE);