mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 01:24:38 +00:00
Removed fixed stack base address
svn path=/trunk/; revision=1559
This commit is contained in:
parent
6579aafa03
commit
42d7089e72
3 changed files with 10 additions and 19 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $Id: create.c,v 1.32 2001/01/21 00:07:03 phreak Exp $
|
||||
/* $Id: create.c,v 1.33 2001/01/23 09:58:12 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -123,7 +123,6 @@ CreateProcessA (
|
|||
return Result;
|
||||
}
|
||||
|
||||
#define STACK_TOP (0xb0000000)
|
||||
|
||||
HANDLE STDCALL KlCreateFirstThread(HANDLE ProcessHandle,
|
||||
LPSECURITY_ATTRIBUTES lpThreadAttributes,
|
||||
|
@ -159,8 +158,8 @@ HANDLE STDCALL KlCreateFirstThread(HANDLE ProcessHandle,
|
|||
else
|
||||
CreateSuspended = FALSE;
|
||||
|
||||
|
||||
BaseAddress = (PVOID)(STACK_TOP - dwStackSize);
|
||||
/* Allocate thread stack */
|
||||
BaseAddress = NULL;
|
||||
Status = NtAllocateVirtualMemory(ProcessHandle,
|
||||
&BaseAddress,
|
||||
0,
|
||||
|
@ -180,7 +179,7 @@ HANDLE STDCALL KlCreateFirstThread(HANDLE ProcessHandle,
|
|||
ThreadContext.SegDs = USER_DS;
|
||||
ThreadContext.SegCs = USER_CS;
|
||||
ThreadContext.SegSs = USER_DS;
|
||||
ThreadContext.Esp = STACK_TOP - 20;
|
||||
ThreadContext.Esp = (ULONG)(BaseAddress + dwStackSize - 20);
|
||||
ThreadContext.EFlags = (1<<1) + (1<<9);
|
||||
|
||||
DPRINT("ThreadContext.Eip %x\n",ThreadContext.Eip);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: process.c,v 1.23 2000/12/28 20:38:27 ekohl Exp $
|
||||
/* $Id: process.c,v 1.24 2001/01/23 09:57:42 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -23,8 +23,6 @@
|
|||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
#define STACK_TOP (0xb0000000)
|
||||
|
||||
HANDLE STDCALL KlCreateFirstThread(HANDLE ProcessHandle,
|
||||
ULONG StackSize,
|
||||
LPTHREAD_START_ROUTINE lpStartAddress,
|
||||
|
@ -44,7 +42,7 @@ HANDLE STDCALL KlCreateFirstThread(HANDLE ProcessHandle,
|
|||
ObjectAttributes.Attributes = 0;
|
||||
ObjectAttributes.SecurityQualityOfService = NULL;
|
||||
|
||||
BaseAddress = (PVOID)(STACK_TOP - StackSize);
|
||||
BaseAddress = NULL;
|
||||
Status = NtAllocateVirtualMemory(ProcessHandle,
|
||||
&BaseAddress,
|
||||
0,
|
||||
|
@ -65,7 +63,7 @@ HANDLE STDCALL KlCreateFirstThread(HANDLE ProcessHandle,
|
|||
ThreadContext.SegDs = USER_DS;
|
||||
ThreadContext.SegCs = USER_CS;
|
||||
ThreadContext.SegSs = USER_DS;
|
||||
ThreadContext.Esp = STACK_TOP - 20;
|
||||
ThreadContext.Esp = (ULONG)BaseAddress + StackSize - 20;
|
||||
ThreadContext.EFlags = (1<<1) + (1<<9);
|
||||
|
||||
DPRINT("ThreadContext.Eip %x\n",ThreadContext.Eip);
|
||||
|
|
|
@ -30,10 +30,6 @@
|
|||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
/* GLOBALS *******************************************************************/
|
||||
|
||||
#define STACK_TOP (0xb0000000)
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
/*
|
||||
|
@ -157,16 +153,14 @@ NTSTATUS LdrLoadInitialProcess (VOID)
|
|||
Peb->ImageBaseAddress);
|
||||
NTHeaders = RtlImageNtHeader(Peb->ImageBaseAddress);
|
||||
DPRINT("NTHeaders %x\n", NTHeaders);
|
||||
StackBase = (PVOID)
|
||||
(STACK_TOP - NTHeaders->OptionalHeader.SizeOfStackReserve);
|
||||
DPRINT("StackBase %x\n", StackBase);
|
||||
StackSize = NTHeaders->OptionalHeader.SizeOfStackReserve;
|
||||
DPRINT("StackSize %x\n", StackSize);
|
||||
KeDetachProcess();
|
||||
DPRINT("Dereferencing process\n");
|
||||
// ObDereferenceObject(Process);
|
||||
|
||||
DPRINT("Stack size %x\n", StackSize);
|
||||
StackBase = (PVOID)NULL;
|
||||
DPRINT("StackBase %x StackSize %x\n", StackBase, StackSize);
|
||||
DPRINT("Allocating virtual memory\n");
|
||||
Status = ZwAllocateVirtualMemory(ProcessHandle,
|
||||
(PVOID*)&StackBase,
|
||||
|
@ -194,7 +188,7 @@ NTSTATUS LdrLoadInitialProcess (VOID)
|
|||
*/
|
||||
memset(&Context,0,sizeof(CONTEXT));
|
||||
Context.SegSs = USER_DS;
|
||||
Context.Esp = STACK_TOP - 20;
|
||||
Context.Esp = (ULONG)StackBase + StackSize - 20;
|
||||
Context.EFlags = 0x202;
|
||||
Context.SegCs = USER_CS;
|
||||
Context.Eip = (ULONG)LdrStartupAddr;
|
||||
|
|
Loading…
Reference in a new issue