X-Git-Url: http://git.jankratochvil.net/?a=blobdiff_plain;f=ntoskrnl%2Fps%2Fcreate.c;h=3eacb2968dbbaf429d49220e54e613bb4c7ecb5b;hb=refs%2Ftags%2Fcaptive-0_8;hp=0c0711291c10c4113affed8f6810d8d83d2d0e20;hpb=569875a61758c7ea252562281ac4d95dce52f252;p=reactos.git diff --git a/ntoskrnl/ps/create.c b/ntoskrnl/ps/create.c index 0c07112..3eacb29 100644 --- a/ntoskrnl/ps/create.c +++ b/ntoskrnl/ps/create.c @@ -283,7 +283,6 @@ PsReferenceImpersonationToken(PETHREAD Thread, VOID PiBeforeBeginThread(CONTEXT c) { - DPRINT("PiBeforeBeginThread(Eip %x)\n", c.Eip); KeLowerIrql(PASSIVE_LEVEL); } @@ -388,7 +387,7 @@ PsInitializeThread(HANDLE ProcessHandle, KeInitializeSpinLock(&Thread->ActiveTimerListLock); InitializeListHead(&Thread->IrpList); Thread->Cid.UniqueThread = (HANDLE)InterlockedIncrement( - &PiNextThreadUniqueId); + (LONG *)&PiNextThreadUniqueId); Thread->Cid.UniqueProcess = (HANDLE)Thread->ThreadsProcess->UniqueProcessId; Thread->DeadThread = 0; Thread->Win32Thread = 0; @@ -421,7 +420,7 @@ static NTSTATUS PsCreateTeb(HANDLE ProcessHandle, PTEB *TebPtr, PETHREAD Thread, - PINITIAL_TEB InitialTeb) + PUSER_STACK UserStack) { MEMORY_BASIC_INFORMATION Info; NTSTATUS Status; @@ -469,6 +468,7 @@ PsCreateTeb(HANDLE ProcessHandle, DPRINT ("TebBase %p TebSize %lu\n", TebBase, TebSize); + RtlZeroMemory(&Teb, sizeof(TEB)); /* set all pointers to and from the TEB */ Teb.Tib.Self = TebBase; if (Thread->ThreadsProcess) @@ -477,13 +477,24 @@ PsCreateTeb(HANDLE ProcessHandle, } DPRINT("Teb.Peb %x\n", Teb.Peb); - /* store stack information from InitialTeb */ - if (InitialTeb != NULL) - { - Teb.Tib.StackBase = InitialTeb->StackBase; - Teb.Tib.StackLimit = InitialTeb->StackLimit; - Teb.DeallocationStack = InitialTeb->StackAllocate; - } + /* store stack information from UserStack */ + if(UserStack != NULL) + { + /* fixed-size stack */ + if(UserStack->FixedStackBase && UserStack->FixedStackLimit) + { + Teb.Tib.StackBase = UserStack->FixedStackBase; + Teb.Tib.StackLimit = UserStack->FixedStackLimit; + Teb.DeallocationStack = UserStack->FixedStackLimit; + } + /* expandable stack */ + else + { + Teb.Tib.StackBase = UserStack->ExpandableStackBase; + Teb.Tib.StackLimit = UserStack->ExpandableStackLimit; + Teb.DeallocationStack = UserStack->ExpandableStackBottom; + } + } /* more initialization */ Teb.Cid.UniqueThread = Thread->Cid.UniqueThread; @@ -549,7 +560,7 @@ NtCreateThread(PHANDLE ThreadHandle, HANDLE ProcessHandle, PCLIENT_ID Client, PCONTEXT ThreadContext, - PINITIAL_TEB InitialTeb, + PUSER_STACK UserStack, BOOLEAN CreateSuspended) { PETHREAD Thread; @@ -580,7 +591,7 @@ NtCreateThread(PHANDLE ThreadHandle, Status = PsCreateTeb(ProcessHandle, &TebBase, Thread, - InitialTeb); + UserStack); if (!NT_SUCCESS(Status)) { return(Status);