Partial patch of larger rosrtl removal patch. This one merely is a structure fix patch, and renames/corrects RTL_USER_PROCESS_INFORMATION (which had the totally wrong names) as well as updates the TEB to the latest version. It also fixes SECTION_IMAGE_INFORMATION to have the right format and names. Also, some callers of CreateProcessW are modified to not send a constant string as lpCommandLine (this was illegal and will crash on Windows/my patch). INITIAL_TEB was also renamed to the more correct fields, although they won't make sense with the current rosrtl/rtl implementation, the names will only make sense with the next patch. Finally NtTerminateThread was fixed to support sending NULL as handle, and PspExitThread was updated to work with the new FreestackOnExit flag, both of which will be used in the next patch.
Modified: trunk/reactos/include/ndk/fixmes.txt
Modified: trunk/reactos/include/ndk/pstypes.h
Modified: trunk/reactos/include/ndk/rtlfuncs.h
Modified: trunk/reactos/include/ndk/rtltypes.h
Modified: trunk/reactos/include/ndk/umfuncs.h
Modified: trunk/reactos/include/ndk/zwfuncs.h
Modified: trunk/reactos/include/ndk/zwtypes.h
Modified: trunk/reactos/lib/gdi32/main/dllmain.c
Modified: trunk/reactos/lib/kernel32/file/file.c
Modified: trunk/reactos/lib/kernel32/include/kernel32.h
Modified: trunk/reactos/lib/kernel32/misc/console.c
Modified: trunk/reactos/lib/kernel32/misc/handle.c
Modified: trunk/reactos/lib/kernel32/misc/ldr.c
Modified: trunk/reactos/lib/kernel32/misc/nls.c
Modified: trunk/reactos/lib/kernel32/process/create.c
Modified: trunk/reactos/lib/kernel32/process/proc.c
Modified: trunk/reactos/lib/kernel32/synch/wait.c
Modified: trunk/reactos/lib/kernel32/thread/fiber.c
Modified: trunk/reactos/lib/kernel32/thread/fls.c
Modified: trunk/reactos/lib/ntdll/dbg/debug.c
Modified: trunk/reactos/lib/ntdll/rtl/path.c
Modified: trunk/reactos/lib/rosrtl/thread/i386/context.c
Modified: trunk/reactos/lib/rosrtl/thread/stack.c
Modified: trunk/reactos/lib/rtl/env.c
Modified: trunk/reactos/lib/rtl/ppb.c
Modified: trunk/reactos/lib/rtl/process.c
Modified: trunk/reactos/lib/rtl/thread.c
Modified: trunk/reactos/lib/syssetup/install.c
Modified: trunk/reactos/lib/user32/misc/dllmain.c
Modified: trunk/reactos/ntoskrnl/io/irq.c
Modified: trunk/reactos/ntoskrnl/ke/kthread.c
Modified: trunk/reactos/ntoskrnl/ldr/init.c
Modified: trunk/reactos/ntoskrnl/mm/process.c
Modified: trunk/reactos/ntoskrnl/mm/section.c
Modified: trunk/reactos/ntoskrnl/ps/kill.c
Modified: trunk/reactos/subsys/csrss/api/wapi.c
Modified: trunk/reactos/subsys/csrss/init.c
Modified: trunk/reactos/subsys/smss/client.c
Modified: trunk/reactos/subsys/smss/debug.c
Modified: trunk/reactos/subsys/smss/initss.c
Modified: trunk/reactos/subsys/smss/smapi.c
Modified: trunk/reactos/subsys/smss/smapiexec.c
Modified: trunk/reactos/subsys/smss/smss.h
Modified: trunk/reactos/subsys/system/winlogon/winlogon.c
Modified: trunk/reactos/subsys/win32k/ntuser/window.c
Modified: trunk/reactos/w32api/include/winbase.h

Modified: trunk/reactos/include/ndk/fixmes.txt
--- trunk/reactos/include/ndk/fixmes.txt	2005-07-11 23:32:55 UTC (rev 16539)
+++ trunk/reactos/include/ndk/fixmes.txt	2005-07-12 01:56:14 UTC (rev 16540)
@@ -26,14 +26,15 @@
 		- Object Directory + implementation doesn't match NT (Alex) [obtypes.h]
 
 	Priority 3:
+	- Some RTL Structures need review (Alex) [rtltypes.h]
 	- Pushlock support is needed to fix EPROCESS (Alex) [pstypes.h]
 	- MADDRESS_SPACE must be converted into the NT Type (Alex) [pstypes.h, mmtypes.h]
 
 	Priority 4:
 	- FIXED: Kernel and Memory Types are not architecture-specific (Eric) [ketypes.h, mmtypes.h]
-	- Win32K Builds with windows.h [extypes.h, ketypes.h]
+	- Win32K Builds with windows.h (Filip, bugzilla id 666) [extypes.h, ketypes.h]
 
 	Priority 5:
 	- LPC Types are totally wrong. [lpctypes.h]
 	- Missing System Info Classes [zwtypes.h]
-	- Process Priority Classes are messed up [pstypes.h]
\ No newline at end of file
+	- Process Priority Classes are messed up (Alex) [pstypes.h]

Modified: trunk/reactos/include/ndk/pstypes.h
--- trunk/reactos/include/ndk/pstypes.h	2005-07-11 23:32:55 UTC (rev 16539)
+++ trunk/reactos/include/ndk/pstypes.h	2005-07-12 01:56:14 UTC (rev 16540)
@@ -93,12 +93,6 @@
 
 struct _ETHREAD;
 
