KeRaiseIrql(APC_LEVEL, &OldIrql);
/* Queue the User APC */
- KiInitializeUserApc(NULL,
- (PVOID)((ULONG_PTR)Thread->Tcb.InitialStack -
- sizeof(KTRAP_FRAME) -
- SIZEOF_FX_SAVE_AREA),
+ KiInitializeUserApc(KeGetExceptionFrame(&Thread->Tcb),
+ KeGetTrapFrame(&Thread->Tcb),
PspSystemDllEntryPoint,
NULL,
PspSystemDllBase,
if (ThreadContext)
{
/* User-mode Thread, create Teb */
- TebBase = MmCreateTeb(Process, &Thread->Cid, InitialTeb);
- if (!TebBase)
+ Status = MmCreateTeb(Process, &Thread->Cid, InitialTeb, &TebBase);
+ if (!NT_SUCCESS(Status))
{
/* Failed to create the TEB. Release rundown and dereference */
ExReleaseRundownProtection(&Process->RundownProtect);
ObDereferenceObject(Thread);
- return STATUS_INSUFFICIENT_RESOURCES;
+ return Status;
}
/* Set the Start Addresses */