diff --git a/reactos/include/ntdll/rtl.h b/reactos/include/ntdll/rtl.h index f2b8afdcc7c..a9df15d4004 100644 --- a/reactos/include/ntdll/rtl.h +++ b/reactos/include/ntdll/rtl.h @@ -1,10 +1,31 @@ -/* $Id: rtl.h,v 1.10 2000/02/19 19:33:28 ekohl Exp $ +/* $Id: rtl.h,v 1.11 2000/02/25 23:57:21 ekohl Exp $ * */ -VOID WINAPI __RtlInitHeap(PVOID base, - ULONG minsize, - ULONG maxsize); + +/* + * Preliminary data type!! + * + * This definition is not finished yet. It will change in the future. + */ +typedef struct _RTL_USER_PROCESS_INFO +{ + ULONG Unknown1; // 0x00 + HANDLE ProcessHandle; // 0x04 + HANDLE ThreadHandle; // 0x08 + CLIENT_ID ClientId; // 0x0C + ULONG Unknown5; // 0x14 + LONG StackZeroBits; // 0x18 + LONG StackReserved; // 0x1C + LONG StackCommit; // 0x20 + ULONG Unknown9; // 0x24 +// more data ... ??? +} RTL_USER_PROCESS_INFO, *PRTL_USER_PROCESS_INFO; + + +//VOID WINAPI __RtlInitHeap(PVOID base, +// ULONG minsize, +// ULONG maxsize); #define HEAP_BASE (0xa0000000) @@ -177,15 +198,15 @@ NTSTATUS STDCALL RtlCreateUserProcess ( PUNICODE_STRING CommandLine, - ULONG Unknown1, - PRTL_USER_PROCESS_PARAMETERS ProcessParameters, + ULONG Unknown2, + PRTL_USER_PROCESS_PARAMETERS ProcessParameters, // verified PSECURITY_DESCRIPTOR ProcessSd, PSECURITY_DESCRIPTOR ThreadSd, WINBOOL bInheritHandles, DWORD dwCreationFlags, - PCLIENT_ID ClientId, - PHANDLE ProcessHandle, - PHANDLE ThreadHandle + ULONG Unknown8, + ULONG Unknown9, + PRTL_USER_PROCESS_INFO ProcessInfo // verified ); NTSTATUS diff --git a/reactos/lib/ntdll/rtl/process.c b/reactos/lib/ntdll/rtl/process.c index 439f724427c..bf17e1e7594 100644 --- a/reactos/lib/ntdll/rtl/process.c +++ b/reactos/lib/ntdll/rtl/process.c @@ -1,4 +1,4 @@ -/* $Id: process.c,v 1.15 2000/02/19 19:34:49 ekohl Exp $ +/* $Id: process.c,v 1.16 2000/02/25 23:58:03 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries @@ -98,7 +98,9 @@ HANDLE STDCALL KlCreateFirstThread(HANDLE ProcessHandle, return(ThreadHandle); } -static NTSTATUS RtlpMapFile(PUNICODE_STRING ApplicationName, +static NTSTATUS RtlpMapFile( +PRTL_USER_PROCESS_PARAMETERS Ppb, +//PUNICODE_STRING ApplicationName, PHANDLE Section) { HANDLE hFile; @@ -109,12 +111,17 @@ static NTSTATUS RtlpMapFile(PUNICODE_STRING ApplicationName, hFile = NULL; + RtlDeNormalizeProcessParams (Ppb); + InitializeObjectAttributes(&ObjectAttributes, - ApplicationName, +// ApplicationName, + &(Ppb->ImagePathName), OBJ_CASE_INSENSITIVE, NULL, SecurityDescriptor); + RtlNormalizeProcessParams (Ppb); + /* * Try to open the executable */ @@ -245,16 +252,20 @@ static NTSTATUS KlInitPeb (HANDLE ProcessHandle, return(STATUS_SUCCESS); } -NTSTATUS STDCALL RtlCreateUserProcess(PUNICODE_STRING CommandLine, - ULONG Unknown1, - PRTL_USER_PROCESS_PARAMETERS Ppb, - PSECURITY_DESCRIPTOR ProcessSd, - PSECURITY_DESCRIPTOR ThreadSd, - WINBOOL bInheritHandles, - DWORD dwCreationFlags, - PCLIENT_ID ClientId, - PHANDLE ProcessHandle, - PHANDLE ThreadHandle) +NTSTATUS +STDCALL +RtlCreateUserProcess ( + PUNICODE_STRING CommandLine, // verified + ULONG Unknown2, + PRTL_USER_PROCESS_PARAMETERS Ppb, // verified + PSECURITY_DESCRIPTOR ProcessSd, + PSECURITY_DESCRIPTOR ThreadSd, + WINBOOL bInheritHandles, + DWORD dwCreationFlags, + ULONG Unknown8, + ULONG Unknown9, + PRTL_USER_PROCESS_INFO ProcessInfo // verified + ) { HANDLE hSection; HANDLE hThread; @@ -263,16 +274,17 @@ NTSTATUS STDCALL RtlCreateUserProcess(PUNICODE_STRING CommandLine, PROCESS_BASIC_INFORMATION ProcessBasicInfo; ULONG retlen; - DPRINT("CreateProcessW(CommandLine '%w')\n", CommandLine->Buffer); + DPRINT("RtlCreateUserProcess\n"); - Status = RtlpMapFile(CommandLine, +// Status = RtlpMapFile(CommandLine, + Status = RtlpMapFile(Ppb, &hSection); /* * Create a new process */ - Status = NtCreateProcess(ProcessHandle, + Status = NtCreateProcess(&(ProcessInfo->ProcessHandle), PROCESS_ALL_ACCESS, NULL, NtCurrentProcess(), @@ -289,23 +301,20 @@ NTSTATUS STDCALL RtlCreateUserProcess(PUNICODE_STRING CommandLine, * Get some information about the process */ - ZwQueryInformationProcess(*ProcessHandle, + ZwQueryInformationProcess(ProcessInfo->ProcessHandle, ProcessBasicInformation, &ProcessBasicInfo, sizeof(ProcessBasicInfo), &retlen); DPRINT("ProcessBasicInfo.UniqueProcessId %d\n", ProcessBasicInfo.UniqueProcessId); - if (ClientId != NULL) - { - ClientId->UniqueProcess = (HANDLE)ProcessBasicInfo.UniqueProcessId; - } + ProcessInfo->ClientId.UniqueProcess = (HANDLE)ProcessBasicInfo.UniqueProcessId; /* * Create Process Environment Block */ DPRINT("Creating peb\n"); - KlInitPeb(*ProcessHandle, Ppb); + KlInitPeb(ProcessInfo->ProcessHandle, Ppb); DPRINT("Creating thread for process\n"); lpStartAddress = (LPTHREAD_START_ROUTINE) @@ -313,12 +322,12 @@ NTSTATUS STDCALL RtlCreateUserProcess(PUNICODE_STRING CommandLine, AddressOfEntryPoint + ((PIMAGE_OPTIONAL_HEADER)OPTHDROFFSET(NTDLL_BASE))->ImageBase; - hThread = KlCreateFirstThread(*ProcessHandle, + hThread = KlCreateFirstThread(ProcessInfo->ProcessHandle, // Headers.OptionalHeader.SizeOfStackReserve, 0x200000, lpStartAddress, dwCreationFlags, - ClientId); + &(ProcessInfo->ClientId)); if (hThread == NULL) { DPRINT("Failed to create thread\n"); diff --git a/reactos/subsys/smss/init.c b/reactos/subsys/smss/init.c index 8e8bf8c4673..e1c768c64c0 100644 --- a/reactos/subsys/smss/init.c +++ b/reactos/subsys/smss/init.c @@ -1,4 +1,4 @@ -/* $Id: init.c,v 1.13 2000/02/21 22:43:15 ekohl Exp $ +/* $Id: init.c,v 1.14 2000/02/25 23:58:57 ekohl Exp $ * * init.c - Session Manager initialization * @@ -33,6 +33,8 @@ #define NDEBUG +/* uncomment to run csrss.exe */ +//#define RUN_CSRSS /* GLOBAL VARIABLES *********************************************************/ @@ -126,6 +128,7 @@ InitSessionManager ( UNICODE_STRING CmdLineW; UNICODE_STRING CurrentDirectoryW; PRTL_USER_PROCESS_PARAMETERS ProcessParameters; + RTL_USER_PROCESS_INFO ProcessInfo; /* Create the "\SmApiPort" object (LPC) */ RtlInitUnicodeString (&UnicodeString, @@ -191,18 +194,19 @@ InitSessionManager ( /* FIXME: Load the well known DLLs */ - /* Create paging files */ #if 0 + /* Create paging files */ SmCreatePagingFiles (); #endif +#if 0 /* Load missing registry hives */ -// NtInitializeRegistry (FALSE); + NtInitializeRegistry (FALSE); +#endif /* Set environment variables from registry */ SmSetEnvironmentVariables (); -//#if 0 /* Load the kernel mode driver win32k.sys */ RtlInitUnicodeString (&CmdLineW, L"\\??\\C:\\reactos\\system32\\drivers\\win32k.sys"); @@ -212,9 +216,8 @@ InitSessionManager ( { return FALSE; } -//#endif -#if 0 +#ifdef RUN_CSRSS /* Start the Win32 subsystem (csrss.exe) */ DisplayString (L"SM: Executing csrss.exe\n"); @@ -243,17 +246,19 @@ InitSessionManager ( NULL, FALSE, 0, - NULL, - &Children[CHILD_CSRSS], - NULL); + 0, + 0, + &ProcessInfo); + + RtlDestroyProcessParameters (ProcessParameters); + if (!NT_SUCCESS(Status)) { DisplayString (L"SM: Loading csrss.exe failed!\n"); return FALSE; } - - RtlDestroyProcessParameters (ProcessParameters); -#endif + Children[CHILD_CSRSS] = ProcessInfo.ProcessHandle; +#endif /* RUN_CSRSS */ /* Start the simple shell (shell.exe) */ @@ -262,7 +267,8 @@ InitSessionManager ( L"\\??\\C:\\reactos\\system32\\shell.exe"); #if 0 /* Start the logon process (winlogon.exe) */ - RtlInitUnicodeString (&CmdLineW, + DisplayString (L"SM: Running winlogon\n"); + RtlInitUnicodeString (&UnicodeString, L"\\??\\C:\\reactos\\system32\\winlogon.exe"); #endif @@ -289,9 +295,9 @@ InitSessionManager ( NULL, FALSE, 0, - NULL, - &Children[CHILD_WINLOGON], - NULL); + 0, + 0, + &ProcessInfo); RtlDestroyProcessParameters (ProcessParameters); @@ -304,6 +310,7 @@ InitSessionManager ( #endif return FALSE; } + Children[CHILD_WINLOGON] = ProcessInfo.ProcessHandle; /* Create the \DbgSsApiPort object (LPC) */ RtlInitUnicodeString (&UnicodeString,