-typedef struct _CURDIR
-{
-    UNICODE_STRING DosPath;
-    PVOID Handle;
-} CURDIR, *PCURDIR;
-
 typedef struct _DESCRIPTOR_TABLE_ENTRY
 {
     ULONG Selector;
@@ -181,75 +175,101 @@
 
 typedef struct _INITIAL_TEB
 {
+    PVOID PreviousStackBase;
+    PVOID PreviousStackLimit;
     PVOID StackBase;
     PVOID StackLimit;
-    PVOID StackCommit;
-    PVOID StackCommitMax;
-    PVOID StackReserved;
+    PVOID AllocatedStackBase;
 } INITIAL_TEB, *PINITIAL_TEB;
 
+typedef struct _TEB_ACTIVE_FRAME_CONTEXT 
+{
+    ULONG Flags;
+    LPSTR FrameName;
+} TEB_ACTIVE_FRAME_CONTEXT, *PTEB_ACTIVE_FRAME_CONTEXT;
+
+typedef struct _TEB_ACTIVE_FRAME
+{
+    ULONG Flags;
+    struct _TEB_ACTIVE_FRAME *Previous;
+    PTEB_ACTIVE_FRAME_CONTEXT Context;
+} TEB_ACTIVE_FRAME, *PTEB_ACTIVE_FRAME;
+
 typedef struct _TEB
 {
-    NT_TIB Tib;                         /* 00h */
-    PVOID EnvironmentPointer;           /* 1Ch */
-    CLIENT_ID Cid;                      /* 20h */
-    PVOID ActiveRpcInfo;                /* 28h */
-    PVOID ThreadLocalStoragePointer;    /* 2Ch */
-    struct _PEB *Peb;                   /* 30h */
-    ULONG LastErrorValue;               /* 34h */
-    ULONG CountOfOwnedCriticalSections; /* 38h */
-    PVOID CsrClientThread;              /* 3Ch */
-    struct _W32THREAD* Win32ThreadInfo; /* 40h */
-    ULONG Win32ClientInfo[0x1F];        /* 44h */
-    PVOID WOW32Reserved;                /* C0h */
-    LCID CurrentLocale;                 /* C4h */
-    ULONG FpSoftwareStatusRegister;     /* C8h */
-    PVOID SystemReserved1[0x36];        /* CCh */
-    PVOID Spare1;                       /* 1A4h */
-    LONG ExceptionCode;                 /* 1A8h */
-    UCHAR SpareBytes1[0x28];            /* 1ACh */
-    PVOID SystemReserved2[0xA];         /* 1D4h */
-    GDI_TEB_BATCH GdiTebBatch;          /* 1FCh */
-    ULONG gdiRgn;                       /* 6DCh */
-    ULONG gdiPen;                       /* 6E0h */
-    ULONG gdiBrush;                     /* 6E4h */
-    CLIENT_ID RealClientId;             /* 6E8h */
-    PVOID GdiCachedProcessHandle;       /* 6F0h */
-    ULONG GdiClientPID;                 /* 6F4h */
-    ULONG GdiClientTID;                 /* 6F8h */
-    PVOID GdiThreadLocaleInfo;          /* 6FCh */
-    PVOID UserReserved[5];              /* 700h */
-    PVOID glDispatchTable[0x118];       /* 714h */
-    ULONG glReserved1[0x1A];            /* B74h */
-    PVOID glReserved2;                  /* BDCh */
-    PVOID glSectionInfo;                /* BE0h */
-    PVOID glSection;                    /* BE4h */
-    PVOID glTable;                      /* BE8h */
-    PVOID glCurrentRC;                  /* BECh */
-    PVOID glContext;                    /* BF0h */
-    NTSTATUS LastStatusValue;           /* BF4h */
-    UNICODE_STRING StaticUnicodeString; /* BF8h */
-    WCHAR StaticUnicodeBuffer[0x105];   /* C00h */
-    PVOID DeallocationStack;            /* E0Ch */
-    PVOID TlsSlots[0x40];               /* E10h */
-    LIST_ENTRY TlsLinks;                /* F10h */
-    PVOID Vdm;                          /* F18h */
-    PVOID ReservedForNtRpc;             /* F1Ch */
-    PVOID DbgSsReserved[0x2];           /* F20h */
-    ULONG HardErrorDisabled;            /* F28h */
-    PVOID Instrumentation[0x10];        /* F2Ch */
-    PVOID WinSockData;                  /* F6Ch */
-    ULONG GdiBatchCount;                /* F70h */
-    USHORT _Spare2;                     /* F74h */
-    BOOLEAN IsFiber;                    /* F76h */
-    UCHAR Spare3;                       /* F77h */
-    ULONG _Spare4;                      /* F78h */
-    ULONG _Spare5;                      /* F7Ch */
-    PVOID ReservedForOle;               /* F80h */
-    ULONG WaitingOnLoaderLock;          /* F84h */
-    ULONG _Unknown[11];                 /* F88h */
-    PVOID FlsSlots;                     /* FB4h */
-    PVOID WineDebugInfo;                /* Needed for WINE DLL's  */
+    NT_TIB Tib;                             /* 00h */
+    PVOID EnvironmentPointer;               /* 1Ch */
+    CLIENT_ID Cid;                          /* 20h */
+    PVOID ActiveRpcHandle;                  /* 28h */
+    PVOID ThreadLocalStoragePointer;        /* 2Ch */
+    struct _PEB *ProcessEnvironmentBlock;   /* 30h */
+    ULONG LastErrorValue;                   /* 34h */
+    ULONG CountOfOwnedCriticalSections;     /* 38h */
+    PVOID CsrClientThread;                  /* 3Ch */
+    struct _W32THREAD* Win32ThreadInfo;     /* 40h */
+    ULONG User32Reserved[0x1A];             /* 44h */
+    ULONG UserReserved[5];                  /* ACh */
+    PVOID WOW32Reserved;                    /* C0h */
+    LCID CurrentLocale;                     /* C4h */
+    ULONG FpSoftwareStatusRegister;         /* C8h */
+    PVOID SystemReserved1[0x36];            /* CCh */
+    LONG ExceptionCode;                     /* 1A4h */
+    struct _ACTIVATION_CONTEXT_STACK *ActivationContextStackPointer; /* 1A8h */
+    UCHAR SpareBytes1[0x28];                /* 1ACh */
+    GDI_TEB_BATCH GdiTebBatch;              /* 1D4h */
+    CLIENT_ID RealClientId;                 /* 6B4h */
+    PVOID GdiCachedProcessHandle;           /* 6BCh */
+    ULONG GdiClientPID;                     /* 6C0h */
+    ULONG GdiClientTID;                     /* 6C4h */
+    PVOID GdiThreadLocalInfo;               /* 6C8h */
+    ULONG Win32ClientInfo[62];              /* 6CCh */
+    PVOID glDispatchTable[0xE9];            /* 7C4h */
+    ULONG glReserved1[0x1D];                /* B68h */
+    PVOID glReserved2;                      /* BDCh */
+    PVOID glSectionInfo;                    /* BE0h */
+    PVOID glSection;                        /* BE4h */
+    PVOID glTable;                          /* BE8h */
+    PVOID glCurrentRC;                      /* BECh */
+    PVOID glContext;                        /* BF0h */
+    NTSTATUS LastStatusValue;               /* BF4h */
+    UNICODE_STRING StaticUnicodeString;     /* BF8h */
+    WCHAR StaticUnicodeBuffer[0x105];       /* C00h */
+    PVOID DeallocationStack;                /* E0Ch */
+    PVOID TlsSlots[0x40];                   /* E10h */
+    LIST_ENTRY TlsLinks;                    /* F10h */
+    PVOID Vdm;                              /* F18h */
+    PVOID ReservedForNtRpc;                 /* F1Ch */
+    PVOID DbgSsReserved[0x2];               /* F20h */
+    ULONG HardErrorDisabled;                /* F28h */
+    PVOID Instrumentation[14];              /* F2Ch */
+    PVOID SubProcessTag;                    /* F64h */
+    PVOID EtwTraceData;                     /* F68h */
+    PVOID WinSockData;                      /* F6Ch */
+    ULONG GdiBatchCount;                    /* F70h */
+    BOOLEAN InDbgPrint;                     /* F74h */
+    BOOLEAN FreeStackOnTermination;         /* F75h */
+    BOOLEAN HasFiberData;                   /* F76h */
+    UCHAR IdealProcessor;                   /* F77h */
+    ULONG GuaranteedStackBytes;             /* F78h */
+    PVOID ReservedForPerf;                  /* F7Ch */
+    PVOID ReservedForOle;                   /* F80h */
+    ULONG WaitingOnLoaderLock;              /* F84h */
+    ULONG SparePointer1;                    /* F88h */
+    ULONG SoftPatchPtr1;                    /* F8Ch */
+    ULONG SoftPatchPtr2;                    /* F90h */
+    PVOID *TlsExpansionSlots;               /* F94h */
+    ULONG ImpersionationLocale;             /* F98h */
+    ULONG IsImpersonating;                  /* F9Ch */
+    PVOID NlsCache;                         /* FA0h */
+    PVOID pShimData;                        /* FA4h */
+    ULONG HeapVirualAffinity;               /* FA8h */
+    PVOID CurrentTransactionHandle;         /* FACh */
+    PTEB_ACTIVE_FRAME ActiveFrame;          /* FB0h */
+    PVOID FlsData;                          /* FB4h */
+    UCHAR SafeThunkCall;                    /* FB8h */
+    UCHAR BooleanSpare[3];                  /* FB9h */
+    /* FIXME: Needed for WINE DLL's */
+    PVOID WineDebugInfo;                    /* FBCh */    
 } TEB, *PTEB;
 
 /* KERNEL MODE ONLY **********************************************************/

Modified: trunk/reactos/include/ndk/rtlfuncs.h
--- trunk/reactos/include/ndk/rtlfuncs.h	2005-07-11 23:32:55 UTC (rev 16539)
+++ trunk/reactos/include/ndk/rtlfuncs.h	2005-07-12 01:56:14 UTC (rev 16540)
@@ -1049,7 +1049,7 @@
     IN BOOLEAN CurrentDirectory,
     IN HANDLE DebugPort OPTIONAL,
     IN HANDLE ExceptionPort OPTIONAL,
-    OUT PRTL_PROCESS_INFO ProcessInfo
+    OUT PRTL_USER_PROCESS_INFORMATION ProcessInfo
 );
 
 NTSTATUS
