mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
2003-03-16 Casper S. Hornstrup <chorns@users.sourceforge.net>
* include/ntos/rtltypes.h (PRTL_BASE_PROCESS_START_ROUTINE): Define. * lib/kernel32/process/create.c (RtlBaseProcessStartRoutine): Import. (KlCreateFirstThread): Support images with native subsystem ID. * lib/ntdll/def/ntdll.def (RtlBaseProcessStartRoutine): Export. * lib/ntdll/def/ntdll.edf (RtlBaseProcessStartRoutine): Ditto. * lib/ntdll/rtl/exception.c (RtlBaseProcessStart): Forward declare. (RtlBaseProcessStartRoutine, RtlBaseProcessStart): Add. svn path=/trunk/; revision=4317
This commit is contained in:
parent
4f23f4eae4
commit
77eee7ca44
6 changed files with 64 additions and 19 deletions
|
@ -1,3 +1,13 @@
|
|||
2003-03-16 Casper S. Hornstrup <chorns@users.sourceforge.net>
|
||||
|
||||
* include/ntos/rtltypes.h (PRTL_BASE_PROCESS_START_ROUTINE): Define.
|
||||
* lib/kernel32/process/create.c (RtlBaseProcessStartRoutine): Import.
|
||||
(KlCreateFirstThread): Support images with native subsystem ID.
|
||||
* lib/ntdll/def/ntdll.def (RtlBaseProcessStartRoutine): Export.
|
||||
* lib/ntdll/def/ntdll.edf (RtlBaseProcessStartRoutine): Ditto.
|
||||
* lib/ntdll/rtl/exception.c (RtlBaseProcessStart): Forward declare.
|
||||
(RtlBaseProcessStartRoutine, RtlBaseProcessStart): Add.
|
||||
|
||||
2003-03-16 Casper S. Hornstrup <chorns@users.sourceforge.net>
|
||||
|
||||
* include/defines.h (VS_FFI_SIGNATURE, VS_FFI_STRUCVERSION): Define.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: rtltypes.h,v 1.3 2002/11/25 15:47:52 robd Exp $
|
||||
/* $Id: rtltypes.h,v 1.4 2003/03/16 14:16:54 chorns Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -220,4 +220,8 @@ typedef struct _RTL_MESSAGE_RESOURCE_DATA
|
|||
RTL_MESSAGE_RESOURCE_BLOCK Blocks[1];
|
||||
} RTL_MESSAGE_RESOURCE_DATA, *PRTL_MESSAGE_RESOURCE_DATA;
|
||||
|
||||
typedef VOID STDCALL
|
||||
(*PRTL_BASE_PROCESS_START_ROUTINE)(PTHREAD_START_ROUTINE StartAddress,
|
||||
PVOID Parameter);
|
||||
|
||||
#endif /* __DDK_RTLTYPES_H */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: create.c,v 1.62 2003/03/09 21:38:40 hbirr Exp $
|
||||
/* $Id: create.c,v 1.63 2003/03/16 14:16:54 chorns Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -18,6 +18,9 @@
|
|||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
__declspec(dllimport)
|
||||
PRTL_BASE_PROCESS_START_ROUTINE RtlBaseProcessStartRoutine;
|
||||
|
||||
WINBOOL STDCALL
|
||||
CreateProcessA (LPCSTR lpApplicationName,
|
||||
LPSTR lpCommandLine,
|
||||
|
@ -217,8 +220,7 @@ BaseProcessStart(LPTHREAD_START_ROUTINE lpStartAddress,
|
|||
HANDLE STDCALL
|
||||
KlCreateFirstThread(HANDLE ProcessHandle,
|
||||
LPSECURITY_ATTRIBUTES lpThreadAttributes,
|
||||
ULONG StackReserve,
|
||||
ULONG StackCommit,
|
||||
PSECTION_IMAGE_INFORMATION Sii,
|
||||
LPTHREAD_START_ROUTINE lpStartAddress,
|
||||
DWORD dwCreationFlags,
|
||||
LPDWORD lpThreadId)
|
||||
|
@ -232,6 +234,7 @@ KlCreateFirstThread(HANDLE ProcessHandle,
|
|||
BOOLEAN CreateSuspended = FALSE;
|
||||
ULONG OldPageProtection;
|
||||
ULONG ResultLength;
|
||||
ULONG ThreadStartAddress;
|
||||
ULONG InitialStack[6];
|
||||
|
||||
ObjectAttributes.Length = sizeof(OBJECT_ATTRIBUTES);
|
||||
|
@ -252,10 +255,10 @@ KlCreateFirstThread(HANDLE ProcessHandle,
|
|||
else
|
||||
CreateSuspended = FALSE;
|
||||
|
||||
InitialTeb.StackReserve = (StackReserve < 0x100000) ? 0x100000 : StackReserve;
|
||||
InitialTeb.StackReserve = (Sii->StackReserve < 0x100000) ? 0x100000 : Sii->StackReserve;
|
||||
/* FIXME: use correct commit size */
|
||||
#if 0
|
||||
InitialTeb.StackCommit = (StackCommit < PAGE_SIZE) ? PAGE_SIZE : StackCommit;
|
||||
InitialTeb.StackCommit = (Sii->StackCommit < PAGE_SIZE) ? PAGE_SIZE : Sii->StackCommit;
|
||||
#endif
|
||||
InitialTeb.StackCommit = InitialTeb.StackReserve - PAGE_SIZE;
|
||||
|
||||
|
@ -274,7 +277,7 @@ KlCreateFirstThread(HANDLE ProcessHandle,
|
|||
{
|
||||
DPRINT("Error reserving stack space!\n");
|
||||
SetLastErrorByStatus(Status);
|
||||
return(NULL);
|
||||
return(INVALID_HANDLE_VALUE);
|
||||
}
|
||||
|
||||
DPRINT("StackAllocate: %p ReserveSize: 0x%lX\n",
|
||||
|
@ -328,8 +331,17 @@ KlCreateFirstThread(HANDLE ProcessHandle,
|
|||
return(INVALID_HANDLE_VALUE);
|
||||
}
|
||||
|
||||
if (Sii->Subsystem != IMAGE_SUBSYSTEM_NATIVE)
|
||||
{
|
||||
ThreadStartAddress = (ULONG) BaseProcessStart;
|
||||
}
|
||||
else
|
||||
{
|
||||
ThreadStartAddress = (ULONG) RtlBaseProcessStartRoutine;
|
||||
}
|
||||
|
||||
memset(&ThreadContext,0,sizeof(CONTEXT));
|
||||
ThreadContext.Eip = (ULONG)BaseProcessStart;
|
||||
ThreadContext.Eip = ThreadStartAddress;
|
||||
ThreadContext.SegGs = USER_DS;
|
||||
ThreadContext.SegFs = USER_DS;
|
||||
ThreadContext.SegEs = USER_DS;
|
||||
|
@ -738,7 +750,6 @@ CreateProcessW(LPCWSTR lpApplicationName,
|
|||
TempCurrentDirectoryW);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Create a section for the executable
|
||||
*/
|
||||
|
@ -1080,11 +1091,11 @@ CreateProcessW(LPCWSTR lpApplicationName,
|
|||
/*
|
||||
* Create the thread for the kernel
|
||||
*/
|
||||
DPRINT("Creating thread for process\n");
|
||||
DPRINT("Creating thread for process (EntryPoint = 0x%.08x)\n",
|
||||
ImageBaseAddress + (ULONG)Sii.EntryPoint);
|
||||
hThread = KlCreateFirstThread(hProcess,
|
||||
lpThreadAttributes,
|
||||
Sii.StackReserve,
|
||||
Sii.StackCommit,
|
||||
&Sii,
|
||||
ImageBaseAddress + (ULONG)Sii.EntryPoint,
|
||||
dwCreationFlags,
|
||||
&lpProcessInformation->dwThreadId);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; $Id: ntdll.def,v 1.92 2003/02/16 18:54:26 hbirr Exp $
|
||||
; $Id: ntdll.def,v 1.93 2003/03/16 14:16:54 chorns Exp $
|
||||
;
|
||||
; ReactOS Operating System
|
||||
;
|
||||
|
@ -302,6 +302,7 @@ RtlAreAnyAccessesGranted@8
|
|||
RtlAreBitsClear@12
|
||||
RtlAreBitsSet@12
|
||||
RtlAssert@16
|
||||
RtlBaseProcessStartRoutine DATA
|
||||
;RtlCaptureStackBackTrace
|
||||
RtlCharToInteger@12
|
||||
RtlCheckRegistryKey@8
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; $Id: ntdll.edf,v 1.81 2003/02/16 18:54:26 hbirr Exp $
|
||||
; $Id: ntdll.edf,v 1.82 2003/03/16 14:16:54 chorns Exp $
|
||||
;
|
||||
; ReactOS Operating System
|
||||
;
|
||||
|
@ -302,6 +302,7 @@ RtlAreAnyAccessesGranted=RtlAreAnyAccessesGranted@8
|
|||
RtlAreBitsClear=RtlAreBitsClear@12
|
||||
RtlAreBitsSet=RtlAreBitsSet@12
|
||||
RtlAssert=RtlAssert@16
|
||||
RtlBaseProcessStartRoutine DATA
|
||||
;RtlCaptureStackBackTrace
|
||||
RtlCharToInteger=RtlCharToInteger@12
|
||||
RtlCheckRegistryKey=RtlCheckRegistryKey@8
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: exception.c,v 1.11 2002/10/26 00:32:18 chorns Exp $
|
||||
/* $Id: exception.c,v 1.12 2003/03/16 14:16:54 chorns Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -18,6 +18,13 @@
|
|||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
|
||||
VOID STDCALL
|
||||
RtlBaseProcessStart(PTHREAD_START_ROUTINE StartAddress,
|
||||
PVOID Parameter);
|
||||
|
||||
__declspec(dllexport)
|
||||
PRTL_BASE_PROCESS_START_ROUTINE RtlBaseProcessStartRoutine = RtlBaseProcessStart;
|
||||
|
||||
ULONG
|
||||
RtlpDispatchException(IN PEXCEPTION_RECORD ExceptionRecord,
|
||||
IN PCONTEXT Context);
|
||||
|
@ -54,4 +61,15 @@ RtlRaiseException(PEXCEPTION_RECORD ExceptionRecord)
|
|||
DbgPrint("RtlRaiseException()");
|
||||
}
|
||||
|
||||
VOID STDCALL
|
||||
RtlBaseProcessStart(PTHREAD_START_ROUTINE StartAddress,
|
||||
PVOID Parameter)
|
||||
{
|
||||
NTSTATUS ExitStatus = STATUS_SUCCESS;
|
||||
|
||||
ExitStatus = (NTSTATUS) (StartAddress)(Parameter);
|
||||
|
||||
NtTerminateProcess(NtCurrentProcess(), ExitStatus);
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
Loading…
Reference in a new issue