- Remove unused ldr/userldr.c
- Rename LdrLoadInitialProcess to Exp... and move to executive initialization.
- Removed ldr/init.c
- Renamed ldr/sysdll.c functions to Psp (correct naming) and deleted file.
- Renamed SystemDll... ntdll pointers to correct Ke names
- Use direct Ke names instead of going through an API call.
- Make ExpInit... functions STDCALL
Modified: trunk/reactos/ntoskrnl/ex/callback.c
Modified: trunk/reactos/ntoskrnl/ex/event.c
Modified: trunk/reactos/ntoskrnl/ex/evtpair.c
Modified: trunk/reactos/ntoskrnl/ex/init.c
Modified: trunk/reactos/ntoskrnl/ex/lookas.c
Modified: trunk/reactos/ntoskrnl/ex/mutant.c
Modified: trunk/reactos/ntoskrnl/ex/profile.c
Modified: trunk/reactos/ntoskrnl/ex/sem.c
Modified: trunk/reactos/ntoskrnl/ex/time.c
Modified: trunk/reactos/ntoskrnl/ex/timer.c
Modified: trunk/reactos/ntoskrnl/ex/uuid.c
Modified: trunk/reactos/ntoskrnl/ex/win32k.c
Modified: trunk/reactos/ntoskrnl/ex/work.c
Modified: trunk/reactos/ntoskrnl/include/internal/ex.h
Modified: trunk/reactos/ntoskrnl/include/internal/ke.h
Modified: trunk/reactos/ntoskrnl/include/internal/ldr.h
Modified: trunk/reactos/ntoskrnl/include/internal/ps.h
Modified: trunk/reactos/ntoskrnl/ke/apc.c
Modified: trunk/reactos/ntoskrnl/ke/catch.c
Modified: trunk/reactos/ntoskrnl/ke/i386/exp.c
Modified: trunk/reactos/ntoskrnl/ke/main.c
Modified: trunk/reactos/ntoskrnl/ke/usercall.c
Deleted: trunk/reactos/ntoskrnl/ldr/init.c
Deleted: trunk/reactos/ntoskrnl/ldr/sysdll.c
Deleted: trunk/reactos/ntoskrnl/ldr/userldr.c
Modified: trunk/reactos/ntoskrnl/ntoskrnl.xml
Modified: trunk/reactos/ntoskrnl/ps/process.c
Modified: trunk/reactos/ntoskrnl/ps/psmgr.c
Modified: trunk/reactos/ntoskrnl/ps/thread.c

Modified: trunk/reactos/ntoskrnl/ex/callback.c
--- trunk/reactos/ntoskrnl/ex/callback.c	2005-08-05 01:25:43 UTC (rev 17052)
+++ trunk/reactos/ntoskrnl/ex/callback.c	2005-08-05 03:44:24 UTC (rev 17053)
@@ -71,6 +71,8 @@
  * TRUE if the Callback Object Type was successfully created.
  */
 VOID