@@ -1059,8 +1059,8 @@
     IN PSECURITY_DESCRIPTOR SecurityDescriptor,
     IN BOOLEAN CreateSuspended,
     IN LONG StackZeroBits,
-    IN OUT PULONG StackReserve,
-    IN OUT PULONG StackCommit,
+    IN ULONG StackReserve,
+    IN ULONG StackCommit,
     IN PTHREAD_START_ROUTINE StartAddress,
     IN PVOID Parameter,
     IN OUT PHANDLE ThreadHandle,
@@ -1075,11 +1075,11 @@
 STDCALL
 RtlDestroyProcessParameters(IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters);
 
-NTSTATUS
+VOID
 STDCALL
 RtlExitUserThread(NTSTATUS Status);
 
-NTSTATUS
+VOID
 STDCALL
 RtlInitializeContext(
     IN HANDLE ProcessHandle,

Modified: trunk/reactos/include/ndk/rtltypes.h
--- trunk/reactos/include/ndk/rtltypes.h	2005-07-11 23:32:55 UTC (rev 16539)
+++ trunk/reactos/include/ndk/rtltypes.h	2005-07-12 01:56:14 UTC (rev 16540)
@@ -17,10 +17,18 @@
 /* CONSTANTS *****************************************************************/
 #define MAXIMUM_LEADBYTES 12
 
-#define PPF_NORMALIZED (1)
+#define PPF_NORMALIZED             0x01
+#define PPF_PROFILE_USER           0x02
+#define PPF_PROFILE_SERVER         0x04
+#define PPF_PROFILE_KERNEL         0x08
 
-#define PEB_BASE        (0x7FFDF000)
+#define PPF_RESERVE_1MB            0x20
+#define PPF_DISABLE_HEAP_CHECKS    0x100
+#define PPF_PROCESS_OR_1           0x200
+#define PPF_PROCESS_OR_2           0x400
 
+#define PEB_BASE                   (0x7FFDF000)
+
 #define EXCEPTION_CONTINUE_SEARCH     0
 #define EXCEPTION_EXECUTE_HANDLER     1
 
@@ -218,6 +226,12 @@
     ULONG ModuleCount;
     DEBUG_MODULE_INFORMATION ModuleEntry[1];
 } MODULE_INFORMATION, *PMODULE_INFORMATION;
+
+typedef struct _RTL_HEAP_DEFINITION
+{
+    ULONG Length;
+    ULONG Unknown[11];
+} RTL_HEAP_DEFINITION, *PRTL_HEAP_DEFINITION;
 /* END REVIEW AREA */
 
 typedef struct _EXCEPTION_REGISTRATION
@@ -229,6 +243,12 @@
 typedef EXCEPTION_REGISTRATION EXCEPTION_REGISTRATION_RECORD;
 typedef PEXCEPTION_REGISTRATION PEXCEPTION_REGISTRATION_RECORD;
 
+typedef struct _CURDIR
+{
+    UNICODE_STRING DosPath;
+    HANDLE Handle;
+} CURDIR, *PCURDIR;
+
 typedef struct RTL_DRIVE_LETTER_CURDIR
 {
     USHORT Flags;
@@ -237,12 +257,6 @@
     UNICODE_STRING DosPath;
 } RTL_DRIVE_LETTER_CURDIR, *PRTL_DRIVE_LETTER_CURDIR;
 
-typedef struct _RTL_HEAP_DEFINITION
-{
-    ULONG Length;
-    ULONG Unknown[11];
-} RTL_HEAP_DEFINITION, *PRTL_HEAP_DEFINITION;
-
 typedef struct _RTL_RANGE_LIST
 {
     LIST_ENTRY ListHead;
@@ -323,44 +337,44 @@
 
 typedef struct _RTL_USER_PROCESS_PARAMETERS
 {
-    ULONG  AllocationSize;
-    ULONG  Size;
-    ULONG  Flags;
-    ULONG  DebugFlags;
-    HANDLE  hConsole;
-    ULONG  ProcessGroup;
-    HANDLE  hStdInput;
-    HANDLE  hStdOutput;
-    HANDLE  hStdError;
-    UNICODE_STRING  CurrentDirectoryName;
-    HANDLE  CurrentDirectoryHandle;
-    UNICODE_STRING  DllPath;
-    UNICODE_STRING  ImagePathName;
-    UNICODE_STRING  CommandLine;
-    PWSTR  Environment;
-    ULONG  dwX;
-    ULONG  dwY;
-    ULONG  dwXSize;
-    ULONG  dwYSize;
-    ULONG  dwXCountChars;
-    ULONG  dwYCountChars;
-    ULONG  dwFillAttribute;
-    ULONG  dwFlags;
-    ULONG  wShowWindow;
-    UNICODE_STRING  WindowTitle;
-    UNICODE_STRING  DesktopInfo;
-    UNICODE_STRING  ShellInfo;
-    UNICODE_STRING  RuntimeInfo;
+    ULONG MaximumLength;
+    ULONG Length;
+    ULONG Flags;
+    ULONG DebugFlags;
+    HANDLE ConsoleHandle;
+    ULONG ConsoleFlags;
+    HANDLE StandardInput;
+    HANDLE StandardOutput;
+    HANDLE StandardError;
+    CURDIR CurrentDirectory;
+    UNICODE_STRING DllPath;
+    UNICODE_STRING ImagePathName;
+    UNICODE_STRING CommandLine;
+    PWSTR Environment;
+    ULONG StartingX;
+    ULONG StartingY;
+    ULONG CountX;
+    ULONG CountY;
+    ULONG CountCharsX;
+    ULONG CountCharsY;
+    ULONG FillAttribute;;
+    ULONG WindowFlags;
+    ULONG ShowWindowFlags;
+    UNICODE_STRING WindowTitle;
+    UNICODE_STRING DesktopInfo;
+    UNICODE_STRING ShellInfo;
+    UNICODE_STRING RuntimeData;
+    RTL_DRIVE_LETTER_CURDIR CurrentDirectories[32];
 } RTL_USER_PROCESS_PARAMETERS, *PRTL_USER_PROCESS_PARAMETERS;
 
-typedef struct _RTL_PROCESS_INFO
+typedef struct _RTL_USER_PROCESS_INFORMATION
 {
-   ULONG Size;
-   HANDLE ProcessHandle;
-   HANDLE ThreadHandle;
-   CLIENT_ID ClientId;
-   SECTION_IMAGE_INFORMATION ImageInfo;
-} RTL_PROCESS_INFO, *PRTL_PROCESS_INFO;
+    ULONG Size;
+    HANDLE ProcessHandle;
+    HANDLE ThreadHandle;
+    CLIENT_ID ClientId;
+    SECTION_IMAGE_INFORMATION ImageInformation;
+} RTL_USER_PROCESS_INFORMATION, *PRTL_USER_PROCESS_INFORMATION;
 
 typedef struct _RTL_ATOM_TABLE_ENTRY
 {

Modified: trunk/reactos/include/ndk/umfuncs.h
--- trunk/reactos/include/ndk/umfuncs.h	2005-07-11 23:32:55 UTC (rev 16539)
+++ trunk/reactos/include/ndk/umfuncs.h	2005-07-12 01:56:14 UTC (rev 16540)
@@ -122,7 +122,7 @@
     ULONG Unknown2
 );
 
-NTSTATUS
+VOID
 STDCALL
 DbgUiRemoteBreakin(VOID);
 

Modified: trunk/reactos/include/ndk/zwfuncs.h
--- trunk/reactos/include/ndk/zwfuncs.h	2005-07-11 23:32:55 UTC (rev 16539)
+++ trunk/reactos/include/ndk/zwfuncs.h	2005-07-12 01:56:14 UTC (rev 16540)
@@ -3693,6 +3693,7 @@
     IN HANDLE ThreadHandle,
     IN NTSTATUS ExitStatus
 );