+INIT_FUNCTION
+STDCALL
 ExpInitializeCallbacks(VOID)
 {
    OBJECT_ATTRIBUTES ObjectAttributes;

Modified: trunk/reactos/ntoskrnl/ex/event.c
--- trunk/reactos/ntoskrnl/ex/event.c	2005-08-05 01:25:43 UTC (rev 17052)
+++ trunk/reactos/ntoskrnl/ex/event.c	2005-08-05 03:44:24 UTC (rev 17053)
@@ -34,6 +34,7 @@
 
 VOID
 INIT_FUNCTION
+STDCALL
 ExpInitializeEventImplementation(VOID)
 {
   OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;

Modified: trunk/reactos/ntoskrnl/ex/evtpair.c
--- trunk/reactos/ntoskrnl/ex/evtpair.c	2005-08-05 01:25:43 UTC (rev 17052)
+++ trunk/reactos/ntoskrnl/ex/evtpair.c	2005-08-05 03:44:24 UTC (rev 17053)
@@ -31,6 +31,7 @@
 
 VOID
 INIT_FUNCTION
+STDCALL
 ExpInitializeEventPairImplementation(VOID)
 {
   OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;

Modified: trunk/reactos/ntoskrnl/ex/init.c
--- trunk/reactos/ntoskrnl/ex/init.c	2005-08-05 01:25:43 UTC (rev 17052)
+++ trunk/reactos/ntoskrnl/ex/init.c	2005-08-05 03:44:24 UTC (rev 17053)
@@ -405,6 +405,79 @@
     HalDisplayString(str);
     
 }
+
+INIT_FUNCTION
+NTSTATUS
+ExpLoadInitialProcess(PHANDLE ProcessHandle,
+                      PHANDLE ThreadHandle)
+{
+    UNICODE_STRING ImagePath = RTL_CONSTANT_STRING(L"\\SystemRoot\\system32\\smss.exe");
+    HANDLE SystemProcessHandle;
+    NTSTATUS Status;
+    PRTL_USER_PROCESS_PARAMETERS Params=NULL;
+    RTL_USER_PROCESS_INFORMATION Info;
+
+    /* Create a handle to the process */
+    Status = ObpCreateHandle(PsGetCurrentProcess(),
+                             PsInitialSystemProcess,
+                             PROCESS_CREATE_PROCESS | PROCESS_CREATE_THREAD | PROCESS_QUERY_INFORMATION,
+                             FALSE,
+                             &SystemProcessHandle);
+    if(!NT_SUCCESS(Status))
+    {
+        DPRINT1("Failed to create a handle for the system process!\n");
+        return Status;
+    }
+
+    /* Create the Parameters */
+    Status = RtlCreateProcessParameters(&Params,
+                                        &ImagePath,
+                                        NULL,
+                                        NULL,
+                                        NULL,
+                                        NULL,
+                                        NULL,
+                                        NULL,
+                                        NULL,
+                                        NULL);
+    if(!NT_SUCCESS(Status))
+    {
+        DPRINT1("Failed to create ppb!\n");
+        ZwClose(SystemProcessHandle);
+        return Status;
+    }
+
+    DPRINT("Creating process\n");
+    Status = RtlCreateUserProcess(&ImagePath,
+                                  OBJ_CASE_INSENSITIVE,
+                                  Params,
+                                  NULL,
+                                  NULL,
+                                  SystemProcessHandle,
+                                  FALSE,
+                                  NULL,
+                                  NULL,
+                                  &Info);
+    
+    /* Close the handle and free the params */
+    ZwClose(SystemProcessHandle);
+    RtlDestroyProcessParameters(Params);
+
+    if (!NT_SUCCESS(Status))
+    {
+        DPRINT1("NtCreateProcess() failed (Status %lx)\n", Status);
+        return(Status);
+    }
+
+    /* Start it up */
+    ZwResumeThread(Info.ThreadHandle, NULL);
+
+    /* Return Handles */
+    *ProcessHandle = Info.ProcessHandle;
+    *ThreadHandle = Info.ThreadHandle;
+    DPRINT("Process created successfully\n");
+    return STATUS_SUCCESS;
+}
    
 VOID
 INIT_FUNCTION
@@ -468,7 +541,7 @@
     ObInit();
 
     /* Initialize Lookaside Lists */
-    ExInit2();
+    ExpInitLookasideLists();
 
     /* Set up Region Maps, Sections and the Paging File */
     MmInit2();
@@ -506,7 +579,7 @@
     HalInitSystem(1, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock);
 
     /* Initialize Basic System Objects and Worker Threads */
-    ExInit3();
+    ExInit2();
 
     /* Create the system handle table, assign it to the system process, create
        the client id table and assign a PID for the system process. This needs
@@ -575,7 +648,7 @@
     IoInit3();
 
     /* Load the System DLL and its Entrypoints */
-    LdrpInitializeSystemDll();
+    PsLocateSystemDll();
 
     /* Initialize the Default Locale */
     PiInitDefaultLocale();
@@ -604,7 +677,7 @@
     }
 
     /* Launch initial process */
-    Status = LdrLoadInitialProcess(&ProcessHandle,
+    Status = ExpLoadInitialProcess(&ProcessHandle,
                                    &ThreadHandle);
 
     /* Check for success, Bugcheck if we failed */
@@ -671,25 +744,21 @@
     ZwClose(ProcessHandle);
 }
 
-VOID INIT_FUNCTION
+VOID
+STDCALL
+INIT_FUNCTION
 ExInit2(VOID)
 {
-  ExpInitLookasideLists();
+    ExpInitializeEventImplementation();
+    ExpInitializeEventPairImplementation();
+    ExpInitializeMutantImplementation();
+    ExpInitializeSemaphoreImplementation();
+    ExpInitializeTimerImplementation();
+    LpcpInitSystem();
+    ExpInitializeProfileImplementation();
+    ExpWin32kInit();
+    ExpInitUuids();
+    ExpInitializeHandleTables();
 }
 
-VOID INIT_FUNCTION
-ExInit3 (VOID)
-{
-  ExpInitializeEventImplementation();
-  ExpInitializeEventPairImplementation();
-  ExpInitializeMutantImplementation();
-  ExpInitializeSemaphoreImplementation();
-  ExpInitializeTimerImplementation();
-  LpcpInitSystem();
-  ExpInitializeProfileImplementation();
-  ExpWin32kInit();
-  ExpInitUuids();
-  ExpInitializeHandleTables();
-}
-
 /* EOF */

Modified: trunk/reactos/ntoskrnl/ex/lookas.c
--- trunk/reactos/ntoskrnl/ex/lookas.c	2005-08-05 01:25:43 UTC (rev 17052)
+++ trunk/reactos/ntoskrnl/ex/lookas.c	2005-08-05 03:44:24 UTC (rev 17053)
@@ -26,6 +26,7 @@
 
 VOID 
 INIT_FUNCTION
+STDCALL
 ExpInitLookasideLists()
 {
     /* Initialize Lock and Listhead */

Modified: trunk/reactos/ntoskrnl/ex/mutant.c
--- trunk/reactos/ntoskrnl/ex/mutant.c	2005-08-05 01:25:43 UTC (rev 17052)
+++ trunk/reactos/ntoskrnl/ex/mutant.c	2005-08-05 03:44:24 UTC (rev 17053)
@@ -51,6 +51,7 @@
 
 VOID
 INIT_FUNCTION
+STDCALL
 ExpInitializeMutantImplementation(VOID)
 {
     OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;

Modified: trunk/reactos/ntoskrnl/ex/profile.c
--- trunk/reactos/ntoskrnl/ex/profile.c	2005-08-05 01:25:43 UTC (rev 17052)
+++ trunk/reactos/ntoskrnl/ex/profile.c	2005-08-05 03:44:24 UTC (rev 17053)
@@ -74,6 +74,7 @@
 
 VOID
 INIT_FUNCTION
+STDCALL
 ExpInitializeProfileImplementation(VOID)
 {
     OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;

Modified: trunk/reactos/ntoskrnl/ex/sem.c
--- trunk/reactos/ntoskrnl/ex/sem.c	2005-08-05 01:25:43 UTC (rev 17052)
+++ trunk/reactos/ntoskrnl/ex/sem.c	2005-08-05 03:44:24 UTC (rev 17053)
@@ -32,6 +32,7 @@
 
 VOID
 INIT_FUNCTION
+STDCALL
 ExpInitializeSemaphoreImplementation(VOID)
 {
     OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;

Modified: trunk/reactos/ntoskrnl/ex/time.c
--- trunk/reactos/ntoskrnl/ex/time.c	2005-08-05 01:25:43 UTC (rev 17052)
+++ trunk/reactos/ntoskrnl/ex/time.c	2005-08-05 03:44:24 UTC (rev 17053)
@@ -27,7 +27,9 @@
 
 /* FUNCTIONS ****************************************************************/
 
-VOID INIT_FUNCTION
+VOID
+INIT_FUNCTION
+STDCALL
 ExpInitTimeZoneInfo(VOID)
 {
   LARGE_INTEGER CurrentTime;

Modified: trunk/reactos/ntoskrnl/ex/timer.c
--- trunk/reactos/ntoskrnl/ex/timer.c	2005-08-05 01:25:43 UTC (rev 17052)
+++ trunk/reactos/ntoskrnl/ex/timer.c	2005-08-05 03:44:24 UTC (rev 17053)
@@ -221,6 +221,7 @@
 
 VOID
 INIT_FUNCTION
+STDCALL
 ExpInitializeTimerImplementation(VOID)
 {
     OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;

Modified: trunk/reactos/ntoskrnl/ex/uuid.c
--- trunk/reactos/ntoskrnl/ex/uuid.c	2005-08-05 01:25:43 UTC (rev 17052)
+++ trunk/reactos/ntoskrnl/ex/uuid.c	2005-08-05 03:44:24 UTC (rev 17053)
@@ -41,7 +41,9 @@
 
 /* FUNCTIONS ****************************************************************/
 
-VOID INIT_FUNCTION
+VOID
+INIT_FUNCTION
+STDCALL
 ExpInitUuids(VOID)
 {
   ExInitializeFastMutex(&UuidMutex);

Modified: trunk/reactos/ntoskrnl/ex/win32k.c
--- trunk/reactos/ntoskrnl/ex/win32k.c	2005-08-05 01:25:43 UTC (rev 17052)
+++ trunk/reactos/ntoskrnl/ex/win32k.c	2005-08-05 03:44:24 UTC (rev 17053)
@@ -119,6 +119,7 @@
 
 VOID
 INIT_FUNCTION
+STDCALL
 ExpWin32kInit(VOID)
 {
     OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;

Modified: trunk/reactos/ntoskrnl/ex/work.c
--- trunk/reactos/ntoskrnl/ex/work.c	2005-08-05 01:25:43 UTC (rev 17052)
+++ trunk/reactos/ntoskrnl/ex/work.c	2005-08-05 03:44:24 UTC (rev 17053)
@@ -132,6 +132,7 @@
 
 VOID
 INIT_FUNCTION
+STDCALL
 ExpInitializeWorkerThreads(VOID)
 {
     ULONG WorkQueueType;

Modified: trunk/reactos/ntoskrnl/include/internal/ex.h
--- trunk/reactos/ntoskrnl/include/internal/ex.h	2005-08-05 01:25:43 UTC (rev 17052)
+++ trunk/reactos/ntoskrnl/include/internal/ex.h	2005-08-05 03:44:24 UTC (rev 17053)
@@ -11,27 +11,31 @@
 /* INITIALIZATION FUNCTIONS *************************************************/
 
 VOID
+STDCALL
 ExpWin32kInit(VOID);
 
 VOID
+STDCALL
 ExInit2(VOID);
 
 VOID
-ExInit3(VOID);
-
-VOID
+STDCALL
 ExpInitTimeZoneInfo(VOID);
 
 VOID
+STDCALL
 ExpInitializeWorkerThreads(VOID);
 
 VOID
+STDCALL
 ExpInitLookasideLists(VOID);
 
 VOID
+STDCALL
 ExpInitializeCallbacks(VOID);
 
 VOID
+STDCALL
 ExpInitUuids(VOID);
 
 VOID
@@ -39,24 +43,31 @@
 ExpInitializeExecutive(VOID);
 
 VOID
+STDCALL
 ExpInitializeEventImplementation(VOID);
 
 VOID
+STDCALL
 ExpInitializeEventImplementation(VOID);
 
 VOID
+STDCALL
 ExpInitializeEventPairImplementation(VOID);
 
 VOID
+STDCALL
 ExpInitializeSemaphoreImplementation(VOID);
 
 VOID
+STDCALL
 ExpInitializeMutantImplementation(VOID);
 
 VOID
+STDCALL
 ExpInitializeTimerImplementation(VOID);
 
 VOID
+STDCALL
 ExpInitializeProfileImplementation(VOID);
 
 /* HANDLE TABLE FUNCTIONS ***************************************************/

Modified: trunk/reactos/ntoskrnl/include/internal/ke.h
--- trunk/reactos/ntoskrnl/include/internal/ke.h	2005-08-05 01:25:43 UTC (rev 17052)
+++ trunk/reactos/ntoskrnl/include/internal/ke.h	2005-08-05 03:44:24 UTC (rev 17053)
@@ -19,6 +19,11 @@
 struct _KPRCB;
 struct _KEXCEPTION_FRAME;
 
+extern PVOID KeUserApcDispatcher;
+extern PVOID KeUserCallbackDispatcher;
+extern PVOID KeUserExceptionDispatcher;
+extern PVOID KeRaiseUserExceptionDispatcher;
+
 #define IPI_REQUEST_FUNCTIONCALL    0
 #define IPI_REQUEST_APC		    1
 #define IPI_REQUEST_DPC		    2

Modified: trunk/reactos/ntoskrnl/include/internal/ldr.h
--- trunk/reactos/ntoskrnl/include/internal/ldr.h	2005-08-05 01:25:43 UTC (rev 17052)
+++ trunk/reactos/ntoskrnl/include/internal/ldr.h	2005-08-05 03:44:24 UTC (rev 17053)
@@ -21,36 +21,6 @@
 LdrInitModuleManagement (VOID);
 
 NTSTATUS
-STDCALL
-LdrpMapSystemDll(
-    PEPROCESS Process,
-    PVOID *DllBase
-);
-
-NTSTATUS
-STDCALL
-LdrpInitializeSystemDll(VOID);
-
-NTSTATUS
-STDCALL
-LdrpGetSystemDllEntryPoints(VOID);
-
-PVOID
-LdrpGetSystemDllEntryPoint (VOID);
-
-PVOID
-LdrpGetSystemDllApcDispatcher(VOID);
-
-PVOID
-LdrpGetSystemDllExceptionDispatcher(VOID);
-
-PVOID
-LdrpGetSystemDllCallbackDispatcher(VOID);
-
-PVOID
-LdrpGetSystemDllRaiseExceptionDispatcher(VOID);
-
-NTSTATUS
 LdrpMapImage(
     HANDLE	ProcessHandle,
     HANDLE	SectionHandle,

Modified: trunk/reactos/ntoskrnl/include/internal/ps.h
--- trunk/reactos/ntoskrnl/include/internal/ps.h	2005-08-05 01:25:43 UTC (rev 17052)
+++ trunk/reactos/ntoskrnl/include/internal/ps.h	2005-08-05 03:44:24 UTC (rev 17053)
@@ -199,6 +199,21 @@
 STDCALL
 PspDestroyQuotaBlock(PEPROCESS Process);
 
+NTSTATUS
+STDCALL
+PspMapSystemDll(
+    PEPROCESS Process,
+    PVOID *DllBase
+);
+
+NTSTATUS
+STDCALL
+PsLocateSystemDll(VOID);
+
+NTSTATUS
+STDCALL
+PspGetSystemDllEntryPoints(VOID);
+
 /* CLIENT ID */
 
 NTSTATUS PsCreateCidHandle(PVOID Object, POBJECT_TYPE ObjectType, PHANDLE Handle);

Modified: trunk/reactos/ntoskrnl/ke/apc.c
--- trunk/reactos/ntoskrnl/ke/apc.c	2005-08-05 01:25:43 UTC (rev 17052)
+++ trunk/reactos/ntoskrnl/ke/apc.c	2005-08-05 03:44:24 UTC (rev 17053)
@@ -847,7 +847,7 @@
     Esp[3] = (ULONG)SystemArgument1;
     Esp[4] = (ULONG)SystemArgument2;
     Esp[5] = (ULONG)Context;
-    TrapFrame->Eip = (ULONG)LdrpGetSystemDllApcDispatcher();
+    TrapFrame->Eip = (ULONG)KeUserApcDispatcher;
     DPRINT("TrapFrame->Eip: %x\n", TrapFrame->Eip);
     TrapFrame->Esp = (ULONG)Esp;
 }

Modified: trunk/reactos/ntoskrnl/ke/catch.c
--- trunk/reactos/ntoskrnl/ke/catch.c	2005-08-05 01:25:43 UTC (rev 17052)
+++ trunk/reactos/ntoskrnl/ke/catch.c	2005-08-05 03:44:24 UTC (rev 17053)
@@ -161,7 +161,7 @@
                     DPRINT1("User-mode stack was invalid. Terminating target thread\n");
                 }
                 /* Set EIP to the User-mode Dispathcer */
-                Tf->Eip = (ULONG)LdrpGetSystemDllExceptionDispatcher();
+                Tf->Eip = (ULONG)KeRaiseUserExceptionDispatcher;
                 return;
             }
 

Modified: trunk/reactos/ntoskrnl/ke/i386/exp.c
--- trunk/reactos/ntoskrnl/ke/i386/exp.c	2005-08-05 01:25:43 UTC (rev 17052)
+++ trunk/reactos/ntoskrnl/ke/i386/exp.c	2005-08-05 03:44:24 UTC (rev 17053)
@@ -923,7 +923,7 @@
     } _SEH_END;
 
    OldEip = Thread->TrapFrame->Eip;
-   Thread->TrapFrame->Eip = (ULONG_PTR)LdrpGetSystemDllRaiseExceptionDispatcher();
+   Thread->TrapFrame->Eip = (ULONG_PTR)KeRaiseUserExceptionDispatcher;
    return((NTSTATUS)OldEip);
 }
 

Modified: trunk/reactos/ntoskrnl/ke/main.c
--- trunk/reactos/ntoskrnl/ke/main.c	2005-08-05 01:25:43 UTC (rev 17052)
+++ trunk/reactos/ntoskrnl/ke/main.c	2005-08-05 03:44:24 UTC (rev 17053)
@@ -41,6 +41,11 @@
 ULONG_PTR LastKrnlPhysAddr;
 ULONG_PTR LastKernelAddress;
 
+PVOID KeUserApcDispatcher = NULL;
+PVOID KeUserCallbackDispatcher = NULL;
+PVOID KeUserExceptionDispatcher = NULL;
+PVOID KeRaiseUserExceptionDispatcher = NULL;
+
 ULONG KeLargestCacheLine = 0x40; /* FIXME: Arch-specific */
 
 /* We allocate 4 pages, but we only use 3. The 4th is to guarantee page alignment */

Modified: trunk/reactos/ntoskrnl/ke/usercall.c
--- trunk/reactos/ntoskrnl/ke/usercall.c	2005-08-05 01:25:43 UTC (rev 17052)
+++ trunk/reactos/ntoskrnl/ke/usercall.c	2005-08-05 03:44:24 UTC (rev 17053)
@@ -207,7 +207,7 @@
   NewFrame = (PKTRAP_FRAME)((char*)NewStack + StackSize - sizeof(KTRAP_FRAME) - sizeof(FX_SAVE_AREA));
   /* We need the stack pointer to remain 4-byte aligned */
   NewFrame->Esp -= (((ArgumentLength + 3) & (~ 0x3)) + (4 * sizeof(ULONG)));
-  NewFrame->Eip = (ULONG)LdrpGetSystemDllCallbackDispatcher();
+  NewFrame->Eip = (ULONG)KeUserCallbackDispatcher;
   UserEsp = (PULONG)NewFrame->Esp;
   UserEsp[0] = 0;     /* Return address. */
   UserEsp[1] = RoutineIndex;

Deleted: trunk/reactos/ntoskrnl/ldr/init.c
--- trunk/reactos/ntoskrnl/ldr/init.c	2005-08-05 01:25:43 UTC (rev 17052)
+++ trunk/reactos/ntoskrnl/ldr/init.c	2005-08-05 03:44:24 UTC (rev 17053)
@@ -1,103 +0,0 @@
-/* $Id$
- *
- * COPYRIGHT:       See COPYING in the top level directory
- * PROJECT:         ReactOS kernel
- * FILE:            ntoskrnl/ldr/init.c
- * PURPOSE:         Loaders for PE executables
- *
- * PROGRAMMERS:     Jean Michault
- *                  Rex Jolliff (rex@lvcablemodem.com)
- */
-
-/* INCLUDES *****************************************************************/
-
-
-#include <ntoskrnl.h>
-
-#define NDEBUG
-#include <internal/debug.h>
-
-/* FUNCTIONS *****************************************************************/
-
-INIT_FUNCTION
-NTSTATUS
-LdrLoadInitialProcess(PHANDLE ProcessHandle,
-		      PHANDLE ThreadHandle)
-{
-   UNICODE_STRING ImagePath = RTL_CONSTANT_STRING(L"\\SystemRoot\\system32\\smss.exe");
-   HANDLE SystemProcessHandle;
-   NTSTATUS Status;
-   PRTL_USER_PROCESS_PARAMETERS Params=NULL;
-   RTL_USER_PROCESS_INFORMATION Info;
-
-   Status = ObpCreateHandle(
-      PsGetCurrentProcess(),
-      PsInitialSystemProcess,
-      PROCESS_CREATE_PROCESS | PROCESS_CREATE_THREAD | PROCESS_QUERY_INFORMATION,
-      FALSE,
-      &SystemProcessHandle
-      );
-
-   if(!NT_SUCCESS(Status))
-   {
-      DPRINT1("Failed to create a handle for the system process!\n");
-      return Status;
-   }
-
-
-   Status = RtlCreateProcessParameters(
-      &Params,
-      &ImagePath,
-      NULL,
-      NULL,
-      NULL,
-      NULL,
-      NULL,
-      NULL,
-      NULL,
-      NULL
-      );
-
-  if(!NT_SUCCESS(Status))
-  {
-    DPRINT1("Failed to create ppb!\n");
-    ZwClose(SystemProcessHandle);
-    return Status;
-  }
-
-
-   DPRINT("Creating process\n");
-
-   Status = RtlCreateUserProcess(
-      &ImagePath,
-      OBJ_CASE_INSENSITIVE, //Valid are OBJ_INHERIT and OBJ_CASE_INSENSITIVE.
-      Params,
-      NULL,
-      NULL,
-      SystemProcessHandle,
-      FALSE,
-      NULL,
-      NULL,
-      &Info
-      );
-
-   ZwClose(SystemProcessHandle);
-   RtlDestroyProcessParameters(Params);
-
-   if (!NT_SUCCESS(Status))
-   {
-      DPRINT1("NtCreateProcess() failed (Status %lx)\n", Status);
-      return(Status);
-   }
-
-   ZwResumeThread(Info.ThreadHandle, NULL);
-
-   *ProcessHandle = Info.ProcessHandle;
-   *ThreadHandle= Info.ThreadHandle;
-
-   DPRINT("Process created successfully\n");
-
-   return(STATUS_SUCCESS);
-}
-
-/* EOF */

Deleted: trunk/reactos/ntoskrnl/ldr/sysdll.c
--- trunk/reactos/ntoskrnl/ldr/sysdll.c	2005-08-05 01:25:43 UTC (rev 17052)
+++ trunk/reactos/ntoskrnl/ldr/sysdll.c	2005-08-05 03:44:24 UTC (rev 17053)
@@ -1,278 +0,0 @@
-/* $Id$
- *
- * COPYRIGHT:       See COPYING in the top level directory
- * PROJECT:         ReactOS kernel
- * FILE:            ntoskrnl/ldr/sysdll.c
- * PURPOSE:         Loaders for PE executables
- *
- * PROGRAMMERS:     Jean Michault
- *                  Rex Jolliff (rex@lvcablemodem.com)
- *                  Skywing
- */
-
-/* INCLUDES *****************************************************************/
-
-#include <ntoskrnl.h>
-#define NDEBUG
-#include <internal/debug.h>
-
-/* GLOBALS *******************************************************************/
-
-PVOID SystemDllEntryPoint = NULL;
-PVOID SystemDllApcDispatcher = NULL;
-PVOID SystemDllCallbackDispatcher = NULL;
-PVOID SystemDllExceptionDispatcher = NULL;
-PVOID SystemDllRaiseExceptionDispatcher = NULL;
-
-PVOID LdrpSystemDllBase = NULL;
-PVOID LdrpSystemDllSection = NULL;
-
-/* FUNCTIONS *****************************************************************/
-
-PVOID LdrpGetSystemDllExceptionDispatcher(VOID)
-{
-  return(SystemDllExceptionDispatcher);
-}
-
-PVOID LdrpGetSystemDllCallbackDispatcher(VOID)
-{
-  return(SystemDllCallbackDispatcher);
-}
-
-PVOID LdrpGetSystemDllEntryPoint(VOID)
-{
-   return(SystemDllEntryPoint);
-}
-
-PVOID LdrpGetSystemDllApcDispatcher(VOID)
-{
-   return(SystemDllApcDispatcher);
-}
-
-PVOID LdrpGetSystemDllRaiseExceptionDispatcher(VOID)
-{
-   return(SystemDllRaiseExceptionDispatcher);
-}
-
-NTSTATUS
-STDCALL
-INIT_FUNCTION
-LdrpGetSystemDllEntryPoints(VOID)
-{
-    ANSI_STRING ProcedureName;
-    NTSTATUS Status;
-
-    /* Retrieve ntdll's startup address */
-    DPRINT("Getting Entrypoint: %p\n", LdrpSystemDllBase);
-    RtlInitAnsiString(&ProcedureName, "LdrInitializeThunk");
-    Status = LdrGetProcedureAddress((PVOID)LdrpSystemDllBase,
-                                    &ProcedureName,
-                                    0,
-                                    &SystemDllEntryPoint);
-
-    if (!NT_SUCCESS(Status)) {
-
-        DPRINT1 ("LdrGetProcedureAddress failed (Status %x)\n", Status);
-        return (Status);
-    }
-
-    /* Get User APC Dispatcher */
-    DPRINT("Getting Entrypoint\n");
-    RtlInitAnsiString(&ProcedureName, "KiUserApcDispatcher");
-    Status = LdrGetProcedureAddress((PVOID)LdrpSystemDllBase,
-                                    &ProcedureName,
-                                    0,
-                                    &SystemDllApcDispatcher);
-
-    if (!NT_SUCCESS(Status)) {
-
-        DPRINT1 ("LdrGetProcedureAddress failed (Status %x)\n", Status);
-        return (Status);
-    }
-
-    /* Get Exception Dispatcher */
-    DPRINT("Getting Entrypoint\n");
-    RtlInitAnsiString(&ProcedureName, "KiUserExceptionDispatcher");
-    Status = LdrGetProcedureAddress((PVOID)LdrpSystemDllBase,
-                                    &ProcedureName,
-                                    0,
-                                    &SystemDllExceptionDispatcher);
-
-    if (!NT_SUCCESS(Status)) {
-
-        DPRINT1 ("LdrGetProcedureAddress failed (Status %x)\n", Status);
-        return (Status);
-    }
-
-    /* Get Callback Dispatcher */
-    DPRINT("Getting Entrypoint\n");
-    RtlInitAnsiString(&ProcedureName, "KiUserCallbackDispatcher");
-    Status = LdrGetProcedureAddress((PVOID)LdrpSystemDllBase,
-                                    &ProcedureName,
-                                    0,
-                                    &SystemDllCallbackDispatcher);
-
-    if (!NT_SUCCESS(Status)) {
-
-        DPRINT1 ("LdrGetProcedureAddress failed (Status %x)\n", Status);
-        return (Status);
-    }
-
-    /* Get Raise Exception Dispatcher */
-    DPRINT("Getting Entrypoint\n");
-    RtlInitAnsiString(&ProcedureName, "KiRaiseUserExceptionDispatcher");
-    Status = LdrGetProcedureAddress((PVOID)LdrpSystemDllBase,
-                                    &ProcedureName,
-                                    0,
-                                    &SystemDllRaiseExceptionDispatcher);
-
-    if (!NT_SUCCESS(Status)) {
-
-        DPRINT1 ("LdrGetProcedureAddress failed (Status %x)\n", Status);
-        return (Status);
-    }
-
-    /* Return success */
-    return(STATUS_SUCCESS);
-}
-
-NTSTATUS
-STDCALL
-LdrpMapSystemDll(PEPROCESS Process,
-                 PVOID *DllBase)
-{
-    NTSTATUS Status;
-    ULONG ViewSize = 0;
-    PVOID ImageBase = 0;
-
-    /* Map the System DLL */
-    DPRINT("Mapping System DLL\n");
-    Status = MmMapViewOfSection(LdrpSystemDllSection,
-                                Process,
-                                (PVOID*)&ImageBase,
-                                0,
-                                0,
-                                NULL,
-                                &ViewSize,
-                                0,
-                                MEM_COMMIT,
-                                PAGE_READWRITE);
-
-    if (!NT_SUCCESS(Status)) {
-
-        DPRINT1("Failed to map System DLL Into Process\n");
-    }
-
-    if (DllBase) *DllBase = ImageBase;
-
-    return Status;
-}
-
-NTSTATUS
-STDCALL
-INIT_FUNCTION
-LdrpInitializeSystemDll(VOID)
-{
-    UNICODE_STRING DllPathname = RTL_CONSTANT_STRING(L"\\SystemRoot\\system32\\ntdll.dll");
-    OBJECT_ATTRIBUTES FileObjectAttributes;
-    IO_STATUS_BLOCK Iosb;
-    HANDLE FileHandle;
-    HANDLE NTDllSectionHandle;
-    NTSTATUS Status;
-    CHAR BlockBuffer[1024];
-    PIMAGE_DOS_HEADER DosHeader;
-    PIMAGE_NT_HEADERS NTHeaders;
-
-    /* Locate and open NTDLL to determine ImageBase and LdrStartup */
-    InitializeObjectAttributes(&FileObjectAttributes,
-                               &DllPathname,
-                               0,
-                               NULL,
-                               NULL);
-
-    DPRINT("Opening NTDLL\n");
-    Status = ZwOpenFile(&FileHandle,
-                        FILE_READ_ACCESS,
-                        &FileObjectAttributes,
-                        &Iosb,
-                        FILE_SHARE_READ,
-                        FILE_SYNCHRONOUS_IO_NONALERT);
-
-    if (!NT_SUCCESS(Status)) {
-        DPRINT1("NTDLL open failed (Status %x)\n", Status);
-        return Status;
-     }
-
-     /* Load NTDLL is valid */
-     DPRINT("Reading NTDLL\n");
-     Status = ZwReadFile(FileHandle,
-                         0,
-                         0,
-                         0,
-                         &Iosb,
-                         BlockBuffer,
-                         sizeof(BlockBuffer),
-                         0,
-                         0);
-    if (!NT_SUCCESS(Status) || Iosb.Information != sizeof(BlockBuffer)) {
-
-        DPRINT1("NTDLL header read failed (Status %x)\n", Status);
-        ZwClose(FileHandle);
-        return Status;
-    }
-
-    /* Check if it's valid */
-    DosHeader = (PIMAGE_DOS_HEADER)BlockBuffer;
-    NTHeaders = (PIMAGE_NT_HEADERS)(BlockBuffer + DosHeader->e_lfanew);
-
-    if ((DosHeader->e_magic != IMAGE_DOS_SIGNATURE) ||
-        (DosHeader->e_lfanew == 0L) ||
-        (*(PULONG) NTHeaders != IMAGE_NT_SIGNATURE)) {
-
-        DPRINT1("NTDLL format invalid\n");
-        ZwClose(FileHandle);
-        return(STATUS_UNSUCCESSFUL);
-    }
-
-    /* Create a section for NTDLL */
-    DPRINT("Creating section\n");
-    Status = ZwCreateSection(&NTDllSectionHandle,
-                             SECTION_ALL_ACCESS,
-                             NULL,
-                             NULL,
-                             PAGE_READONLY,
-                             SEC_IMAGE | SEC_COMMIT,
-                             FileHandle);
-    if (!NT_SUCCESS(Status)) {
-
-        DPRINT1("NTDLL create section failed (Status %x)\n", Status);
-        ZwClose(FileHandle);
-        return(Status);
-    }
-    ZwClose(FileHandle);
-
-    /* Reference the Section */
-    DPRINT("ObReferenceObjectByHandle section: %d\n", NTDllSectionHandle);
-    Status = ObReferenceObjectByHandle(NTDllSectionHandle,
-                                       SECTION_ALL_ACCESS,
-                                       MmSectionObjectType,
-                                       KernelMode,
-                                       (PVOID*)&LdrpSystemDllSection,
-                                       NULL);
-    if (!NT_SUCCESS(Status)) {
-
-        DPRINT1("NTDLL section reference failed (Status %x)\n", Status);
-        return(Status);
-    }
-
-    /* Map it */
-    LdrpMapSystemDll(PsGetCurrentProcess(), &LdrpSystemDllBase);
-    DPRINT("LdrpSystemDllBase: %x\n", LdrpSystemDllBase);
-
-    /* Now get the Entrypoints */
-    LdrpGetSystemDllEntryPoints();
-
-    return STATUS_SUCCESS;
-}
-
-/* EOF */

Deleted: trunk/reactos/ntoskrnl/ldr/userldr.c
--- trunk/reactos/ntoskrnl/ldr/userldr.c	2005-08-05 01:25:43 UTC (rev 17052)
+++ trunk/reactos/ntoskrnl/ldr/userldr.c	2005-08-05 03:44:24 UTC (rev 17053)
@@ -1,62 +0,0 @@
-/* $Id$
- *
- * COPYRIGHT:       See COPYING in the top level directory
- * PROJECT:         ReactOS kernel
- * FILE:            ntoskrnl/ldr/userldr.c
- * PURPOSE:         Loaders for PE executables
- *
- * PROGRAMMERS:     Jean Michault
- *                  Rex Jolliff (rex@lvcablemodem.com)
- */
-
-/* INCLUDES *****************************************************************/
-
-#include <ntoskrnl.h>
-#define NDEBUG
-#include <internal/debug.h>
-
-
-/* FUNCTIONS *****************************************************************/
-
-NTSTATUS LdrpMapImage(HANDLE ProcessHandle,
-		      HANDLE SectionHandle,
-		      PVOID* ReturnedImageBase)
-/*
- * FUNCTION: LdrpMapImage maps a user-mode image into an address space
- * PARAMETERS:
- *   ProcessHandle
- *              Points to the process to map the image into
- *
- *   SectionHandle
- *              Points to the section to map
- *
- * RETURNS: Status
- */
-{
-  ULONG ViewSize;
-  PVOID ImageBase;
-  NTSTATUS Status;
-
-  ViewSize = 0;
-  ImageBase = 0;
-
-  Status = ZwMapViewOfSection(SectionHandle,
-			      ProcessHandle,
-			      (PVOID*)&ImageBase,
-			      0,
-			      ViewSize,
-			      NULL,
-			      &ViewSize,
-			      0,
-			      MEM_COMMIT,
-			      PAGE_READWRITE);
-  if (!NT_SUCCESS(Status))
-    {
-      CPRINT("Image map view of section failed (Status %x)", Status);
-      return(Status);
-    }
-
-   *ReturnedImageBase = ImageBase;
-
-   return(STATUS_SUCCESS);
-}

Modified: trunk/reactos/ntoskrnl/ntoskrnl.xml
--- trunk/reactos/ntoskrnl/ntoskrnl.xml	2005-08-05 01:25:43 UTC (rev 17052)
+++ trunk/reactos/ntoskrnl/ntoskrnl.xml	2005-08-05 03:44:24 UTC (rev 17053)
@@ -212,12 +212,9 @@
 		<file>kdmain.c</file>
 	</directory>
 	<directory name="ldr">
-		<file>init.c</file>
 		<file>loader.c</file>
[truncated at 1000 lines; 291 more skipped]