+
 NTSTATUS
 STDCALL
 ZwTerminateThread(

Modified: trunk/reactos/include/ndk/zwtypes.h
--- trunk/reactos/include/ndk/zwtypes.h	2005-07-11 23:32:55 UTC (rev 16539)
+++ trunk/reactos/include/ndk/zwtypes.h	2005-07-12 01:56:14 UTC (rev 16540)
@@ -427,19 +427,22 @@
 /* Class 1 */
 typedef struct _SECTION_IMAGE_INFORMATION
 {
-    ULONG     EntryPoint;
-    ULONG     Unknown1;
-    ULONG_PTR StackReserve;
-    ULONG_PTR StackCommit;
-    ULONG     Subsystem;
-    USHORT    MinorSubsystemVersion;
-    USHORT    MajorSubsystemVersion;
-    ULONG     Unknown2;
-    ULONG     Characteristics;
-    USHORT    ImageNumber;
-    BOOLEAN   Executable;
-    UCHAR     Unknown3;
-    ULONG     Unknown4[3];
+    PVOID TransferAddress;
+    ULONG ZeroBits;
+    ULONG MaximumStackSize;
+    ULONG CommittedStackSize;
+    ULONG SubsystemType;
+    USHORT SubSystemMinorVersion;
+    USHORT SubSystemMajorVersion;
+    ULONG GpValue;
+    USHORT ImageCharacteristics;
+    USHORT DllChracteristics;
+    USHORT Machine;
+    UCHAR ImageContainsCode;
+    UCHAR Spare1;
+    ULONG LoaderFlags;
+    ULONG ImageFileSIze;
+    ULONG Reserved[1];
 } SECTION_IMAGE_INFORMATION, *PSECTION_IMAGE_INFORMATION;
 
 /*

Modified: trunk/reactos/lib/gdi32/main/dllmain.c
--- trunk/reactos/lib/gdi32/main/dllmain.c	2005-07-11 23:32:55 UTC (rev 16539)
+++ trunk/reactos/lib/gdi32/main/dllmain.c	2005-07-12 01:56:14 UTC (rev 16540)
@@ -32,7 +32,7 @@
 	hProcessHeap = GetProcessHeap();
 
         /* map the gdi handle table to user space */
-	GdiHandleTable = NtCurrentTeb()->Peb->GdiSharedHandleTable;
+	GdiHandleTable = NtCurrentTeb()->ProcessEnvironmentBlock->GdiSharedHandleTable;
 	CurrentProcessId = NtCurrentTeb()->Cid.UniqueProcess;
 }
 

Modified: trunk/reactos/lib/kernel32/file/file.c
--- trunk/reactos/lib/kernel32/file/file.c	2005-07-11 23:32:55 UTC (rev 16539)
+++ trunk/reactos/lib/kernel32/file/file.c	2005-07-12 01:56:14 UTC (rev 16540)
@@ -534,15 +534,15 @@
   switch ((ULONG)hFile)
     {
       case STD_INPUT_HANDLE:
-	hFile = NtCurrentPeb()->ProcessParameters->hStdInput;
+	hFile = NtCurrentPeb()->ProcessParameters->StandardInput;
 	break;
 
       case STD_OUTPUT_HANDLE:
-	hFile = NtCurrentPeb()->ProcessParameters->hStdOutput;
+	hFile = NtCurrentPeb()->ProcessParameters->StandardOutput;
 	break;
 
       case STD_ERROR_HANDLE:
-	hFile = NtCurrentPeb()->ProcessParameters->hStdError;
+	hFile = NtCurrentPeb()->ProcessParameters->StandardError;
 	break;
     }
 

Modified: trunk/reactos/lib/kernel32/include/kernel32.h
--- trunk/reactos/lib/kernel32/include/kernel32.h	2005-07-11 23:32:55 UTC (rev 16539)
+++ trunk/reactos/lib/kernel32/include/kernel32.h	2005-07-12 01:56:14 UTC (rev 16540)
@@ -23,6 +23,9 @@
 #define FIELD_OFFSET(type,fld)	((LONG)&(((type *)0)->fld))
 #endif
 
+#define IsConsoleHandle(h) \
+  ((((ULONG)h) & 0x10000003) == 0x3) ? TRUE : FALSE
+
 #define SetLastErrorByStatus(__S__) \
  ((void)SetLastError(RtlNtStatusToDosError(__S__)))
 
@@ -47,8 +50,6 @@
 
 /* FUNCTION PROTOTYPES *******************************************************/
 
-BOOL STDCALL IsConsoleHandle(HANDLE Handle);
-
 BOOL STDCALL VerifyConsoleIoHandle(HANDLE Handle);
 
 BOOL STDCALL CloseConsoleHandle(HANDLE Handle);

Modified: trunk/reactos/lib/kernel32/misc/console.c
--- trunk/reactos/lib/kernel32/misc/console.c	2005-07-11 23:32:55 UTC (rev 16539)
+++ trunk/reactos/lib/kernel32/misc/console.c	2005-07-12 01:56:14 UTC (rev 16540)
@@ -91,7 +91,7 @@
 		RtlEnterCriticalSection(&ConsoleLock);
 
 		if(!(nCode == CTRL_C_EVENT &&
-			NtCurrentPeb()->ProcessParameters->ProcessGroup & 1))
+			NtCurrentPeb()->ProcessParameters->ConsoleFlags & 1))
 		{
 			for(i = NrCtrlHandlers; i > 0; -- i)
 				if(CtrlHandlers[i - 1](nCode)) break;
@@ -110,7 +110,7 @@
 	RtlEnterCriticalSection(&ConsoleLock);
 
 	if(!(nCode == CTRL_C_EVENT &&
-		NtCurrentPeb()->ProcessParameters->ProcessGroup & 1))
+		NtCurrentPeb()->ProcessParameters->ConsoleFlags & 1))
 	{
 	i = NrCtrlHandlers;
 	while(i > 0)
@@ -1012,22 +1012,7 @@
   return TRUE;
 }
 
-
 /*
- * internal function
- */
-BOOL STDCALL
-IsConsoleHandle(HANDLE Handle)
-{
-  if ((((ULONG)Handle) & 0x10000003) == 0x3)
-    {
-      return(TRUE);
-    }
-  return(FALSE);
-}
-
-
-/*
  * @implemented
  */
 HANDLE STDCALL
@@ -1047,13 +1032,13 @@
   switch (nStdHandle)
     {
       case STD_INPUT_HANDLE:
-	return Ppb->hStdInput;
+	return Ppb->StandardInput;
 
       case STD_OUTPUT_HANDLE:
-	return Ppb->hStdOutput;
+	return Ppb->StandardOutput;
 
       case STD_ERROR_HANDLE:
-	return Ppb->hStdError;
+	return Ppb->StandardError;
     }
 
   SetLastError (ERROR_INVALID_PARAMETER);
@@ -1085,15 +1070,15 @@
   switch (nStdHandle)
     {
       case STD_INPUT_HANDLE:
-	Ppb->hStdInput = hHandle;
+	Ppb->StandardInput = hHandle;
 	return TRUE;
 
       case STD_OUTPUT_HANDLE:
-	Ppb->hStdOutput = hHandle;
+	Ppb->StandardOutput = hHandle;
 	return TRUE;
 
       case STD_ERROR_HANDLE:
-	Ppb->hStdError = hHandle;
+	Ppb->StandardError = hHandle;
 	return TRUE;
     }
 
@@ -1347,7 +1332,7 @@
    NTSTATUS Status;
    HANDLE hStdError;
 
-   if(NtCurrentPeb()->ProcessParameters->hConsole)
+   if(NtCurrentPeb()->ProcessParameters->ConsoleHandle)
    {
 	DPRINT("AllocConsole: Allocate duplicate console to the same Process\n");
 	SetLastErrorByStatus (STATUS_OBJECT_NAME_EXISTS);
@@ -1363,7 +1348,7 @@
 	 SetLastErrorByStatus ( Status );
 	 return FALSE;
       }
-   NtCurrentPeb()->ProcessParameters->hConsole = Request.Data.AllocConsoleRequest.Console;
+   NtCurrentPeb()->ProcessParameters->ConsoleHandle = Request.Data.AllocConsoleRequest.Console;
    SetStdHandle( STD_INPUT_HANDLE, Request.Data.AllocConsoleRequest.InputHandle );
    SetStdHandle( STD_OUTPUT_HANDLE, Request.Data.AllocConsoleRequest.OutputHandle );
    hStdError = DuplicateConsoleHandle(Request.Data.AllocConsoleRequest.OutputHandle,

Modified: trunk/reactos/lib/kernel32/misc/handle.c
--- trunk/reactos/lib/kernel32/misc/handle.c	2005-07-11 23:32:55 UTC (rev 16539)
+++ trunk/reactos/lib/kernel32/misc/handle.c	2005-07-12 01:56:14 UTC (rev 16540)
@@ -43,13 +43,13 @@
   switch ((ULONG)hObject)
   {
     case STD_INPUT_HANDLE:
-      hObject = Ppb->hStdInput;
+      hObject = Ppb->StandardInput;
       break;
     case STD_OUTPUT_HANDLE:
-      hObject = Ppb->hStdOutput;
+      hObject = Ppb->StandardOutput;
       break;
     case STD_ERROR_HANDLE:
-      hObject = Ppb->hStdError;
+      hObject = Ppb->StandardError;
       break;
   }
 
@@ -95,13 +95,13 @@
   switch ((ULONG)hObject)
   {
     case STD_INPUT_HANDLE:
-      hObject = Ppb->hStdInput;
+      hObject = Ppb->StandardInput;
       break;
     case STD_OUTPUT_HANDLE:
-      hObject = Ppb->hStdOutput;
+      hObject = Ppb->StandardOutput;
       break;
     case STD_ERROR_HANDLE:
-      hObject = Ppb->hStdError;
+      hObject = Ppb->StandardError;
       break;
   }
 
@@ -153,13 +153,13 @@
    switch ((ULONG)hObject)
    {
      case STD_INPUT_HANDLE:
-       hObject = Ppb->hStdInput;
+       hObject = Ppb->StandardInput;
        break;
      case STD_OUTPUT_HANDLE:
-       hObject = Ppb->hStdOutput;
+       hObject = Ppb->StandardOutput;
        break;
      case STD_ERROR_HANDLE:
-       hObject = Ppb->hStdError;
+       hObject = Ppb->StandardError;
        break;
    }
 
@@ -198,13 +198,13 @@
    switch ((ULONG)hSourceHandle)
    {
      case STD_INPUT_HANDLE:
-       hSourceHandle = Ppb->hStdInput;
+       hSourceHandle = Ppb->StandardInput;
        break;
      case STD_OUTPUT_HANDLE:
-       hSourceHandle = Ppb->hStdOutput;
+       hSourceHandle = Ppb->StandardOutput;
        break;
      case STD_ERROR_HANDLE:
-       hSourceHandle = Ppb->hStdError;
+       hSourceHandle = Ppb->StandardError;
        break;
    }
 

Modified: trunk/reactos/lib/kernel32/misc/ldr.c
--- trunk/reactos/lib/kernel32/misc/ldr.c	2005-07-11 23:32:55 UTC (rev 16539)
+++ trunk/reactos/lib/kernel32/misc/ldr.c	2005-07-12 01:56:14 UTC (rev 16540)
@@ -43,7 +43,7 @@
 	}
 	else
 	{
-	        ModuleName = NtCurrentTeb()->Peb->ProcessParameters->ImagePathName;
+	        ModuleName = NtCurrentTeb()->ProcessEnvironmentBlock->ProcessParameters->ImagePathName;
 	        lpModule = ModuleName.Buffer;
 	        lpModuleEnd = lpModule + (ModuleName.Length / sizeof(WCHAR));
 	}

Modified: trunk/reactos/lib/kernel32/misc/nls.c
--- trunk/reactos/lib/kernel32/misc/nls.c	2005-07-11 23:32:55 UTC (rev 16539)
+++ trunk/reactos/lib/kernel32/misc/nls.c	2005-07-12 01:56:14 UTC (rev 16540)
@@ -101,7 +101,7 @@
    /* Setup ANSI code page. */
    AnsiCodePage.CodePage = CP_ACP;
    AnsiCodePage.SectionHandle = NULL;
-   AnsiCodePage.SectionMapping = NtCurrentTeb()->Peb->AnsiCodePageData;
+   AnsiCodePage.SectionMapping = NtCurrentTeb()->ProcessEnvironmentBlock->AnsiCodePageData;
    RtlInitCodePageTable((PUSHORT)AnsiCodePage.SectionMapping,
                         &AnsiCodePage.CodePageTable);
    InsertTailList(&CodePageListHead, &AnsiCodePage.Entry);
@@ -109,7 +109,7 @@
    /* Setup OEM code page. */
    OemCodePage.CodePage = CP_OEMCP;
    OemCodePage.SectionHandle = NULL;
-   OemCodePage.SectionMapping = NtCurrentTeb()->Peb->OemCodePageData;
+   OemCodePage.SectionMapping = NtCurrentTeb()->ProcessEnvironmentBlock->OemCodePageData;
    RtlInitCodePageTable((PUSHORT)OemCodePage.SectionMapping,
                         &OemCodePage.CodePageTable);
    InsertTailList(&CodePageListHead, &OemCodePage.Entry);

Modified: trunk/reactos/lib/kernel32/process/create.c
--- trunk/reactos/lib/kernel32/process/create.c	2005-07-11 23:32:55 UTC (rev 16539)
+++ trunk/reactos/lib/kernel32/process/create.c	2005-07-12 01:56:14 UTC (rev 16540)
@@ -16,7 +16,7 @@
 /* FIXME */
 #include <rosrtl/thread.h>
 
-#define NDEBUG
+//#define NDEBUG
 #include "../include/debug.h"
 
 /* FUNCTIONS ****************************************************************/
@@ -339,7 +339,7 @@
    RtlRosR32AttribsToNativeAttribs(&oaThreadAttribs, lpThreadAttributes);
 
    /* native image */
-   if(Sii->Subsystem != IMAGE_SUBSYSTEM_NATIVE)
+   if(Sii->SubsystemType != IMAGE_SUBSYSTEM_NATIVE)
    {
       pTrueStartAddress = (PVOID)BaseProcessStart;
    }
@@ -368,8 +368,8 @@
 	  &oaThreadAttribs,
 	  dwCreationFlags & CREATE_SUSPENDED,
 	  0,
-	  Sii->StackReserve,
-	  Sii->StackCommit,
+	  Sii->MaximumStackSize,
+	  Sii->CommittedStackSize,
 	  pTrueStartAddress,
 	  &hThread,
 	  &cidClientId,
@@ -382,8 +382,8 @@
                                        &oaThreadAttribs,
 				       dwCreationFlags & CREATE_SUSPENDED,
 				       0,
-				       &(Sii->StackReserve),
-				       &(Sii->StackCommit),
+				       &(Sii->MaximumStackSize),
+				       &(Sii->CommittedStackSize),
 				       pTrueStartAddress,
 				       &hThread,
 				       &cidClientId,
@@ -401,8 +401,8 @@
           "StackCommit           %p\n"
 	  "ThreadHandle          %p\n"
 	  "ClientId.UniqueThread %p\n",
-	  Sii->StackReserve,
-	  Sii->StackCommit,
+	  Sii->MaximumStackSize,
+	  Sii->CommittedStackSize,
 	  hThread,
 	  cidClientId.UniqueThread);
 
@@ -550,7 +550,7 @@
 
    /* create the PPB */
    PpbBase = NULL;
-   PpbSize = Ppb->AllocationSize;
+   PpbSize = Ppb->MaximumLength;
    Status = NtAllocateVirtualMemory(ProcessHandle,
 				    &PpbBase,
 				    0,
@@ -566,7 +566,7 @@
    NtWriteVirtualMemory(ProcessHandle,
 			PpbBase,
 			Ppb,
-			Ppb->AllocationSize,
+			Ppb->MaximumLength,
 			&BytesWritten);
 
    /* write pointer to environment */
@@ -996,7 +996,7 @@
       return FALSE;
    }
 
-   if (0 != (Sii.Characteristics & IMAGE_FILE_DLL))
+   if (0 != (Sii.ImageCharacteristics & IMAGE_FILE_DLL))
    {
       NtClose(hSection);
       DPRINT("Can't execute a DLL\n");
@@ -1004,11 +1004,11 @@
       return FALSE;
    }
 
-   if (IMAGE_SUBSYSTEM_WINDOWS_GUI != Sii.Subsystem
-       && IMAGE_SUBSYSTEM_WINDOWS_CUI != Sii.Subsystem)
+   if (IMAGE_SUBSYSTEM_WINDOWS_GUI != Sii.SubsystemType
+       && IMAGE_SUBSYSTEM_WINDOWS_CUI != Sii.SubsystemType)
    {
       NtClose(hSection);
-      DPRINT("Invalid subsystem %d\n", Sii.Subsystem);
+      DPRINT("Invalid subsystem %d\n", Sii.SubsystemType);
       SetLastError(ERROR_CHILD_NOT_COMPLETE);
       return FALSE;
    }
@@ -1124,12 +1124,12 @@
    /*
     * Translate some handles for the new process
     */
-   if (Ppb->CurrentDirectoryHandle)
+   if (Ppb->CurrentDirectory.Handle)
    {
       Status = NtDuplicateObject (NtCurrentProcess(),
-	                          Ppb->CurrentDirectoryHandle,
+	                          Ppb->CurrentDirectory.Handle,
 				  hProcess,
-				  &Ppb->CurrentDirectoryHandle,
+				  &Ppb->CurrentDirectory.Handle,
 				  0,
 				  TRUE,
 				  DUPLICATE_SAME_ACCESS);
@@ -1159,15 +1159,15 @@
    Request = CREATE_PROCESS;
    CsrRequest.Data.CreateProcessRequest.NewProcessId =
       (HANDLE)ProcessBasicInfo.UniqueProcessId;
-   if (Sii.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI)
+   if (Sii.SubsystemType == IMAGE_SUBSYSTEM_WINDOWS_GUI)
    {
       /* Do not create a console for GUI applications */
       dwCreationFlags &= ~CREATE_NEW_CONSOLE;
       dwCreationFlags |= DETACHED_PROCESS;
    }
-   else if (Sii.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_CUI)
+   else if (Sii.SubsystemType == IMAGE_SUBSYSTEM_WINDOWS_CUI)
    {
-      if (NULL == Ppb->hConsole)
+      if (NULL == Ppb->ConsoleHandle)
       {
          dwCreationFlags |= CREATE_NEW_CONSOLE;
       }
@@ -1183,7 +1183,7 @@
       DbgPrint("Failed to tell csrss about new process. Expect trouble.\n");
    }
 
-   Ppb->hConsole = CsrRequest.Data.CreateProcessRequest.Console;
+   Ppb->ConsoleHandle = CsrRequest.Data.CreateProcessRequest.Console;
 
    InputSet = FALSE;
    OutputSet = FALSE;
@@ -1196,19 +1196,19 @@
    {
       if (lpStartupInfo->hStdInput)
       {
-	 Ppb->hStdInput = lpStartupInfo->hStdInput;
+	 Ppb->StandardInput = lpStartupInfo->hStdInput;
          InputSet = TRUE;
          InputDup = TRUE;
       }
       if (lpStartupInfo->hStdOutput)
       {
-	 Ppb->hStdOutput = lpStartupInfo->hStdOutput;
+	 Ppb->StandardOutput = lpStartupInfo->hStdOutput;
          OutputSet = TRUE;
          OutputDup = TRUE;
       }
       if (lpStartupInfo->hStdError)
       {
-	 Ppb->hStdError = lpStartupInfo->hStdError;
+	 Ppb->StandardError = lpStartupInfo->hStdError;
          ErrorSet = TRUE;
          ErrorDup = TRUE;
       }
@@ -1221,19 +1221,19 @@
    {
       if (! InputSet)
       {
-         Ppb->hStdInput = CsrRequest.Data.CreateProcessRequest.InputHandle;
+         Ppb->StandardInput = CsrRequest.Data.CreateProcessRequest.InputHandle;
          InputSet = TRUE;
          InputDup = FALSE;
       }
       if (! OutputSet)
       {
-         Ppb->hStdOutput = CsrRequest.Data.CreateProcessRequest.OutputHandle;
+         Ppb->StandardOutput = CsrRequest.Data.CreateProcessRequest.OutputHandle;
          OutputSet = TRUE;
          OutputDup = FALSE;
       }
       if (! ErrorSet)
       {
-         Ppb->hStdError = CsrRequest.Data.CreateProcessRequest.OutputHandle;
+         Ppb->StandardError = CsrRequest.Data.CreateProcessRequest.OutputHandle;
          ErrorSet = TRUE;
          ErrorDup = FALSE;
       }
@@ -1242,34 +1242,34 @@
    /* Use existing handles otherwise */
    if (! InputSet)
    {
-      Ppb->hStdInput = NtCurrentPeb()->ProcessParameters->hStdInput;
+      Ppb->StandardInput = NtCurrentPeb()->ProcessParameters->StandardInput;
       InputDup = TRUE;
    }
    if (! OutputSet)
    {
-      Ppb->hStdOutput = NtCurrentPeb()->ProcessParameters->hStdOutput;
+      Ppb->StandardOutput = NtCurrentPeb()->ProcessParameters->StandardOutput;
       OutputDup = TRUE;
    }
    if (! ErrorSet)
    {
-      Ppb->hStdError = NtCurrentPeb()->ProcessParameters->hStdError;
+      Ppb->StandardError = NtCurrentPeb()->ProcessParameters->StandardError;
       ErrorDup = TRUE;
    }
 
    /* Now duplicate handles if required */
-   if (InputDup && Ppb->hStdInput != NULL)
+   if (InputDup && Ppb->StandardInput != NULL)
    {
-      if (IsConsoleHandle(Ppb->hStdInput))
+      if (IsConsoleHandle(Ppb->StandardInput))
       {
-         Ppb->hStdInput = CsrRequest.Data.CreateProcessRequest.InputHandle;
+         Ppb->StandardInput = CsrRequest.Data.CreateProcessRequest.InputHandle;
       }
       else
       {
          DPRINT("Duplicate input handle\n");
          Status = NtDuplicateObject (NtCurrentProcess(),
-                                     Ppb->hStdInput,
+                                     Ppb->StandardInput,
                                      hProcess,
-                                     &Ppb->hStdInput,
+                                     &Ppb->StandardInput,
                                      0,
                                      TRUE,
                                      DUPLICATE_SAME_ACCESS);
@@ -1280,19 +1280,19 @@
       }
    }
 
-   if (OutputDup && Ppb->hStdOutput != NULL)
+   if (OutputDup && Ppb->StandardOutput != NULL)
    {
-      if (IsConsoleHandle(Ppb->hStdOutput))
+      if (IsConsoleHandle(Ppb->StandardOutput))
       {
-         Ppb->hStdOutput = CsrRequest.Data.CreateProcessRequest.OutputHandle;
+         Ppb->StandardOutput = CsrRequest.Data.CreateProcessRequest.OutputHandle;
       }
       else
       {
          DPRINT("Duplicate output handle\n");
          Status = NtDuplicateObject (NtCurrentProcess(),
-                                     Ppb->hStdOutput,
+                                     Ppb->StandardOutput,
                                      hProcess,
-                                     &Ppb->hStdOutput,
+                                     &Ppb->StandardOutput,
                                      0,
                                      TRUE,
                                      DUPLICATE_SAME_ACCESS);
@@ -1303,9 +1303,9 @@
       }
    }
 
-   if (ErrorDup && Ppb->hStdError != NULL)
+   if (ErrorDup && Ppb->StandardError != NULL)
    {
-      if (IsConsoleHandle(Ppb->hStdError))
+      if (IsConsoleHandle(Ppb->StandardError))
       {
          Request = DUPLICATE_HANDLE;
          CsrRequest.Data.DuplicateHandleRequest.ProcessId = (HANDLE)ProcessBasicInfo.UniqueProcessId;
@@ -1316,20 +1316,20 @@
                                       sizeof(CSR_API_MESSAGE));
          if (!NT_SUCCESS(Status) || !NT_SUCCESS(CsrRequest.Status))
          {
-            Ppb->hStdError = INVALID_HANDLE_VALUE;
+            Ppb->StandardError = INVALID_HANDLE_VALUE;
          }
          else
          {
-            Ppb->hStdError = CsrRequest.Data.DuplicateHandleRequest.Handle;
+            Ppb->StandardError = CsrRequest.Data.DuplicateHandleRequest.Handle;
          }
       }
       else
       {
          DPRINT("Duplicate error handle\n");
[truncated at 1000 lines; 1357 more skipped]