Index: ReactOS.rbuild
===================================================================
--- ReactOS.rbuild	(revision 21808)
+++ ReactOS.rbuild	(working copy)
@@ -24,14 +24,12 @@
     <define name="KDBG" value="1" />
     <property name="DBG_OR_KDBG" value="true" />
   </if>
-  
-  <if property="GDB" value="0">
-    <compilerflag>-Os</compilerflag>
-    <compilerflag>-Wno-strict-aliasing</compilerflag>
-    <compilerflag>-ftracer</compilerflag>
-    <compilerflag>-momit-leaf-frame-pointer</compilerflag>
-    <compilerflag>-mpreferred-stack-boundary=2</compilerflag>
-  </if>
+  <compilerflag>-O3</compilerflag>
+  <compilerflag>-fno-optimize-sibling-calls</compilerflag>
+  <compilerflag>-Wno-strict-aliasing</compilerflag>
+  <compilerflag>-ftracer</compilerflag>
+  <compilerflag>-momit-leaf-frame-pointer</compilerflag>
+  <compilerflag>-mpreferred-stack-boundary=2</compilerflag>
   <compilerflag>-Wpointer-arith</compilerflag>
 
   <include>.</include>
Index: subsystems/win32/win32k/ntuser/winsta.c
===================================================================
--- subsystems/win32/win32k/ntuser/winsta.c	(revision 21808)
+++ subsystems/win32/win32k/ntuser/winsta.c	(working copy)
@@ -97,10 +97,10 @@
 NTSTATUS
 STDCALL
 IntWinStaObjectOpen(OB_OPEN_REASON Reason,
+                    PEPROCESS Process,
                     PVOID ObjectBody,
-                    PEPROCESS Process,
-                    ULONG HandleCount,
-                    ACCESS_MASK GrantedAccess)
+                    ACCESS_MASK GrantedAccess,
+                    ULONG HandleCount)
 {
    PWINSTATION_OBJECT WinSta = (PWINSTATION_OBJECT)ObjectBody;
    NTSTATUS Status;
Index: subsystems/win32/win32k/include/winsta.h
===================================================================
--- subsystems/win32/win32k/include/winsta.h	(revision 21808)
+++ subsystems/win32/win32k/include/winsta.h	(working copy)
@@ -54,11 +54,11 @@
 
 NTSTATUS
 STDCALL
-IntWinStaObjectOpen(OB_OPEN_REASON Reason,
-                    PVOID ObjectBody,
-                    PEPROCESS Process,
-                    ULONG HandleCount,
-                    ACCESS_MASK GrantedAccess);
+IntWinStaObjectOpen(IN OB_OPEN_REASON Reason,
+                    IN PEPROCESS Process OPTIONAL,
+                    IN PVOID ObjectBody,
+                    IN ACCESS_MASK GrantedAccess,
+                    IN ULONG HandleCount);
 
 VOID STDCALL
 IntWinStaObjectDelete(PVOID DeletedObject);
Index: subsystems/win32/win32k/main/dllmain.c
===================================================================
--- subsystems/win32/win32k/main/dllmain.c	(revision 21808)
+++ subsystems/win32/win32k/main/dllmain.c	(working copy)
@@ -23,6 +23,7 @@
 
 #include <w32k.h>
 #include <include/napi.h>
+#include <win32k/callout.h>
 
 #define NDEBUG
 #include <debug.h>
@@ -164,7 +165,7 @@
 NTSTATUS 
 STDCALL
 Win32kThreadCallback(struct _ETHREAD *Thread,
-                     BOOLEAN Create)
+                     PSW32THREADCALLOUTTYPE Type)
 {
     struct _EPROCESS *Process;
     PW32THREAD Win32Thread;
@@ -193,7 +194,7 @@
         PsSetThreadWin32Thread(Thread, Win32Thread);
         /* FIXME - unlock the process */
     }
-  if (Create)
+  if (Type == PsW32ThreadCalloutInitialize)
     {
       HWINSTA hWinSta = NULL;
       HDESK hDesk = NULL;
@@ -380,7 +381,7 @@
     /*
      * Register Object Manager Callbacks
      */
-    CalloutData.WinStaCreate = IntWinStaObjectOpen;
+    CalloutData.WinStaOpen = IntWinStaObjectOpen;
     CalloutData.WinStaParse = IntWinStaObjectParse;
     CalloutData.WinStaDelete = IntWinStaObjectDelete;
     CalloutData.WinStaFind = IntWinStaObjectFind;
@@ -392,7 +393,7 @@
     /*
      * Register our per-process and per-thread structures.
      */
-    PsEstablishWin32Callouts(&CalloutData);
+    PsEstablishWin32Callouts((PWIN32_CALLOUTS_FPNS)&CalloutData);
 
     GlobalUserHeap = UserCreateHeap(&GlobalUserHeapSection,
                                     &GlobalUserHeapBase,
Index: subsystems/win32/win32k/objects/dc.c
===================================================================
--- subsystems/win32/win32k/objects/dc.c	(revision 21808)
+++ subsystems/win32/win32k/objects/dc.c	(working copy)
@@ -28,6 +28,14 @@
 #define NDEBUG
 #include <debug.h>
 
+/* ROS Internal. Please deprecate */
+NTHALAPI
+BOOLEAN
+NTAPI
+HalQueryDisplayOwnership(
+    VOID
+);
+
 #ifndef OBJ_COLORSPACE
 #define OBJ_COLORSPACE	(14)
 #endif
Index: subsystems/win32/win32k/w32k.h
===================================================================
--- subsystems/win32/win32k/w32k.h	(revision 21808)
+++ subsystems/win32/win32k/w32k.h	(working copy)
@@ -17,6 +17,7 @@
 #include <ntddk.h>
 #include <ntddmou.h>
 #include <ntndk.h>
+//#include <rtltypes.h>
 
 /* Win32 Headers */
 /* FIXME: Defines in winbase.h that we need... */
@@ -56,9 +57,6 @@
 #include <win32k/ntgdibad.h>
 #include <ntgdi.h>
 
-/* For access to SECTION_OBJECT. FIXME: Once compatible with NT, use NDK! */
-#include <internal/mm.h>
-
 /* Internal Win32K Header */
 #include "include/win32k.h"
 
Index: include/reactos/libs/epsapi/epsapi.h
===================================================================
--- include/reactos/libs/epsapi/epsapi.h	(revision 21808)
+++ include/reactos/libs/epsapi/epsapi.h	(working copy)
@@ -32,7 +32,7 @@
 typedef NTSTATUS (NTAPI *PTHREAD_ENUM_ROUTINE)(IN PSYSTEM_THREAD_INFORMATION CurrentThread,
                                                IN OUT PVOID CallbackContext);
 
-typedef NTSTATUS (NTAPI *PSYSMOD_ENUM_ROUTINE)(IN PSYSTEM_MODULE_INFORMATION_ENTRY CurrentModule,
+typedef NTSTATUS (NTAPI *PSYSMOD_ENUM_ROUTINE)(IN PRTL_PROCESS_MODULE_INFORMATION CurrentModule,
                                                IN OUT PVOID CallbackContext);
 
 typedef NTSTATUS (NTAPI *PPROCMOD_ENUM_ROUTINE)(IN HANDLE ProcessHandle,
@@ -100,18 +100,18 @@
 
 /* capturing & walking */
 NTSTATUS NTAPI
-PsaCaptureSystemModules(OUT PSYSTEM_MODULE_INFORMATION * SystemModules);
+PsaCaptureSystemModules(OUT PRTL_PROCESS_MODULES * SystemModules);
 
 NTSTATUS NTAPI
-PsaWalkSystemModules(IN PSYSTEM_MODULE_INFORMATION SystemModules,
+PsaWalkSystemModules(IN PRTL_PROCESS_MODULES SystemModules,
                      IN PSYSMOD_ENUM_ROUTINE Callback,
                      IN OUT PVOID CallbackContext);
 
-PSYSTEM_MODULE_INFORMATION_ENTRY FASTCALL
-PsaWalkFirstSystemModule(IN PSYSTEM_MODULE_INFORMATION SystemModules);
+PRTL_PROCESS_MODULE_INFORMATION FASTCALL
+PsaWalkFirstSystemModule(IN PRTL_PROCESS_MODULES SystemModules);
 
-PSYSTEM_MODULE_INFORMATION_ENTRY FASTCALL
-PsaWalkNextSystemModule(IN PSYSTEM_MODULE_INFORMATION CurrentSystemModule);
+PRTL_PROCESS_MODULE_INFORMATION FASTCALL
+PsaWalkNextSystemModule(IN PRTL_PROCESS_MODULES CurrentSystemModule);
 
 /* Process modules */
 NTSTATUS NTAPI
Index: include/reactos/arc/arc.h
===================================================================
--- include/reactos/arc/arc.h	(revision 21808)
+++ include/reactos/arc/arc.h	(working copy)
@@ -1,10 +1,6 @@
-/* ARC LOADER TYPES *********************************************************/
+#ifndef _ARC_
+#define _ARC_
 
-#ifndef __INCLUDE_ARC_H
-#define __INCLUDE_ARC_H
-
-/* Types */
-
 typedef enum _IDENTIFIER_FLAG
 {
     Failed = 0x01,
@@ -28,6 +24,20 @@
     MaximumClass
 } CONFIGURATION_CLASS;
 
+typedef enum
+{
+    HwFileDriver,
+    HwFilePort,
+    HwFileClass,
+    HwFileInf,
+    HwFileDll,
+    HwFileDetect,
+    HwFileHal,
+    HwFileCatalog,
+    HwFileMax,
+    HwFileDynUpdt = 31,
+} HwFileType;
+
 typedef struct _CONFIGURATION_COMPONENT
 {
     CONFIGURATION_CLASS Class;
@@ -47,7 +57,8 @@
     struct _CONFIGURATION_COMPONENT_DATA *Parent;
     struct _CONFIGURATION_COMPONENT_DATA *Child;
     struct _CONFIGURATION_COMPONENT_DATA *Sibling;
-    CONFIGURATION_COMPONENT Component;
+    CONFIGURATION_COMPONENT ComponentEntry;
+    PVOID ConfigurationData;
 } CONFIGURATION_COMPONENT_DATA, *PCONFIGURATION_COMPONENT_DATA;
 
 typedef struct _ARC_DISK_INFORMATION
@@ -55,4 +66,202 @@
     LIST_ENTRY DiskSignatureListHead;
 } ARC_DISK_INFORMATION, *PARC_DISK_INFORMATION;
 
+typedef struct _MONITOR_CONFIGURATION_DATA
+{
+    USHORT Version;
+    USHORT Revision;
+    USHORT HorizontalResolution;
+    USHORT HorizontalDisplayTime;
+    USHORT HorizontalBackPorch;
+    USHORT HorizontalFrontPorch;
+    USHORT HorizontalSync;
+    USHORT VerticalResolution;
+    USHORT VerticalBackPorch;
+    USHORT VerticalFrontPorch;
+    USHORT VerticalSync;
+    USHORT HorizontalScreenSize;
+    USHORT VerticalScreenSize;
+} MONITOR_CONFIGURATION_DATA, *PMONITOR_CONFIGURATION_DATA;
+
+typedef struct _FLOPPY_CONFIGURATION_DATA
+{
+    USHORT Version;
+    USHORT Revision;
+    CHAR Size[8];
+    ULONG MaxDensity;
+    ULONG MountDensity;
+} FLOPPY_CONFIGURATION_DATA, *PFLOPPY_CONFIGURATION_DATA;
+
+//
+// SMBIOS Table Header (FIXME: maybe move to smbios.h?)
+//
+typedef struct _SMBIOS_TABLE_HEADER
+{
+   CHAR Signature[4];
+   UCHAR Checksum;
+   UCHAR Length;
+   UCHAR MajorVersion;
+   UCHAR MinorVersion;
+   USHORT MaximumStructureSize;
+   UCHAR EntryPointRevision;
+   UCHAR Reserved[5];
+   CHAR Signature2[5];
+   UCHAR IntermediateChecksum;
+   USHORT StructureTableLength;
+   ULONG StructureTableAddress;
+   USHORT NumberStructures;
+   UCHAR Revision;
+} SMBIOS_TABLE_HEADER, *PSMBIOS_TABLE_HEADER;
+
+//
+// NLS Data Block
+//
+typedef struct _NLS_DATA_BLOCK
+{
+    PVOID AnsiCodePageData;
+    PVOID OemCodePageData;
+    PVOID UnicodeCodePageData;
+} NLS_DATA_BLOCK, *PNLS_DATA_BLOCK;
+
+//
+// Subsystem Specific Loader Blocks
+//
+typedef struct _PROFILE_PARAMETER_BLOCK
+{
+    USHORT Status;
+    USHORT Reserved;
+    USHORT DockingState;
+    USHORT Capabilities;
+    ULONG DockID;
+    ULONG SerialNumber;
+} PROFILE_PARAMETER_BLOCK, *PPROFILE_PARAMETER_BLOCK;
+
+typedef struct _HEADLESS_LOADER_BLOCK
+{
+    UCHAR UsedBiosSettings;
+    UCHAR DataBits;
+    UCHAR StopBits;
+    UCHAR Parity;
+    ULONG BaudRate;
+    ULONG PortNumber;
+    PUCHAR PortAddress;
+    USHORT PciDeviceId;
+    USHORT PciVendorId;
+    UCHAR PciBusNumber;
+    UCHAR PciSlotNumber;
+    UCHAR PciFunctionNumber;
+    ULONG PciFlags;
+    GUID SystemGUID;
+    UCHAR IsMMIODevice;
+    UCHAR TerminalType;
+} HEADLESS_LOADER_BLOCK, *PHEADLESS_LOADER_BLOCK;
+
+typedef struct _NETWORK_LOADER_BLOCK
+{
+    PCHAR DHCPServerACK;
+    ULONG DHCPServerACKLength;
+    PCHAR BootServerReplyPacket;
+    ULONG BootServerReplyPacketLength;
+} NETWORK_LOADER_BLOCK, *PNETWORK_LOADER_BLOCK;
+
+typedef struct _LOADER_PERFORMANCE_DATA
+{
+    ULONGLONG StartTime;
+    ULONGLONG EndTime;
+} LOADER_PERFORMANCE_DATA, *PLOADER_PERFORMANCE_DATA;
+
+//
+// Extended Loader Parameter Block
+//
+typedef struct _LOADER_PARAMETER_EXTENSION
+{
+    ULONG Size;
+    PROFILE_PARAMETER_BLOCK Profile;
+    ULONG MajorVersion;
+    ULONG MinorVersion;
+    PVOID EmInfFileImage;
+    ULONG EmInfFileSize;
+    PVOID TriageDumpBlock;
+    //
+    // NT 5.1
+    //
+    ULONG LoaderPagesSpanned;
+    PHEADLESS_LOADER_BLOCK HeadlessLoaderBlock;
+    PSMBIOS_TABLE_HEADER SMBiosEPSHeader;
+    PVOID DrvDBImage;
+    ULONG DrvDBSize;
+    PNETWORK_LOADER_BLOCK NetworkLoaderBlock;
+    //
+    // NT 5.2+
+    //
+    PCHAR HalpIRQLToTPR;
+    PCHAR HalpVectorToIRQL;
+    LIST_ENTRY FirmwareDescriptorListHead;
+    PVOID AcpiTable;
+    ULONG AcpiTableSize;
+    //
+    // NT 5.2 SP1+
+    //
+    ULONG BootViaWinload:1;
+    ULONG BootViaEFI:1;
+    ULONG Reserved:30;
+    LOADER_PERFORMANCE_DATA LoaderPerformanceData;
+    LIST_ENTRY BootApplicationPersistentData;
+    PVOID WmdTestResult;
+    GUID BootIdentifier;
+} LOADER_PARAMETER_EXTENSION, *PLOADER_PARAMETER_EXTENSION;
+
+//
+// Architecture specific Loader Parameter Blocks
+//
+typedef struct _IA64_LOADER_BLOCK
+{
+    ULONG PlaceHolder;
+} IA64_LOADER_BLOCK, *PIA64_LOADER_BLOCK;
+
+typedef struct _ALPHA_LOADER_BLOCK
+{
+    ULONG PlaceHolder;
+} ALPHA_LOADER_BLOCK, *PALPHA_LOADER_BLOCK;
+
+typedef struct _I386_LOADER_BLOCK
+{
+    PVOID CommonDataArea;
+    ULONG MachineType;
+    ULONG Reserved;
+} I386_LOADER_BLOCK, *PI386_LOADER_BLOCK;
+
+//
+// Loader Parameter Block
+//
+typedef struct _LOADER_PARAMETER_BLOCK
+{
+    LIST_ENTRY LoadOrderListHead;
+    LIST_ENTRY MemoryDescriptorListHead;
+    LIST_ENTRY BootDriverListHead;
+    ULONG_PTR KernelStack;
+    ULONG_PTR Prcb;
+    ULONG_PTR Process;
+    ULONG_PTR Thread;
+    ULONG RegistryLength;
+    PVOID RegistryBase;
+    PCONFIGURATION_COMPONENT_DATA ConfigurationRoot;
+    LPSTR ArcBootDeviceName;
+    LPSTR ArcHalDeviceName;
+    LPSTR NtBootPathName;
+    LPSTR NtHalPathName;
+    LPSTR LoadOptions;
+    PNLS_DATA_BLOCK NlsData;
+    PARC_DISK_INFORMATION ArcDiskInformation;
+    PVOID OemFontFile;
+    struct _SETUP_LOADER_BLOCK *SetupLdrBlock;
+    PLOADER_PARAMETER_EXTENSION Extension;
+    union
+    {
+        I386_LOADER_BLOCK I386;
+        ALPHA_LOADER_BLOCK Alpha;
+        IA64_LOADER_BLOCK Ia64;
+    } u;
+} LOADER_PARAMETER_BLOCK, *PLOADER_PARAMETER_BLOCK;
+
 #endif
Index: include/reactos/drivers/diskdump/diskdump.h
===================================================================
--- include/reactos/drivers/diskdump/diskdump.h	(revision 21808)
+++ include/reactos/drivers/diskdump/diskdump.h	(working copy)
@@ -2,7 +2,7 @@
 #define __DISKDUMP_H
 
 #include <ntddscsi.h>
-#include <ndk/ntndk.h>
+#include <ketypes.h>
 
 #define MM_CORE_DUMP_HEADER_MAGIC         (0xdeafbead)
 #define MM_CORE_DUMP_HEADER_VERSION       (0x1)
Index: include/winsock2.h
===================================================================
--- include/winsock2.h	(revision 21808)
+++ include/winsock2.h	(working copy)
@@ -214,7 +214,8 @@
 #define IMPLINK_IP	155
 #define IMPLINK_LOWEXPER	156
 #define IMPLINK_HIGHEXPER       158
-struct in_addr {
+#ifndef s_addr
+typedef struct in_addr {
 	union {
 		struct { u_char s_b1,s_b2,s_b3,s_b4; } S_un_b;
 		struct { u_short s_w1,s_w2; } S_un_w;
@@ -226,7 +227,8 @@
 #define s_imp   S_un.S_un_w.s_w2
 #define s_impno S_un.S_un_b.s_b4
 #define s_lh    S_un.S_un_b.s_b3
-};
+} IN_ADDR, *PIN_ADDR;
+#endif
 #define IN_CLASSA(i)	((long)(i)&0x80000000)
 #define IN_CLASSA_NET	0xff000000
 #define IN_CLASSA_NSHIFT	24
@@ -589,8 +591,6 @@
 typedef struct linger LINGER;
 typedef struct linger *PLINGER;
 typedef struct linger *LPLINGER;
-typedef struct in_addr IN_ADDR;
-typedef struct in_addr *PIN_ADDR;
 typedef struct in_addr *LPIN_ADDR;
 typedef struct fd_set FD_SET;
 typedef struct fd_set *PFD_SET;
Index: include/ws2tcpip.h
===================================================================
--- include/ws2tcpip.h	(revision 21808)
+++ include/ws2tcpip.h	(working copy)
@@ -144,13 +144,7 @@
    (sizeof(struct ip_msfilter) - sizeof(struct in_addr) \
    + (numsrc) * sizeof(struct in_addr))
 
-struct in_pktinfo {
-	IN_ADDR ipi_addr;
-	UINT    ipi_ifindex;
-};
-typedef struct in_pktinfo IN_PKTINFO;
 
-
 /* ipv6 */
 /* These require XP or .NET Server or use of add-on IPv6 stacks on NT 4
   or higher */
Index: include/winnt.h
===================================================================
--- include/winnt.h	(revision 21808)
+++ include/winnt.h	(working copy)
@@ -968,7 +968,9 @@
 #define SECTION_QUERY 1
 #define SECTION_MAP_EXECUTE 8
 #define SECTION_ALL_ACCESS 0xf001f
+#ifndef __NTDDK_H
 #define MESSAGE_RESOURCE_UNICODE 1
+#endif
 #define RTL_CRITSECT_TYPE 0
 #define RTL_RESOURCE_TYPE 1
 /* Also in winddk.h */
@@ -2500,7 +2502,6 @@
 	DWORD Protect;
 	DWORD Type;
 } MEMORY_BASIC_INFORMATION,*PMEMORY_BASIC_INFORMATION;
-#endif
 typedef struct _MESSAGE_RESOURCE_ENTRY {
 	WORD Length;
 	WORD Flags;
@@ -2515,6 +2516,7 @@
 	DWORD NumberOfBlocks;
 	MESSAGE_RESOURCE_BLOCK Blocks[1];
 } MESSAGE_RESOURCE_DATA,*PMESSAGE_RESOURCE_DATA;
+#endif
 typedef struct _LIST_ENTRY {
 	struct _LIST_ENTRY *Flink;
 	struct _LIST_ENTRY *Blink;
Index: include/ddk/winddk.h
===================================================================
--- include/ddk/winddk.h	(revision 21808)
+++ include/ddk/winddk.h	(working copy)
@@ -200,8 +200,12 @@
 #define NtCurrentProcess() ( (HANDLE)(LONG_PTR) -1 )  
 #define ZwCurrentProcess() NtCurrentProcess()         
 #define NtCurrentThread() ( (HANDLE)(LONG_PTR) -2 )   
-#define ZwCurrentThread() NtCurrentThread()      
+#define ZwCurrentThread() NtCurrentThread()     
+#ifdef _REACTOS_ 
+#define KIP0PCRADDRESS                      0xff000000
+#else
 #define KIP0PCRADDRESS                      0xffdff000
+#endif
 
 #define KERNEL_STACK_SIZE                   12288
 #define KERNEL_LARGE_STACK_SIZE             61440
@@ -231,6 +235,8 @@
 #define HIGH_PRIORITY                     31
 #define MAXIMUM_PRIORITY                  32
 
+#define MAXIMUM_SUSPEND_COUNT             MAXCHAR
+
 #define FILE_SUPERSEDED                   0x00000000
 #define FILE_OPENED                       0x00000001
 #define FILE_CREATED                      0x00000002
@@ -407,6 +413,8 @@
     LONG High2Time;
 } KSYSTEM_TIME, *PKSYSTEM_TIME;
 
+extern volatile KSYSTEM_TIME KeTickCount;
+
 typedef struct _KUSER_SHARED_DATA 
 {
     ULONG TickCountLowDeprecated;
@@ -1024,6 +1032,8 @@
 
 #define LOCK_QUEUE_WAIT                   1
 #define LOCK_QUEUE_OWNER                  2
+#define LOCK_QUEUE_TIMER_LOCK_SHIFT       4
+#define LOCK_QUEUE_TIMER_TABLE_LOCKS (1 << (8 - LOCK_QUEUE_TIMER_LOCK_SHIFT))
 
 typedef enum _KSPIN_LOCK_QUEUE_NUMBER {
   LockQueueDispatcherLock,
@@ -1041,7 +1051,10 @@
   LockQueueNtfsStructLock,
   LockQueueAfdWorkQueueLock,
   LockQueueBcbLock,
-  LockQueueMaximumLock
+  LockQueueMmNonPagedPoolLock,
+  LockQueueUnusedSpare16,
+  LockQueueTimerTableLock,
+  LockQueueMaximumLock = LockQueueTimerTableLock + LOCK_QUEUE_TIMER_TABLE_LOCKS
 } KSPIN_LOCK_QUEUE_NUMBER, *PKSPIN_LOCK_QUEUE_NUMBER;
 
 typedef struct _KSPIN_LOCK_QUEUE {
Index: include/ndk/haltypes.h
===================================================================
--- include/ndk/haltypes.h	(revision 21808)
+++ include/ndk/haltypes.h	(working copy)
@@ -1,4 +1,4 @@
-/*++ NDK Version: 0095
+/*++ NDK Version: 0098
 
 Copyright (c) Alex Ionescu.  All rights reserved.
 
@@ -12,7 +12,7 @@
 
 Author:
 
-    Alex Ionescu (alex.ionescu@reactos.com)   06-Oct-2004
+    Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
 
 --*/
 
@@ -27,28 +27,9 @@
 #ifndef NTOS_MODE_USER
 
 //
-// Multi-Boot Flags (REMOVE ME)
-//
-#ifdef _REACTOS_
-#define MB_FLAGS_MEM_INFO                   (0x1)
-#define MB_FLAGS_BOOT_DEVICE                (0x2)
-#define MB_FLAGS_COMMAND_LINE               (0x4)
-#define MB_FLAGS_MODULE_INFO                (0x8)
-#define MB_FLAGS_AOUT_SYMS                  (0x10)
-#define MB_FLAGS_ELF_SYMS                   (0x20)
-#define MB_FLAGS_MMAP_INFO                  (0x40)
-#define MB_FLAGS_DRIVES_INFO                (0x80)
-#define MB_FLAGS_CONFIG_TABLE               (0x100)
-#define MB_FLAGS_BOOT_LOADER_NAME           (0x200)
-#define MB_FLAGS_APM_TABLE                  (0x400)
-#define MB_FLAGS_GRAPHICS_TABLE             (0x800)
-#define MB_FLAGS_ACPI_TABLE                 (0x1000)
-#endif
-
-//
 // HalShutdownSystem Types
 //
-typedef enum _FIRMWARE_ENTRY
+typedef enum _FIRMWARE_REENTRY
 {
     HalHaltRoutine,
     HalPowerDownRoutine,
@@ -59,190 +40,112 @@
 } FIRMWARE_REENTRY, *PFIRMWARE_REENTRY;
 
 //
-// Hal Private dispatch Table
+// HAL Private function Types
 //
-#define HAL_PRIVATE_DISPATCH_VERSION        2
-typedef struct _HAL_PRIVATE_DISPATCH
-{
-    ULONG Version;
-    PVOID HalHandlerForBus;
-    PVOID HalHandlerForBus2;
-    PVOID HalLocateHiberRanges;
-    PVOID HalRegisterBusHandler;
-    PVOID HalSetWakeEnable;
-    PVOID HalSetWakeAlarm;
-    PVOID HalTranslateBusAddress;
-    PVOID HalTranslateBusAddress2;
-    PVOID HalHaltSystem;
-    PVOID Null;
-    PVOID Null2;
-    PVOID HalAllocateMapRegisters;
-    PVOID KdSetupPciDeviceForDebugging;
-    PVOID KdReleasePciDeviceforDebugging;
-    PVOID KdGetAcpiTablePhase0;
-    PVOID HalReferenceHandler;
-    PVOID HalVectorToIDTEntry;
-    PVOID MatchAll;
-    PVOID KdUnmapVirtualAddress;
-} HAL_PRIVATE_DISPATCH, *PHAL_PRIVATE_DISPATCH;
+typedef
+PBUS_HANDLER
+(*pHalHandlerForConfigSpace)(
+    IN BUS_DATA_TYPE  ConfigSpace,
+    IN ULONG BusNumber
+);
 
-#ifndef _REACTOS_
-//
-// NLS Data Block
-//
-typedef struct _NLS_TABLE_DATA
-{
-    PVOID AnsiCodePageData;
-    PVOID OemCodePageData;
-    PVOID UnicodeCodePageData;
-} NLS_TABLE_DATA, *PNLS_TABLE_DATA;
+typedef
+NTSTATUS
+(*PINSTALL_BUS_HANDLER)(
+    IN PBUS_HANDLER Bus
+);
 
-//
-// Subsystem Specific Loader Blocks
-//
-typedef struct _PROFILE_PARAMETER_BLOCK
-{
-    USHORT DockData0;
-    USHORT DockData1;
-    USHORT DockData2;
-    USHORT DockData3;
-    ULONG DockData4;
-    ULONG DockData5;
-} PROFILE_PARAMETER_BLOCK, *PPROFILE_PARAMETER_BLOCK;
+typedef
+NTSTATUS
+(*pHalRegisterBusHandler)(
+    IN INTERFACE_TYPE InterfaceType,
+    IN BUS_DATA_TYPE ConfigSpace,
+    IN ULONG BusNumber,
+    IN INTERFACE_TYPE ParentInterfaceType,
+    IN ULONG ParentBusNumber,
+    IN ULONG ContextSize,
+    IN PINSTALL_BUS_HANDLER InstallCallback,
+    OUT PBUS_HANDLER *BusHandler
+);
 
-typedef struct _HEADLESS_LOADER_BLOCK
-{
-    UCHAR Unknown[0xC];
-} HEADLESS_LOADER_BLOCK, *PHEADLESS_LOADER_BLOCK;
+typedef
+VOID
+(*pHalSetWakeEnable)(
+    IN BOOLEAN Enable
+);
 
-typedef struct _NETWORK_LOADER_BLOCK
-{
-    UCHAR Unknown[0xC];
-} NETWORK_LOADER_BLOCK, *PNETWORK_LOADER_BLOCK;
 
-//
-// Extended Loader Parameter Block
-//
-typedef struct _LOADER_PARAMETER_EXTENSION
-{
-    ULONG Size;
-    PROFILE_PARAMETER_BLOCK ProfileParameterBlock;
-    ULONG MajorVersion;
-    ULONG MinorVersion;
-    PVOID SpecialConfigInfFile;
-    ULONG SpecialConfigInfSize;
-    PVOID TriageDumpData;
-    //
-    // NT 5.1
-    //
-    ULONG NumberOfPages;
-    PHEADLESS_LOADER_BLOCK HeadlessLoaderBlock;
-    PVOID Unknown1;
-    PVOID PrefetchDatabaseBase;
-    ULONG PrefetchDatabaseSize;
-    PNETWORK_LOADER_BLOCK NetworkLoaderBlock;
-    //
-    // NT 5.2+
-    //
-    PVOID Reserved[2];
-    LIST_ENTRY FirmwareListEntry;
-    PVOID AcpiTableBase;
-    ULONG AcpiTableSize;
-} LOADER_PARAMETER_EXTENSION, *PLOADER_PARAMETER_EXTENSION;
+typedef
+VOID
+(*pHalSetWakeAlarm)(
+    IN ULONGLONG AlartTime,
+    IN PTIME_FIELDS TimeFields
+);
 
-//
-// Architecture specific Loader Parameter Blocks
-//
-typedef struct _I386_LOADER_BLOCK
-{
-    PVOID CommonDataArea;
-    ULONG MachineType;
-    ULONG Reserved;
-} I386_LOADER_BLOCK, *PI386_LOADER_BLOCK;
+typedef
+VOID
+(*pHalLocateHiberRanges)(
+    IN PVOID MemoryMap
+);
 
-//
-// Setup Loader Parameter Block
-//
-typedef struct _SETUP_LOADER_BLOCK
-{
-    ULONG Unknown[139];
-    ULONG Flags;
-} SETUP_LOADER_BLOCK, *PSETUP_LOADER_BLOCK;
+typedef
+BOOLEAN
+(*pHalAllocateMapRegisters)(
+    IN PADAPTER_OBJECT AdapterObject,
+    IN ULONG Unknown,
+    IN ULONG Unknown2,
+    PMAP_REGISTER_ENTRY Registers
+);
 
 //
-// Loader Parameter Block
+// Hal Private dispatch Table
 //
-typedef struct _LOADER_PARAMETER_BLOCK
+#define HAL_PRIVATE_DISPATCH_VERSION        2
+typedef struct _HAL_PRIVATE_DISPATCH
 {
-    LIST_ENTRY LoadOrderListHead;
-    LIST_ENTRY MemoryDescriptorListHead;
-    LIST_ENTRY DriverList;
-    PVOID KernelStack;
-    PVOID Prcb;
-    PVOID Process;
-    PVOID Thread;
-    ULONG RegistryLength;
-    PVOID RegistryBase;
-    PCONFIGURATION_COMPONENT_DATA ConfigurationRoot;
-    LPSTR ArcBootDeviceName;
-    LPSTR ArcHalDeviceName;
-    LPSTR SystemRoot;
-    LPSTR BootRoot;
-    LPSTR CommandLine;
-    PNLS_TABLE_DATA NlsTables;
-    PARC_DISK_INFORMATION ArcDevices;
-    PVOID OEMFont;
-    PSETUP_LOADER_BLOCK SetupLdrBlock;
-    PLOADER_PARAMETER_EXTENSION LpbExtension;
-    union
-    {
-        I386_LOADER_BLOCK I386;
-    } u;
-} LOADER_PARAMETER_BLOCK, *PLOADER_PARAMETER_BLOCK;
+    ULONG Version;
+    pHalHandlerForBus HalHandlerForBus;
+    pHalHandlerForConfigSpace HalHandlerForConfigSpace;
+    pHalLocateHiberRanges HalLocateHiberRanges;
+    pHalRegisterBusHandler HalRegisterBusHandler;
+    pHalSetWakeEnable HalSetWakeEnable;
+    pHalSetWakeAlarm HalSetWakeAlarm;
+    pHalTranslateBusAddress HalPciTranslateBusAddress;
+    pHalAssignSlotResources HalPciAssignSlotResources;
+    pHalHaltSystem HalHaltSystem;
+    pHalFindBusAddressTranslation HalFindBusAddressTranslation;
+    pHalResetDisplay HalResetDisplay;
+    pHalAllocateMapRegisters HalAllocateMapRegisters;
+    pKdSetupPciDeviceForDebugging KdSetupPciDeviceForDebugging;
+    pKdReleasePciDeviceForDebugging KdReleasePciDeviceforDebugging;
+    pKdGetAcpiTablePhase0 KdGetAcpiTablePhase0;
+    pKdCheckPowerButton KdCheckPowerButton;
+    pHalVectorToIDTEntry HalVectorToIDTEntry;
+    pKdMapPhysicalMemory64 KdMapPhysicalMemory64;
+    pKdUnmapVirtualAddress KdUnmapVirtualAddress;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    pKdGetPciDataByOffset KdGetPciDataByOffset;
+    pKdSetPciDataByOffset KdSetPciDataByOffset;
+    PVOID HalGetInterruptVectorOverride;
+    PVOID HalGetVectorInputOverride;
+#endif
+} HAL_PRIVATE_DISPATCH, *PHAL_PRIVATE_DISPATCH;
 
-#else
-
 //
-// FIXME: ReactOS ONLY
+// Kernel Exports
 //
-typedef struct _LOADER_MODULE
-{
-    ULONG ModStart;
-    ULONG ModEnd;
-    ULONG String;
-    ULONG Reserved;
-} LOADER_MODULE, *PLOADER_MODULE;
-typedef struct _LOADER_PARAMETER_BLOCK
-{
-    ULONG Flags;
-    ULONG MemLower;
-    ULONG MemHigher;
-    ULONG BootDevice;
-    ULONG CommandLine;
-    ULONG ModsCount;
-    ULONG ModsAddr;
-    UCHAR Syms[12];
-    ULONG MmapLength;
-    ULONG MmapAddr;
-    ULONG DrivesCount;
-    ULONG DrivesAddr;
-    ULONG ConfigTable;
-    ULONG BootLoaderName;
-    ULONG PageDirectoryStart;
-    ULONG PageDirectoryEnd;
-    ULONG KernelBase;
-} LOADER_PARAMETER_BLOCK, *PLOADER_PARAMETER_BLOCK;
+#ifndef _NTOSKRNL_
+extern PHAL_PRIVATE_DISPATCH HalPrivateDispatchTable;
+#else
+extern HAL_PRIVATE_DISPATCH HalPrivateDispatchTable;
 #endif
 
 //
-// Kernel Exports
+// HAL Exports
 //
-#ifdef __NTOSKRNL__
-extern HAL_PRIVATE_DISPATCH HalPrivateDispatchTable;
-#else
-extern PHAL_PRIVATE_DISPATCH HalPrivateDispatchTable;
+#ifndef _NTHAL_
+extern PUCHAR *KdComPortInUse;
 #endif
-extern ULONG KdComPortInUse;
 
 #endif
 #endif
Index: include/ndk/ifssupp.h
===================================================================
--- include/ndk/ifssupp.h	(revision 21808)
+++ include/ndk/ifssupp.h	(working copy)
@@ -1,4 +1,4 @@
-/*++ NDK Version: 0095
+/*++ NDK Version: 0098
 
 Copyright (c) Alex Ionescu.  All rights reserved.
 
@@ -12,7 +12,7 @@
 
 Author:
 
-    Alex Ionescu (alex.ionescu@reactos.com)   06-Oct-2004
+    Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
 
 --*/
 #ifndef _NTIFS_
Index: include/ndk/iotypes.h
===================================================================
--- include/ndk/iotypes.h	(revision 21808)
+++ include/ndk/iotypes.h	(working copy)
@@ -1,4 +1,4 @@
-/*++ NDK Version: 0095
+/*++ NDK Version: 0098
 
 Copyright (c) Alex Ionescu.  All rights reserved.
 
@@ -12,7 +12,7 @@
 
 Author:
 
-    Alex Ionescu (alex.ionescu@reactos.com)   06-Oct-2004
+    Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
 
 --*/
 
@@ -167,6 +167,14 @@
 #define DNUF_NOT_DISABLEABLE                    0x0008
 
 //
+// Undocumented WMI Registration Flags
+//
+#define WMIREG_FLAG_TRACE_PROVIDER          0x00010000
+#define WMIREG_FLAG_TRACE_NOTIFY_MASK       0x00F00000
+#define WMIREG_NOTIFY_DISK_IO               0x00100000
+#define WMIREG_NOTIFY_TDI_IO                0x00200000
+
+//
 // I/O Completion Information Class for NtQueryIoCompletionInformation
 //
 typedef enum _IO_COMPLETION_INFORMATION_CLASS
@@ -201,6 +209,24 @@
     MaximumInterfaceType
 }INTERFACE_TYPE, *PINTERFACE_TYPE;
 
+typedef enum _BUS_DATA_TYPE
+{
+    ConfigurationSpaceUndefined = -1,
+    Cmos,
+    EisaConfiguration,
+    Pos,
+    CbusConfiguration,
+    PCIConfiguration,
+    VMEConfiguration,
+    NuBusConfiguration,
+    PCMCIAConfiguration,
+    MPIConfiguration,
+    MPSAConfiguration,
+    PNPISAConfiguration,
+    SgiInternalConfiguration,
+    MaximumBusDataType
+} BUS_DATA_TYPE, *PBUS_DATA_TYPE;
+
 //
 // File Information Classes for NtQueryInformationFile
 //
@@ -491,6 +517,21 @@
     LARGE_INTEGER ValidDataLength;
 } FILE_VALID_DATA_LENGTH_INFORMATION, *PFILE_VALID_DATA_LENGTH_INFORMATION;
 
+typedef struct _FILE_DIRECTORY_INFORMATION
+{
+    ULONG NextEntryOffset;
+    ULONG FileIndex;
+    LARGE_INTEGER CreationTime;
+    LARGE_INTEGER LastAccessTime;
+    LARGE_INTEGER LastWriteTime;
+    LARGE_INTEGER ChangeTime;
+    LARGE_INTEGER EndOfFile;
+    LARGE_INTEGER AllocationSize;
+    ULONG FileAttributes;
+    ULONG FileNameLength;
+    WCHAR FileName[1];
+} FILE_DIRECTORY_INFORMATION, *PFILE_DIRECTORY_INFORMATION;
+
 //
 // File System Information structures for NtQueryInformationFile
 //
@@ -997,6 +1038,30 @@
 #endif
 
 //
+// Firmware Boot File Path
+//
+typedef struct _FILE_PATH
+{
+    ULONG Version;
+    ULONG Length;
+    ULONG Type;
+    CHAR FilePath[1];
+} FILE_PATH, *PFILE_PATH;
+
+//
+// Firmware Boot Options
+//
+typedef struct _BOOT_OPTIONS
+{
+    ULONG Version;
+    ULONG Length;
+    ULONG Timeout;
+    ULONG CurrentBootEntryId;
+    ULONG NextBootEntryId;
+    WCHAR HeadlessRedirection[1];
+} BOOT_OPTIONS, *PBOOT_OPTIONS;
+
+//
 // APC Callback for NtCreateFile
 //
 typedef VOID
Index: include/ndk/dbgktypes.h
===================================================================
--- include/ndk/dbgktypes.h	(revision 21808)
+++ include/ndk/dbgktypes.h	(working copy)
@@ -1,4 +1,4 @@
-/*++ NDK Version: 0095
+/*++ NDK Version: 0098
 
 Copyright (c) Alex Ionescu.  All rights reserved.
 
@@ -12,7 +12,7 @@
 
 Author:
 
-    Alex Ionescu (alex.ionescu@reactos.com)   06-Oct-2004
+    Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
 
 --*/
 
Index: include/ndk/setypes.h
===================================================================
--- include/ndk/setypes.h	(revision 21808)
+++ include/ndk/setypes.h	(working copy)
@@ -1,4 +1,4 @@
-/*++ NDK Version: 0095
+/*++ NDK Version: 0098
 
 Copyright (c) Alex Ionescu.  All rights reserved.
 
@@ -12,7 +12,7 @@
 
 Author:
 
-    Alex Ionescu (alex.ionescu@reactos.com)   06-Oct-2004
+    Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
 
 --*/
 
Index: include/ndk/kdfuncs.h
===================================================================
--- include/ndk/kdfuncs.h	(revision 21808)
+++ include/ndk/kdfuncs.h	(working copy)
@@ -1,4 +1,4 @@
-/*++ NDK Version: 0095
+/*++ NDK Version: 0098
 
 Copyright (c) Alex Ionescu.  All rights reserved.
 
@@ -12,7 +12,7 @@
 
 Author:
 
-    Alex Ionescu (alex.ionescu@reactos.com)   06-Oct-2004
+    Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
 
 --*/
 
@@ -34,91 +34,37 @@
 NTAPI
 KdPollBreakIn(VOID);
 
-BOOLEAN
+NTSTATUS
 NTAPI
-KdPortInitialize(
-    PKD_PORT_INFORMATION PortInformation,
-    ULONG Unknown1,
-    ULONG Unknown2
-);
+KdRestore(IN BOOLEAN DisableDbgPorts);
 
-BOOLEAN
+NTSTATUS
 NTAPI
-KdPortInitializeEx(
-    PKD_PORT_INFORMATION PortInformation,
-    ULONG Unknown1,
-    ULONG Unknown2
-);
+KdSave(IN ULONG Unknown);
 
-BOOLEAN
+#ifdef _ARC_
+NTSTATUS
 NTAPI
-KdPortGetByte(
-    PUCHAR ByteRecieved
+KdDebuggerInitialize0(
+    IN struct _LOADER_PARAMETER_BLOCK *LoaderBlock
 );
+#endif
 
-BOOLEAN
+//
+// Debugger API
+//
+NTSTATUS
 NTAPI
-KdPortGetByteEx(
-    PKD_PORT_INFORMATION PortInformation,
-    PUCHAR ByteRecieved
+KdSystemDebugControl(
+    SYSDBG_COMMAND Command,
+    PVOID InputBuffer,
+    ULONG InputBufferLength,
+    PVOID OutputBuffer,
+    ULONG OutputBufferLength,
+    PULONG ReturnLength,
+    KPROCESSOR_MODE PreviousMode
 );
 
-BOOLEAN
-NTAPI
-KdPortPollByte(
-    PUCHAR ByteRecieved
-);
-
-BOOLEAN
-NTAPI
-KdPortPollByteEx(
-    PKD_PORT_INFORMATION PortInformation,
-    PUCHAR ByteRecieved
-);
-
-VOID
-NTAPI
-KdPortPutByte(
-    UCHAR ByteToSend
-);
-
-VOID
-NTAPI
-KdPortPutByteEx(
-    PKD_PORT_INFORMATION PortInformation,
-    UCHAR ByteToSend
-);
-
-VOID
-NTAPI
-KdPortRestore(VOID);
-
-VOID
-NTAPI
-KdPortSave (VOID);
-
-VOID
-NTAPI
-KdRestore(VOID);
-
-VOID
-NTAPI
-KdSave (VOID);
-
-BOOLEAN
-NTAPI
-KdPortDisableInterrupts(VOID);
-
-BOOLEAN
-NTAPI
-KdPortEnableInterrupts(VOID);
-
-BOOLEAN
-NTAPI
-KdDebuggerInitialize0(
-    IN PLOADER_PARAMETER_BLOCK LoaderBlock
-);
-
 #endif
 
 //
@@ -145,7 +91,7 @@
 NTSTATUS
 NTAPI
 NtSystemDebugControl(
-    DEBUG_CONTROL_CODE ControlCode,
+    SYSDBG_COMMAND ControlCode,
     PVOID InputBuffer,
     ULONG InputBufferLength,
     PVOID OutputBuffer,
@@ -174,7 +120,7 @@
 NTSTATUS
 NTAPI
 ZwSystemDebugControl(
-    DEBUG_CONTROL_CODE ControlCode,
+    SYSDBG_COMMAND ControlCode,
     PVOID InputBuffer,
     ULONG InputBufferLength,
     PVOID OutputBuffer,
Index: include/ndk/mmtypes.h
===================================================================
--- include/ndk/mmtypes.h	(revision 21808)
+++ include/ndk/mmtypes.h	(working copy)
@@ -1,4 +1,4 @@
-/*++ NDK Version: 0095
+/*++ NDK Version: 0098
 
 Copyright (c) Alex Ionescu.  All rights reserved.
 
@@ -12,7 +12,7 @@
 
 Author:
 
-    Alex Ionescu (alex.ionescu@reactos.com)   06-Oct-2004
+    Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
 
 --*/
 
@@ -200,21 +200,242 @@
 #ifndef NTOS_MODE_USER
 
 //
-// FIXME: REACTOS SPECIFIC HACK IN EPROCESS
+// PTE Structures
 //
-#ifdef _REACTOS_
-typedef struct _MADDRESS_SPACE
+typedef struct _MMPTE
 {
-    struct _MEMORY_AREA *MemoryAreaRoot;
-    FAST_MUTEX Lock;
-    PVOID LowestAddress;
-    struct _EPROCESS* Process;
-    PUSHORT PageTableRefCountTable;
-    ULONG PageTableRefCountTableSize;
-} MADDRESS_SPACE, *PMADDRESS_SPACE;
-#endif
+    union
+    {
+        ULONG Long;
+        HARDWARE_PTE Flush;
+        MMPTE_HARDWARE Hard;
+        MMPTE_PROTOTYPE Proto;
+        MMPTE_SOFTWARE Soft;
+        MMPTE_TRANSITION Trans;
+        MMPTE_SUBSECTION Subsect;
+        MMPTE_LIST List;
+    };
+} MMPTE, *PMMPTE;
 
 //
+// Section Information structure
+//
+typedef struct _MI_EXTRA_IMAGE_INFORMATION
+{
+    ULONG SizeOfHeaders;
+} MI_EXTRA_IMAGE_INFORMATION, *PMI_EXTRA_IMAGE_INFORMATION;
+
+typedef struct _MI_SECTION_IMAGE_INFORMATION
+{
+    SECTION_IMAGE_INFORMATION ExportedImageInformation;
+    MI_EXTRA_IMAGE_INFORMATION InternalImageInformation;
+} MI_SECTION_IMAGE_INFORMATION, *PMI_SECTION_IMAGE_INFORMATION;
+
+//
+// Section Extension Information
+//
+typedef struct _MMEXTEND_INFO
+{
+    ULONGLONG CommittedSize;
+    ULONG ReferenceCount;
+} MMEXTEND_INFO, *PMMEXTEND_INFO;
+
+//
+// Segment and Segment Flags
+//
+typedef struct _SEGMENT_FLAGS
+{
+    ULONG TotalNumberOfPtes4132:10;
+    ULONG ExtraSharedWowSubsections:1;
+    ULONG LargePages:1;
+    ULONG Spare:20;
+} SEGMENT_FLAGS, *PSEGMENT_FLAGS;
+
+typedef struct _SEGMENT
+{
+    struct _CONTROL_AREA *ControlArea;
+    ULONG TotalNumberOfPtes;
+    ULONG NonExtendedPtes;
+    ULONG Spare0;
+    ULONGLONG SizeOfSegment;
+    MMPTE SegmentPteTemplate;
+    ULONG NumberOfCommittedPages;
+    PMMEXTEND_INFO ExtendInfo;
+    SEGMENT_FLAGS SegmentFlags;
+    PVOID BaseAddress;
+    union
+    {
+        ULONG ImageCommitment;
+        PEPROCESS CreatingProcess;
+    } u1;
+    union
+    {
+        PMI_SECTION_IMAGE_INFORMATION ImageInformation;
+        PVOID FirstMappedVa;
+    } u2;
+    PMMPTE PrototypePte;
+    MMPTE ThePtes[1];
+} SEGMENT, *PSEGMENT;
+
+//
+// Event Counter Structure
+//
+typedef struct _EVENT_COUNTER
+{
+    ULONG RefCount;
+    KEVENT Event;
+    LIST_ENTRY ListEntry;
+} EVENT_COUNTER, *PEVENT_COUNTER;
+
+//
+// Flags
+//
+typedef struct _MMSECTION_FLAGS
+{
+    ULONG BeingDeleted:1;
+    ULONG BeingCreated:1;
+    ULONG BeingPurged:1;
+    ULONG NoModifiedWriting:1;
+    ULONG FailAllIo:1;
+    ULONG Image:1;
+    ULONG Based:1;
+    ULONG File:1;
+    ULONG Networked:1;
+    ULONG NoCache:1;
+    ULONG PhysicalMemory:1;
+    ULONG CopyOnWrite:1;
+    ULONG Reserve:1;
+    ULONG Commit:1;
+    ULONG FloppyMedia:1;
+    ULONG WasPurged:1;
+    ULONG UserReference:1;
+    ULONG GlobalMemory:1;
+    ULONG DeleteOnClose:1;
+    ULONG FilePointerNull:1;
+    ULONG DebugSymbolsLoaded:1;
+    ULONG SetMappedFileIoComplete:1;
+    ULONG CollidedFlush:1;
+    ULONG NoChange:1;
+    ULONG filler0:1;
+    ULONG ImageMappedInSystemSpace:1;
+    ULONG UserWritable:1;
+    ULONG Accessed:1;
+    ULONG GlobalOnlyPerSession:1;
+    ULONG Rom:1;
+    ULONG WriteCombined:1;
+    ULONG filler:1;
+} MMSECTION_FLAGS, *PMMSECTION_FLAGS;
+
+typedef struct _MMSUBSECTION_FLAGS
+{
+    ULONG ReadOnly:1;
+    ULONG ReadWrite:1;
+    ULONG SubsectionStatic:1;
+    ULONG GlobalMemory:1;
+    ULONG Protection:5;
+    ULONG Spare:1;
+    ULONG StartingSector4132:10;
+    ULONG SectorEndOffset:12;
+} MMSUBSECTION_FLAGS, *PMMSUBSECTION_FLAGS;
+
+//
+// Control Area Structures
+//
+typedef struct _CONTROL_AREA
+{
+    PSEGMENT Segment;
+    LIST_ENTRY DereferenceList;
+    ULONG NumberOfSectionReferences;
+    ULONG NumberOfPfnReferences;
+    ULONG NumberOfMappedViews;
+    ULONG NumberOfSystemCacheViews;
+    ULONG NumberOfUserReferences;
+    union
+    {
+        ULONG LongFlags;
+        MMSECTION_FLAGS Flags;
+    } u;
+    PFILE_OBJECT FilePointer;
+    PEVENT_COUNTER WaitingForDeletion;
+    USHORT ModifiedWriteCount;
+    USHORT FlushInProgressCount;
+    ULONG WritableUserReferences;
+    ULONG QuadwordPad;
+} CONTROL_AREA, *PCONTROL_AREA;
+
+typedef struct _LARGE_CONTROL_AREA
+{
+    PSEGMENT Segment;
+    LIST_ENTRY DereferenceList;
+    ULONG NumberOfSectionReferences;
+    ULONG NumberOfPfnReferences;
+    ULONG NumberOfMappedViews;
+    ULONG NumberOfSystemCacheViews;
+    ULONG NumberOfUserReferences;
+    union
+    {
+        ULONG LongFlags;
+        MMSECTION_FLAGS Flags;
+    } u;
+    PFILE_OBJECT FilePointer;
+    PEVENT_COUNTER WaitingForDeletion;
+    USHORT ModifiedWriteCount;
+    USHORT FlushInProgressCount;
+    ULONG WritableUserReferences;
+    ULONG QuadwordPad;
+    ULONG StartingFrame;
+    LIST_ENTRY UserGlobalList;
+    ULONG SessionId;
+} LARGE_CONTROL_AREA, *PLARGE_CONTROL_AREA;
+
+//
+// Subsection
+//
+typedef struct _SUBSECTION
+{
+    PCONTROL_AREA ControlArea;
+    union
+    {
+        ULONG LongFlags;
+        MMSUBSECTION_FLAGS SubsectionFlags;
+    } u;
+    ULONG StartingSector;
+    PMMPTE SubsectionBase;
+    ULONG UnusedPtes;
+    ULONG PtesInSubsection;
+    struct _SUBSECTION *NextSubSection;
+} SUBSECTION, *PSUBSECTION;
+
+//
+// Segment Object
+//
+typedef struct _SEGMENT_OBJECT
+{
+    PVOID BaseAddress;
+    ULONG TotalNumberOfPtes;
+    LARGE_INTEGER SizeOfSegment;
+    ULONG NonExtendedPtes;
+    ULONG ImageCommitment;
+    PCONTROL_AREA ControlArea;
+    PSUBSECTION Subsection;
+    PLARGE_CONTROL_AREA LargeControlArea;
+    PMMSECTION_FLAGS MmSectionFlags;
+    PMMSUBSECTION_FLAGS MmSubSectionFlags;
+} SEGMENT_OBJECT, *PSEGMENT_OBJECT;
+
+//
+// Section Object
+//
+typedef struct _SECTION_OBJECT
+{
+    PVOID StartingVa;
+    PVOID EndingVa;
+    PVOID LeftChild;
+    PVOID RightChild;
+    PSEGMENT_OBJECT Segment;
+} SECTION_OBJECT, *PSECTION_OBJECT;
+
+//
 // Generic Address Range Structure
 //
 typedef struct _ADDRESS_RANGE
Index: include/ndk/obfuncs.h
===================================================================
--- include/ndk/obfuncs.h	(revision 21808)
+++ include/ndk/obfuncs.h	(working copy)
@@ -1,4 +1,4 @@
-/*++ NDK Version: 0095
+/*++ NDK Version: 0098
 
 Copyright (c) Alex Ionescu.  All rights reserved.
 
@@ -12,7 +12,7 @@
 
 Author:
 
-    Alex Ionescu (alex.ionescu@reactos.com)   06-Oct-2004
+    Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
 
 --*/
 
Index: include/ndk/rtlfuncs.h
===================================================================
--- include/ndk/rtlfuncs.h	(revision 21808)
+++ include/ndk/rtlfuncs.h	(working copy)
@@ -1,4 +1,4 @@
-/*++ NDK Version: 0095
+/*++ NDK Version: 0098
 
 Copyright (c) Alex Ionescu.  All rights reserved.
 
@@ -12,7 +12,7 @@
 
 Author:
 
-    Alex Ionescu (alex.ionescu@reactos.com)   06-Oct-2004
+    Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
 
 --*/
 
@@ -24,9 +24,15 @@
 //
 #include <umtypes.h>
 #include <ntnls.h>
+#include <rtltypes.h>
 #include <extypes.h>
-#include <rtltypes.h>
+#include "in6addr.h"
+#include "inaddr.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #ifdef NTOS_MODE_USER
 
 //
@@ -109,7 +115,7 @@
 FORCEINLINE
 BOOLEAN
 RemoveEntryList(
-    IN PLIST_ENTRY  Entry)
+    IN PLIST_ENTRY Entry)
 {
     PLIST_ENTRY OldFlink;
     PLIST_ENTRY OldBlink;
@@ -124,7 +130,7 @@
 FORCEINLINE
 PLIST_ENTRY
 RemoveHeadList(
-    IN PLIST_ENTRY  ListHead)
+    IN PLIST_ENTRY ListHead)
 {
     PLIST_ENTRY Flink;
     PLIST_ENTRY Entry;
@@ -139,7 +145,7 @@
 FORCEINLINE
 PLIST_ENTRY
 RemoveTailList(
-    IN PLIST_ENTRY  ListHead)
+    IN PLIST_ENTRY ListHead)
 {
     PLIST_ENTRY Blink;
     PLIST_ENTRY Entry;
@@ -152,12 +158,61 @@
 }
 
 //
+// Unicode string macros
+//
+FORCEINLINE
+VOID
+RtlInitEmptyUnicodeString(OUT PUNICODE_STRING UnicodeString,
+                          IN PWSTR Buffer,
+                          IN USHORT BufferSize)
+{
+    UnicodeString->Length = 0;
+    UnicodeString->MaximumLength = BufferSize;
+    UnicodeString->Buffer = Buffer;
+}
+
+//
 // LUID Macros
 //
 #define RtlEqualLuid(L1, L2) (((L1)->HighPart == (L2)->HighPart) && \
                               ((L1)->LowPart  == (L2)->LowPart))
+FORCEINLINE
+LUID
+NTAPI_INLINE
+RtlConvertUlongToLuid(ULONG Ulong)
+{
+    LUID TempLuid;
 
+    TempLuid.LowPart = Ulong;
+    TempLuid.HighPart = 0;
+    return TempLuid;
+}
+
 //
+// ASSERT Macros
+//
+#ifndef ASSERT
+#if DBG
+
+#define ASSERT( exp ) \
+    ((!(exp)) ? \
+        (RtlAssert( #exp, __FILE__, __LINE__, NULL ),FALSE) : \
+        TRUE)
+
+#define ASSERTMSG( msg, exp ) \
+    ((!(exp)) ? \
+        (RtlAssert( #exp, __FILE__, __LINE__, msg ),FALSE) : \
+        TRUE)
+
+#else
+
+#define ASSERT( exp )         ((void) 0)
+#define ASSERTMSG( msg, exp ) ((void) 0)
+
+#endif
+#endif
+
+//
 // RTL Splay Tree Functions
 //
 NTSYSAPI
@@ -268,17 +323,16 @@
 );
 
 NTSYSAPI
-VOID
+PVOID
 NTAPI
-RtlCaptureContext(OUT PCONTEXT ContextRecord);
+RtlSetUnhandledExceptionFilter(
+    IN PVOID TopLevelExceptionFilter
+);
 
 NTSYSAPI
-ULONG
+VOID
 NTAPI
-RtlComputeCrc32(
-    IN ULONG Initial,
-    IN PUCHAR Data,
-    IN ULONG Length);
+RtlCaptureContext(OUT PCONTEXT ContextRecord);
 
 NTSYSAPI
 PVOID
@@ -291,6 +345,16 @@
 RtlDecodePointer(IN PVOID Pointer);
 
 NTSYSAPI
+PVOID
+NTAPI
+RtlEncodeSystemPointer(IN PVOID Pointer);
+
+NTSYSAPI
+PVOID
+NTAPI
+RtlDecodeSystemPointer(IN PVOID Pointer);
+
+NTSYSAPI
 BOOLEAN
 NTAPI
 RtlDispatchException(
@@ -329,6 +393,14 @@
 );
 
 //
+// Tracing Functions
+//
+NTSYSAPI
+USHORT
+NTAPI
+RtlLogStackBackTrace(VOID);
+
+//
 // Heap Functions
 //
 NTSYSAPI
@@ -355,6 +427,15 @@
 NTSYSAPI
 ULONG
 NTAPI
+RtlCreateTagHeap(
+    IN HANDLE HeapHandle,
+    IN ULONG Flags,
+    IN PWSTR TagName,
+    IN PWSTR TagSubName
+);
+
+ULONG
+NTAPI
 RtlCompactHeap(
     HANDLE heap,
     ULONG flags
@@ -515,6 +596,16 @@
 NTSYSAPI
 NTSTATUS
 NTAPI
+RtlAcquirePrivilege(
+    IN PULONG Privilege,
+    IN ULONG NumPriv,
+    IN ULONG Flags,
+    OUT PVOID *ReturnedState
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
 RtlAdjustPrivilege(
     IN ULONG Privilege,
     IN BOOLEAN NewValue,
@@ -787,6 +878,13 @@
 );
 
 NTSYSAPI
+VOID
+NTAPI
+RtlReleasePrivilege(
+    IN PVOID ReturnedState
+);
+
+NTSYSAPI
 NTSTATUS
 NTAPI
 RtlSelfRelativeToAbsoluteSD(
@@ -1050,14 +1148,17 @@
 
 #else
 
+NTSYSAPI
 USHORT
 FASTCALL
 RtlUshortByteSwap(IN USHORT Source);
 
+NTSYSAPI
 ULONG
 FASTCALL
 RtlUlongByteSwap(IN ULONG Source);
 
+NTSYSAPI
 ULONGLONG
 FASTCALL
 RtlUlonglongByteSwap(IN ULONGLONG Source);
@@ -1351,6 +1452,16 @@
 );
 
 NTSYSAPI
+NTSTATUS
+NTAPI
+RtlFindCharInUnicodeString(
+    IN ULONG Flags,
+    IN PUNICODE_STRING SearchString,
+    IN PCUNICODE_STRING MatchString,
+    OUT PUSHORT Position
+);
+
+NTSYSAPI
 VOID
 NTAPI
 RtlFreeUnicodeString(IN PUNICODE_STRING UnicodeString);
@@ -1369,10 +1480,19 @@
 VOID
 NTAPI
 RtlInitUnicodeString(
-  IN OUT PUNICODE_STRING DestinationString,
-  IN PCWSTR SourceString);
+    IN OUT PUNICODE_STRING DestinationString,
+    IN PCWSTR SourceString
+);
 
 NTSYSAPI
+NTSTATUS
+NTAPI
+RtlInitUnicodeStringEx(
+    OUT PUNICODE_STRING DestinationString,
+    IN PCWSTR SourceString OPTIONAL
+);
+
+NTSYSAPI
 ULONG
 NTAPI
 RtlIsTextUnicode(
@@ -1417,6 +1537,14 @@
     PULONG Value
 );
 
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlValidateUnicodeString(
+    IN ULONG Flags,
+    IN PCUNICODE_STRING String
+);
+
 //
 // Ansi String Functions
 //
@@ -1653,30 +1781,60 @@
 );
 
 NTSYSAPI
+NTSTATUS
+NTAPI
+RtlComputePrivatizedDllName_U(
+    IN PUNICODE_STRING DllName,
+    OUT PUNICODE_STRING RealName,
+    OUT PUNICODE_STRING LocalName
+);
+
+NTSYSAPI
 VOID
 NTAPI
-RtlDestroyEnvironment(PWSTR Environment);
+RtlDestroyEnvironment(
+    IN PWSTR Environment
+);
 
 NTSYSAPI
 BOOLEAN
 NTAPI
-RtlDoesFileExists_U(PWSTR FileName);
+RtlDoesFileExists_U(
+    IN PCWSTR FileName
+);
 
 NTSYSAPI
+BOOLEAN
+NTAPI
+RtlDoesFileExists_UstrEx(
+    IN PCUNICODE_STRING FileName,
+    IN BOOLEAN SucceedIfBusy
+);
+
+NTSYSAPI
 ULONG
 NTAPI
-RtlDetermineDosPathNameType_U(PCWSTR Path);
+RtlDetermineDosPathNameType_U(
+    IN PCWSTR Path
+);
 
 NTSYSAPI
 ULONG
 NTAPI
+RtlDetermineDosPathNameType_Ustr(
+    IN PCUNICODE_STRING Path
+);
+
+NTSYSAPI
+ULONG
+NTAPI
 RtlDosSearchPath_U(
-    WCHAR *sp,
-    WCHAR *name,
-    WCHAR *ext,
-    ULONG buf_sz,
-    WCHAR *buffer,
-    WCHAR **shortname
+    IN PCWSTR Path,
+    IN PCWSTR FileName,
+    IN PCWSTR Extension,
+    IN ULONG BufferSize,
+    OUT PWSTR Buffer,
+    OUT PWSTR *PartName
 );
 
 NTSYSAPI
@@ -1711,13 +1869,40 @@
 ULONG
 NTAPI
 RtlGetFullPathName_U(
-    const WCHAR *dosname,
-    ULONG size,
-    WCHAR *buf,
-    WCHAR **shortname
+    IN PCWSTR FileName,
+    IN ULONG Size,
+    IN PWSTR Buffer,
+    OUT PWSTR *ShortName
 );
 
 NTSYSAPI
+ULONG
+NTAPI
+RtlGetFullPathName_Ustr(
+    IN PUNICODE_STRING FileName,
+    IN ULONG Size,
+    IN PWSTR Buffer,
+    OUT PWSTR *ShortName,
+    OUT PBOOLEAN InvalidName,
+    OUT RTL_PATH_TYPE *PathType
+);
+
+NTSYSAPI
+ULONG
+NTAPI
+RtlIsDosDeviceName_U(
+    IN PWSTR Name
+);
+
+NTSYSAPI
+ULONG
+NTAPI
+RtlIsDosDeviceName_Ustr(
+    IN PUNICODE_STRING Name
+);
+
+
+NTSYSAPI
 BOOLEAN
 NTAPI
 RtlIsNameLegalDOS8Dot3(
@@ -1738,7 +1923,9 @@
 NTSYSAPI
 NTSTATUS
 NTAPI
-RtlSetCurrentDirectory_U(PUNICODE_STRING name);
+RtlSetCurrentDirectory_U(
+    IN PUNICODE_STRING name
+);
 
 NTSYSAPI
 NTSTATUS
@@ -1789,6 +1976,13 @@
 );
 
 NTSYSAPI
+BOOLEAN
+NTAPI
+RtlTryEnterCriticalSection(
+    IN PRTL_CRITICAL_SECTION CriticalSection
+);
+
+NTSYSAPI
 VOID
 NTAPI
 RtlpUnWaitCriticalSection(
@@ -1902,7 +2096,7 @@
 // Debug Info Functions
 //
 NTSYSAPI
-PRTL_DEBUG_BUFFER
+PRTL_DEBUG_INFORMATION
 NTAPI
 RtlCreateQueryDebugBuffer(
     IN ULONG Size,
@@ -1912,7 +2106,7 @@
 NTSYSAPI
 NTSTATUS
 NTAPI
-RtlDestroyQueryDebugBuffer(IN PRTL_DEBUG_BUFFER DebugBuffer);
+RtlDestroyQueryDebugBuffer(IN PRTL_DEBUG_INFORMATION DebugBuffer);
 
 NTSYSAPI
 NTSTATUS
@@ -1920,7 +2114,7 @@
 RtlQueryProcessDebugInformation(
     IN ULONG ProcessId,
     IN ULONG DebugInfoClassMask,
-    IN OUT PRTL_DEBUG_BUFFER DebugBuffer
+    IN OUT PRTL_DEBUG_INFORMATION DebugBuffer
 );
 
 //
@@ -1983,7 +2177,15 @@
 NTSYSAPI
 VOID
 NTAPI
-RtlSetBits (
+RtlSetBit(
+    PRTL_BITMAP BitMapHeader,
+    ULONG BitNumber
+);
+
+NTSYSAPI
+VOID
+NTAPI
+RtlSetBits(
     IN PRTL_BITMAP BitMapHeader,
     IN ULONG StartingIndex,
     IN ULONG NumberToSet
@@ -2043,6 +2245,26 @@
 RtlDeleteTimerQueue(HANDLE TimerQueue);
 
 //
+// SList functions
+//
+PSLIST_ENTRY
+FASTCALL
+InterlockedPushListSList(
+    IN PSLIST_HEADER ListHead,
+    IN PSLIST_ENTRY List,
+    IN PSLIST_ENTRY ListEnd,
+    IN ULONG Count
+);
+
+//
+// Range List functions
+//
+NTSYSAPI
+VOID
+NTAPI
+RtlFreeRangeList(IN PRTL_RANGE_LIST RangeList);
+
+//
 // Debug Functions
 //
 ULONG
@@ -2052,6 +2274,24 @@
     IN ...
 );
 
+NTSYSAPI
+ULONG
+__cdecl
+DbgPrintEx(
+    IN ULONG ComponentId,
+    IN ULONG Level,
+    IN PCH Format,
+    IN ...
+);
+
+ULONG
+NTAPI
+DbgPrompt(
+    IN PCH PromptString,
+    OUT PCH OutputString,
+    IN ULONG OutputSize
+);
+
 VOID
 NTAPI
 DbgBreakPoint(VOID);
@@ -2129,9 +2369,9 @@
 PVOID
 NTAPI
 RtlImageDirectoryEntryToData(
-    PVOID  BaseAddress,
-    BOOLEAN bFlag,
-    ULONG Directory,
+    PVOID BaseAddress,
+    BOOLEAN MappedAsImage,
+    USHORT Directory,
     PULONG Size
 );
 
@@ -2151,6 +2391,16 @@
 RtlImageNtHeader(IN PVOID BaseAddress);
 
 NTSYSAPI
+NTSTATUS
+NTAPI
+RtlImageNtHeaderEx(
+    IN ULONG Flags,
+    IN PVOID BaseAddress,
+    IN ULONGLONG Size,
+    IN PIMAGE_NT_HEADERS *NtHeader
+);
+
+NTSYSAPI
 PIMAGE_SECTION_HEADER
 NTAPI
 RtlImageRvaToSection(
@@ -2160,6 +2410,73 @@
 );
 
 //
+// Activation Context Functions
+//
+#ifdef NTOS_MODE_USER
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlActivateActivationContextUnsafeFast(
+    IN PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame,
+    IN PVOID Context
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlAllocateActivationContextStack(
+    IN PVOID *Context
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlGetActiveActivationContext(
+    IN PVOID *Context
+);
+
+NTSYSAPI
+VOID
+NTAPI
+RtlReleaseActivationContext(
+    IN PVOID *Context
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlDeactivateActivationContextUnsafeFast(
+    IN PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlDosApplyFileIsolationRedirection_Ustr(
+    IN BOOLEAN Unknown,
+    IN PUNICODE_STRING OriginalName,
+    IN PUNICODE_STRING Extension,
+    IN OUT PUNICODE_STRING RedirectedName,
+    IN OUT PUNICODE_STRING RedirectedName2,
+    IN OUT PUNICODE_STRING *OriginalName2,
+    IN PVOID Unknown1,
+    IN PVOID Unknown2,
+    IN PVOID Unknown3
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlFindActivationContextSectionString(
+    IN PVOID Unknown0,
+    IN PVOID Unknown1,
+    IN ULONG SectionType,
+    IN PUNICODE_STRING SectionName,
+    IN PVOID Unknown2
+);
+#endif
+
+//
 // Registry Functions
 //
 NTSYSAPI
@@ -2311,8 +2628,19 @@
 NTSYSAPI
 ULONG
 NTAPI
-RtlUniform(PULONG Seed);
+RtlUniform(
+    IN PULONG Seed
+);
 
+NTSYSAPI
+ULONG
+NTAPI
+RtlComputeCrc32(
+    IN UINT PartialCrc,
+    IN PUCHAR Buffer,
+    IN ULONG Length
+);
+
 //
 // Network Functions
 //
@@ -2320,36 +2648,36 @@
 NTSTATUS
 NTAPI
 RtlIpv4StringToAddressW(
-    IN LPWSTR IpString,
-    IN ULONG Base,
-    OUT PULONG PtrToIpAddr,
-    OUT PULONG IpAddr
+    IN PWCHAR String,
+    IN UCHAR Strict,
+    OUT PWCHAR Terminator,
+    OUT struct in_addr *Addr
 );
 
 NTSYSAPI
 NTSTATUS
 NTAPI
 RtlIpv6StringToAddressA(
-    IN LPSTR Name,
-    OUT PULONG Unknown,
-    OUT PVOID IpAddr
+    IN PCHAR Name,
+    OUT PCHAR *Terminator,
+    OUT struct in6_addr *Addr
 );
 
 NTSYSAPI
 NTSTATUS
 NTAPI
 RtlIpv6StringToAddressW(
-    IN LPWSTR Name,
-    OUT PULONG Unknown,
-    OUT PVOID IpAddr
+    IN PWCHAR Name,
+    OUT PCHAR *Terminator,
+    OUT struct in6_addr *Addr
 );
 
 NTSYSAPI
 NTSTATUS
 NTAPI
 RtlIpv6StringToAddressExA(
-    IN LPSTR AddressName,
-    IN PVOID Address,
+    IN PCHAR AddressString,
+    IN struct in6_addr *Address,
     IN PULONG ScopeId,
     IN PUSHORT Port
 );
@@ -2358,8 +2686,8 @@
 NTSTATUS
 NTAPI
 RtlIpv6StringToAddressExW(
-    IN LPWSTR AddressName,
-    IN PVOID Address,
+    IN PWCHAR AddressName,
+    IN struct in6_addr *Address,
     IN PULONG ScopeId,
     IN PUSHORT Port
 );
@@ -2368,6 +2696,7 @@
 //
 // Time Functions
 //
+struct _RTL_TIME_ZONE_INFORMATION;
 NTSYSAPI
 NTSTATUS
 NTAPI
@@ -2402,6 +2731,14 @@
     PTIME_FIELDS TimeFields
 );
 
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlSystemTimeToLocalTime(
+    IN PLARGE_INTEGER SystemTime,
+    OUT PLARGE_INTEGER LocalTime
+);
+
 //
 // Version Functions
 //
@@ -2424,4 +2761,8 @@
 NTAPI
 RtlGetNtProductType(OUT PNT_PRODUCT_TYPE ProductType);
 
+#ifdef __cplusplus
+}
 #endif
+
+#endif
Index: include/ndk/potypes.h
===================================================================
--- include/ndk/potypes.h	(revision 21808)
+++ include/ndk/potypes.h	(working copy)
@@ -1,4 +1,4 @@
-/*++ NDK Version: 0095
+/*++ NDK Version: 0098
 
 Copyright (c) Alex Ionescu.  All rights reserved.
 
@@ -12,7 +12,7 @@
 
 Author:
 
-    Alex Ionescu (alex.ionescu@reactos.com)   06-Oct-2004
+    Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
 
 --*/
 
Index: include/ndk/ldrtypes.h
===================================================================
--- include/ndk/ldrtypes.h	(revision 21808)
+++ include/ndk/ldrtypes.h	(working copy)
@@ -1,4 +1,4 @@
-/*++ NDK Version: 0095
+/*++ NDK Version: 0098
 
 Copyright (c) Alex Ionescu.  All rights reserved.
 
@@ -12,7 +12,7 @@
 
 Author:
 
-    Alex Ionescu (alex.ionescu@reactos.com)   06-Oct-2004
+    Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
 
 --*/
 
@@ -27,31 +27,47 @@
 //
 // Resource Type Levels
 //
-#define RESOURCE_TYPE_LEVEL             0
-#define RESOURCE_NAME_LEVEL             1
-#define RESOURCE_LANGUAGE_LEVEL         2
-#define RESOURCE_DATA_LEVEL             3
+#define RESOURCE_TYPE_LEVEL                     0
+#define RESOURCE_NAME_LEVEL                     1
+#define RESOURCE_LANGUAGE_LEVEL                 2
+#define RESOURCE_DATA_LEVEL                     3
 
 //
 // Loader Data Table Entry Flags
 //
-#define LDRP_STATIC_LINK                0x00000002
-#define LDRP_IMAGE_DLL                  0x00000004
-#define LDRP_LOAD_IN_PROGRESS           0x00001000
-#define LDRP_UNLOAD_IN_PROGRESS         0x00002000
-#define LDRP_ENTRY_PROCESSED            0x00004000
-#define LDRP_ENTRY_INSERTED             0x00008000
-#define LDRP_CURRENT_LOAD               0x00010000
-#define LDRP_FAILED_BUILTIN_LOAD        0x00020000
-#define LDRP_DONT_CALL_FOR_THREADS      0x00040000
-#define LDRP_PROCESS_ATTACH_CALLED      0x00080000
-#define LDRP_DEBUG_SYMBOLS_LOADED       0x00100000
-#define LDRP_IMAGE_NOT_AT_BASE          0x00200000
-#define LDRP_COR_IMAGE                  0x00400000
-#define LDR_COR_OWNS_UNMAP              0x00800000
-#define LDRP_REDIRECTED                 0x10000000
+#define LDRP_STATIC_LINK                        0x00000002
+#define LDRP_IMAGE_DLL                          0x00000004
+#define LDRP_LOAD_IN_PROGRESS                   0x00001000
+#define LDRP_UNLOAD_IN_PROGRESS                 0x00002000
+#define LDRP_ENTRY_PROCESSED                    0x00004000
+#define LDRP_ENTRY_INSERTED                     0x00008000
+#define LDRP_CURRENT_LOAD                       0x00010000
+#define LDRP_FAILED_BUILTIN_LOAD                0x00020000
+#define LDRP_DONT_CALL_FOR_THREADS              0x00040000
+#define LDRP_PROCESS_ATTACH_CALLED              0x00080000
+#define LDRP_DEBUG_SYMBOLS_LOADED               0x00100000
+#define LDRP_IMAGE_NOT_AT_BASE                  0x00200000
+#define LDRP_COR_IMAGE                          0x00400000
+#define LDR_COR_OWNS_UNMAP                      0x00800000
+#define LDRP_REDIRECTED                         0x10000000
 
 //
+// Dll Characteristics for LdrLoadDll
+//
+#define LDR_IGNORE_CODE_AUTHZ_LEVEL             0x00001000
+
+//
+// LdrAddRef Flags
+//
+#define LDR_PIN_MODULE                          0x00000001
+
+//
+// LdrLockLoaderLock Flags
+//
+#define LDR_LOCK_LOADER_LOCK_FLAG_RAISE_STATUS  0x00000001
+#define LDR_LOCK_LOADER_LOCK_FLAG_TRY_ONLY      0x00000002
+
+//
 // Loader Data stored in the PEB
 //
 typedef struct _PEB_LDR_DATA
@@ -70,7 +86,7 @@
 //
 typedef struct _LDR_DATA_TABLE_ENTRY
 {
-    LIST_ENTRY InLoadOrderModuleList;
+    LIST_ENTRY InLoadOrderLinks;
     LIST_ENTRY InMemoryOrderModuleList;
     LIST_ENTRY InInitializationOrderModuleList;
     PVOID DllBase;
@@ -107,8 +123,45 @@
 } LDR_RESOURCE_INFO, *PLDR_RESOURCE_INFO;
 
 //
-// LdrAddRef Flags
+// DLL Notifications
 //
-#define LDR_PIN_MODULE                  0x00000001
+typedef struct _LDR_DLL_LOADED_NOTIFICATION_DATA
+{
+    ULONG Flags;
+    PUNICODE_STRING FullDllName;
+    PUNICODE_STRING BaseDllName;
+    PVOID DllBase;
+    ULONG SizeOfImage;
+} LDR_DLL_LOADED_NOTIFICATION_DATA, *PLDR_DLL_LOADED_NOTIFICATION_DATA;
 
+typedef VOID
+(*PLDR_DLL_LOADED_NOTIFICATION_CALLBACK)(
+    IN BOOLEAN Type,
+    IN struct _LDR_DLL_LOADED_NOTIFICATION_DATA *Data
+);
+
+typedef struct _LDR_DLL_LOADED_NOTIFICATION_ENTRY
+{
+    LIST_ENTRY NotificationListEntry;
+    PLDR_DLL_LOADED_NOTIFICATION_CALLBACK Callback;
+} LDR_DLL_LOADED_NOTIFICATION_ENTRY, *PLDR_DLL_LOADED_NOTIFICATION_ENTRY;
+
+//
+// Alternate Resources Support
+//
+typedef struct _ALT_RESOURCE_MODULE
+{
+    LANGID LangId;
+    PVOID ModuleBase;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    PVOID ModuleManifest;
 #endif
+    PVOID AlternateModule;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    HANDLE AlternateFileHandle;
+    ULONG ModuleCheckSum;
+    ULONG ErrorCode;
+#endif
+} ALT_RESOURCE_MODULE, *PALT_RESOURCE_MODULE;
+
+#endif
Index: include/ndk/pstypes.h
===================================================================
--- include/ndk/pstypes.h	(revision 21808)
+++ include/ndk/pstypes.h	(working copy)
@@ -1,4 +1,4 @@
-/*++ NDK Version: 0095
+/*++ NDK Version: 0098
 
 Copyright (c) Alex Ionescu.  All rights reserved.
 
@@ -12,7 +12,7 @@
 
 Author:
 
-    Alex Ionescu (alex.ionescu@reactos.com)   06-Oct-2004
+    Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
 
 --*/
 
@@ -76,6 +76,7 @@
 #define FLG_ENABLE_HANDLE_TYPE_TAGGING          0x01000000
 #define FLG_HEAP_PAGE_ALLOCS                    0x02000000
 #define FLG_DEBUG_INITIAL_COMMAND_EX            0x04000000
+#define FLG_VALID_BITS                          0x07FFFFFF
 
 //
 // Process priority classes
@@ -108,6 +109,11 @@
 #define PROCESS_PRIORITY_NORMAL_FOREGROUND      9
 
 //
+// Number of TLS expansion slots
+//
+#define TLS_EXPANSION_SLOTS                     64
+
+//
 // Process Access Types
 //
 #ifndef NTOS_MODE_USER
@@ -123,7 +129,15 @@
 #define PROCESS_QUERY_INFORMATION               0x0400
 #define PROCESS_SUSPEND_RESUME                  0x0800
 #define PROCESS_QUERY_LIMITED_INFORMATION       0x1000
-#define PROCESS_ALL_ACCESS                      (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0xFFFF)
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+#define PROCESS_ALL_ACCESS                      (STANDARD_RIGHTS_REQUIRED | \
+                                                 SYNCHRONIZE | \
+                                                 0xFFFF)
+#else
+#define PROCESS_ALL_ACCESS                      (STANDARD_RIGHTS_REQUIRED | \
+                                                 SYNCHRONIZE | \
+                                                 0xFFF)
+#endif
 
 
 //
@@ -134,7 +148,9 @@
 #define JOB_OBJECT_QUERY                        0x4
 #define JOB_OBJECT_TERMINATE                    0x8
 #define JOB_OBJECT_SET_SECURITY_ATTRIBUTES      0x10
-#define JOB_OBJECT_ALL_ACCESS                   (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 31)
+#define JOB_OBJECT_ALL_ACCESS                   (STANDARD_RIGHTS_REQUIRED | \
+                                                 SYNCHRONIZE | \
+                                                 31)
 #endif
 
 #ifdef NTOS_MODE_USER
@@ -223,6 +239,8 @@
     ThreadCycleTime,
     ThreadPagePriority,
     ThreadActualBasePriority,
+    ThreadTebInformation,
+    ThreadCSwitchMon,
     MaxThreadInfoClass
 } THREADINFOCLASS;
 
@@ -244,30 +262,162 @@
 } JOBOBJECTINFOCLASS;
 
 //
+// Power Event Events for Win32K Power Event Callback
+//
+typedef enum _PSPOWEREVENTTYPE
+{
+    PsW32FullWake = 0,
+    PsW32EventCode = 1,
+    PsW32PowerPolicyChanged = 2,
+    PsW32SystemPowerState = 3,
+    PsW32SystemTime = 4,
+    PsW32DisplayState = 5,
+    PsW32CapabilitiesChanged = 6,
+    PsW32SetStateFailed = 7,
+    PsW32GdiOff = 8,
+    PsW32GdiOn = 9,
+    PsW32GdiPrepareResumeUI = 10,
+    PsW32GdiOffRequest = 11,
+    PsW32MonitorOff = 12,
+} PSPOWEREVENTTYPE;
+
+//
+// Power State Tasks for Win32K Power State Callback
+//
+typedef enum _POWERSTATETASK
+{
+    PowerState_BlockSessionSwitch = 0,
+    PowerState_Init = 1,
+    PowerState_QueryApps = 2,
+    PowerState_QueryServices = 3,
+    PowerState_QueryAppsFailed = 4,
+    PowerState_QueryServicesFailed = 5,
+    PowerState_SuspendApps = 6,
+    PowerState_SuspendServices = 7,
+    PowerState_ShowUI = 8,
+    PowerState_NotifyWL = 9,
+    PowerState_ResumeApps = 10,
+    PowerState_ResumeServices = 11,
+    PowerState_UnBlockSessionSwitch = 12,
+    PowerState_End = 13,
+    PowerState_BlockInput = 14,
+    PowerState_UnblockInput = 15,
+} POWERSTATETASK;
+
+//
+// Win32K Job Callback Types
+//
+typedef enum _PSW32JOBCALLOUTTYPE
+{
+   PsW32JobCalloutSetInformation = 0,
+   PsW32JobCalloutAddProcess = 1,
+   PsW32JobCalloutTerminate = 2,
+} PSW32JOBCALLOUTTYPE;
+
+//
+// Win32K Thread Callback Types
+//
+typedef enum _PSW32THREADCALLOUTTYPE
+{
+    PsW32ThreadCalloutInitialize,
+    PsW32ThreadCalloutExit,
+} PSW32THREADCALLOUTTYPE;
+
+//
 // Declare empty structure definitions so that they may be referenced by
 // routines before they are defined
 //
 struct _W32THREAD;
 struct _W32PROCESS;
 struct _ETHREAD;
+struct _WIN32_POWEREVENT_PARAMETERS;
+struct _WIN32_POWERSTATE_PARAMETERS;
+struct _WIN32_JOBCALLOUT_PARAMETERS;
+struct _WIN32_OPENMETHOD_PARAMETERS;
+struct _WIN32_OKTOCLOSEMETHOD_PARAMETERS;
+struct _WIN32_CLOSEMETHOD_PARAMETERS;
+struct _WIN32_DELETEMETHOD_PARAMETERS;
+struct _WIN32_PARSEMETHOD_PARAMETERS;
 
 //
 // Win32K Process and Thread Callbacks
 //
 typedef NTSTATUS
-(NTAPI *PW32_PROCESS_CALLBACK)(
+(NTAPI *PKWIN32_PROCESS_CALLOUT)(
     struct _EPROCESS *Process,
     BOOLEAN Create
 );
 
 typedef NTSTATUS
-(NTAPI *PW32_THREAD_CALLBACK)(
+(NTAPI *PKWIN32_THREAD_CALLOUT)(
     struct _ETHREAD *Thread,
-    BOOLEAN Create
+    PSW32THREADCALLOUTTYPE Type
 );
 
+typedef NTSTATUS
+(NTAPI *PKWIN32_GLOBALATOMTABLE_CALLOUT)(
+    VOID
+);
+
+typedef NTSTATUS
+(NTAPI *PKWIN32_POWEREVENT_CALLOUT)(
+    struct _WIN32_POWEREVENT_PARAMETERS *Parameters
+);
+
+typedef NTSTATUS
+(NTAPI *PKWIN32_POWERSTATE_CALLOUT)(
+    struct _WIN32_POWERSTATE_PARAMETERS *Parameters
+);
+
+typedef NTSTATUS
+(NTAPI *PKWIN32_JOB_CALLOUT)(
+    struct _WIN32_JOBCALLOUT_PARAMETERS *Parameters
+);
+
+typedef NTSTATUS
+(NTAPI *PGDI_BATCHFLUSH_ROUTINE)(
+    VOID
+);
+
+typedef NTSTATUS
+(NTAPI *PKWIN32_OPENMETHOD_CALLOUT)(
+    struct _WIN32_OPENMETHOD_PARAMETERS *Parameters
+);
+
+typedef NTSTATUS
+(NTAPI *PKWIN32_OKTOCLOSEMETHOD_CALLOUT)(
+    struct _WIN32_OKTOCLOSEMETHOD_PARAMETERS *Parameters
+);
+
+typedef NTSTATUS
+(NTAPI *PKWIN32_CLOSEMETHOD_CALLOUT)(
+    struct _WIN32_CLOSEMETHOD_PARAMETERS *Parameters
+);
+
+typedef NTSTATUS
+(NTAPI *PKWIN32_DELETEMETHOD_CALLOUT)(
+    struct _WIN32_DELETEMETHOD_PARAMETERS *Parameters
+);
+
+typedef NTSTATUS
+(NTAPI *PKWIN32_PARSEMETHOD_CALLOUT)(
+    struct _WIN32_PARSEMETHOD_PARAMETERS *Parameters
+);
+
+typedef NTSTATUS
+(NTAPI *PKWIN32_WIN32DATACOLLECTION_CALLOUT)(
+    struct _EPROCESS *Process,
+    PVOID Callback,
+    PVOID Context
+);
+
 #endif
 
+typedef NTSTATUS
+(NTAPI *PPOST_PROCESS_INIT_ROUTINE)(
+    VOID
+);
+
 #ifdef NTOS_MODE_USER
 
 //
@@ -313,63 +463,112 @@
 //
 typedef struct _PEB
 {
-    UCHAR InheritedAddressSpace;                     /* 00h */
-    UCHAR ReadImageFileExecOptions;                  /* 01h */
-    UCHAR BeingDebugged;                             /* 02h */
-    BOOLEAN SpareBool;                               /* 03h */
-    HANDLE Mutant;                                   /* 04h */
-    PVOID ImageBaseAddress;                          /* 08h */
-    PPEB_LDR_DATA Ldr;                               /* 0Ch */
-    struct _RTL_USER_PROCESS_PARAMETERS *ProcessParameters;  /* 10h */
-    PVOID SubSystemData;                             /* 14h */
-    PVOID ProcessHeap;                               /* 18h */
-    PVOID FastPebLock;                               /* 1Ch */
-    PPEBLOCKROUTINE FastPebLockRoutine;              /* 20h */
-    PPEBLOCKROUTINE FastPebUnlockRoutine;            /* 24h */
-    ULONG EnvironmentUpdateCount;                    /* 28h */
-    PVOID* KernelCallbackTable;                      /* 2Ch */
-    PVOID EventLogSection;                           /* 30h */
-    PVOID EventLog;                                  /* 34h */
-    PPEB_FREE_BLOCK FreeList;                        /* 38h */
-    ULONG TlsExpansionCounter;                       /* 3Ch */
-    PVOID TlsBitmap;                                 /* 40h */
-    ULONG TlsBitmapBits[0x2];                        /* 44h */
-    PVOID ReadOnlySharedMemoryBase;                  /* 4Ch */
-    PVOID ReadOnlySharedMemoryHeap;                  /* 50h */
-    PVOID* ReadOnlyStaticServerData;                 /* 54h */
-    PVOID AnsiCodePageData;                          /* 58h */
-    PVOID OemCodePageData;                           /* 5Ch */
-    PVOID UnicodeCaseTableData;                      /* 60h */
-    ULONG NumberOfProcessors;                        /* 64h */
-    ULONG NtGlobalFlag;                              /* 68h */
-    LARGE_INTEGER CriticalSectionTimeout;            /* 70h */
-    ULONG HeapSegmentReserve;                        /* 78h */
-    ULONG HeapSegmentCommit;                         /* 7Ch */
-    ULONG HeapDeCommitTotalFreeThreshold;            /* 80h */
-    ULONG HeapDeCommitFreeBlockThreshold;            /* 84h */
-    ULONG NumberOfHeaps;                             /* 88h */
-    ULONG MaximumNumberOfHeaps;                      /* 8Ch */
-    PVOID* ProcessHeaps;                             /* 90h */
-    PVOID GdiSharedHandleTable;                      /* 94h */
-    PVOID ProcessStarterHelper;                      /* 98h */
-    PVOID GdiDCAttributeList;                        /* 9Ch */
-    PVOID LoaderLock;                                /* A0h */
-    ULONG OSMajorVersion;                            /* A4h */
-    ULONG OSMinorVersion;                            /* A8h */
-    USHORT OSBuildNumber;                            /* ACh */
-    USHORT OSCSDVersion;                             /* AEh */
-    ULONG OSPlatformId;                              /* B0h */
-    ULONG ImageSubSystem;                            /* B4h */
-    ULONG ImageSubSystemMajorVersion;                /* B8h */
-    ULONG ImageSubSystemMinorVersion;                /* BCh */
-    ULONG ImageProcessAffinityMask;                  /* C0h */
-    ULONG GdiHandleBuffer[0x22];                     /* C4h */
-    PVOID PostProcessInitRoutine;                    /* 14Ch */
-    struct _RTL_BITMAP *TlsExpansionBitmap;          /* 150h */
-    ULONG TlsExpansionBitmapBits[0x20];              /* 154h */
-    ULONG SessionId;                                 /* 1D4h */
-    PVOID AppCompatInfo;                             /* 1D8h */
-    UNICODE_STRING CSDVersion;                       /* 1DCh */
+    UCHAR InheritedAddressSpace;
+    UCHAR ReadImageFileExecOptions;
+    UCHAR BeingDebugged;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    struct
+    {
+        UCHAR ImageUsesLargePages:1;
+        UCHAR IsProtectedProcess:1;
+        UCHAR IsLegacyProcess:1;
+        UCHAR SpareBits:5;
+    };
+#else
+    BOOLEAN SpareBool;
+#endif
+    HANDLE Mutant;
+    PVOID ImageBaseAddress;
+    PPEB_LDR_DATA Ldr;
+    struct _RTL_USER_PROCESS_PARAMETERS *ProcessParameters;
+    PVOID SubSystemData;
+    PVOID ProcessHeap;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    struct _RTL_CRITICAL_SECTION *FastPebLock;
+    PVOID AltThunkSListPtr;
+    PVOID IFEOKey;
+    ULONG Spare;
+    union
+    {
+        PVOID* KernelCallbackTable;
+        PVOID UserSharedInfoPtr;
+    };
+    ULONG SystemReserved[1];
+    ULONG SpareUlong;
+#else
+    PVOID FastPebLock;
+    PPEBLOCKROUTINE FastPebLockRoutine;
+    PPEBLOCKROUTINE FastPebUnlockRoutine;
+    ULONG EnvironmentUpdateCount;
+    PVOID* KernelCallbackTable;
+    PVOID EventLogSection;
+    PVOID EventLog;
+#endif
+    PPEB_FREE_BLOCK FreeList;
+    ULONG TlsExpansionCounter;
+    PVOID TlsBitmap;
+    ULONG TlsBitmapBits[0x2];
+    PVOID ReadOnlySharedMemoryBase;
+    PVOID ReadOnlySharedMemoryHeap;
+    PVOID* ReadOnlyStaticServerData;
+    PVOID AnsiCodePageData;
+    PVOID OemCodePageData;
+    PVOID UnicodeCaseTableData;
+    ULONG NumberOfProcessors;
+    ULONG NtGlobalFlag;
+    LARGE_INTEGER CriticalSectionTimeout;
+    ULONG HeapSegmentReserve;
+    ULONG HeapSegmentCommit;
+    ULONG HeapDeCommitTotalFreeThreshold;
+    ULONG HeapDeCommitFreeBlockThreshold;
+    ULONG NumberOfHeaps;
+    ULONG MaximumNumberOfHeaps;
+    PVOID* ProcessHeaps;
+    PVOID GdiSharedHandleTable;
+    PVOID ProcessStarterHelper;
+    PVOID GdiDCAttributeList;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    struct _RTL_CRITICAL_SECTION *LoaderLock;
+#else
+    PVOID LoaderLock;
+#endif
+    ULONG OSMajorVersion;
+    ULONG OSMinorVersion;
+    USHORT OSBuildNumber;
+    USHORT OSCSDVersion;
+    ULONG OSPlatformId;
+    ULONG ImageSubSystem;
+    ULONG ImageSubSystemMajorVersion;
+    ULONG ImageSubSystemMinorVersion;
+    ULONG ImageProcessAffinityMask;
+    ULONG GdiHandleBuffer[0x22];
+    PPOST_PROCESS_INIT_ROUTINE PostProcessInitRoutine;
+    struct _RTL_BITMAP *TlsExpansionBitmap;
+    ULONG TlsExpansionBitmapBits[0x20];
+    ULONG SessionId;
+#if (NTDDI_VERSION >= NTDDI_WINXP)
+    ULARGE_INTEGER AppCompatFlags;
+    ULARGE_INTEGER AppCompatFlagsUser;
+    PVOID pShimData;
+    PVOID AppCompatInfo;
+    UNICODE_STRING CSDVersion;
+    struct _ACTIVATION_CONTEXT_DATA *ActivationContextData;
+    struct _ASSEMBLY_STORAGE_MAP *ProcessAssemblyStorageMap;
+    struct _ACTIVATION_CONTEXT_DATA *SystemDefaultActivationContextData;
+    struct _ASSEMBLY_STORAGE_MAP *SystemAssemblyStorageMap;
+    ULONG MinimumStackCommit;
+#endif
+#if (NTDDI_VERSION >= NTDDI_WS03)
+    PVOID *FlsCallback;
+    LIST_ENTRY FlsListHead;
+    struct _RTL_BITMAP *FlsBitmap;
+    ULONG FlsBitmapBits[4];
+    ULONG FlsHighIndex;
+#endif
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    PVOID WerRegistrationData;
+    PVOID WerShipAssertPtr;
+#endif
 } PEB, *PPEB;
 
 //
@@ -415,77 +614,129 @@
 //
 typedef struct _TEB
 {
-    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 */
-    PVOID 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 */
+    NT_TIB Tib;
+    PVOID EnvironmentPointer;
+    CLIENT_ID Cid;
+    PVOID ActiveRpcHandle;
+    PVOID ThreadLocalStoragePointer;
+    struct _PEB *ProcessEnvironmentBlock;
+    ULONG LastErrorValue;
+    ULONG CountOfOwnedCriticalSections;
+    PVOID CsrClientThread;
+    struct _W32THREAD* Win32ThreadInfo;
+    ULONG User32Reserved[0x1A];
+    ULONG UserReserved[5];
+    PVOID WOW32Reserved;
+    LCID CurrentLocale;
+    ULONG FpSoftwareStatusRegister;
+    PVOID SystemReserved1[0x36];
+    LONG ExceptionCode;
+    struct _ACTIVATION_CONTEXT_STACK *ActivationContextStackPointer;
+    UCHAR SpareBytes1[0x24];
+    ULONG TxFsContext;
+    GDI_TEB_BATCH GdiTebBatch;
+    CLIENT_ID RealClientId;
+    PVOID GdiCachedProcessHandle;
+    ULONG GdiClientPID;
+    ULONG GdiClientTID;
+    PVOID GdiThreadLocalInfo;
+    ULONG Win32ClientInfo[62];
+    PVOID glDispatchTable[0xE9];
+    ULONG glReserved1[0x1D];
+    PVOID glReserved2;
+    PVOID glSectionInfo;
+    PVOID glSection;
+    PVOID glTable;
+    PVOID glCurrentRC;
+    PVOID glContext;
+    NTSTATUS LastStatusValue;
+    UNICODE_STRING StaticUnicodeString;
+    WCHAR StaticUnicodeBuffer[0x105];
+    PVOID DeallocationStack;
+    PVOID TlsSlots[0x40];
+    LIST_ENTRY TlsLinks;
+    PVOID Vdm;
+    PVOID ReservedForNtRpc;
+    PVOID DbgSsReserved[0x2];
+    ULONG HardErrorDisabled;
+    PVOID Instrumentation[9];
+    GUID ActivityId;
+    PVOID SubProcessTag;
+    PVOID EtwTraceData;
+    PVOID WinSockData;
+    ULONG GdiBatchCount;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    BOOLEAN SpareBool0;
+    BOOLEAN SpareBool1;
+    BOOLEAN SpareBool2;
+#else
+    BOOLEAN InDbgPrint;
+    BOOLEAN FreeStackOnTermination;
+    BOOLEAN HasFiberData;
+#endif
+    UCHAR IdealProcessor;
+    ULONG GuaranteedStackBytes;
+    PVOID ReservedForPerf;
+    PVOID ReservedForOle;
+    ULONG WaitingOnLoaderLock;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    PVOID SavedPriorityState;
+#else
+    ULONG SparePointer1;
+#endif
+    ULONG SoftPatchPtr1;
+    ULONG SoftPatchPtr2;
+    PVOID *TlsExpansionSlots;
+    ULONG ImpersionationLocale;
+    ULONG IsImpersonating;
+    PVOID NlsCache;
+    PVOID pShimData;
+    ULONG HeapVirualAffinity;
+    PVOID CurrentTransactionHandle;
+    PTEB_ACTIVE_FRAME ActiveFrame;
+#if (NTDDI_VERSION >= NTDDI_WS03)
+    PVOID FlsData;
+#endif
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    PVOID PreferredLangauges;
+    PVOID UserPrefLanguages;
+    PVOID MergedPrefLanguages;
+    ULONG MuiImpersonation;
+    union
+    {
+        struct
+        {
+            USHORT SpareCrossTebFlags:16;
+        };
+        USHORT CrossTebFlags;
+    };
+    union
+    {
+        struct
+        {
+            USHORT DbgSafeThunkCall:1;
+            USHORT DbgInDebugPrint:1;
+            USHORT DbgHasFiberData:1;
+            USHORT DbgSkipThreadAttach:1;
+            USHORT DbgWerInShipAssertCode:1;
+            USHORT DbgIssuedInitialBp:1;
+            USHORT DbgClonedThread:1;
+            USHORT SpareSameTebBits:9;
+        };
+        USHORT SameTebFlags;
+    };
+    PVOID TxnScopeEntercallback;
+    PVOID TxnScopeExitCAllback;
+    PVOID TxnScopeContext;
+    ULONG LockCount;
+    ULONG ProcessRundown;
+    ULONGLONG LastSwitchTime;
+    ULONGLONG TotalSwitchOutTime;
+    LARGE_INTEGER WaitReasonBitMap;
+#else
+    UCHAR SafeThunkCall;
+    UCHAR BooleanSpare[3];
+#endif
 } TEB, *PTEB;
 
 #ifdef NTOS_MODE_USER
@@ -543,7 +794,7 @@
 typedef struct _PROCESS_PRIORITY_CLASS
 {
     BOOLEAN Foreground;
-    UCHAR   PriorityClass;
+    UCHAR PriorityClass;
 } PROCESS_PRIORITY_CLASS, *PPROCESS_PRIORITY_CLASS;
 
 //
@@ -581,7 +832,7 @@
 } EPROCESS_QUOTA_BLOCK, *PEPROCESS_QUOTA_BLOCK;
 
 //
-// FIXME: This really belongs in mmtypes.h
+// Process Pagefault History
 //
 typedef struct _PAGEFAULT_HISTORY
 {
@@ -613,252 +864,371 @@
 } TERMINATION_PORT, *PTERMINATION_PORT;
 
 //
+// Per-Process APC Rate Limiting
+//
+typedef struct _PSP_RATE_APC
+{
+    union
+    {
+        SINGLE_LIST_ENTRY NextApc;
+        ULONGLONG ExcessCycles;
+    };
+    ULONGLONG TargetGEneration;
+    KAPC RateApc;
+} PSP_RATE_APC, *PPSP_RATE_APC;
+
+//
 // Executive Thread (ETHREAD)
 //
 #include <pshpack4.h>
 typedef struct _ETHREAD
 {
-    KTHREAD                        Tcb;                         /* 000 */
-    PVOID                          Padding;                     /* 1B4 */
-    LARGE_INTEGER                  CreateTime;                  /* 1B8 */
+    KTHREAD Tcb;
+    PVOID Padding;
+    LARGE_INTEGER CreateTime;
     union
     {
-        LARGE_INTEGER              ExitTime;                    /* 1C0 */
-        LIST_ENTRY                 LpcReplyChain;               /* 1C0 */
-        LIST_ENTRY                 KeyedWaitChain;              /* 1C0 */
+        LARGE_INTEGER ExitTime;
+        LIST_ENTRY LpcReplyChain;
+        LIST_ENTRY KeyedWaitChain;
     };
     union
     {
-        NTSTATUS                   ExitStatus;                  /* 1C8 */
-        PVOID                      OfsChain;                    /* 1C8 */
+        NTSTATUS ExitStatus;
+        PVOID OfsChain;
     };
-    LIST_ENTRY                     PostBlockList;               /* 1CC */
+    LIST_ENTRY PostBlockList;
     union
     {
-        struct _TERMINATION_PORT   *TerminationPort;            /* 1D4 */
-        struct _ETHREAD            *ReaperLink;                 /* 1D4 */
-        PVOID                      KeyedWaitValue;              /* 1D4 */
+        struct _TERMINATION_PORT *TerminationPort;
+        struct _ETHREAD *ReaperLink;
+        PVOID KeyedWaitValue;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+        PVOID Win32StartParameter;
+#endif
     };
-    KSPIN_LOCK                     ActiveTimerListLock;         /* 1D8 */
-    LIST_ENTRY                     ActiveTimerListHead;         /* 1DC */
-    CLIENT_ID                      Cid;                         /* 1E4 */
+    KSPIN_LOCK ActiveTimerListLock;
+    LIST_ENTRY ActiveTimerListHead;
+    CLIENT_ID Cid;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    KSEMAPHORE KeyedWaitSemaphore;
+#else
     union
     {
-        KSEMAPHORE                 LpcReplySemaphore;           /* 1EC */
-        KSEMAPHORE                 KeyedReplySemaphore;         /* 1EC */
+        KSEMAPHORE LpcReplySemaphore;
+        KSEMAPHORE KeyedReplySemaphore;
     };
     union
     {
-        PVOID                      LpcReplyMessage;             /* 200 */
-        PVOID                      LpcWaitingOnPort;            /* 200 */
+        PVOID LpcReplyMessage;
+        PVOID LpcWaitingOnPort;
     };
-    PPS_IMPERSONATION_INFORMATION  ImpersonationInfo;           /* 204 */
-    LIST_ENTRY                     IrpList;                     /* 208 */
-    ULONG                          TopLevelIrp;                 /* 210 */
-    PDEVICE_OBJECT                 DeviceToVerify;              /* 214 */
-    struct _EPROCESS               *ThreadsProcess;             /* 218 */
-    PKSTART_ROUTINE                StartAddress;                /* 21C */
+#endif
+    PPS_IMPERSONATION_INFORMATION ImpersonationInfo;
+    LIST_ENTRY IrpList;
+    ULONG TopLevelIrp;
+    PDEVICE_OBJECT DeviceToVerify;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    PPSP_RATE_APC RateControlApc;
+#else
+    struct _EPROCESS *ThreadsProcess;
+#endif
+    PVOID Win32StartAddress;
     union
     {
-        PVOID                      Win32StartAddress;           /* 220 */
-        ULONG                      LpcReceivedMessageId;        /* 220 */
+        PKSTART_ROUTINE StartAddress;
+        ULONG LpcReceivedMessageId;
     };
-    LIST_ENTRY                     ThreadListEntry;             /* 224 */
-    EX_RUNDOWN_REF                 RundownProtect;              /* 22C */
-    EX_PUSH_LOCK                   ThreadLock;                  /* 230 */
-    ULONG                          LpcReplyMessageId;           /* 234 */
-    ULONG                          ReadClusterSize;             /* 238 */
-    ACCESS_MASK                    GrantedAccess;               /* 23C */
+    LIST_ENTRY ThreadListEntry;
+    EX_RUNDOWN_REF RundownProtect;
+    EX_PUSH_LOCK ThreadLock;
+#if (NTDDI_VERSION < NTDDI_LONGHORN)
+    ULONG LpcReplyMessageId;
+#endif
+    ULONG ReadClusterSize;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    ULONG SpareUlong0;
+#else
+    ACCESS_MASK GrantedAccess;
+#endif
     union
     {
         struct
         {
-           ULONG                   Terminated:1;
-           ULONG                   DeadThread:1;
-           ULONG                   HideFromDebugger:1;
-           ULONG                   ActiveImpersonationInfo:1;
-           ULONG                   SystemThread:1;
-           ULONG                   HardErrorsAreDisabled:1;
-           ULONG                   BreakOnTermination:1;
-           ULONG                   SkipCreationMsg:1;
-           ULONG                   SkipTerminationMsg:1;
+           ULONG Terminated:1;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+           ULONG ThreadInserted:1;
+#else
+           ULONG DeadThread:1;
+#endif
+           ULONG HideFromDebugger:1;
+           ULONG ActiveImpersonationInfo:1;
+           ULONG SystemThread:1;
+           ULONG HardErrorsAreDisabled:1;
+           ULONG BreakOnTermination:1;
+           ULONG SkipCreationMsg:1;
+           ULONG SkipTerminationMsg:1;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+           ULONG CreateMsgSent:1;
+           ULONG ThreadIoPriority:3;
+           ULONG ThreadPagePriority:3;
+           ULONG PendingRatecontrol:1;
+#endif
         };
-        ULONG                      CrossThreadFlags;            /* 240 */
+        ULONG CrossThreadFlags;
     };
     union
     {
         struct
         {
-           ULONG                   ActiveExWorker:1;
-           ULONG                   ExWorkerCanWaitUser:1;
-           ULONG                   MemoryMaker:1;
-           ULONG                   KeyedEventInUse:1;
+           ULONG ActiveExWorker:1;
+           ULONG ExWorkerCanWaitUser:1;
+           ULONG MemoryMaker:1;
+           ULONG KeyedEventInUse:1;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+           ULONG RateApcState:2;
+#endif
         };
-        ULONG                      SameThreadPassiveFlags;      /* 244 */
+        ULONG SameThreadPassiveFlags;
     };
     union
     {
         struct
         {
-           ULONG                   LpcReceivedMsgIdValid:1;
-           ULONG                   LpcExitThreadCalled:1;
-           ULONG                   AddressSpaceOwner:1;
-           ULONG                   OwnsProcessWorkingSetExclusive:1;
-           ULONG                   OwnsProcessWorkingSetShared:1;
-           ULONG                   OwnsSystemWorkingSetExclusive:1;
-           ULONG                   OwnsSystemWorkingSetShared:1;
-           ULONG                   OwnsSessionWorkingSetExclusive:1;
-           ULONG                   OwnsSessionWorkingSetShared:1;
-           ULONG                   ApcNeeded:1;
+           ULONG LpcReceivedMsgIdValid:1;
+           ULONG LpcExitThreadCalled:1;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+           ULONG Spare:1;
+#else
+           ULONG AddressSpaceOwner:1;
+#endif
+           ULONG OwnsProcessWorkingSetExclusive:1;
+           ULONG OwnsProcessWorkingSetShared:1;
+           ULONG OwnsSystemWorkingSetExclusive:1;
+           ULONG OwnsSystemWorkingSetShared:1;
+           ULONG OwnsSessionWorkingSetExclusive:1;
+           ULONG OwnsSessionWorkingSetShared:1;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+           ULONG SupressSymbolLoad:1;
+           ULONG Spare1:3;
+           ULONG PriorityRegionActive:4;
+#else
+           ULONG ApcNeeded:1;
+#endif
         };
-        ULONG                      SameThreadApcFlags;          /* 248 */
+        ULONG SameThreadApcFlags;
     };
-    UCHAR                          ForwardClusterOnly;          /* 24C */
-    UCHAR                          DisablePageFaultClustering;  /* 24D */
-    UCHAR                          ActiveFaultCount;            /* 24E */
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    UCHAR CacheManagerActive;
+#else
+    UCHAR ForwardClusterOnly;
+#endif
+    UCHAR DisablePageFaultClustering;
+    UCHAR ActiveFaultCount;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    ULONG AlpcMessageId;
+    union
+    {
+        PVOID AlpcMessage;
+        ULONG AlpcReceiveAttributeSet;
+    };
+    LIST_ENTRY AlpcWaitListEntry;
+    KSEMAPHORE AlpcWaitSemaphore;
+    ULONG CacheManagerCount;
+#endif
 } ETHREAD;
 
-#if defined(_NTOSKRNL_)
-    #include <internal/mm.h>
-#endif
-
 //
 // Executive Process (EPROCESS)
 //
 typedef struct _EPROCESS
 {
-    KPROCESS              Pcb;                          /* 000 */
-    EX_PUSH_LOCK          ProcessLock;                  /* 078 */
-    LARGE_INTEGER         CreateTime;                   /* 080 */
-    LARGE_INTEGER         ExitTime;                     /* 088 */
-    EX_RUNDOWN_REF        RundownProtect;               /* 090 */
-    HANDLE                UniqueProcessId;              /* 094 */
-    LIST_ENTRY            ActiveProcessLinks;           /* 098 */
-    ULONG                 QuotaUsage[3];                /* 0A0 */
-    ULONG                 QuotaPeak[3];                 /* 0AC */
-    ULONG                 CommitCharge;                 /* 0B8 */
-    ULONG                 PeakVirtualSize;              /* 0BC */
-    ULONG                 VirtualSize;                  /* 0C0 */
-    LIST_ENTRY            SessionProcessLinks;          /* 0C4 */
-    PVOID                 DebugPort;                    /* 0CC */
-    PVOID                 ExceptionPort;                /* 0D0 */
-    PHANDLE_TABLE         ObjectTable;                  /* 0D4 */
-    EX_FAST_REF           Token;                        /* 0D8 */
-    ULONG                 WorkingSetPage;               /* 0DC */
-    KGUARDED_MUTEX        AddressCreationLock;          /* 0E0 */
-    KSPIN_LOCK            HyperSpaceLock;               /* 100 */
-    PETHREAD              ForkInProgress;               /* 104 */
-    ULONG                 HardwareTrigger;              /* 108 */
-    MM_AVL_TABLE          PhysicalVadroot;              /* 10C */
-    PVOID                 CloneRoot;                    /* 110 */
-    ULONG                 NumberOfPrivatePages;         /* 114 */
-    ULONG                 NumberOfLockedPages;          /* 118 */
-    PVOID                 *Win32Process;                /* 11C */
-    struct _EJOB          *Job;                         /* 120 */
-    PVOID                 SectionObject;                /* 124 */
-    PVOID                 SectionBaseAddress;           /* 128 */
-    PEPROCESS_QUOTA_BLOCK QuotaBlock;                   /* 12C */
-    PPAGEFAULT_HISTORY    WorkingSetWatch;              /* 130 */
-    PVOID                 Win32WindowStation;           /* 134 */
-    HANDLE                InheritedFromUniqueProcessId; /* 138 */
-    PVOID                 LdtInformation;               /* 13C */
-    PVOID                 VadFreeHint;                  /* 140 */
-    PVOID                 VdmObjects;                   /* 144 */
-    PVOID                 DeviceMap;                    /* 148 */
-    PVOID                 Spare0[3];                    /* 14C */
+    KPROCESS Pcb;
+    EX_PUSH_LOCK ProcessLock;
+    LARGE_INTEGER CreateTime;
+    LARGE_INTEGER ExitTime;
+    EX_RUNDOWN_REF RundownProtect;
+    HANDLE UniqueProcessId;
+    LIST_ENTRY ActiveProcessLinks;
+    ULONG QuotaUsage[3];
+    ULONG QuotaPeak[3];
+    ULONG CommitCharge;
+    ULONG PeakVirtualSize;
+    ULONG VirtualSize;
+    LIST_ENTRY SessionProcessLinks;
+    PVOID DebugPort;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
     union
     {
-        HARDWARE_PTE_X86  PagedirectoryPte;             /* 158 */
-        ULONGLONG         Filler;                       /* 158 */
+        PVOID ExceptionPortData;
+        ULONG ExceptionPortValue;
+        UCHAR ExceptionPortState:3;
     };
-    ULONG                 Session;                      /* 160 */
-    CHAR                  ImageFileName[16];            /* 164 */
-    LIST_ENTRY            JobLinks;                     /* 174 */
-    PVOID                 LockedPagesList;              /* 17C */
-    LIST_ENTRY            ThreadListHead;               /* 184 */
-    PVOID                 SecurityPort;                 /* 188 */
-    PVOID                 PaeTop;                       /* 18C */
-    ULONG                 ActiveThreads;                /* 190 */
-    ACCESS_MASK           GrantedAccess;                /* 194 */
-    ULONG                 DefaultHardErrorProcessing;   /* 198 */
-    NTSTATUS              LastThreadExitStatus;         /* 19C */
-    struct _PEB*          Peb;                          /* 1A0 */
-    EX_FAST_REF           PrefetchTrace;                /* 1A4 */
-    LARGE_INTEGER         ReadOperationCount;           /* 1A8 */
-    LARGE_INTEGER         WriteOperationCount;          /* 1B0 */
-    LARGE_INTEGER         OtherOperationCount;          /* 1B8 */
-    LARGE_INTEGER         ReadTransferCount;            /* 1C0 */
-    LARGE_INTEGER         WriteTransferCount;           /* 1C8 */
-    LARGE_INTEGER         OtherTransferCount;           /* 1D0 */
-    ULONG                 CommitChargeLimit;            /* 1D8 */
-    ULONG                 CommitChargePeak;             /* 1DC */
-    PVOID                 AweInfo;                      /* 1E0 */
-    SE_AUDIT_PROCESS_CREATION_INFO SeAuditProcessCreationInfo; /* 1E4 */
-    MMSUPPORT             Vm;                           /* 1E8 */
-    LIST_ENTRY            MmProcessLinks;               /* 230 */
-    ULONG                 ModifiedPageCount;            /* 238 */
-    ULONG                 JobStatus;                    /* 23C */
+#else
+    PVOID ExceptionPort;
+#endif
+    PHANDLE_TABLE ObjectTable;
+    EX_FAST_REF Token;
+    ULONG WorkingSetPage;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    EX_PUSH_LOCK AddressCreationLock;
+    PETHREAD RotateInProgress;
+#else
+    KGUARDED_MUTEX AddressCreationLock;
+    KSPIN_LOCK HyperSpaceLock;
+#endif
+    PETHREAD ForkInProgress;
+    ULONG HardwareTrigger;
+    MM_AVL_TABLE PhysicalVadroot;
+    PVOID CloneRoot;
+    ULONG NumberOfPrivatePages;
+    ULONG NumberOfLockedPages;
+    PVOID *Win32Process;
+    struct _EJOB *Job;
+    PVOID SectionObject;
+    PVOID SectionBaseAddress;
+    PEPROCESS_QUOTA_BLOCK QuotaBlock;
+    PPAGEFAULT_HISTORY WorkingSetWatch;
+    PVOID Win32WindowStation;
+    HANDLE InheritedFromUniqueProcessId;
+    PVOID LdtInformation;
+    PVOID VadFreeHint;
+    PVOID VdmObjects;
+    PVOID DeviceMap;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    ULONG AlpcPagedPoolQuotaCache;
+    PVOID EtwDataSource;
+    PVOID FreeTebHint;
+#else
+    PVOID Spare0[3];
+#endif
     union
     {
+        HARDWARE_PTE_X86 PagedirectoryPte;
+        ULONGLONG Filler;
+    };
+    ULONG Session;
+    CHAR ImageFileName[16];
+    LIST_ENTRY JobLinks;
+    PVOID LockedPagesList;
+    LIST_ENTRY ThreadListHead;
+    PVOID SecurityPort;
+    PVOID PaeTop;
+    ULONG ActiveThreads;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    ULONG ImagePathHash;
+#else
+    ACCESS_MASK GrantedAccess;
+#endif
+    ULONG DefaultHardErrorProcessing;
+    NTSTATUS LastThreadExitStatus;
+    struct _PEB* Peb;
+    EX_FAST_REF PrefetchTrace;
+    LARGE_INTEGER ReadOperationCount;
+    LARGE_INTEGER WriteOperationCount;
+    LARGE_INTEGER OtherOperationCount;
+    LARGE_INTEGER ReadTransferCount;
+    LARGE_INTEGER WriteTransferCount;
+    LARGE_INTEGER OtherTransferCount;
+    ULONG CommitChargeLimit;
+    ULONG CommitChargePeak;
+    PVOID AweInfo;
+    SE_AUDIT_PROCESS_CREATION_INFO SeAuditProcessCreationInfo;
+    MMSUPPORT Vm;
+    LIST_ENTRY MmProcessLinks;
+    ULONG ModifiedPageCount;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    union
+    {
         struct
         {
-            ULONG         CreateReported:1;
-            ULONG         NoDebugInherit:1;
-            ULONG         ProcessExiting:1;
-            ULONG         ProcessDelete:1;
-            ULONG         Wow64SplitPages:1;
-            ULONG         VmDeleted:1;
-            ULONG         OutswapEnabled:1;
-            ULONG         Outswapped:1;
-            ULONG         ForkFailed:1;
-            ULONG         Wow64VaSpace4Gb:1;
-            ULONG         AddressSpaceInitialized:2;
-            ULONG         SetTimerResolution:1;
-            ULONG         BreakOnTermination:1;
-            ULONG         SessionCreationUnderway:1;
-            ULONG         WriteWatch:1;
-            ULONG         ProcessInSession:1;
-            ULONG         OverrideAddressSpace:1;
-            ULONG         HasAddressSpace:1;
-            ULONG         LaunchPrefetched:1;
-            ULONG         InjectInpageErrors:1;
-            ULONG         VmTopDown:1;
-            ULONG         ImageNotifyDone:1;
-            ULONG         PdeUpdateNeeded:1;
-            ULONG         VdmAllowed:1;
-            ULONG         SmapAllowed:1;
-            ULONG         CreateFailed:1;
-            ULONG         DefaultIoPriority:3;
-            ULONG         Spare1:1;
-            ULONG         Spare2:1;
+            ULONG JobNotReallyActive:1;
+            ULONG AccountingFolded:1;
+            ULONG NewProcessReported:1;
+            ULONG ExitProcessReported:1;
+            ULONG ReportCommitChanges:1;
+            ULONG LastReportMemory:1;
+            ULONG ReportPhysicalPageChanges:1;
+            ULONG HandleTableRundown:1;
+            ULONG NeedsHandleRundown:1;
+            ULONG RefTraceEnabled:1;
+            ULONG NumaAware:1;
+            ULONG ProtectedProcess:1;
+            ULONG DefaultPagePriority:3;
+            ULONG ProcessDeleteSelf:1;
+            ULONG ProcessVerifierTarget:1;
         };
-        ULONG             Flags;                        /* 240 */
+        ULONG Flags2;
     };
-
-    NTSTATUS              ExitStatus;                   /* 244 */
-    USHORT                NextPageColor;                /* 248 */
+#else
+    ULONG JobStatus;
+#endif
     union
     {
         struct
         {
-            UCHAR         SubSystemMinorVersion;        /* 24A */
-            UCHAR         SubSystemMajorVersion;        /* 24B */
+            ULONG CreateReported:1;
+            ULONG NoDebugInherit:1;
+            ULONG ProcessExiting:1;
+            ULONG ProcessDelete:1;
+            ULONG Wow64SplitPages:1;
+            ULONG VmDeleted:1;
+            ULONG OutswapEnabled:1;
+            ULONG Outswapped:1;
+            ULONG ForkFailed:1;
+            ULONG Wow64VaSpace4Gb:1;
+            ULONG AddressSpaceInitialized:2;
+            ULONG SetTimerResolution:1;
+            ULONG BreakOnTermination:1;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+            ULONG DeprioritizeViews:1;
+#else
+            ULONG SessionCreationUnderway:1;
+#endif
+            ULONG WriteWatch:1;
+            ULONG ProcessInSession:1;
+            ULONG OverrideAddressSpace:1;
+            ULONG HasAddressSpace:1;
+            ULONG LaunchPrefetched:1;
+            ULONG InjectInpageErrors:1;
+            ULONG VmTopDown:1;
+            ULONG ImageNotifyDone:1;
+            ULONG PdeUpdateNeeded:1;
+            ULONG VdmAllowed:1;
+            ULONG SmapAllowed:1;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+            ULONG ProcessInserted:1;
+#else
+            ULONG CreateFailed:1;
+#endif
+            ULONG DefaultIoPriority:3;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+            ULONG SparePsFlags1:2;
+#else
+            ULONG Spare1:1;
+            ULONG Spare2:1;
+#endif
         };
-        USHORT            SubSystemVersion;             /* 24A */
+        ULONG Flags;
     };
-    UCHAR                 PriorityClass;                /* 24C */
-    MM_AVL_TABLE          VadRoot;                      /* 250 */
-    ULONG                 Cookie;                       /* 270 */
-
-#ifdef _REACTOS_
-    /* FIXME: WILL BE DEPRECATED WITH PUSHLOCK SUPPORT IN 0.3.0*/
-    KEVENT                LockEvent;                    /* 274 */
-    ULONG                 LockCount;                    /* 284 */
-    struct _KTHREAD       *LockOwner;                   /* 288 */
-
-    /* FIXME: MOVE TO AVL TREES                                */
-    MADDRESS_SPACE        AddressSpace;                 /* 28C */
+    NTSTATUS ExitStatus;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    USHORT Spare7;
+#else
+    USHORT NextPageColor;
 #endif
+    union
+    {
+        struct
+        {
+            UCHAR SubSystemMinorVersion;
+            UCHAR SubSystemMajorVersion;
+        };
+        USHORT SubSystemVersion;
+    };
+    UCHAR PriorityClass;
+    MM_AVL_TABLE VadRoot;
+    ULONG Cookie;
 } EPROCESS;
 #include <poppack.h>
 
@@ -925,7 +1295,14 @@
     ULONG PeakProcessMemoryUsed;
     ULONG PeakJobMemoryUsed;
     ULONG CurrentJobMemoryUsed;
+#if (NTDDI_VERSION == NTDDI_WINXP)
+    FAST_MUTEX MemoryLimitsLock;
+#elif (NTDDI_VERSION == NTDDI_WS03)
     KGUARDED_MUTEX MemoryLimitsLock;
+#elif (NTDDI_VERSION >= NTDDI_LONGHORN)
+    EX_PUSH_LOCK MemoryLimitsLock;
+#endif
+    LIST_ENTRY JobSetLinks;
     ULONG MemberLevel;
     ULONG JobFlags;
 } EJOB, *PEJOB;
@@ -934,30 +1311,94 @@
 //
 // Win32K Callback Registration Data
 //
-typedef struct _W32_CALLOUT_DATA
+typedef struct _WIN32_POWEREVENT_PARAMETERS
 {
-    PW32_PROCESS_CALLBACK W32ProcessCallout;
-    PW32_THREAD_CALLBACK W32ThreadCallout;
-    PVOID UserGlobalAtomTableCallout;
-    PVOID UserPowerEventCallout;
-    PVOID UserPowerStateCallout;
-    PVOID UserJobCallout;
-    PVOID NtGdiUserFlushUserBatch;
-    OB_OPEN_METHOD DesktopOpen;
-    PVOID DesktopUnmap;
-    OB_DELETE_METHOD DesktopDelete;
-    OB_OKAYTOCLOSE_METHOD WinstaOkayToClose;
-    OB_DELETE_METHOD WinStaDelete;
-    OB_PARSE_METHOD WinStaParse;
-    OB_OPEN_METHOD WinStaOpen;
-#ifdef _REACTOS_
-    /* FIXME: REACTOS ONLY */
-    OB_FIND_METHOD WinStaFind;
-    OB_OPEN_METHOD WinStaCreate;
-    OB_CREATE_METHOD DesktopCreate;
-#endif
-} W32_CALLOUT_DATA, *PW32_CALLOUT_DATA;
+    PSPOWEREVENTTYPE EventNumber;
+    ULONG Code;
+} WIN32_POWEREVENT_PARAMETERS, *PWIN32_POWEREVENT_PARAMETERS;
 
+typedef struct _WIN32_POWERSTATE_PARAMETERS
+{
+    UCHAR Promotion;
+    POWER_ACTION SystemAction;
+    SYSTEM_POWER_STATE MinSystemState;
+    ULONG Flags;
+    POWERSTATETASK PowerStateTask;
+} WIN32_POWERSTATE_PARAMETERS, *PWIN32_POWERSTATE_PARAMETERS;
+
+typedef struct _WIN32_JOBCALLOUT_PARAMETERS
+{
+    PVOID Job;
+    PSW32JOBCALLOUTTYPE CalloutType;
+    PVOID Data;
+} WIN32_JOBCALLOUT_PARAMETERS, *PWIN32_JOBCALLOUT_PARAMETERS;
+
+typedef struct _WIN32_OPENMETHOD_PARAMETERS
+{
+    OB_OPEN_REASON OpenReason;
+    PEPROCESS Process;
+    PVOID Object;
+    ULONG GrantedAccess;
+    ULONG HandleCount;
+} WIN32_OPENMETHOD_PARAMETERS, *PWIN32_OPENMETHOD_PARAMETERS;
+
+typedef struct _WIN32_OKAYTOCLOSEMETHOD_PARAMETERS
+{
+    PEPROCESS Process;
+    PVOID Object;
+    HANDLE Handle;
+    KPROCESSOR_MODE PreviousMode;
+} WIN32_OKAYTOCLOSEMETHOD_PARAMETERS, *PWIN32_OKAYTOCLOSEMETHOD_PARAMETERS;
+
+typedef struct _WIN32_CLOSEMETHOD_PARAMETERS
+{
+    PEPROCESS Process;
+    PVOID Object;
+    ACCESS_MASK AccessMask;
+    ULONG ProcessHandleCount;
+    ULONG SystemHandleCount;
+} WIN32_CLOSEMETHOD_PARAMETERS, *PWIN32_CLOSEMETHOD_PARAMETERS;
+
+typedef struct _WIN32_DELETEMETHOD_PARAMETERS
+{
+    PVOID Object;
+} WIN32_DELETEMETHOD_PARAMETERS, *PWIN32_DELETEMETHOD_PARAMETERS;
+
+typedef struct _WIN32_PARSEMETHOD_PARAMETERS
+{
+    PVOID ParseObject;
+    PVOID ObjectType;
+    PACCESS_STATE AccessState;
+    KPROCESSOR_MODE AccessMode;
+    ULONG Attributes;
+    OUT PUNICODE_STRING CompleteName;
+    PUNICODE_STRING RemainingName;
+    PVOID Context;
+    PSECURITY_QUALITY_OF_SERVICE SecurityQos;
+    PVOID *Object;
+} WIN32_PARSEMETHOD_PARAMETERS, *PWIN32_PARSEMETHOD_PARAMETERS;
+
+typedef struct _WIN32_CALLOUTS_FPNS
+{
+    PKWIN32_PROCESS_CALLOUT ProcessCallout;
+    PKWIN32_THREAD_CALLOUT ThreadCallout;
+    PKWIN32_GLOBALATOMTABLE_CALLOUT GlobalAtomTableCallout;
+    PKWIN32_POWEREVENT_CALLOUT PowerEventCallout;
+    PKWIN32_POWERSTATE_CALLOUT PowerStateCallout;
+    PKWIN32_JOB_CALLOUT JobCallout;
+    PGDI_BATCHFLUSH_ROUTINE BatchFlushRoutine;
+    PKWIN32_OPENMETHOD_CALLOUT DesktopOpenProcedure;
+    PKWIN32_OKTOCLOSEMETHOD_CALLOUT DesktopOkToCloseProcedure;
+    PKWIN32_CLOSEMETHOD_CALLOUT DesktopCloseProcedure;
+    PKWIN32_DELETEMETHOD_CALLOUT DesktopDeleteProcedure;
+    PKWIN32_OKTOCLOSEMETHOD_CALLOUT WindowStationOkToCloseProcedure;
+    PKWIN32_CLOSEMETHOD_CALLOUT WindowStationCloseProcedure;
+    PKWIN32_DELETEMETHOD_CALLOUT WindowStationDeleteProcedure;
+    PKWIN32_PARSEMETHOD_CALLOUT WindowStationParseProcedure;
+    PKWIN32_OPENMETHOD_CALLOUT WindowStationOpenProcedure;
+    PKWIN32_WIN32DATACOLLECTION_CALLOUT Win32DataCollectionProcedure;
+} WIN32_CALLOUTS_FPNS, *PWIN32_CALLOUTS_FPNS;
+
 #endif // !NTOS_MODE_USER
 
 #endif // _PSTYPES_H
Index: include/ndk/exfuncs.h
===================================================================
--- include/ndk/exfuncs.h	(revision 21808)
+++ include/ndk/exfuncs.h	(working copy)
@@ -1,4 +1,4 @@
-/*++ NDK Version: 0095
+/*++ NDK Version: 0098
 
 Copyright (c) Alex Ionescu.  All rights reserved.
 
@@ -12,7 +12,7 @@
 
 Author:
 
-    Alex Ionescu (alex.ionescu@reactos.com)   06-Oct-2004
+    Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
 
 --*/
 
@@ -208,6 +208,15 @@
 NTSYSCALLAPI
 NTSTATUS
 NTAPI
+NtOpenKeyedEvent(
+    OUT PHANDLE EventHandle,
+    IN ACCESS_MASK DesiredAccess,
+    IN POBJECT_ATTRIBUTES ObjectAttributes
+);
+
+NTSYSCALLAPI
+NTSTATUS
+NTAPI
 NtOpenEventPair(
     OUT PHANDLE EventPairHandle,
     IN ACCESS_MASK DesiredAccess,
@@ -369,6 +378,16 @@
 NTSYSCALLAPI
 NTSTATUS
 NTAPI
+NtReleaseKeyedEvent(
+    IN HANDLE EventHandle,
+    IN PVOID Key,
+    IN BOOLEAN Alertable,
+    IN PLARGE_INTEGER Timeout OPTIONAL
+);
+
+NTSYSCALLAPI
+NTSTATUS
+NTAPI
 NtReleaseSemaphore(
     IN HANDLE SemaphoreHandle,
     IN LONG ReleaseCount,
@@ -416,6 +435,13 @@
 NTSYSCALLAPI
 NTSTATUS
 NTAPI
+NtSetEventBoostPriority(
+    IN HANDLE EventHandle
+);
+
+NTSYSCALLAPI
+NTSTATUS
+NTAPI
 NtSetHighEventPair(
     IN HANDLE EventPairHandle
 );
@@ -488,6 +514,16 @@
 NTSYSCALLAPI
 NTSTATUS
 NTAPI
+NtWaitForKeyedEvent(
+    IN HANDLE EventHandle,
+    IN PVOID Key,
+    IN BOOLEAN Alertable,
+    IN PLARGE_INTEGER Timeout OPTIONAL
+);
+
+NTSYSCALLAPI
+NTSTATUS
+NTAPI
 NtWaitHighEventPair(
     IN HANDLE EventPairHandle
 );
@@ -536,7 +572,6 @@
 );
 
 NTSYSAPI
-NTSYSAPI
 NTSTATUS
 NTAPI
 ZwCreateEvent(
@@ -824,6 +859,7 @@
 );
 
 NTSYSAPI
+NTSYSAPI
 NTSTATUS
 NTAPI
 ZwSetEvent(
Index: include/ndk/lpcfuncs.h
===================================================================
--- include/ndk/lpcfuncs.h	(revision 21808)
+++ include/ndk/lpcfuncs.h	(working copy)
@@ -1,4 +1,4 @@
-/*++ NDK Version: 0095
+/*++ NDK Version: 0098
 
 Copyright (c) Alex Ionescu.  All rights reserved.
 
@@ -12,7 +12,7 @@
 
 Author:
 
-    Alex Ionescu (alex.ionescu@reactos.com)   06-Oct-2004
+    Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
 
 --*/
 
@@ -27,6 +27,7 @@
 //
 // Native calls
 //
+NTSYSCALLAPI
 NTSTATUS
 NTAPI
 NtAcceptConnectPort(
@@ -38,6 +39,7 @@
     PREMOTE_PORT_VIEW ClientView OPTIONAL
 );
 
+NTSYSCALLAPI
 NTSTATUS
 NTAPI
 NtCompleteConnectPort(
@@ -58,6 +60,7 @@
     PULONG ConnectionInformationLength OPTIONAL
 );
 
+NTSYSCALLAPI
 NTSTATUS
 NTAPI
 NtCreatePort(
@@ -68,6 +71,7 @@
     ULONG MaxPoolUsage
 );
 
+NTSYSCALLAPI
 NTSTATUS
 NTAPI
 NtCreateWaitablePort(
@@ -78,6 +82,7 @@
     ULONG NPMessageQueueSize OPTIONAL
 );
 
+NTSYSCALLAPI
 NTSTATUS
 NTAPI
 NtImpersonateClientOfPort(
@@ -85,6 +90,7 @@
     PPORT_MESSAGE ClientMessage
 );
 
+NTSYSCALLAPI
 NTSTATUS
 NTAPI
 NtListenPort(
@@ -92,6 +98,7 @@
     PPORT_MESSAGE ConnectionRequest
 );
 
+NTSYSCALLAPI
 NTSTATUS
 NTAPI
 NtQueryInformationPort(
@@ -102,6 +109,7 @@
     PULONG ReturnLength
 );
 
+NTSYSCALLAPI
 NTSTATUS
 NTAPI
 NtReadRequestData(
@@ -113,6 +121,7 @@
     PULONG ReturnLength
 );
 
+NTSYSCALLAPI
 NTSTATUS
 NTAPI
 NtReplyPort(
@@ -120,6 +129,7 @@
     IN PPORT_MESSAGE LpcReply
 );
 
+NTSYSCALLAPI
 NTSTATUS
 NTAPI
 NtReplyWaitReceivePort(
@@ -129,6 +139,7 @@
     OUT PPORT_MESSAGE ReceiveMessage
 );
 
+NTSYSCALLAPI
 NTSTATUS
 NTAPI
 NtReplyWaitReceivePortEx(
@@ -139,6 +150,7 @@
     IN PLARGE_INTEGER Timeout OPTIONAL
 );
 
+NTSYSCALLAPI
 NTSTATUS
 NTAPI
 NtReplyWaitReplyPort(
@@ -146,6 +158,7 @@
     OUT PPORT_MESSAGE ReplyMessage
 );
 
+NTSYSCALLAPI
 NTSTATUS
 NTAPI
 NtRequestPort(
@@ -177,6 +190,7 @@
     PULONG ConnectionInformationLength OPTIONAL
 );
 
+NTSYSCALLAPI
 NTSTATUS
 NTAPI
 NtWriteRequestData(
@@ -188,6 +202,7 @@
     PULONG ReturnLength
 );
 
+NTSYSAPI
 NTSTATUS
 NTAPI
 ZwAcceptConnectPort(
@@ -199,13 +214,14 @@
     PREMOTE_PORT_VIEW ClientView OPTIONAL
 );
 
+NTSYSAPI
 NTSTATUS
 NTAPI
 ZwCompleteConnectPort(
     HANDLE PortHandle
 );
 
-NTSYSCALLAPI
+NTSYSAPI
 NTSTATUS
 NTAPI
 ZwConnectPort(
@@ -219,6 +235,7 @@
     PULONG ConnectionInformationLength OPTIONAL
 );
 
+NTSYSAPI
 NTSTATUS
 NTAPI
 ZwCreatePort(
@@ -229,6 +246,7 @@
     ULONG MaxPoolUsage
 );
 
+NTSYSAPI
 NTSTATUS
 NTAPI
 ZwCreateWaitablePort(
@@ -239,6 +257,7 @@
     ULONG NPMessageQueueSize OPTIONAL
 );
 
+NTSYSAPI
 NTSTATUS
 NTAPI
 ZwImpersonateClientOfPort(
@@ -246,6 +265,7 @@
     PPORT_MESSAGE ClientMessage
 );
 
+NTSYSAPI
 NTSTATUS
 NTAPI
 ZwListenPort(
@@ -253,6 +273,7 @@
     PPORT_MESSAGE ConnectionRequest
 );
 
+NTSYSAPI
 NTSTATUS
 NTAPI
 ZwQueryInformationPort(
@@ -263,6 +284,7 @@
     PULONG ReturnLength
 );
 
+NTSYSAPI
 NTSTATUS
 NTAPI
 ZwReadRequestData(
@@ -274,6 +296,7 @@
     PULONG ReturnLength
 );
 
+NTSYSAPI
 NTSTATUS
 NTAPI
 ZwReplyPort(
@@ -281,6 +304,7 @@
     IN PPORT_MESSAGE LpcReply
 );
 
+NTSYSAPI
 NTSTATUS
 NTAPI
 ZwReplyWaitReceivePort(
@@ -290,6 +314,7 @@
     OUT PPORT_MESSAGE ReceiveMessage
 );
 
+NTSYSAPI
 NTSTATUS
 NTAPI
 ZwReplyWaitReceivePortEx(
@@ -300,6 +325,7 @@
     IN PLARGE_INTEGER Timeout OPTIONAL
 );
 
+NTSYSAPI
 NTSTATUS
 NTAPI
 ZwReplyWaitReplyPort(
@@ -307,6 +333,7 @@
     OUT PPORT_MESSAGE ReplyMessage
 );
 
+NTSYSAPI
 NTSTATUS
 NTAPI
 ZwRequestPort(
@@ -314,7 +341,7 @@
     IN PPORT_MESSAGE LpcMessage
 );
 
-NTSYSCALLAPI
+NTSYSAPI
 NTSTATUS
 NTAPI
 ZwRequestWaitReplyPort(
@@ -323,7 +350,7 @@
     IN PPORT_MESSAGE LpcRequest
 );
 
-NTSYSCALLAPI
+NTSYSAPI
 NTSTATUS
 NTAPI
 ZwSecureConnectPort(
@@ -338,6 +365,7 @@
     PULONG ConnectionInformationLength OPTIONAL
 );
 
+NTSYSAPI
 NTSTATUS
 NTAPI
 ZwWriteRequestData(
Index: include/ndk/kdtypes.h
===================================================================
--- include/ndk/kdtypes.h	(revision 21808)
+++ include/ndk/kdtypes.h	(working copy)
@@ -1,4 +1,4 @@
-/*++ NDK Version: 0095
+/*++ NDK Version: 0098
 
 Copyright (c) Alex Ionescu.  All rights reserved.
 
@@ -12,7 +12,7 @@
 
 Author:
 
-    Alex Ionescu (alex.ionescu@reactos.com)   06-Oct-2004
+    Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
 
 --*/
 
@@ -47,6 +47,7 @@
 //
 // DebugService Control Types
 //
+#define BREAKPOINT_BREAK                    0
 #define BREAKPOINT_PRINT                    1
 #define BREAKPOINT_PROMPT                   2
 #define BREAKPOINT_LOAD_SYMBOLS             3
@@ -55,25 +56,109 @@
 //
 // Debug Control Codes for NtSystemDebugcontrol
 //
-typedef enum _DEBUG_CONTROL_CODE
+typedef enum _SYSDBG_COMMAND
 {
-    DebugGetTraceInformation = 1,
-    DebugSetInternalBreakpoint,
-    DebugSetSpecialCall,
-    DebugClearSpecialCalls,
-    DebugQuerySpecialCalls,
-    DebugDbgBreakPoint,
-    DebugDbgLoadSymbols
-} DEBUG_CONTROL_CODE;
+    SysDbgQueryModuleInformation = 0,
+    SysDbgQueryTraceInformation = 1,
+    SysDbgSetTracepoint = 2,
+    SysDbgSetSpecialCall = 3,
+    SysDbgClearSpecialCalls = 4,
+    SysDbgQuerySpecialCalls = 5,
+    SysDbgBreakPoint = 6,
+    SysDbgQueryVersion = 7,
+    SysDbgReadVirtual = 8,
+    SysDbgWriteVirtual = 9,
+    SysDbgReadPhysical = 10,
+    SysDbgWritePhysical = 11,
+    SysDbgReadControlSpace = 12,
+    SysDbgWriteControlSpace = 13,
+    SysDbgReadIoSpace = 14,
+    SysDbgWriteIoSpace = 15,
+    SysDbgReadMsr = 16,
+    SysDbgWriteMsr = 17,
+    SysDbgReadBusData = 18,
+    SysDbgWriteBusData = 19,
+    SysDbgCheckLowMemory = 20,
+    SysDbgEnableKernelDebugger = 21,
+    SysDbgDisableKernelDebugger = 22,
+    SysDbgGetAutoKdEnable = 23,
+    SysDbgSetAutoKdEnable = 24,
+    SysDbgGetPrintBufferSize = 25,
+    SysDbgSetPrintBufferSize = 26,
+    SysDbgGetKdUmExceptionEnable = 27,
+    SysDbgSetKdUmExceptionEnable = 28,
+    SysDbgGetTriageDump = 29,
+    SysDbgGetKdBlockEnable = 30,
+    SysDbgSetKdBlockEnable = 31,
+    SysDbgRegisterForUmBreakInfo = 32,
+    SysDbgGetUmBreakPid = 33,
+    SysDbgClearUmBreakPid = 34,
+    SysDbgGetUmAttachPid = 35,
+    SysDbgClearUmAttachPid = 36,
+} SYSDBG_COMMAND;
 
 //
-// Kernel Debugger Port Definition
+// System Debugger Types
 //
-typedef struct _KD_PORT_INFORMATION
+typedef struct _SYSDBG_PHYSICAL
 {
-    ULONG ComPort;
-    ULONG BaudRate;
-    ULONG BaseAddress;
-} KD_PORT_INFORMATION, *PKD_PORT_INFORMATION;
+    PHYSICAL_ADDRESS Address;
+    PVOID Buffer;
+    ULONG Request;
+} SYSDBG_PHYSICAL, *PSYSDBG_PHYSICAL;
 
+typedef struct _SYSDBG_VIRTUAL
+{
+    PVOID Address;
+    PVOID Buffer;
+    ULONG Request;
+} SYSDBG_VIRTUAL, *PSYSDBG_VIRTUAL;
+
+typedef struct _SYSDBG_CONTROL_SPACE
+{
+    ULONGLONG Address;
+    PVOID Buffer;
+    ULONG Request;
+    ULONG Processor;
+} SYSDBG_CONTROL_SPACE, *PSYSDBG_CONTROL_SPACE;
+
+typedef struct _SYSDBG_IO_SPACE
+{
+    ULONGLONG Address;
+    PVOID Buffer;
+    ULONG Request;
+    INTERFACE_TYPE InterfaceType;
+    ULONG BusNumber;
+    ULONG AddressSpace;
+} SYSDBG_IO_SPACE, *PSYSDBG_IO_SPACE;
+
+typedef struct _SYSDBG_BUS_DATA
+{
+    ULONG Address;
+    PVOID Buffer;
+    ULONG Request;
+    BUS_DATA_TYPE BusDataType;
+    ULONG BusNumber;
+    ULONG SlotNumber;
+} SYSDBG_BUS_DATA, *PSYSDBG_BUS_DATA;
+
+typedef struct _SYSDBG_MSR
+{
+    ULONG Address;
+    ULONGLONG Data;
+} SYSDBG_MSR, *PSYSDBG_MSR;
+
+typedef struct _SYSDBG_TRIAGE_DUMP
+{
+    ULONG Flags;
+    ULONG BugCheckCode;
+    ULONG_PTR BugCheckParam1;
+    ULONG_PTR BugCheckParam2;
+    ULONG_PTR BugCheckParam3;
+    ULONG_PTR BugCheckParam4;
+    ULONG ProcessHandles;
+    ULONG ThreadHandles;
+    PHANDLE Handles;
+} SYSDBG_TRIAGE_DUMP, *PSYSDBG_TRIAGE_DUMP;
+
 #endif // _KDTYPES_H
Index: include/ndk/obtypes.h
===================================================================
--- include/ndk/obtypes.h	(revision 21808)
+++ include/ndk/obtypes.h	(working copy)
@@ -1,4 +1,4 @@
-/*++ NDK Version: 0095
+/*++ NDK Version: 0098
 
 Copyright (c) Alex Ionescu.  All rights reserved.
 
@@ -12,7 +12,7 @@
 
 Author:
 
-    Alex Ionescu (alex.ionescu@reactos.com)   06-Oct-2004
+    Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
 
 --*/
 
@@ -49,6 +49,11 @@
 }
 
 //
+// Number of custom-defined bits that can be attached to a handle
+//
+#define OBJ_HANDLE_TAGBITS                      0x3
+
+//
 // Directory Object Access Rights
 //
 #define DIRECTORY_QUERY                         0x0001
@@ -132,7 +137,6 @@
 } OB_DUMP_CONTROL, *POB_DUMP_CONTROL;
 
 #ifndef NTOS_MODE_USER
-#ifndef _REACTOS_
 
 //
 // Object Type Callbacks
@@ -209,87 +213,6 @@
 #else
 
 //
-// FIXME: ReactOS ONLY Object Callbacks
-//
-typedef NTSTATUS
-(NTAPI *OB_OPEN_METHOD)(
-    OB_OPEN_REASON Reason,
-    PVOID ObjectBody,
-    PEPROCESS Process,
-    ULONG HandleCount,
-    ACCESS_MASK GrantedAccess
-);
-
-typedef NTSTATUS
-(NTAPI *OB_PARSE_METHOD)(
-    PVOID Object,
-    PVOID *NextObject,
-    PUNICODE_STRING FullPath,
-    PWSTR *Path,
-    ULONG Attributes
-);
-
-typedef VOID
-(NTAPI *OB_DELETE_METHOD)(
-    PVOID DeletedObject
-);
-
-typedef VOID
-(NTAPI *OB_CLOSE_METHOD)(
-    PVOID ClosedObject,
-    ULONG HandleCount
-);
-
-typedef VOID
-(NTAPI *OB_DUMP_METHOD)(
-    VOID
-);
-
-typedef NTSTATUS
-(NTAPI *OB_OKAYTOCLOSE_METHOD)(
-    VOID
-);
-
-typedef NTSTATUS
-(NTAPI *OB_QUERYNAME_METHOD)(
-    PVOID ObjectBody,
-    POBJECT_NAME_INFORMATION ObjectNameInfo,
-    ULONG Length,
-    PULONG ReturnLength
-);
-
-typedef PVOID
-(NTAPI *OB_FIND_METHOD)(
-    PVOID  WinStaObject,
-    PWSTR  Name,
-    ULONG  Attributes
-);
-
-typedef NTSTATUS
-(NTAPI *OB_SECURITY_METHOD)(
-    PVOID Object,
-    SECURITY_OPERATION_CODE OperationType,
-    SECURITY_INFORMATION SecurityInformation,
-    PSECURITY_DESCRIPTOR NewSecurityDescriptor,
-    PULONG ReturnLength,
-    PSECURITY_DESCRIPTOR *OldSecurityDescriptor,
-    POOL_TYPE PoolType,
-    PGENERIC_MAPPING GenericMapping
-);
-
-typedef NTSTATUS
-(NTAPI *OB_CREATE_METHOD)(
-    PVOID ObjectBody,
-    PVOID Parent,
-    PWSTR RemainingPath,
-    struct _OBJECT_ATTRIBUTES* ObjectAttributes
-);
-
-#endif
-
-#else
-
-//
 // Object Information Types for NtQueryInformationObject
 //
 typedef struct _OBJECT_NAME_INFORMATION
@@ -434,9 +357,6 @@
 //
 typedef struct _OBJECT_HEADER
 {
-#ifdef _REACTOS_
-    LIST_ENTRY Entry; // FIXME: REACTOS ONLY
-#endif
     LONG PointerCount;
     union
     {
Index: include/ndk/rtltypes.h
===================================================================
--- include/ndk/rtltypes.h	(revision 21808)
+++ include/ndk/rtltypes.h	(working copy)
@@ -1,4 +1,4 @@
-/*++ NDK Version: 0095
+/*++ NDK Version: 0098
 
 Copyright (c) Alex Ionescu.  All rights reserved.
 
@@ -12,7 +12,7 @@
 
 Author:
 
-    Alex Ionescu (alex.ionescu@reactos.com)   06-Oct-2004
+    Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
 
 --*/
 
@@ -42,6 +42,9 @@
 #define RTL_USER_PROCESS_PARAMETERS_DISABLE_HEAP_CHECKS      0x100
 #define RTL_USER_PROCESS_PARAMETERS_PROCESS_OR_1             0x200
 #define RTL_USER_PROCESS_PARAMETERS_PROCESS_OR_2             0x400
+#define RTL_USER_PROCESS_PARAMETERS_PRIVATE_DLL_PATH         0x1000
+#define RTL_USER_PROCESS_PARAMETERS_LOCAL_DLL_PATH           0x2000
+#define RTL_USER_PROCESS_PARAMETERS_NX                       0x20000
 
 //
 // Exception Flags
@@ -50,6 +53,7 @@
 #define EXCEPTION_UNWINDING                                  0x02
 #define EXCEPTION_EXIT_UNWIND                                0x04
 #define EXCEPTION_STACK_INVALID                              0x08
+#define EXCEPTION_UNWIND                                     (EXCEPTION_UNWINDING + EXCEPTION_EXIT_UNWIND)
 #define EXCEPTION_NESTED_CALL                                0x10
 #define EXCEPTION_TARGET_UNWIND                              0x20
 #define EXCEPTION_COLLIDED_UNWIND                            0x20
@@ -64,6 +68,26 @@
 #define RTL_RANGE_CONFLICT                                   0x02
 
 //
+// Activation Context Frame Flags
+//
+#define RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_FORMAT_WHISTLER \
+                                                            0x1
+
+//
+// Heap Flags
+//
+#define HEAP_CLASS_0                                        0x00000000
+#define HEAP_CLASS_1                                        0x00001000
+#define HEAP_CLASS_2                                        0x00002000
+#define HEAP_CLASS_3                                        0x00003000
+#define HEAP_CLASS_4                                        0x00004000
+#define HEAP_CLASS_5                                        0x00005000
+#define HEAP_CLASS_6                                        0x00006000
+#define HEAP_CLASS_7                                        0x00007000
+#define HEAP_CLASS_8                                        0x00008000
+#define HEAP_CLASS_MASK                                     0x0000F000
+
+//
 // Registry Keys
 //
 #define RTL_REGISTRY_ABSOLUTE                                0
@@ -120,6 +144,12 @@
 #define RTL_CRITSECT_TYPE                                   0
 #define RTL_RESOURCE_TYPE                                   1
 
+//
+// RtlAcquirePrivileges Flags
+//
+#define RTL_ACQUIRE_PRIVILEGE_IMPERSONATE                   1
+#define RTL_ACQUIRE_PRIVILEGE_PROCESS                       2
+
 #ifdef NTOS_MODE_USER
 
 //
@@ -141,6 +171,12 @@
 #define NLS_MB_CODE_PAGE_TAG                                NlsMbCodePageTag
 #define NLS_MB_OEM_CODE_PAGE_TAG                            NlsMbOemCodePageTag
 #define NLS_OEM_LEAD_BYTE_INFO                              NlsOemLeadByteInfo
+#else
+//
+// Message Resource Flag
+//
+#define MESSAGE_RESOURCE_UNICODE                            0x0001
+
 #endif
 #define MAXIMUM_LEADBYTES                                   12
 
@@ -165,6 +201,14 @@
 #define RTL_ATOM_IS_PINNED                                  0x1
 
 //
+// Critical section lock bits
+//
+#define CS_LOCK_BIT                                         0x1
+#define CS_LOCK_BIT_V                                       0x0
+#define CS_LOCK_WAITER_WOKEN                                0x2
+#define CS_LOCK_WAITER_INC                                  0x4
+
+//
 // Codepage Tags
 //
 #ifdef NTOS_MODE_USER
@@ -221,14 +265,14 @@
 //
 typedef enum _RTL_PATH_TYPE
 {
-    INVALID_PATH = 0,
-    UNC_PATH,              // "//foo"
-    ABSOLUTE_DRIVE_PATH,   // "c:/foo"
-    RELATIVE_DRIVE_PATH,   // "c:foo"
-    ABSOLUTE_PATH,         // "/foo"
-    RELATIVE_PATH,         // "foo"
-    DEVICE_PATH,           // "//./foo"
-    UNC_DOT_PATH           // "//."
+    RtlPathTypeUnknown,
+    RtlPathTypeUncAbsolute,
+    RtlPathTypeDriveAbsolute,
+    RtlPathTypeDriveRelative,
+    RtlPathTypeRooted,
+    RtlPathTypeRelative,
+    RtlPathTypeLocalDevice,
+    RtlPathTypeRootLocalDevice,
 } RTL_PATH_TYPE;
 
 #ifndef NTOS_MODE_USER
@@ -263,6 +307,30 @@
     IN OUT PVOID DispatcherContext
 );
 
+//
+// RTL Library Allocation/Free Routines
+//
+typedef PVOID
+(NTAPI *PRTL_ALLOCATE_STRING_ROUTINE)(
+    SIZE_T NumberOfBytes
+);
+
+typedef PVOID
+(NTAPI *PRTL_REALLOCATE_STRING_ROUTINE)(
+    SIZE_T NumberOfBytes,
+    PVOID Buffer
+);
+
+typedef
+VOID
+(NTAPI *PRTL_FREE_STRING_ROUTINE)(
+    PVOID Buffer
+);
+
+extern const PRTL_ALLOCATE_STRING_ROUTINE RtlAllocateStringRoutine;
+extern const PRTL_FREE_STRING_ROUTINE RtlFreeStringRoutine;
+extern const PRTL_REALLOCATE_STRING_ROUTINE RtlReallocateStringRoutine;
+
 #endif
 
 //
@@ -538,7 +606,39 @@
     CSHORT Weekday;
 } TIME_FIELDS, *PTIME_FIELDS;
 
+//
+// Activation Context
+//
+typedef PVOID PACTIVATION_CONTEXT;
+
+//
+// Activation Context Frame
+//
+typedef struct _RTL_ACTIVATION_CONTEXT_STACK_FRAME
+{
+    struct __RTL_ACTIVATION_CONTEXT_STACK_FRAME *Previous;
+    PACTIVATION_CONTEXT ActivationContext;
+    ULONG Flags;
+} RTL_ACTIVATION_CONTEXT_STACK_FRAME,
+  *PRTL_ACTIVATION_CONTEXT_STACK_FRAME;
+
+typedef struct _RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED
+{
+    ULONG Size;
+    ULONG Format;
+    RTL_ACTIVATION_CONTEXT_STACK_FRAME Frame;
+    PVOID Extra1;
+    PVOID Extra2;
+    PVOID Extra3;
+    PVOID Extra4;
+} RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED,
+  *PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED;
+
 #endif
+
+//
+// ACE Structure
+//
 typedef struct _ACE
 {
     ACE_HEADER Header;
@@ -550,42 +650,54 @@
 //
 typedef struct _RTL_PROCESS_MODULE_INFORMATION
 {
-    ULONG Reserved[2];
-    PVOID Base;
-    ULONG Size;
+    ULONG Section;
+    PVOID MappedBase;
+    PVOID ImageBase;
+    ULONG ImageSize;
     ULONG Flags;
-    USHORT Index;
-    USHORT Unknown;
+    USHORT LoadOrderIndex;
+    USHORT InitOrderIndex;
     USHORT LoadCount;
-    USHORT ModuleNameOffset;
-    CHAR ImageName[256];
+    USHORT OffsetToFileName;
+    CHAR FullPathName[256];
 } RTL_PROCESS_MODULE_INFORMATION, *PRTL_PROCESS_MODULE_INFORMATION;
 
 typedef struct _RTL_PROCESS_MODULES
 {
-    ULONG ModuleCount;
-    RTL_PROCESS_MODULE_INFORMATION ModuleEntry[1];
+    ULONG NumberOfModules;
+    RTL_PROCESS_MODULE_INFORMATION Modules[1];
 } RTL_PROCESS_MODULES, *PRTL_PROCESS_MODULES;
 
-typedef struct _RTL_PROCESS_HEAP_INFORMATION
+typedef struct _RTL_PROCESS_MODULE_INFORMATION_EX
 {
-    PVOID Base;
+    ULONG NextOffset;
+    RTL_PROCESS_MODULE_INFORMATION BaseInfo;
+    ULONG ImageCheckSum;
+    ULONG TimeDateStamp;
+    PVOID DefaultBase;
+} RTL_PROCESS_MODULE_INFORMATION_EX, *PRTL_PROCESS_MODULE_INFORMATION_EX;
+
+typedef struct _RTL_HEAP_INFORMATION
+{
+    PVOID BaseAddress;
     ULONG Flags;
-    USHORT Granularity;
-    USHORT Unknown;
-    ULONG Allocated;
-    ULONG Committed;
-    ULONG TagCount;
-    ULONG BlockCount;
-    ULONG Reserved[7];
+    USHORT EntryOverhead;
+    USHORT CreatorBackTraceIndex;
+    ULONG BytesAllocated;
+    ULONG BytesCommitted;
+    ULONG NumberOfTags;
+    ULONG NumberOfEntries;
+    ULONG NumberOfPseudoTags;
+    ULONG PseudoTagGranularity;
+    ULONG Reserved[4];
     PVOID Tags;
-    PVOID Blocks;
-} RTL_PROCESS_HEAP_INFORMATION, *PRTL_PROCESS_HEAP_INFORMATION;
+    PVOID Entries;
+} RTL_HEAP_INFORMATION, *PRTL_HEAP_INFORMATION;
 
 typedef struct _RTL_PROCESS_HEAPS
 {
-    ULONG HeapCount;
-    RTL_PROCESS_HEAP_INFORMATION HeapEntry[1];
+    ULONG NumberOfHeaps;
+    RTL_HEAP_INFORMATION Heaps[1];
 } RTL_PROCESS_HEAPS, *PRTL_PROCESS_HEAPS;
 
 typedef struct _RTL_PROCESS_LOCK_INFORMATION
@@ -604,8 +716,8 @@
 
 typedef struct _RTL_PROCESS_LOCKS
 {
-    ULONG LockCount;
-    RTL_PROCESS_LOCK_INFORMATION LockEntry[1];
+    ULONG NumberOfLocks;
+    RTL_PROCESS_LOCK_INFORMATION Locks[1];
 } RTL_PROCESS_LOCKS, *PRTL_PROCESS_LOCKS;
 
 typedef struct _RTL_PROCESS_BACKTRACE_INFORMATION
@@ -626,27 +738,61 @@
     RTL_PROCESS_BACKTRACE_INFORMATION BackTraces[1];
 } RTL_PROCESS_BACKTRACES, *PRTL_PROCESS_BACKTRACES;
 
-typedef struct _RTL_DEBUG_BUFFER
+typedef struct _RTL_PROCESS_VERIFIER_OPTIONS
 {
-    HANDLE SectionHandle;
-    PVOID SectionBase;
-    PVOID RemoteSectionBase;
-    ULONG SectionBaseDelta;
-    HANDLE EventPairHandle;
-    ULONG Unknown[2];
-    HANDLE RemoteThreadHandle;
-    ULONG InfoClassMask;
-    ULONG SizeOfInfo;
-    ULONG AllocatedSize;
-    ULONG SectionSize;
-    PRTL_PROCESS_MODULES ModuleInformation;
-    PRTL_PROCESS_BACKTRACES BackTraceInformation;
-    PRTL_PROCESS_HEAPS HeapInformation;
-    PRTL_PROCESS_LOCKS LockInformation;
-    PVOID Reserved[8];
-} RTL_DEBUG_BUFFER, *PRTL_DEBUG_BUFFER;
+    ULONG SizeStruct;
+    ULONG Option;
+    UCHAR OptionData[1];
+    //
+    // Option array continues below
+    //
+} RTL_PROCESS_VERIFIER_OPTIONS, *PRTL_PROCESS_VERIFIER_OPTIONS;
 
+typedef struct _RTL_DEBUG_INFORMATION
+{
+    HANDLE SectionHandleClient;
+    PVOID ViewBaseClient;
+    PVOID ViewBaseTarget;
+    ULONG ViewBaseDelta;
+    HANDLE EventPairClient;
+    PVOID EventPairTarget;
+    HANDLE TargetProcessId;
+    HANDLE TargetThreadHandle;
+    ULONG Flags;
+    ULONG OffsetFree;
+    ULONG CommitSize;
+    ULONG ViewSize;
+    union
+    {
+        PRTL_PROCESS_MODULES Modules;
+        PRTL_PROCESS_MODULE_INFORMATION_EX ModulesEx;
+    };
+    PRTL_PROCESS_BACKTRACES BackTraces;
+    PRTL_PROCESS_HEAPS Heaps;
+    PRTL_PROCESS_LOCKS Locks;
+    HANDLE SpecificHeap;
+    HANDLE TargetProcessHandle;
+    RTL_PROCESS_VERIFIER_OPTIONS VerifierOptions;
+    HANDLE ProcessHeap;
+    HANDLE CriticalSectionHandle;
+    HANDLE CriticalSectionOwnerThread;
+    PVOID Reserved[4];
+} RTL_DEBUG_INFORMATION, *PRTL_DEBUG_INFORMATION;
+
 //
+// Unload Event Trace Structure for RtlGetUnloadEventTrace
+//
+typedef struct _RTL_UNLOAD_EVENT_TRACE
+{
+    PVOID BaseAddress;
+    ULONG SizeOfImage;
+    ULONG Sequence;
+    ULONG TimeDateStamp;
+    ULONG CheckSum;
+    WCHAR ImageName[32];
+} RTL_UNLOAD_EVENT_TRACE, *PRTL_UNLOAD_EVENT_TRACE;
+
+//
 // RTL Handle Structures
 //
 typedef struct _RTL_HANDLE_TABLE_ENTRY
@@ -692,6 +838,19 @@
     UNICODE_STRING DosPath;
 } RTL_DRIVE_LETTER_CURDIR, *PRTL_DRIVE_LETTER_CURDIR;
 
+//
+// Private State structure for RtlAcquirePrivilege/RtlReleasePrivilege
+//
+typedef struct _RTL_ACQUIRE_STATE
+{
+    HANDLE Token;
+    HANDLE OldImpersonationToken;
+    PTOKEN_PRIVILEGES OldPrivileges;
+    PTOKEN_PRIVILEGES NewPrivileges;
+    ULONG Flags;
+    UCHAR OldPrivBuffer[1024];
+} RTL_ACQUIRE_STATE, *PRTL_ACQUIRE_STATE;
+
 #ifndef NTOS_MODE_USER
 
 //
@@ -718,7 +877,7 @@
     ULONG_PTR SpinCount;
 } RTL_CRITICAL_SECTION, *PRTL_CRITICAL_SECTION;
 
-#else
+#endif
 
 //
 // RTL Range List Structures
@@ -749,8 +908,6 @@
     ULONG Stamp;
 } RTL_RANGE_LIST_ITERATOR, *PRTL_RANGE_LIST_ITERATOR;
 
-#endif
-
 //
 // RTL Resource
 //
@@ -902,6 +1059,24 @@
 #endif
 
 //
+// Hotpatch Header
+//
+typedef struct _RTL_PATCH_HEADER
+{
+    LIST_ENTRY PatchList;
+    PVOID PatchImageBase;
+    struct _RTL_PATCH_HEADER *NextPath;
+    ULONG PatchFlags;
+    LONG PatchRefCount;
+    struct _HOTPATCH_HEADER *HotpatchHeader;
+    UNICODE_STRING TargetDllName;
+    PVOID TargetDllBase;
+    PLDR_DATA_TABLE_ENTRY TargetLdrDataTableEntry;
+    PLDR_DATA_TABLE_ENTRY PatchLdrDataTableEntry;
+    struct _SYSTEM_HOTPATCH_CODE_INFORMATION *CodeInfo;
+} RTL_PATCH_HEADER, *PRTL_PATCH_HEADER;
+
+//
 // Header for NLS Files
 //
 typedef struct _NLS_FILE_HEADER
@@ -917,4 +1092,47 @@
     UCHAR LeadByte[MAXIMUM_LEADBYTES];
 } NLS_FILE_HEADER, *PNLS_FILE_HEADER;
 
+//
+// Stack Traces
+//
+typedef struct _RTL_STACK_TRACE_ENTRY
+{
+    struct _RTL_STACK_TRACE_ENTRY *HashChain;
+    ULONG TraceCount;
+    USHORT Index;
+    USHORT Depth;
+    PVOID BackTrace[32];
+} RTL_STACK_TRACE_ENTRY, *PRTL_STACK_TRACE_ENTRY;
+
+typedef struct _STACK_TRACE_DATABASE
+{
+    RTL_CRITICAL_SECTION CriticalSection;
+} STACK_TRACE_DATABASE, *PSTACK_TRACE_DATABASE;
+
+#ifndef NTOS_MODE_USER
+
+//
+// Message Resource Entry, Block and Data
+//
+typedef struct _MESSAGE_RESOURCE_ENTRY
+{
+    USHORT Length;
+    USHORT Flags;
+    UCHAR Text[ANYSIZE_ARRAY];
+} MESSAGE_RESOURCE_ENTRY, *PMESSAGE_RESOURCE_ENTRY;
+
+typedef struct _MESSAGE_RESOURCE_BLOCK
+{
+    ULONG LowId;
+    ULONG HighId;
+    ULONG OffsetToEntries;
+} MESSAGE_RESOURCE_BLOCK, *PMESSAGE_RESOURCE_BLOCK;
+
+typedef struct _MESSAGE_RESOURCE_DATA
+{
+    ULONG NumberOfBlocks;
+    MESSAGE_RESOURCE_BLOCK Blocks[ANYSIZE_ARRAY];
+} MESSAGE_RESOURCE_DATA, *PMESSAGE_RESOURCE_DATA;
+
 #endif
+#endif
Index: include/ndk/inbvfuncs.h
===================================================================
--- include/ndk/inbvfuncs.h	(revision 21808)
+++ include/ndk/inbvfuncs.h	(working copy)
@@ -1,4 +1,4 @@
-/*++ NDK Version: 0095
+/*++ NDK Version: 0098
 
 Copyright (c) Alex Ionescu.  All rights reserved.
 
@@ -12,7 +12,7 @@
 
 Author:
 
-    Alex Ionescu (alex.ionescu@reactos.com)   06-Oct-2004
+    Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
 
 --*/
 
@@ -54,7 +54,7 @@
 VOID
 NTAPI
 InbvInstallDisplayStringFilter(
-    IN PVOID Unknown
+    IN PVOID DisplayFilter
 );
 
 BOOLEAN
Index: include/ndk/cmfuncs.h
===================================================================
--- include/ndk/cmfuncs.h	(revision 21808)
+++ include/ndk/cmfuncs.h	(working copy)
@@ -1,4 +1,4 @@
-/*++ NDK Version: 0095
+/*++ NDK Version: 0098
 
 Copyright (c) Alex Ionescu.  All rights reserved.
 
@@ -12,7 +12,7 @@
 
 Author:
 
-    Alex Ionescu (alex.ionescu@reactos.com)   06-Oct-2004
+    Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
 
 --*/
 
Index: include/ndk/kefuncs.h
===================================================================
--- include/ndk/kefuncs.h	(revision 21808)
+++ include/ndk/kefuncs.h	(working copy)
@@ -1,4 +1,4 @@
-/*++ NDK Version: 0095
+/*++ NDK Version: 0098
 
 Copyright (c) Alex Ionescu.  All rights reserved.
 
@@ -12,7 +12,7 @@
 
 Author:
 
-    Alex Ionescu (alex.ionescu@reactos.com)   06-Oct-2004
+    Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
 
 --*/
 
@@ -111,6 +111,20 @@
     PKSPIN_LOCK SpinLock
 );
 
+KIRQL
+FASTCALL
+KeAcquireQueuedSpinLockRaiseToSynch(
+    IN KSPIN_LOCK_QUEUE_NUMBER LockNumber
+);
+
+KIRQL
+FASTCALL
+KeAcquireInStackQueuedSpinLockRaiseToSynch(
+    IN PKSPIN_LOCK SpinLock,
+    IN PKLOCK_QUEUE_HANDLE LockHandle
+);
+
+
 //
 // Interrupt Functions
 //
@@ -172,9 +186,17 @@
     VOID
 );
 
+BOOLEAN
+NTAPI
+KiIpiServiceRoutine(
+    IN PKTRAP_FRAME TrapFrame,
+    IN PVOID ExceptionFrame
+);
+
 //
-// ARC Configuration Functions
+// ARC Configuration Functions. Only enabled if you have ARC Support
 //
+#ifdef _ARC_
 PCONFIGURATION_COMPONENT_DATA
 NTAPI
 KeFindConfigurationNextEntry(
@@ -193,6 +215,7 @@
     IN CONFIGURATION_TYPE Type,
     IN PULONG ComponentKey OPTIONAL
 );
+#endif
 
 //
 // Low-level Hardware/CPU Control Functions
@@ -200,12 +223,26 @@
 VOID
 NTAPI
 KeFlushEntireTb(
-    IN BOOLEAN Unknown,
-    IN BOOLEAN CurrentCpuOnly
+    IN BOOLEAN Invalid,
+    IN BOOLEAN AllProcessors
 );
 
 VOID
 NTAPI
+KeUpdateSystemTime(
+    PKTRAP_FRAME TrapFrame,
+    KIRQL Irql
+);
+
+VOID
+NTAPI
+KeUpdateRunTime(
+    PKTRAP_FRAME TrapFrame,
+    KIRQL Irql
+);
+
+VOID
+NTAPI
 KeSetDmaIoCoherency(
     IN ULONG Coherency
 );
@@ -230,6 +267,13 @@
     IN ULONG MinIncrement
 );
 
+NTSTATUS
+NTAPI
+Ke386CallBios(
+    IN ULONG BiosCommand,
+    IN OUT PCONTEXT BiosArguments
+);
+
 //
 // Misc. Functions
 //
@@ -449,8 +493,8 @@
     IN ULONG RoutineIndex,
     IN PVOID Argument,
     IN ULONG ArgumentLength,
-    OUT PVOID* Result,
-    OUT PULONG ResultLength
+    OUT PVOID* Result OPTIONAL,
+    OUT PULONG ResultLength OPTIONAL
 );
 
 NTSYSCALLAPI
Index: include/ndk/extypes.h
===================================================================
--- include/ndk/extypes.h	(revision 21808)
+++ include/ndk/extypes.h	(working copy)
@@ -1,4 +1,4 @@
-/*++ NDK Version: 0095
+/*++ NDK Version: 0098
 
 Copyright (c) Alex Ionescu.  All rights reserved.
 
@@ -12,7 +12,7 @@
 
 Author:
 
-    Alex Ionescu (alex.ionescu@reactos.com)   06-Oct-2004
+    Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
 
 --*/
 
@@ -196,9 +196,9 @@
     SystemUnloadGdiDriverInformation,
     SystemTimeAdjustmentInformation,
     SystemSummaryMemoryInformation,
-    SystemNextEventIdInformation,
-    SystemEventIdsInformation,
-    SystemCrashDumpInformation,
+    SystemMirrorMemoryInformation,
+    SystemPerformanceTraceInformation,
+    SystemObsolete0,
     SystemExceptionInformation,
     SystemCrashDumpStateInformation,
     SystemKernelDebuggerInformation,
@@ -220,7 +220,51 @@
     SystemVerifierInformation,
     SystemAddVerifier,
     SystemSessionProcessesInformation,
-    SystemInformationClassMax
+    SystemLoadGdiDriverInSystemSpaceInformation,
+    SystemNumaProcessorMap,
+    SystemPrefetcherInformation,
+    SystemExtendedProcessInformation,
+    SystemRecommendedSharedDataAlignment,
+    SystemComPlusPackage,
+    SystemNumaAvailableMemory,
+    SystemProcessorPowerInformation,
+    SystemEmulationBasicInformation,
+    SystemEmulationProcessorInformation,
+    SystemExtendedHanfleInformation,
+    SystemLostDelayedWriteInformation,
+    SystemBigPoolInformation,
+    SystemSessionPoolTagInformation,
+    SystemSessionMappedViewInformation,
+    SystemHotpatchInformation,
+    SystemObjectSecurityMode,
+    SystemWatchDogTimerHandler,
+    SystemWatchDogTimerInformation,
+    SystemLogicalProcessorInformation,
+    SystemWo64SharedInformationObosolete,
+    SystemRegisterFirmwareTableInformationHandler,
+    SystemFirmwareTableInformation,
+    SystemModuleInformationEx,
+    SystemVerifierTriageInformation,
+    SystemSuperfetchInformation,
+    SystemMemoryListInformation,
+    SystemFileCacheInformationEx,
+    SystemThreadPriorityClientIdInformation,
+    SystemProcessorIdleCycleTimeInformation,
+    SystemVerifierCancellationInformation,
+    SystemProcessorPowerInformationEx,
+    SystemRefTraceInformation,
+    SystemSpecialPoolInformation,
+    SystemProcessIdInformation,
+    SystemErrorPortInformation,
+    SystemBootEnvironmentInformation,
+    SystemHypervisorInformation,
+    SystemVerifierInformationEx,
+    SystemTimeZoneInformation,
+    SystemImageFileExecutionOptionsInformation,
+    SystemCoverageInformation,
+    SystemPrefetchPathInformation,
+    SystemVerifierFaultsInformation,
+    MaxSystemInfoClass,
 } SYSTEM_INFORMATION_CLASS;
 
 //
@@ -228,7 +272,8 @@
 //
 typedef enum _MUTANT_INFORMATION_CLASS
 {
-    MutantBasicInformation
+    MutantBasicInformation,
+    MutantOwnerInformation
 } MUTANT_INFORMATION_CLASS;
 
 //
@@ -264,9 +309,30 @@
     EventBasicInformation
 } EVENT_INFORMATION_CLASS;
 
-#ifndef NTOS_MODE_USER
+#ifdef NTOS_MODE_USER
 
 //
+// Firmware Table Actions for SystemFirmwareTableInformation
+//
+typedef enum _SYSTEM_FIRMWARE_TABLE_ACTION
+{
+    SystemFirmwareTable_Enumerate = 0,
+    SystemFirmwareTable_Get = 1,
+} SYSTEM_FIRMWARE_TABLE_ACTION, *PSYSTEM_FIRMWARE_TABLE_ACTION;
+
+//
+// Firmware Handler Callback
+//
+struct _SYSTEM_FIRMWARE_TABLE_INFORMATION;
+typedef
+NTSTATUS
+(__cdecl *PFNFTH)(
+    IN struct _SYSTEM_FIRMWARE_TABLE_INFORMATION *FirmwareTableInformation
+);
+
+#else
+
+//
 // Executive Work Queue Structures
 //
 typedef struct _EX_QUEUE_WORKER_INFO
@@ -305,12 +371,10 @@
 //
 typedef struct _EX_RUNDOWN_REF_CACHE_AWARE
 {
-    union
-    {
-        ULONG_PTR Count;
-        PVOID Ptr;
-    };
+    PEX_RUNDOWN_REF RunRefs;
     PVOID PoolToFree;
+    ULONG RunRefSize;
+    ULONG Number;
 } EX_RUNDOWN_REF_CACHE_AWARE, *PEX_RUNDOWN_REF_CACHE_AWARE;
 
 //
@@ -319,7 +383,7 @@
 typedef struct _EX_RUNDOWN_WAIT_BLOCK
 {
     ULONG_PTR Count;
-    KEVENT RundownEvent;
+    KEVENT WakeEvent;
 } EX_RUNDOWN_WAIT_BLOCK, *PEX_RUNDOWN_WAIT_BLOCK;
 
 //
@@ -382,18 +446,18 @@
 } CALLBACK_OBJECT , *PCALLBACK_OBJECT;
 
 //
-// Profile OBject
+// Profile Object
 //
 typedef struct _EPROFILE
 {
     PEPROCESS Process;
-    PVOID ImageBase;
-    SIZE_T ImageSize;
+    PVOID RangeBase;
+    SIZE_T RangeSize;
     PVOID Buffer;
     ULONG BufferSize;
     ULONG BucketSize;
-    PKPROFILE KeProfile;
-    PVOID LockedBuffer;
+    PKPROFILE ProfileObject;
+    PVOID LockedBufferAddress;
     PMDL Mdl;
     ULONG Segment;
     KPROFILE_SOURCE ProfileSource;
@@ -403,6 +467,24 @@
 //
 // Handle Table Structures
 //
+typedef struct _HANDLE_TRACE_DB_ENTRY
+{
+    CLIENT_ID ClientId;
+    HANDLE Handle;
+    ULONG Type;
+    PVOID StackTrace[16];
+} HANDLE_TRACE_DB_ENTRY, *PHANDLE_TRACE_DB_ENTRY;
+
+typedef struct _HANDLE_TRACE_DEBUG_INFO
+{
+    LONG RefCount;
+    ULONG TableSize;
+    ULONG BitMaskFlags;
+    FAST_MUTEX CloseCompatcionLock;
+    ULONG CurrentStackIndex;
+    HANDLE_TRACE_DB_ENTRY TraceDb[1];
+} HANDLE_TRACE_DEBUG_INFO, *PHANDLE_TRACE_DEBUG_INFO;
+
 typedef struct _HANDLE_TABLE_ENTRY_INFO
 {
     ULONG AuditMask;
@@ -416,17 +498,52 @@
         ULONG_PTR ObAttributes;
         PHANDLE_TABLE_ENTRY_INFO InfoTable;
         ULONG_PTR Value;
-    } u1;
+    };
     union
     {
         ULONG GrantedAccess;
-        USHORT GrantedAccessIndex;
+        struct
+        {
+            USHORT GrantedAccessIndex;
+            USHORT CreatorBackTraceIndex;
+        };
         LONG NextFreeTableEntry;
-    } u2;
+    };
 } HANDLE_TABLE_ENTRY, *PHANDLE_TABLE_ENTRY;
 
 typedef struct _HANDLE_TABLE
 {
+#if 0
+    ULONG TableCode;
+    PEPROCESS QuotaProcess;
+    PVOID UniqueProcessId;
+    EX_PUSH_LOCK HandleLock;
+    LIST_ENTRY HandleTableList;
+    EX_PUSH_LOCK HandleContentionEvent;
+    PHANDLE_TRACE_DEBUG_INFO DebugInfo;
+    LONG ExtraInfoPages;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    union
+    {
+        ULONG Flags;
+        UCHAR StrictFIFO:1;
+    };
+    LONG FirstFreeHandle;
+    PHANDLE_TABLE_ENTRY LastFreeHandleEntry;
+    LONG HandleCount;
+    ULONG NextHandleNeedingPool;
+#else
+    ULONG FirstFree;
+    ULONG LastFree;
+    ULONG NextHandleNeedingPool;
+    LONG HandleCount;
+    union
+    {
+        ULONG Flags;
+        UCHAR StrictFIFO:1;
+    };
+#endif
+#else
     ULONG Flags;
     LONG HandleCount;
     PHANDLE_TABLE_ENTRY **Table;
@@ -437,6 +554,7 @@
     ERESOURCE HandleTableLock;
     LIST_ENTRY HandleTableList;
     KEVENT HandleContentionEvent;
+#endif
 } HANDLE_TABLE, *PHANDLE_TABLE;
 
 #endif
@@ -466,6 +584,11 @@
     BOOLEAN AbandonedState;
 } MUTANT_BASIC_INFORMATION, *PMUTANT_BASIC_INFORMATION;
 
+typedef struct _MUTANT_OWNER_INFORMATION
+{
+    CLIENT_ID ClientId;
+} MUTANT_OWNER_INFORMATION, *PMUTANT_OWNER_INFORMATION;
+
 //
 // Information Structures for NtQueryAtom
 //
@@ -662,7 +785,7 @@
     HANDLE InheritedFromUniqueProcessId;
     ULONG HandleCount;
     ULONG SessionId;
-    ULONG PageDirectoryFrame;
+    ULONG UniqueProcessKey;
 
     //
     // This part corresponds to VM_COUNTERS_EX.
@@ -679,7 +802,7 @@
     ULONG QuotaNonPagedPoolUsage;
     ULONG PagefileUsage;
     ULONG PeakPagefileUsage;
-    ULONG PrivateUsage;
+    ULONG PrivatePageCount;
 
     //
     // This part corresponds to IO_COUNTERS
@@ -691,7 +814,7 @@
     LARGE_INTEGER WriteTransferCount;
     LARGE_INTEGER OtherTransferCount;
 
-    SYSTEM_THREAD_INFORMATION TH[1];
+    //SYSTEM_THREAD_INFORMATION TH[1];
 } SYSTEM_PROCESS_INFORMATION, *PSYSTEM_PROCESS_INFORMATION;
 
 // Class 6
@@ -737,58 +860,12 @@
     LARGE_INTEGER TimeOfCalls[1];
 } SYSTEM_CALL_TIME_INFORMATION, *PSYSTEM_CALL_TIME_INFORMATION;
 
-// Class 11
-typedef struct _SYSTEM_MODULE_INFORMATION_ENTRY
-{
-    ULONG  Unknown1;
-    ULONG  Unknown2;
-    PVOID  Base;
-    ULONG  Size;
-    ULONG  Flags;
-    USHORT  Index;
-    USHORT  NameLength;
-    USHORT  LoadCount;
-    USHORT  PathLength;
-    CHAR  ImageName[256];
-} SYSTEM_MODULE_INFORMATION_ENTRY, *PSYSTEM_MODULE_INFORMATION_ENTRY;
-typedef struct _SYSTEM_MODULE_INFORMATION
-{
-    ULONG Count;
-    SYSTEM_MODULE_INFORMATION_ENTRY Module[1];
-} SYSTEM_MODULE_INFORMATION, *PSYSTEM_MODULE_INFORMATION;
+// Class 11 - See RTL_PROCESS_MODULES
 
-// Class 12
-typedef struct _SYSTEM_RESOURCE_LOCK_ENTRY
-{
-    ULONG  ResourceAddress;
-    ULONG  Always1;
-    ULONG  Unknown;
-    ULONG  ActiveCount;
-    ULONG  ContentionCount;
-    ULONG  Unused[2];
-    ULONG  NumberOfSharedWaiters;
-    ULONG  NumberOfExclusiveWaiters;
-} SYSTEM_RESOURCE_LOCK_ENTRY, *PSYSTEM_RESOURCE_LOCK_ENTRY;
+// Class 12 - See RTL_PROCESS_LOCKS
 
-typedef struct _SYSTEM_RESOURCE_LOCK_INFO
-{
-    ULONG Count;
-    SYSTEM_RESOURCE_LOCK_ENTRY Lock[1];
-} SYSTEM_RESOURCE_LOCK_INFO, *PSYSTEM_RESOURCE_LOCK_INFO;
+// Class 13 - See RTL_PROCESS_BACKTRACES
 
-// FIXME: Class 13
-typedef struct _SYSTEM_BACKTRACE_INFORMATION_ENTRY
-{
-    ULONG Dummy;
-} SYSTEM_BACKTRACE_INFORMATION_ENTRY, *PSYSTEM_BACKTRACE_INFORMATION_ENTRY;
-
-typedef struct _SYSTEM_BACKTRACE_INFORMATION
-{
-    ULONG Unknown[4];
-    ULONG Count;
-    SYSTEM_BACKTRACE_INFORMATION_ENTRY Trace[1];
-} SYSTEM_BACKTRACE_INFORMATION, *PSYSTEM_BACKTRACE_INFORMATION;
-
 // Class 14 - 15
 typedef struct _SYSTEM_POOL_ENTRY
 {
@@ -914,14 +991,10 @@
     ULONG BopCount;
 } SYSTEM_VDM_INSTEMUL_INFO, *PSYSTEM_VDM_INSTEMUL_INFO;
 
-// FIXME: Class 20
-typedef struct _SYSTEM_VDM_BOP_INFO
-{
-    PVOID Dummy;
-} SYSTEM_VDM_BOP_INFO, *PSYSTEM_VDM_BOP_INFO;
+// Class 20 - ULONG VDMBOPINFO
 
 // Class 21
-typedef struct _SYSTEM_CACHE_INFORMATION
+typedef struct _SYSTEM_FILECACHE_INFORMATION
 {
     ULONG CurrentSize;
     ULONG PeakSize;
@@ -930,8 +1003,9 @@
     ULONG MaximumWorkingSet;
     ULONG CurrentSizeIncludingTransitionInPages;
     ULONG PeakSizeIncludingTransitionInPages;
-    ULONG Unused[2];
-} SYSTEM_CACHE_INFORMATION, *PSYSTEM_CACHE_INFORMATION;
+    ULONG TransitionRePurposeCount;
+    ULONG Flags;
+} SYSTEM_FILECACHE_INFORMATION, *PSYSTEM_FILECACHE_INFORMATION;
 
 // Class 22
 typedef struct _SYSTEM_POOLTAG
@@ -984,6 +1058,7 @@
     USHORT ModifiedCount;
     USHORT PageTableCount;
 } SYSTEM_MEMORY_INFO, *PSYSTEM_MEMORY_INFO;
+
 typedef struct _SYSTEM_MEMORY_INFORMATION
 {
     ULONG InfoSize;
@@ -999,6 +1074,7 @@
     PVOID SectionPointer;
     PVOID EntryPoint;
     PIMAGE_EXPORT_DIRECTORY ExportSectionPointer;
+    ULONG ImageLength;
 } SYSTEM_GDI_DRIVER_INFORMATION, *PSYSTEM_GDI_DRIVER_INFORMATION;
 
 // Class 27
@@ -1020,14 +1096,19 @@
 
 // Class 29 - Same as 25
 
-// FIXME: Class 30 - 31
+// FIXME: Class 30
 
-// Class 32
-typedef struct _SYSTEM_CRASH_DUMP_INFORMATION
+// Class 31
+typedef struct _SYSTEM_REF_TRACE_INFORMATION
 {
-    HANDLE CrashDumpSection;
-} SYSTEM_CRASH_DUMP_INFORMATION, *PSYSTEM_CRASH_DUMP_INFORMATION;
+   UCHAR TraceEnable;
+   UCHAR TracePermanent;
+   UNICODE_STRING TraceProcessName;
+   UNICODE_STRING TracePoolTags;
+} SYSTEM_REF_TRACE_INFORMATION, *PSYSTEM_REF_TRACE_INFORMATION;
 
+// Class 32 - OBSOLETE
+
 // Class 33
 typedef struct _SYSTEM_EXCEPTION_INFORMATION
 {
@@ -1151,16 +1232,135 @@
 // Class 50
 // Not a structure. Only a ULONG_PTR for the SystemRangeStart
 
-// FIXME: Class 51 (Based on MM_DRIVER_VERIFIER_DATA)
+// Class 51
+typedef struct _SYSTEM_VERIFIER_INFORMATION
+{
+   ULONG NextEntryOffset;
+   ULONG Level;
+   UNICODE_STRING DriverName;
+   ULONG RaiseIrqls;
+   ULONG AcquireSpinLocks;
+   ULONG SynchronizeExecutions;
+   ULONG AllocationsAttempted;
+   ULONG AllocationsSucceeded;
+   ULONG AllocationsSucceededSpecialPool;
+   ULONG AllocationsWithNoTag;
+   ULONG TrimRequests;
+   ULONG Trims;
+   ULONG AllocationsFailed;
+   ULONG AllocationsFailedDeliberately;
+   ULONG Loads;
+   ULONG Unloads;
+   ULONG UnTrackedPool;
+   ULONG CurrentPagedPoolAllocations;
+   ULONG CurrentNonPagedPoolAllocations;
+   ULONG PeakPagedPoolAllocations;
+   ULONG PeakNonPagedPoolAllocations;
+   ULONG PagedPoolUsageInBytes;
+   ULONG NonPagedPoolUsageInBytes;
+   ULONG PeakPagedPoolUsageInBytes;
+   ULONG PeakNonPagedPoolUsageInBytes;
+} SYSTEM_VERIFIER_INFORMATION, *PSYSTEM_VERIFIER_INFORMATION;
 
 // FIXME: Class 52
 
 // Class 53 
-typedef struct _SYSTEM_SESSION_PROCESSES_INFORMATION
+typedef struct _SYSTEM_SESSION_PROCESS_INFORMATION
 {
     ULONG SessionId;
-    ULONG BufferSize;
+    ULONG SizeOfBuf;
     PVOID Buffer; // Same format as in SystemProcessInformation
-} SYSTEM_SESSION_PROCESSES_INFORMATION, *PSYSTEM_SESSION_PROCESSES_INFORMATION;
+} SYSTEM_SESSION_PROCESS_INFORMATION, *PSYSTEM_SESSION_PROCESS_INFORMATION;
 
+// FIXME: Class 54-97
+
+//
+// Hotpatch flags
+//
+#define RTL_HOTPATCH_SUPPORTED_FLAG         0x01
+#define RTL_HOTPATCH_SWAP_OBJECT_NAMES      0x08 << 24
+#define RTL_HOTPATCH_SYNC_RENAME_FILES      0x10 << 24
+#define RTL_HOTPATCH_PATCH_USER_MODE        0x20 << 24
+#define RTL_HOTPATCH_REMAP_SYSTEM_DLL       0x40 << 24
+#define RTL_HOTPATCH_PATCH_KERNEL_MODE      0x80 << 24
+
+
+// Class 69
+typedef struct _SYSTEM_HOTPATCH_CODE_INFORMATION
+{
+    ULONG Flags;
+    ULONG InfoSize;
+    union
+    {
+        struct
+        {
+            ULONG Foo;
+        } CodeInfo;
+        struct
+        {
+            USHORT NameOffset;
+            USHORT NameLength;
+        } KernelInfo;
+        struct
+        {
+            USHORT NameOffset;
+            USHORT NameLength;
+            USHORT TargetNameOffset;
+            USHORT TargetNameLength;
+            UCHAR PatchingFinished;
+        } UserModeInfo;
+        struct
+        {
+            USHORT NameOffset;
+            USHORT NameLength;
+            USHORT TargetNameOffset;
+            USHORT TargetNameLength;
+            UCHAR PatchingFinished;
+            NTSTATUS ReturnCode;
+            HANDLE TargetProcess;
+        } InjectionInfo;
+        struct
+        {
+            HANDLE FileHandle1;
+            PIO_STATUS_BLOCK IoStatusBlock1;
+            PVOID RenameInformation1;
+            PVOID RenameInformationLength1;
+            HANDLE FileHandle2;
+            PIO_STATUS_BLOCK IoStatusBlock2;
+            PVOID RenameInformation2;
+            PVOID RenameInformationLength2;
+        } RenameInfo;
+        struct
+        {
+            HANDLE ParentDirectory;
+            HANDLE ObjectHandle1;
+            HANDLE ObjectHandle2;
+        } AtomicSwap;
+    };
+} SYSTEM_HOTPATCH_CODE_INFORMATION, *PSYSTEM_HOTPATCH_CODE_INFORMATION;
+
+//
+// Class 75
+//
+#ifdef NTOS_MODE_USER
+typedef struct _SYSTEM_FIRMWARE_TABLE_HANDLER
+{
+    ULONG ProviderSignature;
+    BOOLEAN Register;
+    PFNFTH FirmwareTableHandler;
+    PVOID DriverObject;
+} SYSTEM_FIRMWARE_TABLE_HANDLER, *PSYSTEM_FIRMWARE_TABLE_HANDLER;
+
+//
+// Class 76
+//
+typedef struct _SYSTEM_FIRMWARE_TABLE_INFORMATION
+{
+    ULONG ProviderSignature;
+    SYSTEM_FIRMWARE_TABLE_ACTION Action;
+    ULONG TableID;
+    ULONG TableBufferLength;
+    UCHAR TableBuffer[1];
+} SYSTEM_FIRMWARE_TABLE_INFORMATION, *PSYSTEM_FIRMWARE_TABLE_INFORMATION;
 #endif
+#endif
Index: include/ndk/halfuncs.h
===================================================================
--- include/ndk/halfuncs.h	(revision 21808)
+++ include/ndk/halfuncs.h	(working copy)
@@ -1,4 +1,4 @@
-/*++ NDK Version: 0095
+/*++ NDK Version: 0098
 
 Copyright (c) Alex Ionescu.  All rights reserved.
 
@@ -12,7 +12,7 @@
 
 Author:
 
-    Alex Ionescu (alex.ionescu@reactos.com)   06-Oct-2004
+    Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
 
 --*/
 
@@ -30,14 +30,6 @@
 //
 // The DDK steals these away from you.
 //
-VOID
-_enable(
-    VOID
-);
-VOID
-_disable(
-    VOID
-);
 #ifdef _MSC_VER
 #pragma intrinsic(_enable)
 #pragma intrinsic(_disable)
@@ -47,33 +39,12 @@
 // Display Functions
 //
 NTHALAPI
-BOOLEAN
-NTAPI
-HalQueryDisplayOwnership(
-    VOID
-);
-
-NTHALAPI
 VOID
 NTAPI
 HalDisplayString(
     IN PCHAR String
 );
 
-NTHALAPI
-BOOLEAN
-NTAPI
-HalQueryDisplayOwnership(
-    VOID
-);
-
-NTHALAPI
-VOID
-NTAPI
-HalReleaseDisplayOwnership(
-    VOID
-);
-
 //
 // Initialization Functions
 //
@@ -84,12 +55,13 @@
     VOID
 );
 
+#ifdef _ARC_
 NTHALAPI
 VOID
 NTAPI
 HalInitializeProcessor(
     ULONG ProcessorNumber,
-    PLOADER_PARAMETER_BLOCK LoaderBlock
+    struct _LOADER_PARAMETER_BLOCK *LoaderBlock
 );
 
 NTHALAPI
@@ -97,8 +69,9 @@
 NTAPI
 HalInitSystem(
     ULONG BootPhase,
-    PLOADER_PARAMETER_BLOCK LoaderBlock
+    struct _LOADER_PARAMETER_BLOCK *LoaderBlock
 );
+#endif
 
 NTHALAPI
 VOID
@@ -179,7 +152,7 @@
 VOID
 NTAPI
 HalRequestIpi(
-    ULONG Unknown
+    KAFFINITY TargetSet
 );
 
 NTHALAPI
@@ -192,6 +165,7 @@
 //
 // I/O Functions
 //
+#ifdef _ARC_
 NTHALAPI
 VOID
 NTAPI
@@ -201,6 +175,7 @@
     PUCHAR NtSystemPath,
     PSTRING NtSystemPathString
 );
+#endif
 
 //
 // Environment Functions
@@ -213,5 +188,15 @@
     IN PCH Value
 );
 
+//
+// Time Functions
+//
+NTHALAPI
+VOID
+NTAPI
+HalQueryRealTimeClock(
+    IN PTIME_FIELDS RtcTime
+);
+
 #endif
 #endif
Index: include/ndk/lpctypes.h
===================================================================
--- include/ndk/lpctypes.h	(revision 21808)
+++ include/ndk/lpctypes.h	(working copy)
@@ -1,4 +1,4 @@
-/*++ NDK Version: 0095
+/*++ NDK Version: 0098
 
 Copyright (c) Alex Ionescu.  All rights reserved.
 
@@ -12,7 +12,7 @@
 
 Author:
 
-    Alex Ionescu (alex.ionescu@reactos.com)   06-Oct-2004
+    Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
 
 --*/
 
@@ -228,7 +228,7 @@
 #endif
 
 //
-// Client Died LPC Message (FIXME: should go in pstypes.h?)
+// Client Died LPC Message
 //
 typedef struct _CLIENT_DIED_MSG
 {
Index: include/ndk/i386/mmtypes.h
===================================================================
--- include/ndk/i386/mmtypes.h	(revision 21808)
+++ include/ndk/i386/mmtypes.h	(working copy)
@@ -29,4 +29,121 @@
 #define PAGE_SIZE                         0x1000
 #define PAGE_SHIFT                        12L
 
+//
+// Page Table Entry Definitions
+//
+typedef struct _HARDWARE_PTE_X86
+{
+    ULONG Valid:1;
+    ULONG Write:1;
+    ULONG Owner:1;
+    ULONG WriteThrough:1;
+    ULONG CacheDisable:1;
+    ULONG Accessed:1;
+    ULONG Dirty:1;
+    ULONG LargePage:1;
+    ULONG Global:1;
+    ULONG CopyOnWrite:1;
+    ULONG Prototype: 1;
+    ULONG reserved: 1;
+    ULONG PageFrameNumber:20;
+} HARDWARE_PTE_X86, *PHARDWARE_PTE_X86;
+
+typedef struct _MMPTE_SOFTWARE
+{
+    ULONG Valid:1;
+    ULONG PageFileLow:4;
+    ULONG Protection:5;
+    ULONG Prototype:1;
+    ULONG Transition:1;
+    ULONG PageFileHigh:20;
+} MMPTE_SOFTWARE;
+
+typedef struct _MMPTE_TRANSITION
+{
+    ULONG Valid:1;
+    ULONG Write:1;
+    ULONG Owner:1;
+    ULONG WriteThrough:1;
+    ULONG CacheDisable:1;
+    ULONG Protection:5;
+    ULONG Prototype:1;
+    ULONG Transition:1;
+    ULONG PageFrameNumber:20;
+} MMPTE_TRANSITION;
+
+typedef struct _MMPTE_PROTOTYPE
+{
+    ULONG Valid:1;
+    ULONG ProtoAddressLow:7;
+    ULONG ReadOnly:1;
+    ULONG WhichPool:1;
+    ULONG Prototype:1;
+    ULONG ProtoAddressHigh:21;
+} MMPTE_PROTOTYPE;
+
+typedef struct _MMPTE_SUBSECTION
+{
+    ULONG Valid:1;
+    ULONG SubsectionAddressLow:4;
+    ULONG Protection:5;
+    ULONG Prototype:1;
+    ULONG SubsectionAddressHigh:20;
+    ULONG WhichPool:1;
+} MMPTE_SUBSECTION;
+
+typedef struct _MMPTE_LIST
+{
+    ULONG Valid:1;
+    ULONG OneEntry:1;
+    ULONG filler10:10;
+    ULONG NextEntry:20;
+} MMPTE_LIST;
+
+#ifndef CONFIG_SMP
+
+typedef struct _MMPTE_HARDWARE
+{
+    ULONG Valid:1;
+    ULONG Write:1;
+    ULONG Owner:1;
+    ULONG WriteThrough:1;
+    ULONG CacheDisable:1;
+    ULONG Accessed:1;
+    ULONG Dirty:1;
+    ULONG LargePage:1;
+    ULONG Global:1;
+    ULONG CopyOnWrite:1;
+    ULONG Prototype:1;
+    ULONG reserved:1;
+    ULONG PageFrameNumber:20;
+} MMPTE_HARDWARE, *PMMPTE_HARDWARE;
+
+#else
+
+typedef struct _MMPTE_HARDWARE
+{
+    ULONG Valid:1;
+    ULONG Writable:1;
+    ULONG Owner:1;
+    ULONG WriteThrough:1;
+    ULONG CacheDisable:1;
+    ULONG Accessed:1;
+    ULONG Dirty:1;
+    ULONG LargePage:1;
+    ULONG Global:1;
+    ULONG CopyOnWrite:1;
+    ULONG Prototype:1;
+    ULONG Write:1;
+    ULONG PageFrameNumber:20;
+} MMPTE_HARDWARE, *PMMPTE_HARDWARE;
+
 #endif
+
+//
+// Use the right PTE structure
+//
+#define HARDWARE_PTE        HARDWARE_PTE_X86
+#define PHARDWARE_PTE       PHARDWARE_PTE_X86
+
+#endif
Index: include/ndk/i386/ketypes.h
===================================================================
--- include/ndk/i386/ketypes.h	(revision 21808)
+++ include/ndk/i386/ketypes.h	(working copy)
@@ -1,4 +1,4 @@
-/*++ NDK Version: 0095
+/*++ NDK Version: 0098
 
 Copyright (c) Alex Ionescu.  All rights reserved.
 
@@ -12,7 +12,7 @@
 
 Author:
 
-    Alex Ionescu (alex.ionescu@reactos.com)   06-Oct-2004
+    Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
 
 --*/
 
@@ -34,13 +34,57 @@
 #define I386_TRAP_GATE          0xF
 
 //
+// Selector Names
+//
+#define RPL_MASK                0x0003
+#define MODE_MASK               0x0001
+#define KGDT_R0_CODE            (0x8)
+#define KGDT_R0_DATA            (0x10)
+#define KGDT_R3_CODE            (0x18)
+#define KGDT_R3_DATA            (0x20)
+#define KGDT_TSS                (0x28)
+#define KGDT_R0_PCR             (0x30)
+#define KGDT_R3_TEB             (0x38)
+#define KGDT_LDT                (0x48)
+#define KGDT_DF_TSS             (0x50)
+#define KGDT_NMI_TSS            (0x58)
+
+//
+// CR4
+//
+#define CR4_VME                 0x1
+#define CR4_PVI                 0x2
+#define CR4_TSD                 0x4
+#define CR4_DE                  0x8
+#define CR4_PSE                 0x10
+#define CR4_PAE                 0x20
+#define CR4_MCE                 0x40
+#define CR4_PGE                 0x80
+#define CR4_FXSR                0x200
+#define CR4_XMMEXCPT            0x400
+
+//
+// EFlags
+//
+#define EFLAGS_TF               0x100
+#define EFLAGS_INTERRUPT_MASK   0x200
+#define EFLAGS_NESTED_TASK      0x4000
+#define EFLAGS_V86_MASK         0x20000
+#define EFLAGS_ALIGN_CHECK      0x40000
+#define EFLAGS_VIF              0x80000
+#define EFLAGS_VIP              0x100000
+#define EFLAG_SIGN              0x8000
+#define EFLAG_ZERO              0x4000
+
+#ifndef NTOS_MODE_USER
+//
 // IPI Types
 //
 #define IPI_APC                 1
 #define IPI_DPC                 2
-#define IPI_FREEZE              3
-#define IPI_PACKET_READY        4
-#define IPI_SYNCH_REQUEST       10
+#define IPI_FREEZE              4
+#define IPI_PACKET_READY        8
+#define IPI_SYNCH_REQUEST       16
 
 //
 // FN/FX (FPU) Save Area Structures
@@ -146,16 +190,16 @@
         } Bytes;
         struct
         {
-            ULONG BaseMid : 8;
-            ULONG Type : 5;
-            ULONG Dpl : 2;
-            ULONG Pres : 1;
-            ULONG LimitHi : 4;
-            ULONG Sys : 1;
-            ULONG Reserved_0 : 1;
-            ULONG Default_Big : 1;
-            ULONG Granularity : 1;
-            ULONG BaseHi : 8;
+            ULONG BaseMid:8;
+            ULONG Type:5;
+            ULONG Dpl:2;
+            ULONG Pres:1;
+            ULONG LimitHi:4;
+            ULONG Sys:1;
+            ULONG Reserved_0:1;
+            ULONG Default_Big:1;
+            ULONG Granularity:1;
+            ULONG BaseHi:8;
         } Bits;
     } HighWord;
 } LDT_ENTRY, *PLDT_ENTRY, *LPLDT_ENTRY;
@@ -178,16 +222,16 @@
         } Bytes;
         struct
         {
-            ULONG BaseMid       : 8;
-            ULONG Type          : 5;
-            ULONG Dpl           : 2;
-            ULONG Pres          : 1;
-            ULONG LimitHi       : 4;
-            ULONG Sys           : 1;
-            ULONG Reserved_0    : 1;
-            ULONG Default_Big   : 1;
-            ULONG Granularity   : 1;
-            ULONG BaseHi        : 8;
+            ULONG BaseMid:8;
+            ULONG Type:5;
+            ULONG Dpl:2;
+            ULONG Pres:1;
+            ULONG LimitHi:4;
+            ULONG Sys:1;
+            ULONG Reserved_0:1;
+            ULONG Default_Big:1;
+            ULONG Granularity:1;
+            ULONG BaseHi:8;
         } Bits;
     } HighWord;
 } KGDTENTRY, *PKGDTENTRY;
@@ -222,26 +266,6 @@
     USHORT ExtendedOffset;
 } KIDTENTRY, *PKIDTENTRY;
 
-//
-// Page Table Entry Definition
-//
-typedef struct _HARDWARE_PTE_X86
-{
-    ULONG Valid             : 1;
-    ULONG Write             : 1;
-    ULONG Owner             : 1;
-    ULONG WriteThrough      : 1;
-    ULONG CacheDisable      : 1;
-    ULONG Accessed          : 1;
-    ULONG Dirty             : 1;
-    ULONG LargePage         : 1;
-    ULONG Global            : 1;
-    ULONG CopyOnWrite       : 1;
-    ULONG Prototype         : 1;
-    ULONG reserved          : 1;
-    ULONG PageFrameNumber   : 20;
-} HARDWARE_PTE_X86, *PHARDWARE_PTE_X86;
-
 typedef struct _DESCRIPTOR
 {
     USHORT Pad;
@@ -277,9 +301,9 @@
 #pragma pack(push,4)
 typedef struct _KPROCESSOR_STATE
 {
-    PCONTEXT ContextFrame;
+    CONTEXT ContextFrame;
     KSPECIAL_REGISTERS SpecialRegisters;
-} KPROCESSOR_STATE;
+} KPROCESSOR_STATE, *PKPROCESSOR_STATE;
 
 //
 // Processor Region Control Block
@@ -301,8 +325,13 @@
     KPROCESSOR_STATE ProcessorState;
     ULONG KernelReserved[16];
     ULONG HalReserved[16];
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    ULONG CFlushSize;
+    UCHAR PrcbPad0[88];
+#else
     UCHAR PrcbPad0[92];
-    PVOID LockQueue[33]; // Used for Queued Spinlocks
+#endif
+    KSPIN_LOCK_QUEUE LockQueue[LockQueueMaximumLock];
     struct _KTHREAD *NpxThread;
     ULONG InterruptCount;
     ULONG KernelTime;
@@ -314,18 +343,41 @@
     ULONG PageColor;
     UCHAR SkipTick;
     UCHAR DebuggerSavedIRQL;
+#if (NTDDI_VERSION >= NTDDI_WS03)
+    UCHAR NodeColor;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    UCHAR PollSlot;
+#else
+    UCHAR Spare1;
+#endif
+    ULONG NodeShiftedColor;
+#else
     UCHAR Spare1[6];
+#endif
     struct _KNODE *ParentNode;
     ULONG MultiThreadProcessorSet;
     struct _KPRCB *MultiThreadSetMaster;
+#if (NTDDI_VERSION >= NTDDI_WS03)
+    ULONG SecondaryColorMask;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    ULONG DpcTimeLimit;
+#else
+    LONG Sleeping;
+#endif
+#else
     ULONG ThreadStartCount[2];
+#endif
     ULONG CcFastReadNoWait;
     ULONG CcFastReadWait;
     ULONG CcFastReadNotPossible;
     ULONG CcCopyReadNoWait;
     ULONG CcCopyReadWait;
     ULONG CcCopyReadNoWaitMiss;
+#if (NTDDI_VERSION < NTDDI_LONGHORN)
     ULONG KeAlignmentFixupCount;
+#endif
+    ULONG SpareCounter0;
+#if (NTDDI_VERSION < NTDDI_LONGHORN)
     ULONG KeContextSwitches;
     ULONG KeDcacheFlushCount;
     ULONG KeExceptionDispatchCount;
@@ -334,13 +386,47 @@
     ULONG KeIcacheFlushCount;
     ULONG KeSecondLevelTbFills;
     ULONG KeSystemCalls;
+#endif
     ULONG IoReadOperationCount;
     ULONG IoWriteOperationCount;
     ULONG IoOtherOperationCount;
     LARGE_INTEGER IoReadTransferCount;
     LARGE_INTEGER IoWriteTransferCount;
     LARGE_INTEGER IoOtherTransferCount;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    ULONG CcFastMdlReadNoWait;
+    ULONG CcFastMdlReadWait;
+    ULONG CcFastMdlReadNotPossible;
+    ULONG CcMapDataNoWait;
+    ULONG CcMapDataWait;
+    ULONG CcPinMappedDataCount;
+    ULONG CcPinReadNoWait;
+    ULONG CcPinReadWait;
+    ULONG CcMdlReadNoWait;
+    ULONG CcMdlReadWait;
+    ULONG CcLazyWriteHotSpots;
+    ULONG CcLazyWriteIos;
+    ULONG CcLazyWritePages;
+    ULONG CcDataFlushes;
+    ULONG CcDataPages;
+    ULONG CcLostDelayedWrites;
+    ULONG CcFastReadResourceMiss;
+    ULONG CcCopyReadWaitMiss;
+    ULONG CcFastMdlReadResourceMiss;
+    ULONG CcMapDataNoWaitMiss;
+    ULONG CcMapDataWaitMiss;
+    ULONG CcPinReadNoWaitMiss;
+    ULONG CcPinReadWaitMiss;
+    ULONG CcMdlReadNoWaitMiss;
+    ULONG CcMdlReadWaitMiss;
+    ULONG CcReadAheadIos;
+    ULONG KeAlignmentFixupCount;
+    ULONG KeExceptionDispatchCount;
+    ULONG KeSystemCalls;
+    ULONG PrcbPad1[3];
+#else
     ULONG SpareCounter1[8];
+#endif
     PP_LOOKASIDE_LIST PPLookasideList[16];
     PP_LOOKASIDE_LIST PPNPagedLookasideList[32];
     PP_LOOKASIDE_LIST PPPagedLookasideList[32];
@@ -350,7 +436,7 @@
     UCHAR PrcbPad2[52];
     PVOID CurrentPacket[3];
     ULONG TargetSet;
-    ULONG_PTR WorkerRoutine;
+    PKIPI_WORKER WorkerRoutine;
     ULONG IpiFrozen;
     UCHAR PrcbPad3[40];
     ULONG RequestSummary;
@@ -370,22 +456,49 @@
     ULONG TimerHand;
     ULONG TimerRequest;
     PVOID DpcThread;
-    struct _KEVENT *DpcEvent;
+    KEVENT DpcEvent;
     UCHAR ThreadDpcEnable;
     BOOLEAN QuantumEnd;
     UCHAR PrcbPad50;
     UCHAR IdleSchedule;
-    ULONG DpcSetEventRequest;
+    LONG DpcSetEventRequest;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    LONG Sleeping;
+    ULONG PeriodicCount;
+    ULONG PeriodicBias;
+    UCHAR PrcbPad5[6];
+#else
     UCHAR PrcbPad5[18];
+#endif
     LONG TickOffset;
-    struct _KDPC* CallDpc;
+    KDPC CallDpc;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    LONG ClockKeepAlive;
+    UCHAR ClockCheckSlot;
+    UCHAR ClockPollCycle;
+    UCHAR PrcbPad6[2];
+    LONG DpcWatchdogPeriod;
+    LONG DpcWatchDogCount;
+    LONG ThreadWatchdogPeriod;
+    LONG ThreadWatchDogCount;
+    ULONG PrcbPad70[2];
+#else
     ULONG PrcbPad7[8];
+#endif
     LIST_ENTRY WaitListHead;
     ULONG ReadySummary;
-    ULONG SelectNextLast;
+    ULONG QueueIndex;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    SINGLE_LIST_ENTRY DeferredReadyListHead;
+    ULONGLONG StartCycles;
+    ULONGLONG CycleTime;
+    ULONGLONG PrcbPad71[3];
     LIST_ENTRY DispatcherReadyListHead[32];
+#else
+    LIST_ENTRY DispatcherReadyListHead[32];
     SINGLE_LIST_ENTRY DeferredReadyListHead;
     ULONG PrcbPad72[11];
+#endif
     PVOID ChainedInterruptList;
     LONG LookasideIrpFloat;
     LONG MmPageFaultCount;
@@ -401,7 +514,15 @@
     LONG MmDirtyWriteIoCount;
     LONG MmMappedPagesWriteCount;
     LONG MmMappedWriteIoCount;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    ULONG CachedCommit;
+    ULONG CachedResidentAvailable;
+    PVOID HyperPte;
+    UCHAR CpuVendor;
+    UCHAR PrcbPad9[3];
+#else
     ULONG SpareFields0[1];
+#endif
     CHAR VendorString[13];
     UCHAR InitialApicId;
     UCHAR LogicalProcessorsPerPhysicalProcessor;
@@ -412,6 +533,23 @@
     LARGE_INTEGER SpareField1;
     FX_SAVE_AREA NpxSaveArea;
     PROCESSOR_POWER_STATE PowerState;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    KDPC DpcWatchdogDoc;
+    KTIMER DpcWatchdogTimer;
+    PVOID WheaInfo;
+    PVOID EtwSupport;
+    SLIST_HEADER InterruptObjectPool;
+    LARGE_INTEGER HyperCallPagePhysical;
+    LARGE_INTEGER HyperCallPageVirtual;
+    PVOID RateControl;
+    CACHE_DESCRIPTOR Cache[5];
+    ULONG CacheCount;
+    ULONG CacheProcessorMask[5];
+    UCHAR LogicalProcessorsPerCore;
+    UCHAR PrcbPad8[3];
+    ULONG PackageProcessorSet;
+    ULONG CoreProcessorSet;
+#endif
 } KPRCB, *PKPRCB;
 
 //
@@ -433,35 +571,36 @@
             PVOID Used_Self;
         };
     };
-    struct _KPCR *Self;          /* 1C */
-    struct _KPRCB *Prcb;         /* 20 */
-    KIRQL Irql;                  /* 24 */
-    ULONG IRR;                   /* 28 */
-    ULONG IrrActive;             /* 2C */
-    ULONG IDR;                   /* 30 */
-    PVOID KdVersionBlock;        /* 34 */
-    PKIDTENTRY IDT;              /* 38 */
+    struct _KPCR *Self;
+    struct _KPRCB *Prcb;
+    KIRQL Irql;
+    ULONG IRR;
+    ULONG IrrActive;
+    ULONG IDR;
+    PVOID KdVersionBlock;
+    PKIDTENTRY IDT;
 #ifdef _REACTOS_
-    PUSHORT GDT;                 /* 3C */
+    PUSHORT GDT;
 #else
-    PKGDTENTRY GDT;              /* 3C */
+    PKGDTENTRY GDT;
 #endif
-    struct _KTSS *TSS;           /* 40 */
-    USHORT MajorVersion;         /* 44 */
-    USHORT MinorVersion;         /* 46 */
-    KAFFINITY SetMember;         /* 48 */
-    ULONG StallScaleFactor;      /* 4C */
-    UCHAR SparedUnused;          /* 50 */
-    UCHAR Number;                /* 51 */
-    UCHAR Reserved;              /* 52 */
-    UCHAR L2CacheAssociativity;  /* 53 */
-    ULONG VdmAlert;              /* 54 */
-    ULONG KernelReserved[14];    /* 58 */
-    ULONG L2CacheSize;           /* 90 */
-    ULONG HalReserved[16];       /* 94 */
-    ULONG InterruptMode;         /* D4 */
-    UCHAR KernelReserved2[0x48]; /* D8 */
-    KPRCB PrcbData;              /* 120 */
+    struct _KTSS *TSS;
+    USHORT MajorVersion;
+    USHORT MinorVersion;
+    KAFFINITY SetMember;
+    ULONG StallScaleFactor;
+    UCHAR SparedUnused;
+    UCHAR Number;
+    UCHAR Reserved;
+    UCHAR L2CacheAssociativity;
+    ULONG VdmAlert;
+    ULONG KernelReserved[14];
+    ULONG SecondLevelCacheSize;
+    ULONG HalReserved[16];
+    ULONG InterruptMode;
+    UCHAR Spare1;
+    ULONG KernelReserved2[17];
+    KPRCB PrcbData;
 } KIPCR, *PKIPCR;
 #pragma pack(pop)
 
@@ -511,5 +650,5 @@
 // i386 CPUs don't have exception frames
 //
 typedef struct _KEXCEPTION_FRAME KEXCEPTION_FRAME, *PKEXCEPTION_FRAME;
-
 #endif
+#endif
Index: include/ndk/sefuncs.h
===================================================================
--- include/ndk/sefuncs.h	(revision 21808)
+++ include/ndk/sefuncs.h	(working copy)
@@ -1,4 +1,4 @@
-/*++ NDK Version: 0095
+/*++ NDK Version: 0098
 
 Copyright (c) Alex Ionescu.  All rights reserved.
 
@@ -12,7 +12,7 @@
 
 Author:
 
-    Alex Ionescu (alex.ionescu@reactos.com)   06-Oct-2004
+    Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
 
 --*/
 
@@ -274,7 +274,7 @@
     OUT PULONG ReturnLength
 );
 
-NTSYSAPI
+NTSYSCALLAPI
 NTSTATUS
 NTAPI
 NtSetInformationToken(
Index: include/ndk/iofuncs.h
===================================================================
--- include/ndk/iofuncs.h	(revision 21808)
+++ include/ndk/iofuncs.h	(working copy)
@@ -1,4 +1,4 @@
-/*++ NDK Version: 0095
+/*++ NDK Version: 0098
 
 Copyright (c) Alex Ionescu.  All rights reserved.
 
@@ -12,7 +12,7 @@
 
 Author:
 
-    Alex Ionescu (alex.ionescu@reactos.com)   06-Oct-2004
+    Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
 
 --*/
 
@@ -140,8 +140,8 @@
 NTSTATUS
 NTAPI
 NtEnumerateBootEntries(
-    IN ULONG Unknown1,
-    IN ULONG Unknown2
+    IN PVOID Buffer,
+    IN PULONG BufferLength
 );
 
 NTSYSCALLAPI
@@ -244,16 +244,16 @@
 NTSTATUS
 NTAPI
 NtQueryBootEntryOrder(
-    IN ULONG Unknown1,
-    IN ULONG Unknown2
+    IN PULONG Ids,
+    IN PULONG Count
 );
 
 NTSYSCALLAPI
 NTSTATUS
 NTAPI
 NtQueryBootOptions(
-    IN ULONG Unknown1,
-    IN ULONG Unknown2
+    IN PBOOT_OPTIONS BootOptions,
+    IN PULONG BootOptionsLength
 );
 
 NTSYSCALLAPI
@@ -389,16 +389,16 @@
 NTSTATUS
 NTAPI
 NtSetBootEntryOrder(
-    IN ULONG Unknown1,
-    IN ULONG Unknown2
+    IN PULONG Ids,
+    IN PULONG Count
 );
 
 NTSYSCALLAPI
 NTSTATUS
 NTAPI
 NtSetBootOptions(
-    ULONG Unknown1,
-    ULONG Unknown2
+    IN PBOOT_OPTIONS BootOptions,
+    IN ULONG FieldsToChange
 );
 
 NTSYSCALLAPI
@@ -458,9 +458,10 @@
 NTSTATUS
 NTAPI
 NtTranslateFilePath(
-    ULONG Unknown1,
-    ULONG Unknown2,
-    ULONG Unknown3
+    PFILE_PATH InputFilePath,
+    ULONG OutputType,
+    PFILE_PATH OutputFilePath,
+    ULONG OutputFilePathLength
 );
 
 NTSYSCALLAPI
@@ -619,14 +620,6 @@
     IN ULONG OutputBufferSize
 );
 
-NTSYSAPI
-NTSTATUS
-NTAPI
-ZwEnumerateBootEntries(
-    IN ULONG Unknown1,
-    IN ULONG Unknown2
-);
-
 #ifdef NTOS_MODE_USER
 NTSYSAPI
 NTSTATUS
@@ -730,22 +723,6 @@
 NTSYSAPI
 NTSTATUS
 NTAPI
-ZwQueryBootEntryOrder(
-    IN ULONG Unknown1,
-    IN ULONG Unknown2
-);
-
-NTSYSAPI
-NTSTATUS
-NTAPI
-ZwQueryBootOptions(
-    IN ULONG Unknown1,
-    IN ULONG Unknown2
-);
-
-NTSYSAPI
-NTSTATUS
-NTAPI
 ZwQueryDirectoryFile(
     IN HANDLE FileHandle,
     IN HANDLE Event OPTIONAL,
@@ -874,22 +851,6 @@
     IN PLARGE_INTEGER Timeout OPTIONAL
 );
 
-NTSYSAPI
-NTSTATUS
-NTAPI
-ZwSetBootEntryOrder(
-    IN ULONG Unknown1,
-    IN ULONG Unknown2
-);
-
-NTSYSAPI
-NTSTATUS
-NTAPI
-ZwSetBootOptions(
-    ULONG Unknown1,
-    ULONG Unknown2
-);
-
 #ifdef NTOS_MODE_USER
 NTSYSAPI
 NTSTATUS
@@ -948,15 +909,6 @@
 NTSYSAPI
 NTSTATUS
 NTAPI
-ZwTranslateFilePath(
-    ULONG Unknown1,
-    ULONG Unknown2,
-    ULONG Unknown3
-);
-
-NTSYSAPI
-NTSTATUS
-NTAPI
 ZwUnloadDriver(
     IN PUNICODE_STRING DriverServiceName
 );
Index: include/ndk/dbgkfuncs.h
===================================================================
--- include/ndk/dbgkfuncs.h	(revision 21808)
+++ include/ndk/dbgkfuncs.h	(working copy)
@@ -1,4 +1,4 @@
-/*++ NDK Version: 0095
+/*++ NDK Version: 0098
 
 Copyright (c) Alex Ionescu.  All rights reserved.
 
@@ -12,7 +12,7 @@
 
 Author:
 
-    Alex Ionescu (alex.ionescu@reactos.com)   06-Oct-2004
+    Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
 
 --*/
 
@@ -56,7 +56,7 @@
     OUT PDBGUI_WAIT_STATE_CHANGE StateChange
 );
 
-NTSYSCALLAPI
+NTSYSAPI
 NTSTATUS
 NTAPI
 ZwCreateDebugObject(
@@ -66,7 +66,7 @@
     IN BOOLEAN KillProcessOnExit
 );
 
-NTSYSCALLAPI
+NTSYSAPI
 NTSTATUS
 NTAPI
 ZwDebugContinue(
@@ -75,7 +75,7 @@
     IN NTSTATUS ContinueStatus
 );
 
-NTSYSCALLAPI
+NTSYSAPI
 NTSTATUS
 NTAPI
 ZwWaitForDebugEvent(
Index: include/ndk/mmfuncs.h
===================================================================
--- include/ndk/mmfuncs.h	(revision 21808)
+++ include/ndk/mmfuncs.h	(working copy)
@@ -1,4 +1,4 @@
-/*++ NDK Version: 0095
+/*++ NDK Version: 0098
 
 Copyright (c) Alex Ionescu.  All rights reserved.
 
@@ -12,7 +12,7 @@
 
 Author:
 
-    Alex Ionescu (alex.ionescu@reactos.com)   06-Oct-2004
+    Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
 
 --*/
 
@@ -31,6 +31,21 @@
 //
 NTSTATUS
 NTAPI
+MmMapViewOfSection(
+    IN PVOID SectionObject,
+    IN PEPROCESS Process,
+    IN OUT PVOID *BaseAddress,
+    IN ULONG ZeroBits,
+    IN ULONG CommitSize,
+    IN OUT PLARGE_INTEGER SectionOffset OPTIONAL,
+    IN OUT PULONG ViewSize,
+    IN SECTION_INHERIT InheritDisposition,
+    IN ULONG AllocationType,
+    IN ULONG Protect
+);
+
+NTSTATUS
+NTAPI
 MmUnmapViewOfSection(
     struct _EPROCESS* Process,
     PVOID BaseAddress
@@ -44,6 +59,14 @@
 NTSYSCALLAPI
 NTSTATUS
 NTAPI
+NtAreMappedFilesTheSame(
+    IN PVOID File1MappedAsAnImage,
+    IN PVOID File2MappedAsFile
+);
+
+NTSYSCALLAPI
+NTSTATUS
+NTAPI
 NtAllocateVirtualMemory(
     IN HANDLE ProcessHandle,
     IN OUT PVOID *BaseAddress,
@@ -216,6 +239,14 @@
 NTSYSAPI
 NTSTATUS
 NTAPI
+ZwAreMappedFilesTheSame(
+    IN PVOID File1MappedAsAnImage,
+    IN PVOID File2MappedAsFile
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
 ZwAllocateVirtualMemory(
     IN HANDLE ProcessHandle,
     IN OUT PVOID *BaseAddress,
Index: include/ndk/cctypes.h
===================================================================
--- include/ndk/cctypes.h	(revision 21808)
+++ include/ndk/cctypes.h	(working copy)
@@ -1,4 +1,4 @@
-/*++ NDK Version: 0095
+/*++ NDK Version: 0098
 
 Copyright (c) Alex Ionescu.  All rights reserved.
 
@@ -12,7 +12,7 @@
 
 Author:
 
-    Alex Ionescu (alex.ionescu@reactos.com)   06-Oct-2004
+    Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
 
 --*/
 
Index: include/ndk/pofuncs.h
===================================================================
--- include/ndk/pofuncs.h	(revision 21808)
+++ include/ndk/pofuncs.h	(working copy)
@@ -1,4 +1,4 @@
-/*++ NDK Version: 0095
+/*++ NDK Version: 0098
 
 Copyright (c) Alex Ionescu.  All rights reserved.
 
@@ -12,7 +12,7 @@
 
 Author:
 
-    Alex Ionescu (alex.ionescu@reactos.com)   06-Oct-2004
+    Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
 
 --*/
 
Index: include/ndk/ntndk.h
===================================================================
--- include/ndk/ntndk.h	(revision 21808)
+++ include/ndk/ntndk.h	(working copy)
@@ -1,4 +1,4 @@
-/*++ NDK Version: 0095
+/*++ NDK Version: 0098
 
 Copyright (c) Alex Ionescu.  All rights reserved.
 
@@ -12,16 +12,34 @@
 
 Author:
 
-    Alex Ionescu (alex.ionescu@reactos.com)   06-Oct-2004
+    Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
 
 --*/
 
 #ifndef _NTNDK_
 #define _NTNDK_
 
+//
+// Disable some warnings that we'd get on /W4.
+// Only active for compilers which support this feature.
+//
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4001)
+#pragma warning(disable:4201)
+#pragma warning(disable:4115)
+#pragma warning(disable:4214)
+#endif
+
+//
+// Headers needed for NDK
+//
 #include <stdarg.h>         // C Standard Header
 #include <umtypes.h>        // General Definitions
 
+//
+// Type Headers
+//
 #include <cctypes.h>        // Cache Manager Types
 #include <cmtypes.h>        // Configuration Manager Types
 #include <dbgktypes.h>      // User-Mode Kernel Debugging Types
@@ -40,6 +58,9 @@
 #include <rtltypes.h>       // Runtime Library Types
 #include <setypes.h>        // Security Subsystem Types
 
+//
+// Function Headers
+//
 #include <cmfuncs.h>        // Configuration Manager Functions
 #include <dbgkfuncs.h>      // User-Mode Kernel Debugging Functions
 #include <kdfuncs.h>        // Kernel Debugger Functions
@@ -60,4 +81,7 @@
 
 #include <asm.h>            // Assembly Offsets
 
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
 #endif // _NTNDK_
Index: include/ndk/ldrfuncs.h
===================================================================
--- include/ndk/ldrfuncs.h	(revision 21808)
+++ include/ndk/ldrfuncs.h	(working copy)
@@ -1,4 +1,4 @@
-/*++ NDK Version: 0095
+/*++ NDK Version: 0098
 
 Copyright (c) Alex Ionescu.  All rights reserved.
 
@@ -12,7 +12,7 @@
 
 Author:
 
-    Alex Ionescu (alex.ionescu@reactos.com)   06-Oct-2004
+    Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
 
 --*/
 
@@ -58,6 +58,11 @@
     OUT PIMAGE_RESOURCE_DIRECTORY *ResourceDirectory
 );
 
+BOOLEAN
+LdrUnloadAlternateResourceModule(
+    IN PVOID BaseAddress
+);
+
 //
 // Misc. Functions
 //
@@ -70,4 +75,28 @@
     OUT PVOID *ProcedureAddress
 );
 
+ULONG
+NTAPI
+LdrRelocateImage(
+    IN PVOID NewBase,
+    IN PUCHAR LoaderName,
+    IN ULONG Success,
+    IN ULONG Conflict,
+    IN ULONG Invalid
+);
+
+NTSTATUS
+LdrLockLoaderLock(
+    IN ULONG Flags,
+    OUT PULONG Disposition OPTIONAL,
+    OUT PULONG Cookie OPTIONAL
+);
+
+NTSTATUS
+NTAPI
+LdrUnlockLoaderLock(
+    IN ULONG Flags,
+    IN ULONG Cookie OPTIONAL
+);
+
 #endif
Index: include/ndk/asm.h
===================================================================
--- include/ndk/asm.h	(revision 21808)
+++ include/ndk/asm.h	(working copy)
@@ -27,8 +27,15 @@
 #define UserMode                                0x1
 
 //
+// CPU Types
+//
+#define CPU_INTEL                               0x1
+#define CPU_AMD                                 0x2
+
+//
 // Selector Names
 //
+#ifdef __ASM__
 #define RPL_MASK                                0x0003
 #define MODE_MASK                               0x0001
 #define KGDT_R0_CODE                            (0x8)
@@ -41,6 +48,7 @@
 #define KGDT_LDT                                (0x48)
 #define KGDT_DF_TSS                             (0x50)
 #define KGDT_NMI_TSS                            (0x58)
+#endif
 
 //
 // KV86M_REGISTERS Offsets
@@ -126,7 +134,7 @@
 #define KPCR_CURRENT_THREAD                     0x124
 #define KPCR_PROCESSOR_NUMBER                   0x130
 #define KPCR_PRCB_SET_MEMBER                    0x134
-#define KPCR_NPX_THREAD                         0x2F4
+#define KPCR_NPX_THREAD                         0x640
 #define KPCR_DR6                                0x428
 #define KPCR_DR7                                0x42C
 #define KPCR_SYSTEM_CALLS                       0x6B8
@@ -302,6 +310,7 @@
 //
 // EFLAGS
 //
+#ifdef __ASM__
 #define EFLAGS_TF                               0x100
 #define EFLAGS_INTERRUPT_MASK                   0x200
 #define EFLAGS_NESTED_TASK                      0x4000
@@ -311,7 +320,6 @@
 #define EFLAGS_VIP                              0x100000
 #define EFLAG_SIGN                              0x8000
 #define EFLAG_ZERO                              0x4000
-#ifndef EFLAG_SELECT
 #define EFLAG_SELECT                            (EFLAG_SIGN + EFLAG_ZERO)
 #endif
 
@@ -333,6 +341,7 @@
 //
 // CR4
 //
+#ifdef __ASM__
 #define CR4_VME                                 0x1
 #define CR4_PVI                                 0x2
 #define CR4_TSD                                 0x4
@@ -343,6 +352,7 @@
 #define CR4_PGE                                 0x80
 #define CR4_FXSR                                0x200
 #define CR4_XMMEXCPT                            0x400
+#endif
 
 //
 // Usermode callout frame definitions
@@ -380,6 +390,19 @@
 #define SERVICE_DESCRIPTOR_LENGTH               0x0010
 
 //
+// Machine types
+//
+#ifdef __ASM__
+#define MACHINE_TYPE_ISA                        0x0000
+#define MACHINE_TYPE_EISA                       0x0001
+#define MACHINE_TYPE_MCA                        0x0002
+
+//
+// Kernel Feature Bits
+//
+#define KF_RDTSC                                0x00000002
+#endif
+//
 // Generic Definitions
 //
 #define MAXIMUM_IDTVECTOR                       0xFF
Index: include/ndk/umfuncs.h
===================================================================
--- include/ndk/umfuncs.h	(revision 21808)
+++ include/ndk/umfuncs.h	(working copy)
@@ -1,4 +1,4 @@
-/*++ NDK Version: 0095
+/*++ NDK Version: 0098
 
 Copyright (c) Alex Ionescu.  All rights reserved.
 
@@ -12,7 +12,7 @@
 
 Author:
 
-    Alex Ionescu (alex.ionescu@reactos.com)   06-Oct-2004
+    Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
 
 --*/
 
@@ -213,7 +213,7 @@
 NTAPI
 LdrLoadDll(
     IN PWSTR SearchPath OPTIONAL,
-    IN ULONG LoadFlags,
+    IN PULONG LoadFlags OPTIONAL,
     IN PUNICODE_STRING Name,
     OUT PVOID *BaseAddress OPTIONAL
 );
@@ -228,10 +228,10 @@
 PIMAGE_BASE_RELOCATION
 NTAPI
 LdrProcessRelocationBlock(
-    IN PVOID Address,
-    IN USHORT Count,
+    IN ULONG_PTR Address,
+    IN ULONG Count,
     IN PUSHORT TypeOffset,
-    IN ULONG_PTR Delta
+    IN LONG_PTR Delta
 );
 
 NTSTATUS
Index: include/ndk/psfuncs.h
===================================================================
--- include/ndk/psfuncs.h	(revision 21808)
+++ include/ndk/psfuncs.h	(working copy)
@@ -1,4 +1,4 @@
-/*++ NDK Version: 0095
+/*++ NDK Version: 0098
 
 Copyright (c) Alex Ionescu.  All rights reserved.
 
@@ -12,7 +12,7 @@
 
 Author:
 
-    Alex Ionescu (alex.ionescu@reactos.com)   06-Oct-2004
+    Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
 
 --*/
 
@@ -71,7 +71,7 @@
 VOID 
 NTAPI
 PsEstablishWin32Callouts(
-    PW32_CALLOUT_DATA CalloutData
+    PWIN32_CALLOUTS_FPNS CalloutData
 );
 
 VOID
@@ -298,6 +298,7 @@
 );
 
 NTSYSCALLAPI
+NTSYSCALLAPI
 NTSTATUS
 NTAPI
 NtSetInformationThread(
@@ -314,6 +315,7 @@
     IN HANDLE ProcessHandle
 );
 
+NTSYSCALLAPI
 NTSTATUS
 NTAPI
 NtSuspendThread(
Index: include/ndk/fixmes.txt
===================================================================
--- include/ndk/fixmes.txt	(revision 21808)
+++ include/ndk/fixmes.txt	(working copy)
@@ -1,88 +0,0 @@
-List of ReactOS Applications compiling with the NDK
-(verify, fix, and optimize their usage)
---------------------------------------------------------------
-
-apps\utils\ps\ps.c: #include <ndk/ntndk.h>
-drivers\dd\blue\blue.c: #include <ndk/halfuncs.h>
-drivers\dd\bootvid\bootvid.c: #include <ndk/ldrfuncs.h>
-drivers\storage\diskdump\diskdump.c: #include <ndk/extypes.h>
-drivers\storage\diskdump\diskdump.c: #include <ndk/rtlfuncs.h>
-hal\hal\hal.c: #include <ndk/halfuncs.h>
-hal\hal\hal.c: #include <ndk/kdfuncs.h>
-lib\crt\except\unwind.c: #include <ndk/umtypes.h>
-lib\crt\except\unwind.c: #include <ndk/extypes.h>
-lib\crt\except\unwind.c: #include <ndk/rtlfuncs.h>
-lib\dnsapi\dnsapi\stubs.c: #include <ndk/ntndk.h>
-lib\epsapi\enum\drivers.c: #include <ndk/ntndk.h>
-lib\epsapi\enum\modules.c: #include <ndk/ntndk.h>
-lib\epsapi\enum\processes.c: #include <ndk/ntndk.h>
-lib\lsasrv\lsaport.c: #include <ndk/ntndk.h>
-lib\lsasrv\lsasrv.c: #include <ndk/ntndk.h>
-lib\nt\entry_point.c: #include <ndk/ntndk.h>
-lib\samlib\samlib.c: #include <ndk/ntndk.h>
-lib\samsrv\samsrv.c: #include <ndk/ntndk.h>
-lib\smdll\query.c: #include <ndk/ntndk.h>
-lib\string\mbstowcs.c: #include <ndk/umtypes.h>
-lib\string\mbstowcs.c: #include <ndk/rtlfuncs.h>
-lib\string\sscanf.c: #include <ndk/umtypes.h>
-lib\string\sscanf.c: #include <ndk/rtlfuncs.h>
-lib\string\wcstombs.c: #include <ndk/umtypes.h>
-lib\string\wcstombs.c: #include <ndk/rtlfuncs.h>
-lib\syssetup\install.c: #include <ndk/ntndk.h>
-lib\syssetup\logfile.c: #include <ndk/ntndk.h>
-lib\wdmguid\wdmguid.c: #include <ndk/sysguid.h>
-regtests\shared\regtests.c: #include <ndk/ntndk.h>
-services\umpnpmgr\umpnpmgr.c: #include <ndk/ntndk.h>
-subsys\ntvdm\ntvdm.c: #include <ndk/ntndk.h>
-subsys\system\autochk\autochk.c: #include <ndk/ntndk.h>
-subsys\system\lsass\lsass.c: #include <ndk/ntndk.h>
-subsys\system\setup\setup.c: #include <ndk/ntndk.h>
-subsys\system\sm\sm.c: #include <ndk/ntndk.h>
-boot\freeldr\freeldr\include\freeldr.h: #include <ndk/ntndk.h>
-drivers\fs\ms\msfs.h: #include <ndk/ntndk.h>
-drivers\fs\np\npfs.h: #include <ndk/iotypes.h>
-drivers\fs\vfat\vfat.h: #include <ndk/ntndk.h>
-drivers\net\ndis\include\ndissys.h: #include <ndk/ntndk.h>
-drivers\net\tcpip\include\precomp.h: #include <ndk/ntndk.h>
-drivers\video\miniport\xboxvmp\xboxvmp.h: #include <ndk/ntndk.h>
-drivers\video\videoprt\videoprt.h: #include <ndk/ntndk.h>
-hal\halx86\include\hal.h: #include <ndk/ntndk.h>
-include\drivers\diskdump\diskdump.h: #include <ndk/ntndk.h>
-lib\advapi32\advapi32.h: #include <ndk/ntndk.h>
-lib\crt\precomp.h: #include <ndk/ntndk.h>
-lib\dbghelp\stackframe.h: #include <ndk/umtypes.h>
-lib\dbghelp\stackframe.h: #include <ndk/extypes.h>
-lib\dbghelp\stackframe.h: #include <ndk/rtlfuncs.h>
-lib\dnsapi\dnsapi\precomp.h: #include <ndk/ntndk.h>
-lib\fmifs\precomp.h: #include <ndk/ntndk.h>
-lib\fslib\vfatlib\vfatlib.h: #include <ndk/ntndk.h>
-lib\fslib\vfatxlib\vfatxlib.h: #include <ndk/ntndk.h>
-lib\gdi32\include\precomp.h: #include <ndk/ntndk.h>
-lib\imagehlp\precomp.h: #include <ndk/umtypes.h>
-lib\imagehlp\precomp.h: #include <ndk/rtlfuncs.h>
-lib\iphlpapi\iphlpapi_private.h: #include <ndk/ntndk.h>
-lib\kernel32\k32.h: #include <ndk/ntndk.h>
-lib\msafd\msafd.h: #include <ndk/ntndk.h>
-lib\ntdll\inc\ntdll.h: #include <ndk/ntndk.h>
-lib\opengl32\teb.h: #include <ndk/ntndk.h>
-lib\psapi\precomp.h: #include <ndk/ntndk.h>
-lib\rtl\rtl.h: #include <ndk/ntndk.h>
-lib\secur32\precomp.h: #include <ndk/ntndk.h>
-lib\setupapi\setupapi_private.h: #include <ndk/ntndk.h>
-lib\smlib\precomp.h: #include <ndk/ntndk.h>
-lib\user32\include\user32.h: #include <ndk/ntndk.h>
-lib\userenv\precomp.h: #include <ndk/ntndk.h>
-lib\wshirda\wshirda.h: #include <ndk/ntndk.h>
-ntoskrnl\include\ntoskrnl.h: #include <ndk/ntndk.h>
-ntoskrnl\include\internal\napi.h: #include <ndk/asm.h>
-services\dhcp\include\rosdhcp.h: #include <ndk/ntndk.h>
-services\eventlog\eventlog.h: #include <ndk/ntndk.h>
-services\rpcss\rpcss.h: #include <ndk/ntndk.h>
-subsys\csrss\csrss.h: #include <ndk/ntndk.h>
-subsys\csrss\include\api.h: #include <ndk/ntndk.h>
-subsys\csrss\win32csr\w32csr.h: #include <ndk/ntndk.h>
-subsys\smss\smss.h: #include <ndk/ntndk.h>
-subsys\system\cmd\precomp.h: #include <ndk/ntndk.h>
-subsys\system\services\services.h: #include <ndk/ntndk.h>
-subsys\system\taskmgr\precomp.h: #include <ndk/ntndk.h>
-subsys\system\usetup\usetup.h: #include <ndk/ntndk.h>
Index: include/ndk/ketypes.h
===================================================================
--- include/ndk/ketypes.h	(revision 21808)
+++ include/ndk/ketypes.h	(working copy)
@@ -1,4 +1,4 @@
-/*++ NDK Version: 0095
+/*++ NDK Version: 0098
 
 Copyright (c) Alex Ionescu.  All rights reserved.
 
@@ -12,7 +12,7 @@
 
 Author:
 
-    Alex Ionescu (alex.ionescu@reactos.com)   06-Oct-2004
+    Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
 
 --*/
 
@@ -24,7 +24,6 @@
 //
 #include <umtypes.h>
 #ifndef NTOS_MODE_USER
-#include <arc/arc.h>
 #include <haltypes.h>
 #include <potypes.h>
 #include <ifssupp.h>
@@ -38,18 +37,44 @@
 //
 // Maximum System Descriptor Table Entries
 //
-#define SSDT_MAX_ENTRIES                4
+#define SSDT_MAX_ENTRIES                2
 
 //
-// Maximum number of times a thread can be suspended
+// Dispatcher Priority increments
 //
-#define MAXIMUM_SUSPEND_COUNT           0x7F
+#define THREAD_ALERT_INCREMENT          2
 
 //
-// Dispatcher Priority increments
+// User Shared Data in Kernel-Mode
 //
-#define THREAD_ALERT_INCREMENT          2
+#define KI_USER_SHARED_DATA             0xffdf0000
 
+//
+// Physical memory offset of KUSER_SHARED_DATA
+//
+#define KI_USER_SHARED_DATA_PHYSICAL    0x41000
+
+//
+// Kernel Feature Bits
+//
+#define KF_RDTSC                        0x00000002
+
+//
+// KPCR Access for non-IA64 builds
+//
+#define K0IPCR                          ((ULONG_PTR)(KIP0PCRADDRESS))
+#define PCR                             ((volatile KPCR * const)K0IPCR)
+#define KeGetPcr()                      PCR
+
+//
+// Number of dispatch codes supported by KINTERRUPT
+//
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+#define KINTERRUPT_DISPATCH_CODES       135
+#else
+#define KINTERRUPT_DISPATCH_CODES       106
+#endif
+
 #ifdef NTOS_MODE_USER
 
 //
@@ -215,6 +240,9 @@
     Waiting,
     Transition,
     DeferredReady,
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    GateWait,
+#endif
 } KTHREAD_STATE, *PKTHREAD_STATE;
 
 //
@@ -225,8 +253,32 @@
     ProcessInMemory,
     ProcessOutOfMemory,
     ProcessInTransition,
+    ProcessInSwap,
+    ProcessOutSwap,
 } KPROCESS_STATE, *PKPROCESS_STATE;
 
+//
+// NtVdmControl Classes
+//
+typedef enum _VDMSERVICECLASS
+{
+   VdmStartExecution = 0,
+   VdmQueueInterrupt = 1,
+   VdmDelayInterrupt = 2,
+   VdmInitialize = 3,
+   VdmFeatures = 4,
+   VdmSetInt21Handler = 5,
+   VdmQueryDir = 6,
+   VdmPrinterDirectIoOpen = 7,
+   VdmPrinterDirectIoClose = 8,
+   VdmPrinterInitialize = 9,
+   VdmSetLdtEntries = 10,
+   VdmSetProcessLdtInfo = 11,
+   VdmAdlibEmulation = 12,
+   VdmPMCliControl = 13,
+   VdmQueryVdmProcess = 14,
+} VDMSERVICECLASS;
+
 #ifdef NTOS_MODE_USER
 
 //
@@ -289,6 +341,9 @@
     LARGE_INTEGER SystemExpirationDate;
     ULONG SuiteMask;
     BOOLEAN KdDebuggerEnabled;
+#if (NTDDI_VERSION >= NTDDI_WINXPSP2)
+    UCHAR NXSupportPolicy;
+#endif
     volatile ULONG ActiveConsoleId;
     volatile ULONG DismountCount;
     ULONG ComPlusPackage;
@@ -306,14 +361,85 @@
         volatile ULONG64 TickCountQuad;
     };
     ULONG Cookie;
+#if (NTDDI_VERSION >= NTDDI_WS03)
     LONGLONG ConsoleSessionForegroundProcessId;
     ULONG Wow64SharedInformation[MAX_WOW64_SHARED_ENTRIES];
-    ULONG UserModeGlobalLogging;
+#endif
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    USHORT UserModeGlobalLogger[8];
+    ULONG HeapTracingPid[2];
+    ULONG CritSecTracingPid[2];
+    union
+    {
+        ULONG SharedDataFlags;
+        struct
+        {
+            ULONG DbgErrorPortPresent:1;
+            ULONG DbgElevationEnabled:1;
+            ULONG DbgVirtEnabled:1;
+            ULONG DbgInstallerDetectEnabled:1;
+            ULONG SpareBits:28;
+        };
+    };
+    ULONG ImageFileExecutionOptions;
+    KAFFINITY ActiveProcessorAffinity;
+#endif
 } KUSER_SHARED_DATA, *PKUSER_SHARED_DATA;
 
+//
+// VDM Structures
+//
+#include "pshpack1.h"
+typedef struct _VdmVirtualIca
+{
+    LONG ica_count[8];
+    LONG ica_int_line;
+    LONG ica_cpu_int;
+    USHORT ica_base;
+    USHORT ica_hipiri;
+    USHORT ica_mode;
+    UCHAR ica_master;
+    UCHAR ica_irr;
+    UCHAR ica_isr;
+    UCHAR ica_imr;
+    UCHAR ica_ssr;
+} VDMVIRTUALICA, *PVDMVIRTUALICA;
+#include "poppack.h"
+
+typedef struct _VdmIcaUserData
+{
+    PVOID pIcaLock;
+    PVDMVIRTUALICA pIcaMaster;
+    PVDMVIRTUALICA pIcaSlave;
+    PULONG pDelayIrq;
+    PULONG pUndelayIrq;
+    PULONG pDelayIret;
+    PULONG pIretHooked;
+    PULONG pAddrIretBopTable;
+    PHANDLE phWowIdleEvent;
+    PLARGE_INTEGER pIcaTimeout;
+    PHANDLE phMainThreadSuspended;
+} VDMICAUSERDATA, *PVDMICAUSERDATA;
+
+typedef struct _VDM_INITIALIZE_DATA
+{
+    PVOID TrapcHandler;
+    PVDMICAUSERDATA IcaUserData;
+} VDM_INITIALIZE_DATA, *PVDM_INITIALIZE_DATA;
+
 #else
 
 //
+// System Thread Start Routine
+//
+typedef
+VOID
+(NTAPI *PKSYSTEM_ROUTINE)(
+    PKSTART_ROUTINE StartRoutine,
+    PVOID StartContext
+);
+
+//
 // APC Environment Types
 //
 typedef enum _KAPC_ENVIRONMENT
@@ -324,6 +450,17 @@
 } KAPC_ENVIRONMENT;
 
 //
+// CPU Cache Types
+//
+typedef enum _PROCESSOR_CACHE_TYPE
+{
+    CacheUnified,
+    CacheInstruction,
+    CacheData,
+    CacheTrace,
+} PROCESSOR_CACHE_TYPE;
+
+//
 // PRCB DPC Data
 //
 typedef struct _KDPC_DATA
@@ -344,6 +481,18 @@
 } PP_LOOKASIDE_LIST, *PPP_LOOKASIDE_LIST;
 
 //
+// CPU Cache Descriptor
+//
+typedef struct _CACHE_DESCRIPTOR
+{
+    UCHAR Level;
+    UCHAR Associativity;
+    USHORT LineSize;
+    ULONG Size;
+    PROCESSOR_CACHE_TYPE Type;
+} CACHE_DESCRIPTOR, *PCACHE_DESCRIPTOR;
+
+//
 // Architectural Types
 //
 #include <arch/ketypes.h>
@@ -351,11 +500,12 @@
 //
 // Kernel Memory Node
 //
+#include <pshpack1.h>
 typedef struct _KNODE
 {
     SLIST_HEADER DeadStackList;
     SLIST_HEADER PfnDereferenceSListHead;
-    ULONG ProcessorMask;
+    KAFFINITY ProcessorMask;
     ULONG Color;
     UCHAR Seed;
     UCHAR NodeNumber;
@@ -364,6 +514,7 @@
     ULONG FreeCount[2];
     struct _SINGLE_LIST_ENTRY *PfnDeferredList;
 } KNODE, *PKNODE;
+#include <poppack.h>
 
 //
 // Kernel Profile Object
@@ -393,6 +544,10 @@
     CSHORT Size;
     LIST_ENTRY InterruptListEntry;
     PKSERVICE_ROUTINE ServiceRoutine;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    PKSERVICE_ROUTINE MessageServiceRoutine;
+    ULONG MessageIndex;
+#endif
     PVOID ServiceContext;
     KSPIN_LOCK SpinLock;
     ULONG TickCount;
@@ -406,9 +561,15 @@
     CHAR Number;
     UCHAR ShareVector;
     KINTERRUPT_MODE Mode;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    KINTERRUPT_POLARITY Polarity;
+#endif
     ULONG ServiceCount;
     ULONG DispatchCount;
-    ULONG DispatchCode[106];
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    ULONGLONG Rsvd1;
+#endif
+    ULONG DispatchCode[KINTERRUPT_DISPATCH_CODES];
 } KINTERRUPT, *PKINTERRUPT;
 
 //
@@ -475,179 +636,236 @@
 #include <pshpack1.h>
 typedef struct _KTHREAD
 {
-    DISPATCHER_HEADER DispatcherHeader;                 /* 00 */
-    LIST_ENTRY MutantListHead;                          /* 10 */
-    PVOID InitialStack;                                 /* 18 */
-    ULONG_PTR StackLimit;                               /* 1C */
-    PVOID KernelStack;                                  /* 20 */
-    KSPIN_LOCK ThreadLock;                              /* 24 */
-    union                                               /* 28 */
-    {                                                   /* 28 */
-        KAPC_STATE ApcState;                            /* 34 */
-        struct                                          /* 28 */
-        {                                               /* 28 */
-            UCHAR ApcStateFill[23];                     /* 34 */
-            UCHAR ApcQueueable;                         /* 3F */
-        };                                              /* 3F */
-    };                                                  /* 3F */
-    UCHAR NextProcessor;                                /* 40 */
-    UCHAR DeferredProcessor;                            /* 41 */
-    UCHAR AdjustReason;                                 /* 42 */
-    UCHAR AdjustIncrement;                              /* 43 */
-    KSPIN_LOCK ApcQueueLock;                            /* 44 */
-    ULONG ContextSwitches;                              /* 48 */
-    UCHAR State;                                        /* 4C */
-    UCHAR NpxState;                                     /* 4D */
-    UCHAR WaitIrql;                                     /* 4E */
-    UCHAR WaitMode;                                     /* 4F */
-    LONG WaitStatus;                                    /* 50 */
-    union                                               /* 54 */
-    {                                                   /* 54 */
-        PKWAIT_BLOCK WaitBlockList;                     /* 54 */
-        PKGATE GateObject;                              /* 54 */
-    };                                                  /* 54 */
-    UCHAR Alertable;                                    /* 58 */
-    UCHAR WaitNext;                                     /* 59 */
-    UCHAR WaitReason;                                   /* 5A */
-    UCHAR Priority;                                     /* 5B */
-    UCHAR EnableStackSwap;                              /* 5C */
-    UCHAR SwapBusy;                                     /* 5D */
-    UCHAR Alerted[2];                                   /* 5E */
-    union                                               /* 60 */
-    {                                                   /* 60 */
-        LIST_ENTRY WaitListEntry;                       /* 60 */
-        SINGLE_LIST_ENTRY SwapListEntry;                /* 60 */
-    };                                                  /* 68 */
-    PKQUEUE Queue;                                      /* 68 */
-    ULONG WaitTime;                                     /* 6C */
-    union                                               /* 70 */
-    {                                                   /* 70 */
-        struct                                          /* 70 */
-        {                                               /* 70 */
-            USHORT KernelApcDisable;                    /* 70 */
-            USHORT SpecialApcDisable;                   /* 72 */
-        };                                              /* 70 */
-        ULONG CombinedApcDisable;                       /* 70 */
-    };                                                  /* 74 */
-    struct _TEB *Teb;                                   /* 74 */
-    union                                               /* 78 */
-    {                                                   /* 78 */
-        KTIMER Timer;                                   /* 78 */
-        UCHAR TimerFill[40];                            /* 78 */
-    };                                                  /* 78 */
-    union                                               /* A0 */
-    {                                                   /* A0 */
-        struct                                          /* A0 */
-        {                                               /* A0 */
-            LONG AutoAlignment:1;                       /* A0 */
-            LONG DisableBoost:1;                        /* A0 */
-            LONG ReservedFlags:30;                      /* A0 */
-        };                                              /* A0 */
-        LONG ThreadFlags;                               /* A0 */
-    };                                                  /* A0 */
-    PVOID Padding;                                      /* A4 */
-    union                                               /* A8 */
-    {                                                   /* A8 */
-        KWAIT_BLOCK WaitBlock[4];                       /* A8 */
-        union                                           /* A8 */
-        {                                               /* A8 */
-            struct                                      /* A8 */
-            {                                           /* A8 */
-                UCHAR WaitBlockFill0[23];               /* A8 */
-                UCHAR SystemAffinityActive;             /* BF */
-            };                                          /* A8 */
-            struct                                      /* A8 */
-            {                                           /* A8 */
-                UCHAR WaitBlockFill1[47];               /* A8 */
-                UCHAR PreviousMode;                     /* D7 */
-            };                                          /* A8 */
-            struct                                      /* A8 */
-            {                                           /* A8 */
-                UCHAR WaitBlockFill2[71];               /* A8 */
-                UCHAR ResourceIndex;                    /* EF */
-            };                                          /* A8 */
-            struct                                      /* A8 */
-            {                                           /* A8 */
-                UCHAR WaitBlockFill3[95];               /* A8 */
-                UCHAR LargeStack;                       /* 107 */
-            };                                          /* A8 */
-        };                                              /* A8 */
-    };                                                  /* A8 */
-    LIST_ENTRY QueueListEntry;                          /* 108 */
-    PKTRAP_FRAME TrapFrame;                             /* 110 */
-    PVOID CallbackStack;                                /* 114 */
-    PVOID ServiceTable;                                 /* 118 */
-    UCHAR ApcStateIndex;                                /* 11C */
-    UCHAR IdealProcessor;                               /* 11D */
-    UCHAR Preempted;                                    /* 11E */
-    UCHAR ProcessReadyQueue;                            /* 11F */
-    UCHAR KernelStackResident;                          /* 120 */
-    CHAR BasePriority;                                  /* 121 */
-    CHAR PriorityDecrement;                             /* 122 */
-    CHAR Saturation;                                    /* 123 */
-    KAFFINITY UserAffinity;                             /* 124 */
-    struct _KPROCESS *Process;                          /* 128 */
-    KAFFINITY Affinity;                                 /* 12C */
-    PKAPC_STATE ApcStatePointer[2];                     /* 130 */
-    union                                               /* 138 */
-    {                                                   /* 138 */
-        KAPC_STATE SavedApcState;                       /* 138 */
-        union                                           /* 138 */
-        {                                               /* 138 */
-            UCHAR SavedApcStateFill[23];                /* 138 */
-            CHAR FreezeCount;                           /* 14F */
-        };                                              /* 138 */
-    };                                                  /* 138 */
-    CHAR SuspendCount;                                  /* 150 */
-    UCHAR UserIdealProcessor;                           /* 151 */
-    UCHAR CalloutActive;                                /* 152 */
-    UCHAR Iopl;                                         /* 153 */
-    PVOID Win32Thread;                                  /* 154 */
-    PVOID StackBase;                                    /* 158 */
-    union                                               /* 15C */
-    {                                                   /* 15C */
-        KAPC SuspendApc;                                /* 15C */
-        union                                           /* 15C */
-        {                                               /* 15C */
-            UCHAR SuspendApcFill0[1];                   /* 15C */
-            CHAR Quantum;                               /* 15D */
-        };                                              /* 15C */
-        union                                           /* 15C */
-        {                                               /* 15C */
-            UCHAR SuspendApcFill1[3];                   /* 15C */
-            UCHAR QuantumReset;                         /* 15F */
-        };                                              /* 15C */
-        union                                           /* 15C */
-        {                                               /* 15C */
-            UCHAR SuspendApcFill2[4];                   /* 15C */
-            ULONG KernelTime;                           /* 160 */
-        };                                              /* 15C */
-        union                                           /* 15C */
-        {                                               /* 15C */
-            UCHAR SuspendApcFill3[36];                  /* 15C */
-            PVOID TlsArray;                             /* 180 */
-        };                                              /* 15C */
-        union                                           /* 15C */
-        {                                               /* 15C */
-            UCHAR SuspendApcFill4[40];                  /* 15C */
-            PVOID LegoData;                             /* 184 */
-        };                                              /* 15C */
-        union                                           /* 15C */
-        {                                               /* 15C */
-            UCHAR SuspendApcFill5[47];                  /* 15C */
-            UCHAR PowerState;                           /* 18B */
-        };                                              /* 15C */
-    };                                                  /* 15C */
-    ULONG UserTime;                                     /* 18C */
-    union                                               /* 190 */
-    {                                                   /* 190 */
-        KSEMAPHORE SuspendSemaphore;                    /* 190 */
-        UCHAR SuspendSemaphorefill[20];                 /* 190 */
-    };                                                  /* 190 */
-    ULONG SListFaultCount;                              /* 1A4 */
-    LIST_ENTRY ThreadListEntry;                         /* 1A8 */
-    PVOID SListFaultAddress;                            /* 1B0 */
-} KTHREAD;                                              /* sizeof: 1B4 */
+    DISPATCHER_HEADER DispatcherHeader;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    ULONGLONG CycleTime;
+    ULONG HighCycleTime;
+#else
+    LIST_ENTRY MutantListHead;
+#endif
+    PVOID InitialStack;
+    ULONG_PTR StackLimit;
+    PVOID KernelStack;
+    KSPIN_LOCK ThreadLock;
+    union
+    {
+        KAPC_STATE ApcState;
+        struct
+        {
+            UCHAR ApcStateFill[23];
+            UCHAR ApcQueueable;
+        };
+    };
+    UCHAR NextProcessor;
+    UCHAR DeferredProcessor;
+    UCHAR AdjustReason;
+    UCHAR AdjustIncrement;
+    KSPIN_LOCK ApcQueueLock;
+    ULONG ContextSwitches;
+    UCHAR State;
+    UCHAR NpxState;
+    UCHAR WaitIrql;
+    UCHAR WaitMode;
+    LONG WaitStatus;
+    union
+    {
+        PKWAIT_BLOCK WaitBlockList;
+        PKGATE GateObject;
+    };
+    UCHAR Alertable;
+    UCHAR WaitNext;
+    UCHAR WaitReason;
+    UCHAR Priority;
+    UCHAR EnableStackSwap;
+    UCHAR SwapBusy;
+    UCHAR Alerted[2];
+    union
+    {
+        LIST_ENTRY WaitListEntry;
+        SINGLE_LIST_ENTRY SwapListEntry;
+    };
+    PKQUEUE Queue;
+    ULONG WaitTime;
+    union
+    {
+        struct
+        {
+            USHORT KernelApcDisable;
+            USHORT SpecialApcDisable;
+        };
+        ULONG CombinedApcDisable;
+    };
+    struct _TEB *Teb;
+    union
+    {
+        KTIMER Timer;
+        UCHAR TimerFill[40];
+    };
+    union
+    {
+        struct
+        {
+            LONG AutoAlignment:1;
+            LONG DisableBoost:1;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+            LONG EtwStackTrace1ApcInserted:1;
+            LONG EtwStackTrace2ApcInserted:1;
+            LONG CycleChargePending:1;
+            LONG ReservedFlags:27;
+#else
+            LONG ReservedFlags:30;
+#endif
+        };
+        LONG ThreadFlags;
+    };
+    PVOID Padding;
+    union
+    {
+        KWAIT_BLOCK WaitBlock[4];
+        union
+        {
+            struct
+            {
+                UCHAR WaitBlockFill0[23];
+                UCHAR SystemAffinityActive;
+            };
+            struct
+            {
+                UCHAR WaitBlockFill1[47];
+                UCHAR PreviousMode;
+            };
+            struct
+            {
+                UCHAR WaitBlockFill2[71];
+                UCHAR ResourceIndex;
+            };
+            struct
+            {
+                UCHAR WaitBlockFill3[95];
+                UCHAR LargeStack;
+            };
+        };
+    };
+    LIST_ENTRY QueueListEntry;
+    PKTRAP_FRAME TrapFrame;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    PVOID FirstArgument;
+#endif
+    PVOID CallbackStack;
+    PVOID ServiceTable;
+    UCHAR ApcStateIndex;
+    UCHAR IdealProcessor;
+    UCHAR Preempted;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    UCHAR CalloutActive;
+#else
+    UCHAR ProcessReadyQueue;
+#endif
+    UCHAR KernelStackResident;
+    CHAR BasePriority;
+    CHAR PriorityDecrement;
+    CHAR Saturation;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    ULONG SystemCallNumber;
+    union
+    {
+        struct
+        {
+            ULONG Reserved0:1;
+            ULONG ReadyTransition:1;
+            ULONG ProcessReadyQueue:1;
+            ULONG Reserved2:1;
+            ULONG Reserved3:28;
+        };
+        LONG MiscFlags;
+    };
+#endif
+    KAFFINITY UserAffinity;
+    struct _KPROCESS *Process;
+    KAFFINITY Affinity;
+    PKAPC_STATE ApcStatePointer[2];
+    union
+    {
+        KAPC_STATE SavedApcState;
+        union
+        {
+            UCHAR SavedApcStateFill[23];
+            CHAR FreezeCount;
+        };
+    };
+    CHAR SuspendCount;
+    UCHAR UserIdealProcessor;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    union
+    {
+        struct
+        {
+            UCHAR ReservedBits0:1;
+            UCHAR SegmentsPresent:1;
+            UCHAR Reservedbits1:1;
+        };
+        UCHAR NestedStateFlags;
+    };
+#else
+    UCHAR CalloutActive;
+#endif
+    UCHAR Iopl;
+    PVOID Win32Thread;
+    PVOID StackBase;
+    union
+    {
+        KAPC SuspendApc;
+        struct
+        {
+            UCHAR SuspendApcFill0[1];
+            CHAR Quantum;
+        };
+        struct
+        {
+            UCHAR SuspendApcFill1[3];
+            UCHAR QuantumReset;
+        };
+        struct
+        {
+            UCHAR SuspendApcFill2[4];
+            ULONG KernelTime;
+        };
+        struct
+        {
+            UCHAR SuspendApcFill3[36];
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+            PKPRCB WaitPrcb;
+#else
+            PVOID TlsArray;
+#endif
+        };
+        struct
+        {
+            UCHAR SuspendApcFill4[40];
+            PVOID LegoData;
+        };
+        struct
+        {
+            UCHAR SuspendApcFill5[47];
+            UCHAR PowerState;
+        };
+    };
+    ULONG UserTime;
+    union
+    {
+        KSEMAPHORE SuspendSemaphore;
+        UCHAR SuspendSemaphorefill[20];
+    };
+    ULONG SListFaultCount;
+    LIST_ENTRY ThreadListEntry;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    LIST_ENTRY MutantListHead;
+#endif
+    PVOID SListFaultAddress;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    PVOID MdlForLockedteb;
+#endif
+} KTHREAD;
 #include <poppack.h>
 
 //
@@ -655,46 +873,55 @@
 //
 typedef struct _KPROCESS
 {
-    DISPATCHER_HEADER     Header;                    /* 000 */
-    LIST_ENTRY            ProfileListHead;           /* 010 */
-    PHYSICAL_ADDRESS      DirectoryTableBase;        /* 018 */
+    DISPATCHER_HEADER Header;
+    LIST_ENTRY ProfileListHead;
+    PHYSICAL_ADDRESS DirectoryTableBase;
 #if defined(_M_IX86)
-    KGDTENTRY             LdtDescriptor;             /* 020 */
-    KIDTENTRY             Int21Descriptor;           /* 028 */
-    USHORT                IopmOffset;                /* 030 */
-    UCHAR                 Iopl;                      /* 032 */
-    UCHAR                 Unused;                    /* 033 */
+    KGDTENTRY LdtDescriptor;
+    KIDTENTRY Int21Descriptor;
+    USHORT IopmOffset;
+    UCHAR Iopl;
+    UCHAR Unused;
 #endif
-    ULONG                 ActiveProcessors;          /* 034 */
-    ULONG                 KernelTime;                /* 038 */
-    ULONG                 UserTime;                  /* 03C */
-    LIST_ENTRY            ReadyListHead;             /* 040 */
-    LIST_ENTRY            SwapListEntry;             /* 048 */
-    PVOID                 VdmTrapcHandler;           /* 04C */
-    LIST_ENTRY            ThreadListHead;            /* 050 */
-    KSPIN_LOCK            ProcessLock;               /* 058 */
-    KAFFINITY             Affinity;                  /* 05C */
+    ULONG ActiveProcessors;
+    ULONG KernelTime;
+    ULONG UserTime;
+    LIST_ENTRY ReadyListHead;
+    SINGLE_LIST_ENTRY SwapListEntry;
+    PVOID VdmTrapcHandler;
+    LIST_ENTRY ThreadListHead;
+    KSPIN_LOCK ProcessLock;
+    KAFFINITY Affinity;
     union
     {
         struct
         {
-            ULONG         AutoAlignment:1;           /* 060.0 */
-            ULONG         DisableBoost:1;            /* 060.1 */
-            ULONG         DisableQuantum:1;          /* 060.2 */
-            ULONG         ReservedFlags:29;          /* 060.3 */
+            ULONG AutoAlignment:1;
+            ULONG DisableBoost:1;
+            ULONG DisableQuantum:1;
+            ULONG ReservedFlags:29;
         };
-        ULONG             ProcessFlags;              /* 060 */
+        ULONG ProcessFlags;
     };
-    CHAR                  BasePriority;              /* 064 */
-    CHAR                  QuantumReset;              /* 065 */
-    UCHAR                 State;                     /* 066 */
-    UCHAR                 ThreadSeed;                /* 067 */
-    UCHAR                 PowerState;                /* 068 */
-    UCHAR                 IdealNode;                 /* 069 */
-    UCHAR                 Visited;                   /* 06A */
-    KEXECUTE_OPTIONS      Flags;                     /* 06B */
-    ULONG                 StackCount;                /* 06C */
-    LIST_ENTRY            ProcessListEntry;          /* 070 */
+    CHAR BasePriority;
+    CHAR QuantumReset;
+    UCHAR State;
+    UCHAR ThreadSeed;
+    UCHAR PowerState;
+    UCHAR IdealNode;
+    UCHAR Visited;
+    union
+    {
+        KEXECUTE_OPTIONS Flags;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+        UCHAR ExecuteOptions;
+#endif
+    };
+    ULONG StackCount;
+    LIST_ENTRY ProcessListEntry;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    ULONGLONG CycleTime;
+#endif
 } KPROCESS, *PKPROCESS;
 
 //
@@ -714,10 +941,10 @@
 //
 // Exported Loader Parameter Block
 //
-#ifdef _REACTOS_
-extern LOADER_PARAMETER_BLOCK NTSYSAPI KeLoaderBlock;
+#ifndef _REACTOS_
+extern struct _LOADER_PARAMETER_BLOCK NTSYSAPI *KeLoaderBlock;
 #else
-extern PLOADER_PARAMETER_BLOCK NTSYSAPI KeLoaderBlock;
+extern struct _ROS_LOADER_PARAMETER_BLOCK NTSYSAPI KeLoaderBlock;
 #endif
 
 //
Index: include/ndk/cmtypes.h
===================================================================
--- include/ndk/cmtypes.h	(revision 21808)
+++ include/ndk/cmtypes.h	(working copy)
@@ -1,4 +1,4 @@
-/*++ NDK Version: 0095
+/*++ NDK Version: 0098
 
 Copyright (c) Alex Ionescu.  All rights reserved.
 
@@ -12,7 +12,7 @@
 
 Author:
 
-    Alex Ionescu (alex.ionescu@reactos.com)   06-Oct-2004
+    Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
 
 --*/
 
@@ -42,6 +42,8 @@
 #define PNP_SET_DEVICE_STATUS           1
 #define PNP_CLEAR_DEVICE_STATUS         2
 
+#ifdef NTOS_MODE_USER
+
 //
 // Resource Type
 //
@@ -59,7 +61,6 @@
 #define CmResourceTypePcCardConfig              130
 #define CmResourceTypeMfCardConfig              131
 
-#ifdef NTOS_MODE_USER
 
 //
 // Resource Descriptor Share Dispositions
@@ -342,7 +343,8 @@
 {
     UNICODE_STRING TargetDeviceInstance;
     ULONG Relation;
-    UNICODE_STRING RelatedDeviceInstance;
+    PWCHAR RelatedDeviceInstance;
+    ULONG RelatedDeviceInstanceLength;
 } PLUGPLAY_CONTROL_RELATED_DEVICE_DATA, *PPLUGPLAY_CONTROL_RELATED_DEVICE_DATA;
 
 // Class 0x0E
@@ -474,6 +476,15 @@
 } CM_RESOURCE_LIST, *PCM_RESOURCE_LIST;
 
 //
+// ROM Block Structure
+//
+typedef struct _CM_ROM_BLOCK
+{
+    ULONG Address;
+    ULONG Size;
+} CM_ROM_BLOCK, *PCM_ROM_BLOCK;
+
+//
 // Disk/INT13 Structures
 //
 typedef struct _CM_INT13_DRIVE_PARAMETER
Index: include/ndk/readme.txt
===================================================================
--- include/ndk/readme.txt	(revision 21808)
+++ include/ndk/readme.txt	(working copy)
@@ -12,7 +12,7 @@
 
 The author, Alex Ionescu, may be reached through the following means:
 
-Email: 	alex.ionescu@reactos.com
+Email: 	alexi@tinykrnl.org
 Mail:	2246, Duvernay. H3J 2Y3. Montreal, QC. CANADA.	
 Phone: 	(514)581-7156
 
@@ -68,6 +68,7 @@
 
 - GNU NTIFS.H, Revision 43
 - W32API, Version 2.5
+- Microsoft Windows Driver Kit
 - Microsoft Driver Development Kit 2003 SP1
 - Microsoft Driver Development Kit 2000
 - Microsoft Driver Development Kit NT 4
@@ -140,24 +141,24 @@
     *  User Mode Application requiring Native Types: 
 
        #define WIN32_NO_STATUS   /* Tell Windows headers you'll use ntstatus.s from NDK */
-       #include <windows.h>      /* Declare Windows Headers like you normally would */
-       #include <ntndk.h>        /* Declare the NDK Headers */
+       #include "windows.h"      /* Declare Windows Headers like you normally would */
+       #include "ntndk.h"        /* Declare the NDK Headers */
 
     * Native Mode Application: 
 
-       #include <windows.h>      /* Declare Windows Headers for basic types. NEEDED UNTIL NDK 1.5 */
-       #include <ntndk.h>        /* Declare the NDK Headers */
+       #include "windows.h"      /* Declare Windows Headers for basic types. NEEDED UNTIL NDK 1.5 */
+       #include "ntndk.h"        /* Declare the NDK Headers */
 
     * Kernel Mode Driver: 
 
-       #include <ntddk.h>       /* Declare DDK Headers like you normally would */
-       #include <ntndk.h>       /* Declare the NDK Headers */
+       #include "ntddk.h"       /* Declare DDK Headers like you normally would */
+       #include "ntndk.h"       /* Declare the NDK Headers */
 
     * You may also include only the files you need (example for User-Mode application):
 
        #define WIN32_NO_STATUS   /* Tell Windows headers you'll use ntstatus.s from NDK */
-       #include <windows.h>      /* Declare Windows Headers like you normally would */
-       #include <rtlfuncs.h>     /* Declare the Rtl* Functions */
+       #include "windows.h"      /* Declare Windows Headers like you normally would */
+       #include "rtlfuncs.h"     /* Declare the Rtl* Functions */
 
 3.3 CAVEATS
 
@@ -167,5 +168,5 @@
       ones. As such, you 'cannot include winternl.h in any project that uses the NDK. Note however, that the NDK fully
       replaces it and retains compatibility with any project that used it.
     * Native programs: Native programs must include "windows.h" until the next release of the NDK (1.5). The upcoming
-      version will automatically detect the lack of missing types and include them. Note however that you will still need
-      to have the PSDK installed.
+      version will automatically detect the lack of missing types and include them. Note however that you will still
+      need to have the PSDK installed.
Index: boot/freeldr/freeldr/reactos/reactos.c
===================================================================
--- boot/freeldr/freeldr/reactos/reactos.c	(revision 21808)
+++ boot/freeldr/freeldr/reactos/reactos.c	(working copy)
@@ -24,7 +24,7 @@
 #define NDEBUG
 #include <debug.h>
 
-LOADER_PARAMETER_BLOCK LoaderBlock;
+ROS_LOADER_PARAMETER_BLOCK LoaderBlock;
 char					reactos_kernel_cmdline[255];	// Command line passed to kernel
 LOADER_MODULE			reactos_modules[64];		// Array to hold boot module info loaded for the kernel
 char					reactos_module_strings[64][256];	// Array to hold module names
Index: boot/freeldr/freeldr/reactos/setupldr.c
===================================================================
--- boot/freeldr/freeldr/reactos/setupldr.c	(revision 21808)
+++ boot/freeldr/freeldr/reactos/setupldr.c	(working copy)
@@ -20,7 +20,7 @@
 
 #include <freeldr.h>
 
-LOADER_PARAMETER_BLOCK LoaderBlock;
+ROS_LOADER_PARAMETER_BLOCK LoaderBlock;
 char					reactos_kernel_cmdline[255];	// Command line passed to kernel
 LOADER_MODULE			reactos_modules[64];		// Array to hold boot module info loaded for the kernel
 char					reactos_module_strings[64][256];	// Array to hold module names
Index: boot/freeldr/freeldr/arch/i386/loader.c
===================================================================
--- boot/freeldr/freeldr/arch/i386/loader.c	(revision 21808)
+++ boot/freeldr/freeldr/arch/i386/loader.c	(working copy)
@@ -101,7 +101,7 @@
 } HARDWARE_PTE_X64, *PHARDWARE_PTE_X64;
 
 typedef struct _PAGE_DIRECTORY_X86 {
-    HARDWARE_PTE_X86 Pde[1024];
+    HARDWARE_PTE Pde[1024];
 } PAGE_DIRECTORY_X86, *PPAGE_DIRECTORY_X86;
 
 typedef struct _PAGE_DIRECTORY_X64 {
Index: boot/freeldr/freeldr/include/freeldr.h
===================================================================
--- boot/freeldr/freeldr/include/freeldr.h	(revision 21808)
+++ boot/freeldr/freeldr/include/freeldr.h	(working copy)
@@ -26,7 +26,10 @@
 #include <stdio.h>
 #include <ctype.h>
 #include <ntddk.h>
-#include <ndk/ntndk.h>
+#include <arc/arc.h>
+#include <ketypes.h>
+#include <mmtypes.h>
+#include <rosldr.h>
 #include <arch.h>
 #include <rtl.h>
 #include <disk.h>
Index: boot/freeldr/freeldr/include/reactos.h
===================================================================
--- boot/freeldr/freeldr/include/reactos.h	(revision 21808)
+++ boot/freeldr/freeldr/include/reactos.h	(working copy)
@@ -49,8 +49,7 @@
 // Loader Functions And Definitions
 //
 ///////////////////////////////////////////////////////////////////////////////////////
- 
-extern LOADER_PARAMETER_BLOCK LoaderBlock; /* Multiboot info structure passed to kernel */
+extern ROS_LOADER_PARAMETER_BLOCK LoaderBlock; /* Multiboot info structure passed to kernel */
 extern char					reactos_kernel_cmdline[255];	// Command line passed to kernel
 extern LOADER_MODULE		reactos_modules[64];		// Array to hold boot module info loaded for the kernel
 extern char					reactos_module_strings[64][256];	// Array to hold module names
@@ -65,6 +64,6 @@
 ULONG_PTR STDCALL FrLdrLoadModule(FILE *ModuleImage, LPCSTR ModuleName, PULONG ModuleSize);
 BOOL STDCALL FrLdrCloseModule(ULONG_PTR ModuleBase, ULONG dwModuleSize);
 VOID STDCALL FrLdrStartup(ULONG Magic);
-typedef VOID (FASTCALL *ASMCODE)(ULONG Magic, PLOADER_PARAMETER_BLOCK LoaderBlock);
+typedef VOID (FASTCALL *ASMCODE)(ULONG Magic, PROS_LOADER_PARAMETER_BLOCK LoaderBlock);
 
 #endif // defined __REACTOS_H
Index: boot/bootdata/txtsetup.sif
===================================================================
--- boot/bootdata/txtsetup.sif	(revision 21808)
+++ boot/bootdata/txtsetup.sif	(working copy)
@@ -37,8 +37,8 @@
 
 [SetupData]
 DefaultPath = \ReactOS
-OsLoadOptions = "/NOGUIBOOT /NODEBUG"
-;OsLoadOptions = "/NOGUIBOOT /DEBUGPORT=COM1 /BAUDRATE=19200 /IRQ=4"
+;OsLoadOptions = "/NOGUIBOOT /NODEBUG"
+OsLoadOptions = "/NOGUIBOOT /DEBUGPORT=COM1 /BREAK"
 ;OsLoadOptions = "/NOGUIBOOT /DEBUGPORT=SCREEN"
 ;OsLoadOptions = "/NOGUIBOOT /DEBUGPORT=BOCHS"
 
Index: hal/hal/hal.c
===================================================================
--- hal/hal/hal.c	(revision 21808)
+++ hal/hal/hal.c	(working copy)
@@ -14,6 +14,8 @@
 #include <ntddk.h>
 #include <ndk/halfuncs.h>
 #include <ndk/kdfuncs.h>
+#include <rosldr.h>
+#include <internal/kd.h>
 
 #define NDEBUG
 #include <debug.h>
@@ -333,7 +335,7 @@
 NTAPI
 HalInitSystem(
   ULONG BootPhase,
-  PLOADER_PARAMETER_BLOCK LoaderBlock)
+  PROS_LOADER_PARAMETER_BLOCK LoaderBlock)
 {
   UNIMPLEMENTED;
 
@@ -344,7 +346,7 @@
 VOID
 NTAPI
 HalInitializeProcessor(ULONG ProcessorNumber,
-                       PLOADER_PARAMETER_BLOCK LoaderBlock)
+                       PROS_LOADER_PARAMETER_BLOCK LoaderBlock)
 {
   UNIMPLEMENTED;
 }
@@ -558,7 +560,7 @@
 VOID
 NTAPI
 IoAssignDriveLetters(
-  PLOADER_PARAMETER_BLOCK LoaderBlock,
+  PROS_LOADER_PARAMETER_BLOCK LoaderBlock,
   PSTRING NtDeviceName,
   PUCHAR NtSystemPath,
   PSTRING NtSystemPathString)
Index: hal/halx86/xbox/display_xbox.c
===================================================================
--- hal/halx86/xbox/display_xbox.c	(revision 21808)
+++ hal/halx86/xbox/display_xbox.c	(working copy)
@@ -284,7 +284,7 @@
 }
 
 VOID FASTCALL
-HalInitializeDisplay (PLOADER_PARAMETER_BLOCK LoaderBlock)
+HalInitializeDisplay (PROS_LOADER_PARAMETER_BLOCK LoaderBlock)
 /*
  * FUNCTION: Initalize the display
  * ARGUMENTS:
Index: hal/halx86/xbox/halinit_xbox.c
===================================================================
--- hal/halx86/xbox/halinit_xbox.c	(revision 21808)
+++ hal/halx86/xbox/halinit_xbox.c	(working copy)
@@ -19,7 +19,7 @@
 /* FUNCTIONS ***************************************************************/
 
 VOID
-HalpInitPhase0(PLOADER_PARAMETER_BLOCK LoaderBlock)
+HalpInitPhase0(PROS_LOADER_PARAMETER_BLOCK LoaderBlock)
 {
   HalpHooks.InitPciBus = HalpXboxInitPciBus;
 
Index: hal/halx86/include/mps.h
===================================================================
--- hal/halx86/include/mps.h	(revision 21808)
+++ hal/halx86/include/mps.h	(working copy)
@@ -9,6 +9,25 @@
 
 #define IRQL2TPR(irql)	    ((irql) >= IPI_LEVEL ? IPI_VECTOR : ((irql) >= PROFILE_LEVEL ? LOCAL_TIMER_VECTOR : ((irql) > DISPATCH_LEVEL ? IRQL2VECTOR(irql) : 0)))
 
+typedef struct _KIRQ_TRAPFRAME
+{
+   ULONG Magic;
+   ULONG Gs;
+   ULONG Fs;
+   ULONG Es;
+   ULONG Ds;
+   ULONG Eax;
+   ULONG Ecx;
+   ULONG Edx;
+   ULONG Ebx;
+   ULONG Esp;
+   ULONG Ebp;
+   ULONG Esi;
+   ULONG Edi;
+   ULONG Eip;
+   ULONG Cs;
+   ULONG Eflags;
+} KIRQ_TRAPFRAME, *PKIRQ_TRAPFRAME;
 
 #if 0
 /* This values are defined in halirql.h */
Index: hal/halx86/include/hal.h
===================================================================
--- hal/halx86/include/hal.h	(revision 21808)
+++ hal/halx86/include/hal.h	(working copy)
@@ -14,12 +14,11 @@
 /* IFS/DDK/NDK Headers */
 #include <ntifs.h>
 #include <ntddk.h>
-#include <ndk/ntndk.h>
+#include <arc/arc.h>
+#include <iotypes.h>
+#include <kefuncs.h>
+#include <rosldr.h>
 
-/* Internal Kernel Headers */
-#include <internal/mm.h>
-#include <internal/ke.h>
-
 #define KPCR_BASE 0xFF000000 // HACK!
 
 /* Internal HAL Headers */
Index: hal/halx86/include/halp.h
===================================================================
--- hal/halx86/include/halp.h	(revision 21808)
+++ hal/halx86/include/halp.h	(working copy)
@@ -8,9 +8,18 @@
 #define HAL_APC_REQUEST	    0
 #define HAL_DPC_REQUEST	    1
 
+//
+// Kernel Debugger Port Definition
+//
+typedef struct _KD_PORT_INFORMATION
+{
+    ULONG ComPort;
+    ULONG BaudRate;
+    ULONG BaseAddress;
+} KD_PORT_INFORMATION, *PKD_PORT_INFORMATION;
+
 /* display.c */
-struct _LOADER_PARAMETER_BLOCK;
-VOID FASTCALL HalInitializeDisplay (struct _LOADER_PARAMETER_BLOCK *LoaderBlock);
+VOID FASTCALL HalInitializeDisplay (struct _ROS_LOADER_PARAMETER_BLOCK *LoaderBlock);
 VOID FASTCALL HalClearDisplay (UCHAR CharAttribute);
 
 /* adapter.c */
@@ -38,7 +47,7 @@
 PVOID HalpMapPhysMemory(ULONG PhysAddr, ULONG Size);
 
 /* Non-generic initialization */
-VOID HalpInitPhase0 (PLOADER_PARAMETER_BLOCK LoaderBlock);
+VOID HalpInitPhase0 (PROS_LOADER_PARAMETER_BLOCK LoaderBlock);
 
 /* sysinfo.c */
 NTSTATUS STDCALL
Index: hal/halx86/up/halinit_up.c
===================================================================
--- hal/halx86/up/halinit_up.c	(revision 21808)
+++ hal/halx86/up/halinit_up.c	(working copy)
@@ -18,7 +18,7 @@
 /* FUNCTIONS ***************************************************************/
 
 VOID
-HalpInitPhase0(PLOADER_PARAMETER_BLOCK LoaderBlock)
+HalpInitPhase0(PROS_LOADER_PARAMETER_BLOCK LoaderBlock)
 {
   HalpInitPICs();
 
Index: hal/halx86/generic/display.c
===================================================================
--- hal/halx86/generic/display.c	(revision 21808)
+++ hal/halx86/generic/display.c	(working copy)
@@ -571,7 +571,7 @@
 /* PRIVATE FUNCTIONS ********************************************************/
 
 VOID FASTCALL
-HalInitializeDisplay (PLOADER_PARAMETER_BLOCK LoaderBlock)
+HalInitializeDisplay (PROS_LOADER_PARAMETER_BLOCK LoaderBlock)
 /*
  * FUNCTION: Initalize the display
  * ARGUMENTS:
Index: hal/halx86/generic/irql.c
===================================================================
--- hal/halx86/generic/irql.c	(revision 21808)
+++ hal/halx86/generic/irql.c	(working copy)
@@ -67,7 +67,7 @@
  * RETURNS: The current irq level
  */
 {
-  return(KeGetCurrentKPCR()->Irql);
+  return(KeGetPcr()->Irql);
 }
 
 VOID HalpInitPICs(VOID)
@@ -136,7 +136,7 @@
     {
       if (HalpPendingInterruptCount[i] > 0)
 	{
-	   KeGetCurrentKPCR()->Irql = (KIRQL)IRQ_TO_DIRQL(i);
+	   KeGetPcr()->Irql = (KIRQL)IRQ_TO_DIRQL(i);
 
            while (HalpPendingInterruptCount[i] > 0)
 	     {
@@ -146,8 +146,8 @@
 	       HalpPendingInterruptCount[i]--;
 	       KiInterruptDispatch2(i + IRQ_BASE, NewIrql);
 	     }
-	   KeGetCurrentKPCR()->Irql--;
-	   HalpEndSystemInterrupt(KeGetCurrentKPCR()->Irql);
+	   KeGetPcr()->Irql--;
+	   HalpEndSystemInterrupt(KeGetPcr()->Irql);
 	}
     }
 
@@ -158,22 +158,22 @@
 {
   if (NewIrql >= PROFILE_LEVEL)
     {
-      KeGetCurrentKPCR()->Irql = NewIrql;
+      KeGetPcr()->Irql = NewIrql;
       return;
     }
   HalpExecuteIrqs(NewIrql);
   if (NewIrql >= DISPATCH_LEVEL)
     {
-      KeGetCurrentKPCR()->Irql = NewIrql;
+      KeGetPcr()->Irql = NewIrql;
       return;
     }
-  KeGetCurrentKPCR()->Irql = DISPATCH_LEVEL;
-  if (((PKIPCR)KeGetCurrentKPCR())->HalReserved[HAL_DPC_REQUEST])
+  KeGetPcr()->Irql = DISPATCH_LEVEL;
+  if (((PKIPCR)KeGetPcr())->HalReserved[HAL_DPC_REQUEST])
     {
-      ((PKIPCR)KeGetCurrentKPCR())->HalReserved[HAL_DPC_REQUEST] = FALSE;
+      ((PKIPCR)KeGetPcr())->HalReserved[HAL_DPC_REQUEST] = FALSE;
       KiDispatchInterrupt();
     }
-  KeGetCurrentKPCR()->Irql = APC_LEVEL;
+  KeGetPcr()->Irql = APC_LEVEL;
   if (NewIrql == APC_LEVEL)
     {
       return;
@@ -183,7 +183,7 @@
     {
       KiDeliverApc(KernelMode, NULL, NULL);
     }
-  KeGetCurrentKPCR()->Irql = PASSIVE_LEVEL;
+  KeGetPcr()->Irql = PASSIVE_LEVEL;
 }
 
 /**********************************************************************
@@ -207,10 +207,10 @@
 {
   DPRINT("KfLowerIrql(NewIrql %d)\n", NewIrql);
   
-  if (NewIrql > KeGetCurrentKPCR()->Irql)
+  if (NewIrql > KeGetPcr()->Irql)
     {
       DbgPrint ("(%s:%d) NewIrql %x CurrentIrql %x\n",
-		__FILE__, __LINE__, NewIrql, KeGetCurrentKPCR()->Irql);
+		__FILE__, __LINE__, NewIrql, KeGetPcr()->Irql);
       KEBUGCHECK(0);
       for(;;);
     }
@@ -266,16 +266,16 @@
   
   DPRINT("KfRaiseIrql(NewIrql %d)\n", NewIrql);
   
-  if (NewIrql < KeGetCurrentKPCR()->Irql)
+  if (NewIrql < KeGetPcr()->Irql)
     {
       DbgPrint ("%s:%d CurrentIrql %x NewIrql %x\n",
-		__FILE__,__LINE__,KeGetCurrentKPCR()->Irql,NewIrql);
+		__FILE__,__LINE__,KeGetPcr()->Irql,NewIrql);
       KEBUGCHECK (0);
       for(;;);
     }
   
-  OldIrql = KeGetCurrentKPCR()->Irql;
-  KeGetCurrentKPCR()->Irql = NewIrql;
+  OldIrql = KeGetPcr()->Irql;
+  KeGetPcr()->Irql = NewIrql;
   return OldIrql;
 }
 
@@ -380,13 +380,13 @@
      WRITE_PORT_UCHAR((PUCHAR)0xa0,0x20);
   }
   
-  if (KeGetCurrentKPCR()->Irql >= Irql)
+  if (KeGetPcr()->Irql >= Irql)
     {
       HalpPendingInterruptCount[irq]++;
       return(FALSE);
     }
-  *OldIrql = KeGetCurrentKPCR()->Irql;
-  KeGetCurrentKPCR()->Irql = Irql;
+  *OldIrql = KeGetPcr()->Irql;
+  KeGetPcr()->Irql = Irql;
 
   return(TRUE);
 }
@@ -461,11 +461,11 @@
   switch (Request)
   {
     case APC_LEVEL:
-      ((PKIPCR)KeGetCurrentKPCR())->HalReserved[HAL_APC_REQUEST] = TRUE;
+      ((PKIPCR)KeGetPcr())->HalReserved[HAL_APC_REQUEST] = TRUE;
       break;
 
     case DISPATCH_LEVEL:
-      ((PKIPCR)KeGetCurrentKPCR())->HalReserved[HAL_DPC_REQUEST] = TRUE;
+      ((PKIPCR)KeGetPcr())->HalReserved[HAL_DPC_REQUEST] = TRUE;
       break;
       
     default:
Index: hal/halx86/generic/timer.c
===================================================================
--- hal/halx86/generic/timer.c	(revision 21808)
+++ hal/halx86/generic/timer.c	(working copy)
@@ -125,9 +125,9 @@
 STDCALL
 KeStallExecutionProcessor(ULONG Microseconds)
 {
-   PKIPCR Pcr = (PKIPCR)KeGetCurrentKPCR();
+   PKIPCR Pcr = (PKIPCR)KeGetPcr();
 
-   if (Pcr->PrcbData.FeatureBits & X86_FEATURE_TSC)
+   if (Pcr->PrcbData.FeatureBits & KF_RDTSC)
    {
       LARGE_INTEGER EndCount, CurrentCount;
       Ki386RdTSC(EndCount);
@@ -201,14 +201,14 @@
     }
 
   UdelayCalibrated = TRUE;
-  Pcr = (PKIPCR)KeGetCurrentKPCR();
+  Pcr = (PKIPCR)KeGetPcr();
 
   /* Initialise timer interrupt with MILLISEC ms interval        */
   WRITE_PORT_UCHAR((PUCHAR) TMR_CTRL, TMR_SC0 | TMR_BOTH | TMR_MD2);  /* binary, mode 2, LSB/MSB, ch 0 */
   WRITE_PORT_UCHAR((PUCHAR) TMR_CNT0, LATCH & 0xff); /* LSB */
   WRITE_PORT_UCHAR((PUCHAR) TMR_CNT0, LATCH >> 8); /* MSB */
 
-  if (Pcr->PrcbData.FeatureBits & X86_FEATURE_TSC)
+  if (Pcr->PrcbData.FeatureBits & KF_RDTSC)
   {
       
      WaitFor8254Wraparound();
@@ -325,9 +325,9 @@
   Ki386SaveFlags(Flags);
   Ki386DisableInterrupts();
 
-  Pcr = (PKIPCR)KeGetCurrentKPCR();
+  Pcr = (PKIPCR)KeGetPcr();
 
-  if (Pcr->PrcbData.FeatureBits & X86_FEATURE_TSC)
+  if (Pcr->PrcbData.FeatureBits & KF_RDTSC)
   {
      Ki386RestoreFlags(Flags);
      if (NULL != PerformanceFreq)
Index: hal/halx86/generic/spinlock.c
===================================================================
--- hal/halx86/generic/spinlock.c	(revision 21808)
+++ hal/halx86/generic/spinlock.c	(working copy)
@@ -91,7 +91,7 @@
  */
 KIRQL
 FASTCALL
-KeAcquireQueuedSpinLockRaiseToSynch(IN PKLOCK_QUEUE_HANDLE LockHandle)
+KeAcquireQueuedSpinLockRaiseToSynch(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber)
 {
     /* Simply raise to dispatch */
     return KfRaiseIrql(DISPATCH_LEVEL);
Index: hal/halx86/generic/halinit.c
===================================================================
--- hal/halx86/generic/halinit.c	(revision 21808)
+++ hal/halx86/generic/halinit.c	(working copy)
@@ -33,17 +33,17 @@
 
 BOOLEAN STDCALL
 HalInitSystem (ULONG BootPhase,
-               PLOADER_PARAMETER_BLOCK LoaderBlock)
+               PROS_LOADER_PARAMETER_BLOCK LoaderBlock)
 {
   if (BootPhase == 0)
     {
       RtlZeroMemory(&HalpHooks, sizeof(HALP_HOOKS));
-      HalpInitPhase0(LoaderBlock);      
+      HalpInitPhase0((PROS_LOADER_PARAMETER_BLOCK)LoaderBlock);      
     }
   else if (BootPhase == 1)
     {
       /* Initialize display and make the screen black */
-      HalInitializeDisplay (LoaderBlock);
+      HalInitializeDisplay ((PROS_LOADER_PARAMETER_BLOCK)LoaderBlock);
       HalpInitBusHandlers();
       HalpInitDma();
 
Index: hal/halx86/mp/halinit_mp.c
===================================================================
--- hal/halx86/mp/halinit_mp.c	(revision 21808)
+++ hal/halx86/mp/halinit_mp.c	(working copy)
@@ -22,7 +22,7 @@
 
 /***************************************************************************/
 VOID
-HalpInitPhase0(PLOADER_PARAMETER_BLOCK LoaderBlock)
+HalpInitPhase0(PROS_LOADER_PARAMETER_BLOCK LoaderBlock)
 
 {
    static BOOLEAN MPSInitialized = FALSE;
Index: hal/halx86/mp/mpsirql.c
===================================================================
--- hal/halx86/mp/mpsirql.c	(revision 21808)
+++ hal/halx86/mp/mpsirql.c	(working copy)
@@ -39,7 +39,7 @@
       DPRINT1 ("CurrentIrql %x\n", irql);
       KEBUGCHECK (0);
     }
-  if (Flags & X86_EFLAGS_IF)
+  if (Flags & EFLAGS_INTERRUPT_MASK)
     {
       Ki386EnableInterrupts();
     }
@@ -62,7 +62,7 @@
   Ki386SaveFlags(Flags);
   Ki386DisableInterrupts();
   Ki386WriteFsByte(FIELD_OFFSET(KPCR, Irql), NewIrql);
-  if (Flags & X86_EFLAGS_IF)
+  if (Flags & EFLAGS_INTERRUPT_MASK)
     {
       Ki386EnableInterrupts();
     }
@@ -90,7 +90,7 @@
           Ki386WriteFsByte(FIELD_OFFSET(KIPCR, HalReserved[HAL_DPC_REQUEST]), 0);
           Ki386EnableInterrupts();
           KiDispatchInterrupt();
-          if (!(Flags & X86_EFLAGS_IF))
+          if (!(Flags & EFLAGS_INTERRUPT_MASK))
             {
               Ki386DisableInterrupts();
             }
@@ -106,7 +106,7 @@
     {
       Ki386EnableInterrupts();
       KiDeliverApc(KernelMode, NULL, NULL);
-      if (!(Flags & X86_EFLAGS_IF))
+      if (!(Flags & EFLAGS_INTERRUPT_MASK))
         {
           Ki386DisableInterrupts();
         }
@@ -207,7 +207,7 @@
       APICWrite (APIC_TPR, IRQL2TPR(NewIrql) & APIC_TPR_PRI);
     }
   KeSetCurrentIrql (NewIrql);
-  if (Flags & X86_EFLAGS_IF)
+  if (Flags & EFLAGS_INTERRUPT_MASK)
     {
       Ki386EnableInterrupts();
     }
@@ -305,7 +305,7 @@
   }
 
   Ki386SaveFlags(Flags);
-  if (Flags & X86_EFLAGS_IF)
+  if (Flags & EFLAGS_INTERRUPT_MASK)
   {
      DPRINT1("HalBeginSystemInterrupt was called with interrupt's enabled\n");
      KEBUGCHECK(0);
@@ -327,7 +327,7 @@
   ULONG Flags;
   Ki386SaveFlags(Flags);
 
-  if (Flags & X86_EFLAGS_IF)
+  if (Flags & EFLAGS_INTERRUPT_MASK)
   {
      DPRINT1("HalEndSystemInterrupt was called with interrupt's enabled\n");
      KEBUGCHECK(0);
Index: hal/halx86/mp/apic.c
===================================================================
--- hal/halx86/mp/apic.c	(revision 21808)
+++ hal/halx86/mp/apic.c	(working copy)
@@ -28,9 +28,10 @@
 /* INCLUDE ***********************************************************************/
 
 #include <hal.h>
+#include <halfuncs.h> /* Not in PCH because only used for MP HAL */
+#include <rtlfuncs.h> /* Not in PCH because only used for MP HAL */
 #define NDEBUG
 #include <debug.h>
-#include <internal/ntoskrnl.h>
 
 /* GLOBALS ***********************************************************************/
 
@@ -809,7 +810,7 @@
    CPU = ThisCPU();
    if ((Count[CPU] % 100) == 0)
    {
-     DbgPrint("(%s:%d) MpsTimerHandler on CPU%d, irql = %d, epi = %x, KPCR = %x\n", __FILE__, __LINE__, CPU, oldIrql,Trapframe->Eip, KeGetCurrentKPCR());
+     DbgPrint("(%s:%d) MpsTimerHandler on CPU%d, irql = %d, epi = %x, KPCR = %x\n", __FILE__, __LINE__, CPU, oldIrql,Trapframe->Eip, KeGetPcr());
    }
    Count[CPU]++;
 #endif
@@ -862,7 +863,7 @@
 
    APICSetupLVTT(1000000000);
 
-   TSCPresent = ((PKIPCR)KeGetCurrentKPCR())->PrcbData.FeatureBits & X86_FEATURE_TSC ? TRUE : FALSE;
+   TSCPresent = ((PKIPCR)KeGetPcr())->PrcbData.FeatureBits & KF_RDTSC ? TRUE : FALSE;
 
    /*
     * The timer chip counts down to zero. Let's wait
@@ -891,7 +892,7 @@
       DPRINT("CPU clock speed is %ld.%04ld MHz.\n",
 	     CPUMap[CPU].CoreSpeed/1000000,
 	     CPUMap[CPU].CoreSpeed%1000000);
-      ((PKIPCR)KeGetCurrentKPCR())->PrcbData.MHz = CPUMap[CPU].CoreSpeed/1000000;
+      ((PKIPCR)KeGetPcr())->PrcbData.MHz = CPUMap[CPU].CoreSpeed/1000000;
    }
 
    CPUMap[CPU].BusSpeed = (HZ * (long)(tt1 - tt2) * APIC_DIVISOR);
@@ -919,7 +920,7 @@
   Access.SystemSegmentFlag = 0;
   Access.SegmentType = I386_INTERRUPT_GATE;
   
-  idt = (KIDTENTRY*)((ULONG)KeGetCurrentKPCR()->IDT + index * sizeof(KIDTENTRY));
+  idt = (KIDTENTRY*)((ULONG)KeGetPcr()->IDT + index * sizeof(KIDTENTRY));
   idt->Offset = address & 0xffff;
   idt->Selector = KGDT_R0_CODE;
   idt->Access = Access.Value;
@@ -1037,11 +1038,11 @@
    /* Write the location of the AP stack */
    Common->Stack = (ULONG)Stack;
    /* Write the page directory page */
-   Ke386GetPageTableDirectory(Common->PageDirectory);
+   Common->PageDirectory = __readcr3();
    /* Write the kernel entry point */
    Common->NtProcessStartup = (ULONG_PTR)RtlImageNtHeader((PVOID)KernelBase)->OptionalHeader.AddressOfEntryPoint + KernelBase;
    /* Write the state of the mae mode */
-   Common->PaeModeEnabled = Ke386GetCr4() & X86_CR4_PAE ? 1 : 0;
+   Common->PaeModeEnabled = __readcr4() & CR4_PAE ? 1 : 0;
 
    DPRINT1("%x %x %x %x\n", Common->Stack, Common->PageDirectory, Common->NtProcessStartup, Common->PaeModeEnabled);
 
Index: lib/epsapi/enum/drivers.c
===================================================================
--- lib/epsapi/enum/drivers.c	(revision 21808)
+++ lib/epsapi/enum/drivers.c	(working copy)
@@ -28,7 +28,7 @@
 PsaEnumerateSystemModules(IN PSYSMOD_ENUM_ROUTINE Callback,
                           IN OUT PVOID CallbackContext)
 {
-  PSYSTEM_MODULE_INFORMATION psmModules;
+  PRTL_PROCESS_MODULES psmModules;
   NTSTATUS Status = STATUS_SUCCESS;
 
 #if 0
@@ -65,10 +65,10 @@
 }
 
 NTSTATUS NTAPI
-PsaCaptureSystemModules(OUT PSYSTEM_MODULE_INFORMATION *SystemModules)
+PsaCaptureSystemModules(OUT PRTL_PROCESS_MODULES *SystemModules)
 {
   SIZE_T nSize = 0;
-  PSYSTEM_MODULE_INFORMATION psmModules = NULL;
+  PRTL_PROCESS_MODULES psmModules = NULL;
   NTSTATUS Status;
 
 #if 0
@@ -94,8 +94,8 @@
      minimize memory operations that could be expensive, or fragment the
      pool/heap, we try to determine the buffer size in advance, knowing that
      the number of elements is unlikely to change */
-  nSize = sizeof(SYSTEM_MODULE_INFORMATION) +
-          (nSize * sizeof(SYSTEM_MODULE_INFORMATION));
+  nSize = sizeof(RTL_PROCESS_MODULES) +
+          (nSize * sizeof(RTL_PROCESS_MODULES));
 
   psmModules = NULL;
 
@@ -157,7 +157,7 @@
 }
 
 NTSTATUS NTAPI
-PsaWalkSystemModules(IN PSYSTEM_MODULE_INFORMATION SystemModules,
+PsaWalkSystemModules(IN PRTL_PROCESS_MODULES SystemModules,
                      IN PSYSMOD_ENUM_ROUTINE Callback,
                      IN OUT PVOID CallbackContext)
 {
@@ -165,10 +165,10 @@
   NTSTATUS Status;
 
   /* repeat until all modules have been returned */
-  for(i = 0; i < SystemModules->Count; i++)
+  for(i = 0; i < SystemModules->NumberOfModules; i++)
   {
     /* return current module to the callback */
-    Status = Callback(&(SystemModules->Module[i]), CallbackContext);
+    Status = Callback(&(SystemModules->Modules[i]), CallbackContext);
   
     if(!NT_SUCCESS(Status))
     {
@@ -179,18 +179,18 @@
   return STATUS_SUCCESS;
 }
 
-PSYSTEM_MODULE_INFORMATION_ENTRY FASTCALL
-PsaWalkFirstSystemModule(IN PSYSTEM_MODULE_INFORMATION SystemModules)
+PRTL_PROCESS_MODULE_INFORMATION FASTCALL
+PsaWalkFirstSystemModule(IN PRTL_PROCESS_MODULES SystemModules)
 { 
-  return &(SystemModules->Module[0]);
+  return &(SystemModules->Modules[0]);
 }
 
-PSYSTEM_MODULE_INFORMATION_ENTRY FASTCALL
-PsaWalkNextSystemModule(IN PSYSTEM_MODULE_INFORMATION CurrentSystemModule)
+PRTL_PROCESS_MODULE_INFORMATION FASTCALL
+PsaWalkNextSystemModule(IN PRTL_PROCESS_MODULES CurrentSystemModule)
 {
-  return (PSYSTEM_MODULE_INFORMATION_ENTRY)((ULONG_PTR)CurrentSystemModule +
-                                            (FIELD_OFFSET(SYSTEM_MODULE_INFORMATION, Module[1]) -
-                                             FIELD_OFFSET(SYSTEM_MODULE_INFORMATION, Module[0])));
+  return (PRTL_PROCESS_MODULE_INFORMATION)((ULONG_PTR)CurrentSystemModule +
+                                            (FIELD_OFFSET(RTL_PROCESS_MODULES, Modules[1]) -
+                                             FIELD_OFFSET(RTL_PROCESS_MODULES, Modules[0])));
 }
 
 /* EOF */
Index: lib/epsapi/enum/processes.c
===================================================================
--- lib/epsapi/enum/processes.c	(revision 21808)
+++ lib/epsapi/enum/processes.c	(working copy)
@@ -265,7 +265,7 @@
   static SIZE_T nOffsetOfThreads = 0;
 
   /* get the offset of the Threads field */
-  nOffsetOfThreads = FIELD_OFFSET(SYSTEM_PROCESS_INFORMATION, TH);
+  nOffsetOfThreads = sizeof(SYSTEM_PROCESS_INFORMATION);
 
   return (PSYSTEM_THREAD_INFORMATION)((ULONG_PTR)CurrentProcess + nOffsetOfThreads);
 }
@@ -274,8 +274,8 @@
 PsaWalkNextThread(IN PSYSTEM_THREAD_INFORMATION CurrentThread)
 {
   return (PSYSTEM_THREAD_INFORMATION)((ULONG_PTR)CurrentThread +
-                           (FIELD_OFFSET(SYSTEM_PROCESS_INFORMATION, TH[1]) -
-                            FIELD_OFFSET(SYSTEM_PROCESS_INFORMATION, TH[0])));
+                           ((sizeof(SYSTEM_PROCESS_INFORMATION) + sizeof(SYSTEM_THREAD_INFORMATION)) -
+                            sizeof(SYSTEM_PROCESS_INFORMATION)));
 }
 
 /* EOF */
Index: lib/epsapi/enum/modules.c
===================================================================
--- lib/epsapi/enum/modules.c	(revision 21808)
+++ lib/epsapi/enum/modules.c	(working copy)
@@ -50,7 +50,7 @@
  
       while(Current != ListHead)
       {
-        PLDR_DATA_TABLE_ENTRY LoaderModule = CONTAINING_RECORD(Current, LDR_DATA_TABLE_ENTRY, InLoadOrderModuleList);
+        PLDR_DATA_TABLE_ENTRY LoaderModule = CONTAINING_RECORD(Current, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks);
    
         /* return the current module to the callback */
         Status = Callback(ProcessHandle, LoaderModule, CallbackContext);
@@ -60,7 +60,7 @@
           goto Failure;
         }
     
-        Current = LoaderModule->InLoadOrderModuleList.Flink;
+        Current = LoaderModule->InLoadOrderLinks.Flink;
       }
 #if 0
     }
@@ -117,7 +117,7 @@
     {
       /* read the current module */
       Status = NtReadVirtualMemory(ProcessHandle,
-                                   CONTAINING_RECORD(Current, LDR_DATA_TABLE_ENTRY, InLoadOrderModuleList),
+                                   CONTAINING_RECORD(Current, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks),
                                    &LoaderModule,
                                    sizeof(LoaderModule),
                                    NULL);
@@ -137,7 +137,7 @@
       }
     
       /* address of the next module in the list */
-      Current = LoaderModule.InLoadOrderModuleList.Flink;
+      Current = LoaderModule.InLoadOrderLinks.Flink;
     }
   }
 
Index: lib/rtl/sd.c
===================================================================
--- lib/rtl/sd.c	(revision 21808)
+++ lib/rtl/sd.c	(working copy)
@@ -800,9 +800,6 @@
         return STATUS_BAD_DESCRIPTOR_FORMAT;
     }
 
-    ASSERT(FIELD_OFFSET(SECURITY_DESCRIPTOR, Owner) ==
-           FIELD_OFFSET(SECURITY_DESCRIPTOR_RELATIVE, Owner));
-
 #ifdef _WIN64
 
     RtlpQuerySecurityDescriptor((PISECURITY_DESCRIPTOR)pRelSD,
@@ -915,8 +912,6 @@
                                         &pSacl,
                                         &pDacl);
 
-    ASSERT(sizeof(SECURITY_DESCRIPTOR) == sizeof(SECURITY_DESCRIPTOR_RELATIVE));
-
     /* clear the self-relative flag and simply convert the offsets to pointers */
     pAbsSD->Control &= ~SE_SELF_RELATIVE;
     pAbsSD->Owner = pOwner;
Index: lib/rtl/crc32.c
===================================================================
--- lib/rtl/crc32.c	(revision 21808)
+++ lib/rtl/crc32.c	(working copy)
@@ -85,7 +85,7 @@
  * @implemented
  */
 ULONG NTAPI
-RtlComputeCrc32 (IN ULONG Initial,
+RtlComputeCrc32 (IN UINT Initial,
 		 IN PUCHAR Data,
 		 IN ULONG Length)
 {
Index: lib/rtl/image.c
===================================================================
--- lib/rtl/image.c	(revision 21808)
+++ lib/rtl/image.c	(working copy)
@@ -45,12 +45,10 @@
  */
 PVOID
 NTAPI
-RtlImageDirectoryEntryToData (
-	PVOID	BaseAddress,
-	BOOLEAN	bMappedAsImage,
-	ULONG	Directory,
-	PULONG	Size
-	)
+RtlImageDirectoryEntryToData(PVOID BaseAddress,
+                             BOOLEAN MappedAsImage,
+                             USHORT Directory,
+                             PULONG Size)
 {
 	PIMAGE_NT_HEADERS NtHeader;
 	ULONG Va;
@@ -59,7 +57,7 @@
 	if ((ULONG_PTR)BaseAddress & 1)
 	{
 		BaseAddress = (PVOID)((ULONG_PTR)BaseAddress & ~1);
-		bMappedAsImage = FALSE;
+		MappedAsImage = FALSE;
         }
 
 
@@ -76,7 +74,7 @@
 
 	*Size = NtHeader->OptionalHeader.DataDirectory[Directory].Size;
 
-	if (bMappedAsImage || Va < NtHeader->OptionalHeader.SizeOfHeaders)
+	if (MappedAsImage || Va < NtHeader->OptionalHeader.SizeOfHeaders)
 		return (PVOID)((ULONG_PTR)BaseAddress + Va);
 
 	/* image mapped as ordinary file, we must find raw pointer */
Index: lib/rtl/unicode.c
===================================================================
--- lib/rtl/unicode.c	(revision 21808)
+++ lib/rtl/unicode.c	(working copy)
@@ -2185,7 +2185,7 @@
  */
 NTSTATUS NTAPI
 RtlValidateUnicodeString(IN ULONG Flags,
-                         IN PUNICODE_STRING UnicodeString)
+                         IN PCUNICODE_STRING UnicodeString)
 {
   /* currently no flags are supported! */
   ASSERT(Flags == 0);
Index: lib/rtl/dbgbuffer.c
===================================================================
--- lib/rtl/dbgbuffer.c	(revision 21808)
+++ lib/rtl/dbgbuffer.c	(working copy)
@@ -16,18 +16,18 @@
 /*
  * @unimplemented
  */
-PRTL_DEBUG_BUFFER NTAPI
+PRTL_DEBUG_INFORMATION NTAPI
 RtlCreateQueryDebugBuffer(IN ULONG Size,
                           IN BOOLEAN EventPair)
 {
    NTSTATUS Status;
-   PRTL_DEBUG_BUFFER Buf = NULL;
-   SIZE_T SectionSize = 100 * PAGE_SIZE;
+   PRTL_DEBUG_INFORMATION Buf = NULL;
+   SIZE_T ViewSize = 100 * PAGE_SIZE;
 
    Status = NtAllocateVirtualMemory( NtCurrentProcess(),
                                     (PVOID*)&Buf,
                                      0,
-                                     &SectionSize,
+                                     &ViewSize,
                                      MEM_COMMIT,
                                      PAGE_READWRITE);
    if (!NT_SUCCESS(Status))
@@ -35,10 +35,10 @@
         return NULL;
      }
 
-   Buf->SectionBase = Buf;
-   Buf->SectionSize = SectionSize;
+   Buf->ViewBaseClient = Buf;
+   Buf->ViewSize = ViewSize;
 
-   DPRINT("RtlCQDB: BA: %p BS: 0x%lx\n", Buf->SectionBase, Buf->SectionSize);
+   DPRINT("RtlCQDB: BA: %p BS: 0x%lx\n", Buf->ViewBaseClient, Buf->ViewSize);
 
    return Buf;
 }
@@ -47,7 +47,7 @@
  * @unimplemented
  */
 NTSTATUS NTAPI
-RtlDestroyQueryDebugBuffer(IN PRTL_DEBUG_BUFFER Buf)
+RtlDestroyQueryDebugBuffer(IN PRTL_DEBUG_INFORMATION Buf)
 {
    NTSTATUS Status = STATUS_SUCCESS;
 
@@ -55,7 +55,7 @@
      {
      Status = NtFreeVirtualMemory( NtCurrentProcess(),
                                   (PVOID)&Buf,
-                                  &Buf->SectionSize,
+                                  &Buf->ViewSize,
                                    MEM_RELEASE);
      }
    if (!NT_SUCCESS(Status))
@@ -71,7 +71,7 @@
  */
 NTSTATUS NTAPI
 RtlpQueryRemoteProcessModules(HANDLE ProcessHandle,
-                              IN PRTL_PROCESS_MODULES ModuleInformation OPTIONAL,
+                              IN PRTL_PROCESS_MODULES Modules OPTIONAL,
                               IN ULONG Size OPTIONAL,
                               OUT PULONG ReturnedSize)
 {
@@ -103,14 +103,14 @@
        return Status;
     }
 
-  if (ModuleInformation == NULL || Size == 0)
+  if (Modules == NULL || Size == 0)
     {
       Status = STATUS_INFO_LENGTH_MISMATCH;
     }
   else
     {
-      ModuleInformation->ModuleCount = 0;
-      ModulePtr = &ModuleInformation->ModuleEntry[0];
+      Modules->NumberOfModules = 0;
+      ModulePtr = &Modules->Modules[0];
       Status = STATUS_SUCCESS;
     }
 
@@ -154,7 +154,7 @@
 
    /* read the current module */
    Status = NtReadVirtualMemory ( ProcessHandle,
-            CONTAINING_RECORD(pleCurEntry, LDR_DATA_TABLE_ENTRY, InLoadOrderModuleList),
+            CONTAINING_RECORD(pleCurEntry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks),
                                  &lmModule,
                                  sizeof(LDR_DATA_TABLE_ENTRY),
                                  NULL );
@@ -183,36 +183,37 @@
         {
           Status = STATUS_INFO_LENGTH_MISMATCH;
         }
-      else if (ModuleInformation != NULL)
+      else if (Modules != NULL)
         {
-          ModulePtr->Reserved[0] = ModulePtr->Reserved[1] = 0;      // FIXME: ??
-          ModulePtr->Base        = lmModule.DllBase;
-          ModulePtr->Size        = lmModule.SizeOfImage;
+          ModulePtr->Section = 0;
+          ModulePtr->MappedBase = NULL;      // FIXME: ??
+          ModulePtr->ImageBase        = lmModule.DllBase;
+          ModulePtr->ImageSize        = lmModule.SizeOfImage;
           ModulePtr->Flags       = lmModule.Flags;
-          ModulePtr->Index       = 0;      // FIXME:  ??
-          ModulePtr->Unknown     = 0;      // FIXME: ??
+          ModulePtr->LoadOrderIndex       = 0;      // FIXME:  ??
+          ModulePtr->InitOrderIndex     = 0;      // FIXME: ??
           ModulePtr->LoadCount   = lmModule.LoadCount;
 
           AnsiString.Length        = 0;
           AnsiString.MaximumLength = 256;
-          AnsiString.Buffer        = ModulePtr->ImageName;
+          AnsiString.Buffer        = ModulePtr->FullPathName;
           RtlUnicodeStringToAnsiString(&AnsiString,
                                        &Unicode,
                                        FALSE);
 
-          p = strrchr(ModulePtr->ImageName, '\\');
+          p = strrchr(ModulePtr->FullPathName, '\\');
           if (p != NULL)
-            ModulePtr->ModuleNameOffset = p - ModulePtr->ImageName + 1;
+            ModulePtr->OffsetToFileName = p - ModulePtr->FullPathName + 1;
           else
-            ModulePtr->ModuleNameOffset = 0;
+            ModulePtr->OffsetToFileName = 0;
 
           ModulePtr++;
-          ModuleInformation->ModuleCount++;
+          Modules->NumberOfModules++;
         }
       UsedSize += sizeof(RTL_PROCESS_MODULE_INFORMATION);
 
       /* address of the next module in the list */
-      pleCurEntry = lmModule.InLoadOrderModuleList.Flink;
+      pleCurEntry = lmModule.InLoadOrderLinks.Flink;
   }
 
   if (ReturnedSize != 0)
@@ -230,13 +231,13 @@
 NTSTATUS NTAPI
 RtlQueryProcessDebugInformation(IN ULONG ProcessId,
                                 IN ULONG DebugInfoMask,
-                                IN OUT PRTL_DEBUG_BUFFER Buf)
+                                IN OUT PRTL_DEBUG_INFORMATION Buf)
 {
    NTSTATUS Status = STATUS_SUCCESS;
    ULONG Pid = (ULONG) NtCurrentTeb()->Cid.UniqueProcess;
 
-   Buf->InfoClassMask = DebugInfoMask;
-   Buf->SizeOfInfo = sizeof(RTL_DEBUG_BUFFER);
+   Buf->Flags = DebugInfoMask;
+   Buf->OffsetFree = sizeof(RTL_DEBUG_INFORMATION);
 
    DPRINT("QueryProcessDebugInformation Start\n");
 
@@ -258,7 +259,7 @@
     ULONG ReturnSize = 0;
     ULONG MSize;
 
-    Mp = (PRTL_PROCESS_MODULES)(Buf + Buf->SizeOfInfo);
+    Mp = (PRTL_PROCESS_MODULES)(Buf + Buf->OffsetFree);
 
     /* I like this better than the do & while loop. */
     Status = LdrQueryProcessModuleInformation( NULL,
@@ -272,9 +273,9 @@
          return Status;
      }
 
-    MSize = Mp->ModuleCount * (sizeof(RTL_PROCESS_MODULES) + 8);
-    Buf->ModuleInformation = Mp;
-    Buf->SizeOfInfo = Buf->SizeOfInfo + MSize;
+    MSize = Mp->NumberOfModules * (sizeof(RTL_PROCESS_MODULES) + 8);
+    Buf->Modules = Mp;
+    Buf->OffsetFree = Buf->OffsetFree + MSize;
      }
 
    if (DebugInfoMask & RTL_DEBUG_QUERY_HEAPS)
@@ -282,7 +283,7 @@
    PRTL_PROCESS_HEAPS Hp;
    ULONG HSize;
 
-   Hp = (PRTL_PROCESS_HEAPS)(Buf + Buf->SizeOfInfo);
+   Hp = (PRTL_PROCESS_HEAPS)(Buf + Buf->OffsetFree);
    HSize = sizeof(RTL_PROCESS_HEAPS);
         if (DebugInfoMask & RTL_DEBUG_QUERY_HEAP_TAGS)
           {
@@ -290,8 +291,8 @@
         if (DebugInfoMask & RTL_DEBUG_QUERY_HEAP_BLOCKS)
           {
           }
-   Buf->HeapInformation = Hp;
-   Buf->SizeOfInfo = Buf->SizeOfInfo + HSize;
+   Buf->Heaps = Hp;
+   Buf->OffsetFree = Buf->OffsetFree + HSize;
 
      }
 
@@ -300,14 +301,14 @@
    PRTL_PROCESS_LOCKS Lp;
    ULONG LSize;
 
-   Lp = (PRTL_PROCESS_LOCKS)(Buf + Buf->SizeOfInfo);
+   Lp = (PRTL_PROCESS_LOCKS)(Buf + Buf->OffsetFree);
    LSize = sizeof(RTL_PROCESS_LOCKS);
-   Buf->LockInformation = Lp;
-   Buf->SizeOfInfo = Buf->SizeOfInfo + LSize;
+   Buf->Locks = Lp;
+   Buf->OffsetFree = Buf->OffsetFree + LSize;
     }
 
    DPRINT("QueryProcessDebugInformation end \n");
-   DPRINT("QueryDebugInfo : 0x%lx\n", Buf->SizeOfInfo);
+   DPRINT("QueryDebugInfo : 0x%lx\n", Buf->OffsetFree);
 }
 else
 {
@@ -315,7 +316,7 @@
   CLIENT_ID ClientId;
   OBJECT_ATTRIBUTES ObjectAttributes;
 
-       Buf->Unknown[0] = (ULONG)NtCurrentProcess();
+       Buf->TargetProcessHandle = NtCurrentProcess();
 
        ClientId.UniqueThread = 0;
        ClientId.UniqueProcess = (HANDLE)ProcessId;
@@ -340,7 +341,7 @@
     ULONG ReturnSize = 0;
     ULONG MSize;
 
-    Mp = (PRTL_PROCESS_MODULES)(Buf + Buf->SizeOfInfo);
+    Mp = (PRTL_PROCESS_MODULES)(Buf + Buf->OffsetFree);
 
     Status = RtlpQueryRemoteProcessModules( hProcess,
                                             NULL,
@@ -356,9 +357,9 @@
          return Status;
      }
 
-    MSize = Mp->ModuleCount * (sizeof(RTL_PROCESS_MODULES) + 8);
-    Buf->ModuleInformation = Mp;
-    Buf->SizeOfInfo = Buf->SizeOfInfo + MSize;
+    MSize = Mp->NumberOfModules * (sizeof(RTL_PROCESS_MODULES) + 8);
+    Buf->Modules = Mp;
+    Buf->OffsetFree = Buf->OffsetFree + MSize;
      }
 
    if (DebugInfoMask & RTL_DEBUG_QUERY_HEAPS)
@@ -366,7 +367,7 @@
    PRTL_PROCESS_HEAPS Hp;
    ULONG HSize;
 
-   Hp = (PRTL_PROCESS_HEAPS)(Buf + Buf->SizeOfInfo);
+   Hp = (PRTL_PROCESS_HEAPS)(Buf + Buf->OffsetFree);
    HSize = sizeof(RTL_PROCESS_HEAPS);
         if (DebugInfoMask & RTL_DEBUG_QUERY_HEAP_TAGS)
           {
@@ -374,8 +375,8 @@
         if (DebugInfoMask & RTL_DEBUG_QUERY_HEAP_BLOCKS)
           {
           }
-   Buf->HeapInformation = Hp;
-   Buf->SizeOfInfo = Buf->SizeOfInfo + HSize;
+   Buf->Heaps = Hp;
+   Buf->OffsetFree = Buf->OffsetFree + HSize;
 
      }
 
@@ -384,14 +385,14 @@
    PRTL_PROCESS_LOCKS Lp;
    ULONG LSize;
 
-   Lp = (PRTL_PROCESS_LOCKS)(Buf + Buf->SizeOfInfo);
+   Lp = (PRTL_PROCESS_LOCKS)(Buf + Buf->OffsetFree);
    LSize = sizeof(RTL_PROCESS_LOCKS);
-   Buf->LockInformation = Lp;
-   Buf->SizeOfInfo = Buf->SizeOfInfo + LSize;
+   Buf->Locks = Lp;
+   Buf->OffsetFree = Buf->OffsetFree + LSize;
     }
 
    DPRINT("QueryProcessDebugInformation end \n");
-   DPRINT("QueryDebugInfo : 0x%lx\n", Buf->SizeOfInfo);
+   DPRINT("QueryDebugInfo : 0x%lx\n", Buf->OffsetFree);
 }
    return Status;
 
Index: lib/rtl/debug.c
===================================================================
--- lib/rtl/debug.c	(revision 21808)
+++ lib/rtl/debug.c	(working copy)
@@ -272,7 +272,7 @@
 NTAPI
 DbgPrompt(PCH OutputString,
           PCH InputString,
-          USHORT InputSize)
+          ULONG InputSize)
 {
     ANSI_STRING Output;
     ANSI_STRING Input;
Index: lib/rtl/network.c
===================================================================
--- lib/rtl/network.c	(revision 21808)
+++ lib/rtl/network.c	(working copy)
@@ -1,8 +1,8 @@
 /*
  * COPYRIGHT:         See COPYING in the top level directory
- * PROJECT:           ReactOS system libraries
+ * PROJECT:           ReactOS Runtime Library
  * PURPOSE:           Network Address Translation implementation
- * PROGRAMMER:        
+ * PROGRAMMER:        Alex Ionescu (alexi@tinykrnl.org)
  */
 
 /* INCLUDES *****************************************************************/
@@ -14,110 +14,74 @@
 
 /* FUNCTIONS ***************************************************************/
 
-/* Borrow this from some headers... */
-typedef struct
-{
-  union
-  {
-    struct { UCHAR s_b1,s_b2,s_b3,s_b4; } S_un_b;
-    struct { USHORT s_w1,s_w2; } S_un_w;
-    ULONG S_addr;
-  } S_un;
-} in_addr;
-
-typedef struct
-{
-  union
-  {
-    UCHAR _S6_u8[16];
-    USHORT _S6_u16[8];
-    ULONG _S6_u32[4];
-  } S6_un;
-} in6_addr;
-
-
 /*
-* @implemented
-*/
+ * @implemented
+ */
 LPSTR
 NTAPI
-RtlIpv4AddressToStringA(
-	PULONG IP,
-	LPSTR Buffer
-	)
+RtlIpv4AddressToStringA(IN struct in_addr *Addr,
+                        OUT PCHAR S)
 {
-  in_addr addr;
-  addr.S_un.S_addr = *IP;
-  return Buffer + sprintf(Buffer, "%u.%u.%u.%u", addr.S_un.S_un_b.s_b1,
-                                                 addr.S_un.S_un_b.s_b2,
-                                                 addr.S_un.S_un_b.s_b3,
-                                                 addr.S_un.S_un_b.s_b4);
+    return S + sprintf(S, "%u.%u.%u.%u", Addr->S_un.S_un_b.s_b1,
+                                         Addr->S_un.S_un_b.s_b2,
+                                         Addr->S_un.S_un_b.s_b3,
+                                         Addr->S_un.S_un_b.s_b4);
 }
 
 /*
-* @unimplemented
-*/
+ * @unimplemented
+ */
 NTSTATUS
 NTAPI
-RtlIpv4AddressToStringExA(
-	PULONG IP,
-	PULONG Port,
-	LPSTR Buffer,
-	PULONG MaxSize
-	)
+RtlIpv4AddressToStringExA(IN struct in_addr *Address,
+                          IN USHORT Port,
+                          OUT PCHAR AddressString,
+                          IN OUT PULONG AddressStringLength)
 {
-	UNIMPLEMENTED;
-	return STATUS_NOT_IMPLEMENTED;
+    UNIMPLEMENTED;
+    return STATUS_NOT_IMPLEMENTED;
 }
 
 /*
-* @implemented
-*/
+ * @implemented
+ */
 LPWSTR
 NTAPI
-RtlIpv4AddressToStringW(
-	PULONG IP,
-	LPWSTR Buffer
-	)
+RtlIpv4AddressToStringW(IN struct in_addr *Addr,
+                        OUT PWCHAR S)
 {
-  in_addr addr;
-  addr.S_un.S_addr = *IP;
-  return Buffer + swprintf(Buffer, L"%u.%u.%u.%u", addr.S_un.S_un_b.s_b1,
-                                                   addr.S_un.S_un_b.s_b2,
-                                                   addr.S_un.S_un_b.s_b3,
-                                                   addr.S_un.S_un_b.s_b4);
+    return S + swprintf(S, L"%u.%u.%u.%u", Addr->S_un.S_un_b.s_b1,
+                                           Addr->S_un.S_un_b.s_b2,
+                                           Addr->S_un.S_un_b.s_b3,
+                                           Addr->S_un.S_un_b.s_b4);
 }
 
 /*
-* @unimplemented
-*/
+ * @unimplemented
+ */
 NTSTATUS
 NTAPI
-RtlIpv4AddressToStringExW(
-	PULONG IP,
-	PULONG Port,
-	LPWSTR Buffer,
-	PULONG MaxSize
-	)
+RtlIpv4AddressToStringExW(IN struct in_addr *Address,
+                          IN USHORT Port,
+                          OUT PWCHAR AddressString,
+                          IN OUT PULONG AddressStringLength)
 {
-	UNIMPLEMENTED;
-	return STATUS_NOT_IMPLEMENTED;
+    UNIMPLEMENTED;
+    return STATUS_NOT_IMPLEMENTED;
 }
 
 /*
-* @unimplemented
-*/
+ * @unimplemented
+ */
 NTSTATUS
 NTAPI
-RtlIpv4StringToAddressA(
-	IN LPSTR IpString,
-	IN ULONG Base,
-	OUT PVOID PtrToIpAddr,
-	OUT ULONG IpAddr
-	)
+RtlIpv4StringToAddressA(IN PCHAR String,
+                        IN BOOLEAN Strict,
+                        OUT PCHAR *Terminator,
+                        OUT struct in_addr *Addr)
 {
-	UNIMPLEMENTED;
-	return STATUS_NOT_IMPLEMENTED;
+    UNIMPLEMENTED;
+    return STATUS_NOT_IMPLEMENTED;
 }
 
 /*
@@ -125,15 +89,13 @@
 */
 NTSTATUS
 NTAPI
-RtlIpv4StringToAddressExA(
-	IN LPSTR IpString,
-	IN ULONG Base,
-	OUT PULONG IpAddr,
-	OUT PULONG Port
-	)
+RtlIpv4StringToAddressExA(IN PCHAR AddressString,
+                          IN BOOLEAN Strict,
+                          OUT struct in_addr *Address,
+                          IN PUSHORT Port)
 {
-	UNIMPLEMENTED;
-	return STATUS_NOT_IMPLEMENTED;
+    UNIMPLEMENTED;
+    return STATUS_NOT_IMPLEMENTED;
 }
 
 /*
@@ -141,15 +103,13 @@
 */
 NTSTATUS
 NTAPI
-RtlIpv4StringToAddressW(
-	IN LPWSTR IpString,
-	IN ULONG Base,
-    OUT PULONG PtrToIpAddr,
-    OUT PULONG IpAddr
-	)
+RtlIpv4StringToAddressW(IN PWCHAR String,
+                        IN UCHAR Strict,
+                        OUT PWCHAR Terminator,
+                        OUT struct in_addr *Addr)
 {
-	UNIMPLEMENTED;
-	return STATUS_NOT_IMPLEMENTED;
+    UNIMPLEMENTED;
+    return STATUS_NOT_IMPLEMENTED;
 }
 
 /*
@@ -157,15 +117,13 @@
 */
 NTSTATUS
 NTAPI
-RtlIpv4StringToAddressExW(
-	IN LPWSTR IpString,
-	IN ULONG Base,
-	OUT PULONG IpAddr,
-	OUT PULONG Port
-	)
+RtlIpv4StringToAddressExW(IN PWCHAR AddressString,
+                          IN BOOLEAN Strict,
+                          OUT struct in_addr *Address,
+                          OUT PUSHORT Port)
 {
-	UNIMPLEMENTED;
-	return STATUS_NOT_IMPLEMENTED;
+    UNIMPLEMENTED;
+    return STATUS_NOT_IMPLEMENTED;
 }
 
 /*
@@ -173,13 +131,11 @@
 */
 NTSTATUS
 NTAPI
-RtlIpv6AddressToStringA(
-	PULONG IP,
-	LPSTR Buffer
-	)
+RtlIpv6AddressToStringA(IN struct in6_addr *Addr,
+                        OUT PCHAR S)
 {
-	UNIMPLEMENTED;
-	return STATUS_NOT_IMPLEMENTED;
+    UNIMPLEMENTED;
+    return STATUS_NOT_IMPLEMENTED;
 }
 
 /*
@@ -187,15 +143,14 @@
 */
 NTSTATUS
 NTAPI
-RtlIpv6AddressToStringExA(
-	PULONG IP,
-	PULONG Port,
-	LPSTR Buffer,
-	PULONG MaxSize
-	)
+RtlIpv6AddressToStringExA(IN struct in6_addr *Address,
+                          IN ULONG ScopeId,
+                          IN ULONG Port,
+                          OUT PCHAR AddressString,
+                          IN OUT PULONG AddressStringLength)
 {
-	UNIMPLEMENTED;
-	return STATUS_NOT_IMPLEMENTED;
+    UNIMPLEMENTED;
+    return STATUS_NOT_IMPLEMENTED;
 }
 
 /*
@@ -203,13 +158,11 @@
 */
 NTSTATUS
 NTAPI
-RtlIpv6AddressToStringW(
-	PULONG IP,
-	LPWSTR Buffer
-	)
+RtlIpv6AddressToStringW(IN struct in6_addr *Addr,
+                        OUT PWCHAR S)
 {
-	UNIMPLEMENTED;
-	return STATUS_NOT_IMPLEMENTED;
+    UNIMPLEMENTED;
+    return STATUS_NOT_IMPLEMENTED;
 }
 
 /*
@@ -217,15 +170,14 @@
 */
 NTSTATUS
 NTAPI
-RtlIpv6AddressToStringExW(
-	PULONG IP,
-	PULONG Port,
-	LPWSTR Buffer,
-	PULONG MaxSize
-	)
+RtlIpv6AddressToStringExW(IN struct in6_addr *Address,
+                          IN ULONG ScopeId,
+                          IN USHORT Port,
+                          IN OUT PWCHAR AddressString,
+                          IN OUT PULONG AddressStringLength)
 {
-	UNIMPLEMENTED;
-	return STATUS_NOT_IMPLEMENTED;
+    UNIMPLEMENTED;
+    return STATUS_NOT_IMPLEMENTED;
 }
 
 /*
@@ -233,9 +185,9 @@
 */
 NTSTATUS
 NTAPI
-RtlIpv6StringToAddressA(IN LPSTR Name,
-                        OUT PULONG Unknown,
-                        OUT PVOID IpAddr)
+RtlIpv6StringToAddressA(IN PCHAR Name,
+                        OUT PCHAR *Terminator,
+                        OUT struct in6_addr *Addr)
 {
     UNIMPLEMENTED;
     return STATUS_NOT_IMPLEMENTED;
@@ -246,10 +198,10 @@
 */
 NTSTATUS
 NTAPI
-RtlIpv6StringToAddressExA(IN LPSTR AddressName,
-                          IN PVOID Address,
-                          IN PULONG ScopeId,
-                          IN PUSHORT Port)
+RtlIpv6StringToAddressExA(IN PCHAR AddressString,
+                          OUT struct in6_addr *Address,
+                          OUT PULONG ScopeId,
+                          OUT PUSHORT Port)
 {
     UNIMPLEMENTED;
     return STATUS_NOT_IMPLEMENTED;
@@ -260,9 +212,9 @@
 */
 NTSTATUS
 NTAPI
-RtlIpv6StringToAddressW(IN LPWSTR Name,
-                        OUT PULONG Unknown,
-                        OUT PVOID IpAddr)
+RtlIpv6StringToAddressW(IN PWCHAR Name,
+                        OUT PCHAR *Terminator,
+                        OUT struct in6_addr *Addr)
 {
     UNIMPLEMENTED;
     return STATUS_NOT_IMPLEMENTED;
@@ -273,10 +225,10 @@
 */
 NTSTATUS
 NTAPI
-RtlIpv6StringToAddressExW(IN LPWSTR AddressName,
-                          IN PVOID Address,
-                          IN PULONG ScopeId,
-                          IN PUSHORT Port)
+RtlIpv6StringToAddressExW(IN PWCHAR AddressName,
+                          OUT struct in6_addr *Address,
+                          OUT PULONG ScopeId,
+                          OUT PUSHORT Port)
 {
     UNIMPLEMENTED;
     return STATUS_NOT_IMPLEMENTED;
Index: lib/rtl/thread.c
===================================================================
--- lib/rtl/thread.c	(revision 21808)
+++ lib/rtl/thread.c	(working copy)
@@ -12,6 +12,7 @@
 /* INCLUDES *****************************************************************/
 
 #include <rtl.h>
+#include "i386/ketypes.h"
 
 #define NDEBUG
 #include <debug.h>
Index: lib/rtl/path.c
===================================================================
--- lib/rtl/path.c	(revision 21808)
+++ lib/rtl/path.c	(working copy)
@@ -61,29 +61,29 @@
 
    if (Path == NULL)
    {
-      return INVALID_PATH;
+      return RtlPathTypeUnknown;
    }
 
    if (IS_PATH_SEPARATOR(Path[0]))
    {
-      if (!IS_PATH_SEPARATOR(Path[1])) return ABSOLUTE_PATH;         /* \xxx   */
-      if (Path[2] != L'.') return UNC_PATH;                          /* \\xxx   */
-      if (IS_PATH_SEPARATOR(Path[3])) return DEVICE_PATH;            /* \\.\xxx */
-      if (Path[3]) return UNC_PATH;                                  /* \\.xxxx */
+      if (!IS_PATH_SEPARATOR(Path[1])) return RtlPathTypeRooted;         /* \xxx   */
+      if (Path[2] != L'.') return RtlPathTypeUncAbsolute;                          /* \\xxx   */
+      if (IS_PATH_SEPARATOR(Path[3])) return RtlPathTypeLocalDevice;            /* \\.\xxx */
+      if (Path[3]) return RtlPathTypeUncAbsolute;                                  /* \\.xxxx */
 
-      return UNC_DOT_PATH;                                           /* \\.     */
+      return RtlPathTypeRootLocalDevice;                                           /* \\.     */
    }
    else
    {
       /* FIXME: the Wine version of this line reads:
-       * if (!Path[1] || Path[1] != L':')    return RELATIVE_PATH
+       * if (!Path[1] || Path[1] != L':')    return RtlPathTypeRelative
        * Should we do this too?
        * -Gunnar
        */
-      if (Path[1] != L':') return RELATIVE_PATH;                     /* xxx     */
-      if (IS_PATH_SEPARATOR(Path[2])) return ABSOLUTE_DRIVE_PATH;    /* x:\xxx  */
+      if (Path[1] != L':') return RtlPathTypeRelative;                     /* xxx     */
+      if (IS_PATH_SEPARATOR(Path[2])) return RtlPathTypeDriveAbsolute;    /* x:\xxx  */
 
-      return RELATIVE_DRIVE_PATH;                                    /* x:xxx   */
+      return RtlPathTypeDriveRelative;                                    /* x:xxx   */
    }
 }
 
@@ -448,16 +448,16 @@
 
     switch (type = RtlDetermineDosPathNameType_U(name))
     {
-    case UNC_PATH:              /* \\foo   */
+    case RtlPathTypeUncAbsolute:              /* \\foo   */
         ptr = skip_unc_prefix( name );
         mark = (ptr - name);
         break;
 
-    case DEVICE_PATH:           /* \\.\foo */
+    case RtlPathTypeLocalDevice:           /* \\.\foo */
         mark = 4;
         break;
 
-    case ABSOLUTE_DRIVE_PATH:   /* c:\foo  */
+    case RtlPathTypeDriveAbsolute:   /* c:\foo  */
         reqsize = sizeof(WCHAR);
         tmp[0] = towupper(name[0]);
         ins_str = tmp;
@@ -465,7 +465,7 @@
         mark = 3;
         break;
 
-    case RELATIVE_DRIVE_PATH:   /* c:foo   */
+    case RtlPathTypeDriveRelative:   /* c:foo   */
         dep = 2;
         if (towupper(name[0]) != towupper(cd->Buffer[0]) || cd->Buffer[1] != ':')
         {
@@ -517,7 +517,7 @@
         }
         /* fall through */
 
-    case RELATIVE_PATH:         /* foo     */
+    case RtlPathTypeRelative:         /* foo     */
         reqsize = cd->Length;
         ins_str = cd->Buffer;
         if (cd->Buffer[1] != ':')
@@ -528,7 +528,7 @@
         else mark = 3;
         break;
 
-    case ABSOLUTE_PATH:         /* \xxx    */
+    case RtlPathTypeRooted:         /* \xxx    */
 #ifdef __WINE__
         if (name[0] == '/')  /* may be a Unix path */
         {
@@ -564,7 +564,7 @@
         }
         break;
 
-    case UNC_DOT_PATH:         /* \\.     */
+    case RtlPathTypeRootLocalDevice:         /* \\.     */
         reqsize = 4 * sizeof(WCHAR);
         dep = 3;
         tmp[0] = '\\';
@@ -575,7 +575,7 @@
         mark = 4;
         break;
 
-    case INVALID_PATH:
+    case RtlPathTypeUnknown:
         goto done;
     }
 
@@ -794,8 +794,8 @@
 	Length = wcslen(fullname + Offset);
 	memcpy (Buffer + tmpLength, fullname + Offset, (Length + 1) * sizeof(WCHAR));
 	Length += tmpLength;
-	if (Type == ABSOLUTE_DRIVE_PATH ||
-	    Type == RELATIVE_DRIVE_PATH)
+	if (Type == RtlPathTypeDriveAbsolute ||
+	    Type == RtlPathTypeDriveRelative)
 	{
 	    /* make the drive letter to uppercase */
 	    Buffer[tmpLength] = towupper(Buffer[tmpLength]);
@@ -840,9 +840,9 @@
 ULONG
 NTAPI
 RtlDosSearchPath_U (
-	WCHAR *sp,
-	WCHAR *name,
-	WCHAR *ext,
+	PCWSTR sp,
+	PCWSTR name,
+	PCWSTR ext,
 	ULONG buf_sz,
 	WCHAR *buffer,
 	PWSTR *FilePart
@@ -852,7 +852,7 @@
 	ULONG Length = 0;
 	PWSTR full_name;
 	PWSTR wcs;
-	PWSTR path;
+	PCWSTR path;
 
 	Type = RtlDetermineDosPathNameType_U (name);
 
@@ -915,7 +915,7 @@
  * @implemented
  */
 BOOLEAN NTAPI
-RtlDoesFileExists_U(IN PWSTR FileName)
+RtlDoesFileExists_U(IN PCWSTR FileName)
 {
 	UNICODE_STRING NtFileName;
 	OBJECT_ATTRIBUTES Attr;
Index: lib/rtl/bootdata.c
===================================================================
--- lib/rtl/bootdata.c	(revision 21808)
+++ lib/rtl/bootdata.c	(working copy)
@@ -657,7 +657,7 @@
 
         /* free allocated memory */
         ASSERT(SecurityDescriptor != NULL);
-        ASSERT(SecurityDescriptor->Dacl != NULL)
+        ASSERT(SecurityDescriptor->Dacl != NULL);
 
         RtlpFreeMemory(SecurityDescriptor->Dacl,
                        TAG('S', 'e', 'A', 'c'));
Index: ntoskrnl/ldr/loader.c
===================================================================
--- ntoskrnl/ldr/loader.c	(revision 21808)
+++ ntoskrnl/ldr/loader.c	(working copy)
@@ -131,7 +131,7 @@
     DPRINT("ModuleObject:%08x  entrypoint at %x\n", &NtoskrnlModuleObject, NtoskrnlModuleObject.EntryPoint);
     NtoskrnlModuleObject.SizeOfImage = NtHeader->OptionalHeader.SizeOfImage;
 
-    InsertTailList(&ModuleListHead, &NtoskrnlModuleObject.InLoadOrderModuleList);
+    InsertTailList(&ModuleListHead, &NtoskrnlModuleObject.InLoadOrderLinks);
 
     /* Initialize ModuleObject for HAL */
     RtlZeroMemory(&HalModuleObject, sizeof(LDR_DATA_TABLE_ENTRY));
@@ -145,7 +145,7 @@
     DPRINT("ModuleObject:%08x  entrypoint at %x\n", &HalModuleObject, HalModuleObject.EntryPoint);
     HalModuleObject.SizeOfImage = NtHeader->OptionalHeader.SizeOfImage;
 
-    InsertTailList(&ModuleListHead, &HalModuleObject.InLoadOrderModuleList);
+    InsertTailList(&ModuleListHead, &HalModuleObject.InLoadOrderLinks);
 }
 
 NTSTATUS
@@ -343,7 +343,7 @@
 
     /* Remove the module from the module list */
     KeAcquireSpinLock(&ModuleListLock,&Irql);
-    RemoveEntryList(&ModuleObject->InLoadOrderModuleList);
+    RemoveEntryList(&ModuleObject->InLoadOrderLinks);
     KeReleaseSpinLock(&ModuleListLock, Irql);
 
     /* Hook for KDB on unloading a driver. */
@@ -390,7 +390,7 @@
     PLIST_ENTRY current_entry;
     PLDR_DATA_TABLE_ENTRY current;
     ULONG ModuleCount = 0;
-    PSYSTEM_MODULE_INFORMATION Smi;
+    PRTL_PROCESS_MODULES Smi;
     ANSI_STRING AnsiName;
     PCHAR p;
     KIRQL Irql;
@@ -405,13 +405,13 @@
     while (current_entry != (&ModuleListHead))
     {
         ModuleCount++;
-        current = CONTAINING_RECORD(current_entry,LDR_DATA_TABLE_ENTRY,InLoadOrderModuleList);
+        current = CONTAINING_RECORD(current_entry,LDR_DATA_TABLE_ENTRY,InLoadOrderLinks);
         tmpBufferSize += current->FullDllName.Length + sizeof(WCHAR) + sizeof(UNICODE_STRING);
         current_entry = current_entry->Flink;
     }
 
-    *ReqSize = sizeof(SYSTEM_MODULE_INFORMATION)+
-        (ModuleCount - 1) * sizeof(SYSTEM_MODULE_INFORMATION_ENTRY);
+    *ReqSize = sizeof(RTL_PROCESS_MODULES)+
+        (ModuleCount - 1) * sizeof(RTL_PROCESS_MODULE_INFORMATION);
 
     if (Size < *ReqSize)
     {
@@ -431,23 +431,23 @@
     /* fill the buffer */
     memset(Buffer, '=', Size);
 
-    Smi = (PSYSTEM_MODULE_INFORMATION)Buffer;
-    Smi->Count = ModuleCount;
+    Smi = (PRTL_PROCESS_MODULES)Buffer;
+    Smi->NumberOfModules = ModuleCount;
 
     ModuleCount = 0;
     current_entry = ModuleListHead.Flink;
     while (current_entry != (&ModuleListHead))
     {
-        current = CONTAINING_RECORD(current_entry,LDR_DATA_TABLE_ENTRY,InLoadOrderModuleList);
+        current = CONTAINING_RECORD(current_entry,LDR_DATA_TABLE_ENTRY,InLoadOrderLinks);
 
-        Smi->Module[ModuleCount].Unknown1 = 0;                /* Always 0 */
-        Smi->Module[ModuleCount].Unknown2 = 0;                /* Always 0 */
-        Smi->Module[ModuleCount].Base = current->DllBase;
-        Smi->Module[ModuleCount].Size = current->SizeOfImage;
-        Smi->Module[ModuleCount].Flags = 0;                /* Flags ??? (GN) */
-        Smi->Module[ModuleCount].Index = (USHORT)ModuleCount;
-        Smi->Module[ModuleCount].NameLength = 0;
-        Smi->Module[ModuleCount].LoadCount = 0; /* FIXME */
+        Smi->Modules[ModuleCount].Section = 0;                /* Always 0 */
+        Smi->Modules[ModuleCount].MappedBase = 0;                /* Always 0 */
+        Smi->Modules[ModuleCount].ImageBase = current->DllBase;
+        Smi->Modules[ModuleCount].ImageSize = current->SizeOfImage;
+        Smi->Modules[ModuleCount].Flags = 0;                /* Flags ??? (GN) */
+        Smi->Modules[ModuleCount].LoadOrderIndex = (USHORT)ModuleCount;
+        Smi->Modules[ModuleCount].InitOrderIndex = 0;
+        Smi->Modules[ModuleCount].LoadCount = 0; /* FIXME */
         UnicodeName[ModuleCount].Buffer = tmpNameBuffer;
         UnicodeName[ModuleCount].MaximumLength = current->FullDllName.Length + sizeof(WCHAR);
         tmpNameBuffer += UnicodeName[ModuleCount].MaximumLength / sizeof(WCHAR);
@@ -459,24 +459,24 @@
 
     KeReleaseSpinLock(&ModuleListLock, Irql);
 
-    for (ModuleCount = 0; ModuleCount < Smi->Count; ModuleCount++)
+    for (ModuleCount = 0; ModuleCount < Smi->NumberOfModules; ModuleCount++)
     {
         AnsiName.Length = 0;
         AnsiName.MaximumLength = 255;
-        AnsiName.Buffer = Smi->Module[ModuleCount].ImageName;
+        AnsiName.Buffer = Smi->Modules[ModuleCount].FullPathName;
         RtlUnicodeStringToAnsiString(&AnsiName, &UnicodeName[ModuleCount], FALSE);
         AnsiName.Buffer[AnsiName.Length] = 0;
-        Smi->Module[ModuleCount].NameLength = AnsiName.Length;
+        Smi->Modules[ModuleCount].InitOrderIndex = AnsiName.Length;
 
         p = strrchr(AnsiName.Buffer, '\\');
         if (p == NULL)
         {
-            Smi->Module[ModuleCount].PathLength = 0;
+            Smi->Modules[ModuleCount].OffsetToFileName = 0;
         }
         else
         {
             p++;
-            Smi->Module[ModuleCount].PathLength = p - AnsiName.Buffer;
+            Smi->Modules[ModuleCount].OffsetToFileName = p - AnsiName.Buffer;
         }
     }
 
@@ -596,7 +596,7 @@
     Entry = ModuleListHead.Flink;
     while (Entry != &ModuleListHead)
     {
-        Module = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY, InLoadOrderModuleList);
+        Module = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks);
 
         DPRINT("Comparing %wZ and %wZ\n",
             &Module->BaseDllName,
@@ -897,7 +897,7 @@
     /* Insert module */
     KeAcquireSpinLock(&ModuleListLock, &Irql);
     InsertTailList(&ModuleListHead,
-        &CreatedModuleObject->InLoadOrderModuleList);
+        &CreatedModuleObject->InLoadOrderLinks);
     KeReleaseSpinLock(&ModuleListLock, Irql);
 
     *ModuleObject = CreatedModuleObject;
Index: ntoskrnl/ps/process.c
===================================================================
--- ntoskrnl/ps/process.c	(revision 21808)
+++ ntoskrnl/ps/process.c	(working copy)
@@ -31,7 +31,7 @@
 
 NTSTATUS
 NTAPI
-PsLockProcess(PEPROCESS Process, BOOLEAN Timeout)
+PsLockProcess(PROS_EPROCESS Process, BOOLEAN Timeout)
 {
   ULONG Attempts = 0;
   PKTHREAD PrevLockOwner;
@@ -90,7 +90,7 @@
 
 VOID
 NTAPI
-PsUnlockProcess(PEPROCESS Process)
+PsUnlockProcess(PROS_EPROCESS Process)
 {
   PAGED_CODE();
 
@@ -288,7 +288,7 @@
                             ObjectAttributes,
                             PreviousMode,
                             NULL,
-                            sizeof(EPROCESS),
+                            sizeof(ROS_EPROCESS),
                             0,
                             0,
                             (PVOID*)&Process);
@@ -301,7 +301,7 @@
 
     /* Clean up the Object */
     DPRINT("Cleaning Process Object\n");
-    RtlZeroMemory(Process, sizeof(EPROCESS));
+    RtlZeroMemory(Process, sizeof(ROS_EPROCESS));
 
     /* Inherit stuff from the Parent since we now have the object created */
     if (pParentProcess)
@@ -325,7 +325,7 @@
 
     /* Setup the Lock Event */
     DPRINT("Initialzing Process Lock\n");
-    KeInitializeEvent(&Process->LockEvent, SynchronizationEvent, FALSE);
+    KeInitializeEvent(&((PROS_EPROCESS)Process)->LockEvent, SynchronizationEvent, FALSE);
 
     /* Setup the Thread List Head */
     DPRINT("Initialzing Process ThreadListHead\n");
@@ -338,8 +338,8 @@
 
     /* Set Process's Directory Base */
     DPRINT("Initialzing Process Directory Base\n");
-    MmCopyMmInfo(pParentProcess ? pParentProcess : PsInitialSystemProcess,
-                 Process,
+    MmCopyMmInfo((PROS_EPROCESS)(pParentProcess ? pParentProcess : PsInitialSystemProcess),
+                 (PROS_EPROCESS)Process,
                  &DirectoryTableBase);
 
     /* Now initialize the Kernel Process */
@@ -360,7 +360,7 @@
 
     /* Create the Process' Address Space */
     DPRINT("Initialzing Process Address Space\n");
-    Status = MmCreateProcessAddressSpace(Process, SectionObject);
+    Status = MmCreateProcessAddressSpace((PROS_EPROCESS)Process, (PROS_SECTION_OBJECT)SectionObject);
     if (!NT_SUCCESS(Status))
     {
         DPRINT1("Failed to create Address Space\n");
@@ -376,8 +376,8 @@
 
     /* Create a handle for the Process */
     DPRINT("Initialzing Process CID Handle\n");
-    CidEntry.u1.Object = Process;
-    CidEntry.u2.GrantedAccess = 0;
+    CidEntry.Object = Process;
+    CidEntry.GrantedAccess = 0;
     Process->UniqueProcessId = ExCreateHandle(PspCidTable, &CidEntry);
     DPRINT("Created CID: %d\n", Process->UniqueProcessId);
     if(!Process->UniqueProcessId)
@@ -393,7 +393,7 @@
     if (pParentProcess)
     {
         DPRINT("Creating PEB\n");
-        Status = MmCreatePeb(Process);
+        Status = MmCreatePeb((PROS_EPROCESS)Process);
         if (!NT_SUCCESS(Status))
         {
             DbgPrint("NtCreateProcess() Peb creation failed: Status %x\n",Status);
@@ -492,7 +492,7 @@
                                          ProcessId)))
     {
         /* Get the Process */
-        FoundProcess = CidEntry->u1.Object;
+        FoundProcess = CidEntry->Object;
 
         /* Make sure it's really a process */
         if (FoundProcess->Pcb.Header.Type == ProcessObject)
@@ -534,7 +534,7 @@
                                           Cid->UniqueThread)))
     {
         /* Get the Process */
-        FoundThread = CidEntry->u1.Object;
+        FoundThread = CidEntry->Object;
 
         /* Make sure it's really a thread and this process' */
         if ((FoundThread->Tcb.DispatcherHeader.Type == ThreadObject) &&
Index: ntoskrnl/ps/win32.c
===================================================================
--- ntoskrnl/ps/win32.c	(revision 21808)
+++ ntoskrnl/ps/win32.c	(working copy)
@@ -13,17 +13,18 @@
 #include <ntoskrnl.h>
 #define NDEBUG
 #include <internal/debug.h>
+#include <win32k/callout.h>
 
 /* GLOBALS ******************************************************************/
 
-static PW32_PROCESS_CALLBACK PspWin32ProcessCallback = NULL;
-static PW32_THREAD_CALLBACK PspWin32ThreadCallback = NULL;
+static PKWIN32_PROCESS_CALLOUT PspWin32ProcessCallback = NULL;
+static PKWIN32_THREAD_CALLOUT PspWin32ThreadCallback = NULL;
 
 extern OB_OPEN_METHOD ExpWindowStationObjectOpen;
-extern OB_PARSE_METHOD ExpWindowStationObjectParse;
+extern OB_ROS_PARSE_METHOD ExpWindowStationObjectParse;
 extern OB_DELETE_METHOD ExpWindowStationObjectDelete;
-extern OB_FIND_METHOD ExpWindowStationObjectFind;
-extern OB_CREATE_METHOD ExpDesktopObjectCreate;
+extern OB_ROS_FIND_METHOD ExpWindowStationObjectFind;
+extern OB_ROS_CREATE_METHOD ExpDesktopObjectCreate;
 extern OB_DELETE_METHOD ExpDesktopObjectDelete;
 
 #ifndef ALEX_CB_REWRITE
@@ -55,11 +56,12 @@
  */
 VOID 
 STDCALL
-PsEstablishWin32Callouts(PW32_CALLOUT_DATA CalloutData)
+PsEstablishWin32Callouts(PWIN32_CALLOUTS_FPNS calloutData)
 {
+    PW32_CALLOUT_DATA CalloutData = (PW32_CALLOUT_DATA)calloutData;
     PspWin32ProcessCallback = CalloutData->W32ProcessCallout;
     PspWin32ThreadCallback = CalloutData->W32ThreadCallout;
-    ExpWindowStationObjectOpen = CalloutData->WinStaCreate;
+    ExpWindowStationObjectOpen = CalloutData->WinStaOpen;
     ExpWindowStationObjectParse = CalloutData->WinStaParse;
     ExpWindowStationObjectDelete = CalloutData->WinStaDelete;
     ExpWindowStationObjectFind = CalloutData->WinStaFind;
Index: ntoskrnl/ps/query.c
===================================================================
--- ntoskrnl/ps/query.c	(revision 21808)
+++ ntoskrnl/ps/query.c	(working copy)
@@ -428,11 +428,11 @@
       case ProcessImageFileName:
       {
           ULONG ImagePathLen = 0;
-          PSECTION_OBJECT Section;
+          PROS_SECTION_OBJECT Section;
           PUNICODE_STRING DstPath = (PUNICODE_STRING)ProcessInformation;
           PWSTR SrcBuffer = NULL, DstBuffer = (PWSTR)(DstPath + 1);
 
-          Section = (PSECTION_OBJECT)Process->SectionObject;
+          Section = (PROS_SECTION_OBJECT)Process->SectionObject;
 
           if (Section != NULL && Section->FileObject != NULL)
           {
@@ -653,7 +653,7 @@
           {
             /* lock the process to be thread-safe! */
 
-            Status = PsLockProcess(Process, FALSE);
+            Status = PsLockProcess((PROS_EPROCESS)Process, FALSE);
             if(NT_SUCCESS(Status))
             {
               /*
@@ -671,7 +671,7 @@
                 ObDereferenceObject(ExceptionPort);
                 Status = STATUS_PORT_ALREADY_SET;
               }
-              PsUnlockProcess(Process);
+              PsUnlockProcess((PROS_EPROCESS)Process);
             }
             else
             {
@@ -758,7 +758,7 @@
 
           /* FIXME - update the session id for the process token */
 
-          Status = PsLockProcess(Process, FALSE);
+          Status = PsLockProcess((PROS_EPROCESS)Process, FALSE);
           if(NT_SUCCESS(Status))
           {
             Process->Session = SessionInfo.SessionId;
@@ -785,7 +785,7 @@
               KeDetachProcess();
             }
 
-            PsUnlockProcess(Process);
+            PsUnlockProcess((PROS_EPROCESS)Process);
           }
         }
         break;
Index: ntoskrnl/ps/thread.c
===================================================================
--- ntoskrnl/ps/thread.c	(revision 21808)
+++ ntoskrnl/ps/thread.c	(working copy)
@@ -182,8 +182,8 @@
 
     /* Create Cid Handle */
     DPRINT("Creating Thread Handle (CID)\n");
-    CidEntry.u1.Object = Thread;
-    CidEntry.u2.GrantedAccess = 0;
+    CidEntry.Object = Thread;
+    CidEntry.GrantedAccess = 0;
     Thread->Cid.UniqueThread = ExCreateHandle(PspCidTable, &CidEntry);
     if (!Thread->Cid.UniqueThread) {
 
@@ -220,7 +220,7 @@
 
         /* Create Teb */
         DPRINT("Initialliazing Thread PEB\n");
-        TebBase = MmCreateTeb(Process, &Thread->Cid, InitialTeb);
+        TebBase = MmCreateTeb((PROS_EPROCESS)Process, &Thread->Cid, InitialTeb);
 
         /* Set the Start Addresses */
         DPRINT("Initialliazing Thread Start Addresses :%x, %x\n", ThreadContext->Eip, ThreadContext->Eax);
@@ -378,7 +378,7 @@
                                          ThreadId)))
     {
         /* Get the Process */
-        FoundThread = CidEntry->u1.Object;
+        FoundThread = CidEntry->Object;
 
         /* Make sure it's really a process */
         if (FoundThread->Tcb.DispatcherHeader.Type == ThreadObject)
Index: ntoskrnl/ps/psmgr.c
===================================================================
--- ntoskrnl/ps/psmgr.c	(revision 21808)
+++ ntoskrnl/ps/psmgr.c	(working copy)
@@ -154,7 +154,7 @@
    RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
    RtlInitUnicodeString(&Name, L"Process");
    ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
-   ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(EPROCESS);
+   ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(ROS_EPROCESS);
    ObjectTypeInitializer.GenericMapping = PiProcessMapping;
    ObjectTypeInitializer.PoolType = NonPagedPool;
    ObjectTypeInitializer.ValidAccessMask = PROCESS_ALL_ACCESS;
@@ -181,7 +181,7 @@
 			   NULL,
 			   KernelMode,
 			   NULL,
-			   sizeof(EPROCESS),
+			   sizeof(ROS_EPROCESS),
 			   0,
 			   0,
 			   (PVOID*)&PsIdleProcess);
@@ -192,7 +192,7 @@
         return;
      }
 
-   RtlZeroMemory(PsIdleProcess, sizeof(EPROCESS));
+   RtlZeroMemory(PsIdleProcess, sizeof(ROS_EPROCESS));
 
    PsIdleProcess->Pcb.Affinity = 0xFFFFFFFF;
    PsIdleProcess->Pcb.IopmOffset = 0xffff;
@@ -203,7 +203,7 @@
    InitializeListHead(&PsIdleProcess->ActiveProcessLinks);
    KeInitializeDispatcherHeader(&PsIdleProcess->Pcb.Header,
 				ProcessObject,
-				sizeof(EPROCESS) / sizeof(LONG),
+				sizeof(ROS_EPROCESS) / sizeof(LONG),
 				FALSE);
    PsIdleProcess->Pcb.DirectoryTableBase.QuadPart = (ULONG_PTR)MmGetPageDirectory();
    strcpy(PsIdleProcess->ImageFileName, "Idle");
@@ -217,7 +217,7 @@
 			   NULL,
 			   KernelMode,
 			   NULL,
-			   sizeof(EPROCESS),
+			   sizeof(ROS_EPROCESS),
 			   0,
 			   0,
 			   (PVOID*)&PsInitialSystemProcess);
@@ -229,7 +229,7 @@
      }
 
    /* System threads may run on any processor. */
-   RtlZeroMemory(PsInitialSystemProcess, sizeof(EPROCESS));
+   RtlZeroMemory(PsInitialSystemProcess, sizeof(ROS_EPROCESS));
 #ifdef CONFIG_SMP   
    /* FIXME:
     *   Only the boot cpu is initialized. Threads of the 
@@ -245,15 +245,15 @@
    InitializeListHead(&PsInitialSystemProcess->Pcb.ThreadListHead);
    KeInitializeDispatcherHeader(&PsInitialSystemProcess->Pcb.Header,
 				ProcessObject,
-				sizeof(EPROCESS) / sizeof(LONG),
+				sizeof(ROS_EPROCESS) / sizeof(LONG),
 				FALSE);
    KProcess = &PsInitialSystemProcess->Pcb;
    PspInheritQuota(PsInitialSystemProcess, NULL);
 
-   MmInitializeAddressSpace(PsInitialSystemProcess,
-			    &PsInitialSystemProcess->AddressSpace);
+   MmInitializeAddressSpace((PROS_EPROCESS)PsInitialSystemProcess,
+			    &((PROS_EPROCESS)PsInitialSystemProcess)->AddressSpace);
 
-   KeInitializeEvent(&PsInitialSystemProcess->LockEvent, SynchronizationEvent, FALSE);
+   KeInitializeEvent(&((PROS_EPROCESS)PsInitialSystemProcess)->LockEvent, SynchronizationEvent, FALSE);
 
 #if defined(__GNUC__)
    KProcess->DirectoryTableBase =
@@ -300,8 +300,8 @@
   ObCreateHandleTable(NULL, FALSE, PsInitialSystemProcess);
   ObpKernelHandleTable = PsInitialSystemProcess->ObjectTable;
 
-  CidEntry.u1.Object = PsInitialSystemProcess;
-  CidEntry.u2.GrantedAccess = 0;
+  CidEntry.Object = PsInitialSystemProcess;
+  CidEntry.GrantedAccess = 0;
   PsInitialSystemProcess->UniqueProcessId = ExCreateHandle(PspCidTable, &CidEntry);
 
   if(!PsInitialSystemProcess->UniqueProcessId)
Index: ntoskrnl/ps/job.c
===================================================================
--- ntoskrnl/ps/job.c	(revision 21808)
+++ ntoskrnl/ps/job.c	(working copy)
@@ -157,7 +157,7 @@
                 /* lock the process so we can safely assign the process. Note that in the
                 meanwhile another thread could have assigned this process to a job! */
 
-                Status = PsLockProcess(Process, FALSE);
+                Status = PsLockProcess((PROS_EPROCESS)Process, FALSE);
                 if(NT_SUCCESS(Status))
                 {
                     if(Process->Job == NULL && Process->Session == Job->SessionId)
@@ -173,7 +173,7 @@
                         /* process is already assigned to a job or session id differs! */
                         Status = STATUS_ACCESS_DENIED;
                     }
-                    PsUnlockProcess(Process);
+                    PsUnlockProcess((PROS_EPROCESS)Process);
 
                     if(NT_SUCCESS(Status))
                     {
Index: ntoskrnl/ps/kill.c
===================================================================
--- ntoskrnl/ps/kill.c	(revision 21808)
+++ ntoskrnl/ps/kill.c	(working copy)
@@ -166,7 +166,7 @@
     SeDeassignPrimaryToken(Process);
 
     /* Release Memory Information */
-    MmReleaseMmInfo(Process);
+    MmReleaseMmInfo((PROS_EPROCESS)Process);
 
     /* Delete the W32PROCESS structure if there's one associated */
     if(Process->Win32Process != NULL) ExFreePool(Process->Win32Process);
@@ -240,7 +240,7 @@
     KeLowerIrql(PASSIVE_LEVEL);
 
     /* Lock the Process before we modify its thread entries */
-    PsLockProcess(CurrentProcess, FALSE);
+    PsLockProcess((PROS_EPROCESS)CurrentProcess, FALSE);
 
     /* wake up the thread so we don't deadlock on PsLockProcess */
     KeForceResumeThread(&CurrentThread->Tcb);
@@ -308,7 +308,7 @@
         }
         
         DPRINT("Decommit teb at %p\n", Teb);
-        MmDeleteTeb(CurrentProcess, Teb);
+        MmDeleteTeb((PROS_EPROCESS)CurrentProcess, Teb);
         CurrentThread->Tcb.Teb = NULL;
     }
 
@@ -316,7 +316,7 @@
     if (Last) PspExitProcess(CurrentProcess);
 
     /* Unlock the Process */
-    PsUnlockProcess(CurrentProcess);
+    PsUnlockProcess((PROS_EPROCESS)CurrentProcess);
 
     /* Cancel I/O for the thread. */
     IoCancelThreadIo(CurrentThread);
@@ -563,11 +563,11 @@
 
     CurrentThread = PsGetCurrentThread();
 
-    PsLockProcess(Process, FALSE);
+    PsLockProcess((PROS_EPROCESS)Process, FALSE);
 
     if(Process->ExitTime.QuadPart != 0)
     {
-      PsUnlockProcess(Process);
+      PsUnlockProcess((PROS_EPROCESS)Process);
       ObDereferenceObject(Process);
       return STATUS_PROCESS_IS_TERMINATING;
     }
@@ -592,7 +592,7 @@
                unlocking the process, fail */
             CurrentThread->Terminated = TRUE;
 
-            PsUnlockProcess(Process);
+            PsUnlockProcess((PROS_EPROCESS)Process);
 
             /* we can safely dereference the process because the current thread
                holds a reference to it until it gets reaped */
@@ -610,7 +610,7 @@
     }
 
     /* unlock and dereference the process so the threads can kill themselves */
-    PsUnlockProcess(Process);
+    PsUnlockProcess((PROS_EPROCESS)Process);
     ObDereferenceObject(Process);
 
     return(STATUS_SUCCESS);
@@ -668,7 +668,7 @@
     if (Thread != PsGetCurrentThread())  {
 
         /* we need to lock the process to make sure it's not already terminating */
-        PsLockProcess(Thread->ThreadsProcess, FALSE);
+        PsLockProcess((PROS_EPROCESS)Thread->ThreadsProcess, FALSE);
 
         /* This isn't our thread, terminate it if not already done */
         if (!Thread->Terminated) {
@@ -679,7 +679,7 @@
              PspTerminateThreadByPointer(Thread, ExitStatus);
         }
 
-        PsUnlockProcess(Thread->ThreadsProcess);
+        PsUnlockProcess((PROS_EPROCESS)Thread->ThreadsProcess);
 
         /* Dereference the Thread and return */
         ObDereferenceObject(Thread);
Index: ntoskrnl/include/ntoskrnl.h
===================================================================
--- ntoskrnl/include/ntoskrnl.h	(revision 21808)
+++ ntoskrnl/include/ntoskrnl.h	(working copy)
@@ -16,6 +16,7 @@
 #include <ntddk.h>
 #include <ntifs.h>
 #include <wdmguid.h>
+#include <arc/arc.h>
 #include <ndk/ntndk.h>
 #undef TEXT
 #define TEXT(s) L##s
@@ -23,6 +24,7 @@
 
 /* FIXME: Temporary until CC Ros is gone */
 #include <ccros.h>
+#include <rosldr.h>
 
 /* Disk Dump Driver Header */
 #include <diskdump/diskdump.h>
Index: ntoskrnl/include/internal/kd.h
===================================================================
--- ntoskrnl/include/internal/kd.h	(revision 21808)
+++ ntoskrnl/include/internal/kd.h	(working copy)
@@ -1,10 +1,61 @@
 #ifndef __INCLUDE_INTERNAL_KERNEL_DEBUGGER_H
 #define __INCLUDE_INTERNAL_KERNEL_DEBUGGER_H
 
+//
+// Kernel Debugger Port Definition
+//
+typedef struct _KD_PORT_INFORMATION
+{
+    ULONG ComPort;
+    ULONG BaudRate;
+    ULONG BaseAddress;
+} KD_PORT_INFORMATION, *PKD_PORT_INFORMATION;
+
 struct _KD_DISPATCH_TABLE;
 extern KD_PORT_INFORMATION GdbPortInfo;
 
+BOOLEAN
+NTAPI
+KdPortInitialize(
+    PKD_PORT_INFORMATION PortInformation,
+    ULONG Unknown1,
+    ULONG Unknown2
+);
+
+BOOLEAN
+NTAPI
+KdPortInitializeEx(
+    PKD_PORT_INFORMATION PortInformation,
+    ULONG Unknown1,
+    ULONG Unknown2
+);
+
+BOOLEAN
+NTAPI
+KdPortGetByte(
+    PUCHAR ByteRecieved);
+
+BOOLEAN
+NTAPI
+KdPortGetByteEx(
+    PKD_PORT_INFORMATION PortInformation,
+    PUCHAR ByteRecieved);
+
+VOID
+NTAPI
+KdPortPutByte(
+    UCHAR ByteToSend
+);
+
+VOID
+NTAPI
+KdPortPutByteEx(
+    PKD_PORT_INFORMATION PortInformation,
+    UCHAR ByteToSend
+);
+
 /* SYMBOL ROUTINES **********************************************************/
+#ifdef __NTOSKRNL__
 
 #if defined(KDBG) || defined(DBG)
 
@@ -284,4 +335,5 @@
 /* Whether to enter KDB as early as possible or not */
 extern BOOLEAN KdpEarlyBreak;
 
+#endif
 #endif /* __INCLUDE_INTERNAL_KERNEL_DEBUGGER_H */
Index: ntoskrnl/include/internal/ke.h
===================================================================
--- ntoskrnl/include/internal/ke.h	(revision 21808)
+++ ntoskrnl/include/internal/ke.h	(working copy)
@@ -277,13 +277,6 @@
 
 /* ipi.c ********************************************************************/
 
-BOOLEAN
-STDCALL
-KiIpiServiceRoutine(
-    IN PKTRAP_FRAME TrapFrame,
-    IN struct _KEXCEPTION_FRAME* ExceptionFrame
-);
-
 VOID
 NTAPI
 KiIpiSendRequest(
@@ -291,13 +284,6 @@
     ULONG IpiRequest
 );
 
-VOID   
-NTAPI   
-KeIpiGenericCall(   
-    VOID (STDCALL *WorkerRoutine)(PVOID),   
-    PVOID Argument   
-);   
-
 /* next file ***************************************************************/
 
 VOID 
@@ -714,13 +700,6 @@
 NTAPI
 KiSetSystemTime(PLARGE_INTEGER NewSystemTime);
 
-NTSTATUS 
-STDCALL
-Ke386CallBios(
-    UCHAR Int,
-    PKV86M_REGISTERS Regs
-);
-
 ULONG
 NTAPI
 KeV86Exception(
Index: ntoskrnl/include/internal/ob.h
===================================================================
--- ntoskrnl/include/internal/ob.h	(revision 21808)
+++ ntoskrnl/include/internal/ob.h	(working copy)
@@ -31,8 +31,31 @@
     LARGE_INTEGER CreateTime;
 } SYMLINK_OBJECT, *PSYMLINK_OBJECT;
 
+typedef struct _ROS_OBJECT_HEADER
+{
+    LIST_ENTRY Entry;
+    LONG PointerCount;
+    union
+    {
+        LONG HandleCount;
+        PVOID NextToFree;
+    };
+    POBJECT_TYPE Type;
+    UCHAR NameInfoOffset;
+    UCHAR HandleInfoOffset;
+    UCHAR QuotaInfoOffset;
+    UCHAR Flags;
+    union
+    {
+        POBJECT_CREATE_INFORMATION ObjectCreateInfo;
+        PVOID QuotaBlockCharged;
+    };
+    PSECURITY_DESCRIPTOR SecurityDescriptor;
+    QUAD Body;
+} ROS_OBJECT_HEADER, *PROS_OBJECT_HEADER;
+
 #define BODY_TO_HEADER(objbdy)                                                 \
-  CONTAINING_RECORD((objbdy), OBJECT_HEADER, Body)
+  CONTAINING_RECORD((objbdy), ROS_OBJECT_HEADER, Body)
   
 #define HEADER_TO_OBJECT_NAME(objhdr) ((POBJECT_HEADER_NAME_INFO)              \
   (!(objhdr)->NameInfoOffset ? NULL: ((PCHAR)(objhdr) - (objhdr)->NameInfoOffset)))
@@ -43,7 +66,7 @@
 #define HEADER_TO_CREATOR_INFO(objhdr) ((POBJECT_HEADER_CREATOR_INFO)          \
   (!((objhdr)->Flags & OB_FLAG_CREATOR_INFO) ? NULL: ((PCHAR)(objhdr) - sizeof(OBJECT_HEADER_CREATOR_INFO))))
 
-#define OBJECT_ALLOC_SIZE(ObjectSize) ((ObjectSize)+sizeof(OBJECT_HEADER))
+#define OBJECT_ALLOC_SIZE(ObjectSize) ((ObjectSize)+sizeof(ROS_OBJECT_HEADER))
 
 #define KERNEL_HANDLE_FLAG (1 << ((sizeof(HANDLE) * 8) - 1))
 #define ObIsKernelHandle(Handle, ProcessorMode)                                \
@@ -58,17 +81,41 @@
 extern POBJECT_TYPE ObSymbolicLinkType;
 extern PHANDLE_TABLE ObpKernelHandleTable;
 
+typedef NTSTATUS
+(NTAPI *OB_ROS_CREATE_METHOD)(
+    PVOID ObjectBody,
+    PVOID Parent,
+    PWSTR RemainingPath,
+    struct _OBJECT_ATTRIBUTES* ObjectAttributes
+);
+
+typedef PVOID
+(NTAPI *OB_ROS_FIND_METHOD)(
+    PVOID  WinStaObject,
+    PWSTR  Name,
+    ULONG  Attributes
+);
+
+typedef NTSTATUS
+(NTAPI *OB_ROS_PARSE_METHOD)(
+    PVOID Object,
+    PVOID *NextObject,
+    PUNICODE_STRING FullPath,
+    PWSTR *Path,
+    ULONG Attributes
+);
+
 VOID
 NTAPI
 ObpAddEntryDirectory(
     PDIRECTORY_OBJECT Parent,
-    POBJECT_HEADER Header,
+    PROS_OBJECT_HEADER Header,
     PWSTR Name
 );
 
 VOID
 NTAPI
-ObpRemoveEntryDirectory(POBJECT_HEADER Header);
+ObpRemoveEntryDirectory(PROS_OBJECT_HEADER Header);
 
 VOID
 NTAPI
Index: ntoskrnl/include/internal/i386/ke.h
===================================================================
--- ntoskrnl/include/internal/i386/ke.h	(revision 21808)
+++ ntoskrnl/include/internal/i386/ke.h	(working copy)
@@ -26,7 +26,7 @@
 #define X86_CR4_OSFXSR          0x00000200 /* enable FXSAVE/FXRSTOR instructions */
 #define X86_CR4_OSXMMEXCPT      0x00000400 /* enable #XF exception */
 
-#define X86_FEATURE_TSC         0x00000010 /* time stamp counters are present */
+#define KF_RDTSC                0x00000002 /* time stamp counters are present */
 #define X86_FEATURE_PAE         0x00000040 /* physical address extension is present */
 #define X86_FEATURE_CX8         0x00000100 /* CMPXCHG8B instruction present */
 #define X86_FEATURE_SYSCALL     0x00000800 /* SYSCALL/SYSRET support present */
@@ -51,81 +51,6 @@
 
 #ifndef __ASM__
 
-typedef struct _KIRQ_TRAPFRAME
-{
-   ULONG Magic;
-   ULONG Gs;
-   ULONG Fs;
-   ULONG Es;
-   ULONG Ds;
-   ULONG Eax;
-   ULONG Ecx;
-   ULONG Edx;
-   ULONG Ebx;
-   ULONG Esp;
-   ULONG Ebp;
-   ULONG Esi;
-   ULONG Edi;
-   ULONG Eip;
-   ULONG Cs;
-   ULONG Eflags;
-} KIRQ_TRAPFRAME, *PKIRQ_TRAPFRAME;
-
-/* Emulate cli/sti instructions */
-#define KV86M_EMULATE_CLI_STI          (0x1)
-/* Allow the v86 mode code to access i/o ports */
-#define KV86M_ALLOW_IO_PORT_ACCESS      (0x2)
-
-typedef struct _KV86M_REGISTERS
-{
-    /*
-     * General purpose registers
-     */
-    ULONG Ebp;
-    ULONG Edi;
-    ULONG Esi;
-    ULONG Edx;
-    ULONG Ecx;
-    ULONG Ebx;
-    ULONG Eax;
-    ULONG Ds;
-    ULONG Es;
-    ULONG Fs;
-    ULONG Gs;
-
-    /*
-     * Control registers
-     */
-    ULONG Eip;
-    ULONG Cs;
-    ULONG Eflags;
-    ULONG Esp;
-    ULONG Ss;
-
-    /*
-     * Control structures
-     */
-    ULONG RecoveryAddress;
-    UCHAR RecoveryInstruction[4];
-    ULONG Vif;
-    ULONG Flags;
-    PNTSTATUS PStatus;
-} KV86M_REGISTERS, *PKV86M_REGISTERS;
-
-typedef struct _KV86M_TRAP_FRAME
-{
-    KTRAP_FRAME Tf;
-
-    ULONG SavedExceptionStack;
-
-    /*
-     * These are put on the top of the stack by the routine that entered
-     * v86 mode so the exception handlers can find the control information
-     */
-    struct _KV86M_REGISTERS* regs;
-    ULONG orig_ebp;
-} KV86M_TRAP_FRAME, *PKV86M_TRAP_FRAME;
-
 extern ULONG Ke386CacheAlignment;
 
 struct _KPCR;
Index: ntoskrnl/include/internal/io.h
===================================================================
--- ntoskrnl/include/internal/io.h	(revision 21808)
+++ ntoskrnl/include/internal/io.h	(working copy)
@@ -477,6 +477,7 @@
 STDCALL
 IopQueryNameFile(
     PVOID ObjectBody,
+    IN BOOLEAN HasName,
     POBJECT_NAME_INFORMATION ObjectNameInfo,
     ULONG Length,
     PULONG ReturnLength
@@ -485,8 +486,11 @@
 VOID
 STDCALL
 IopCloseFile(
-    PVOID ObjectBody,
-    ULONG HandleCount
+    IN PEPROCESS Process OPTIONAL,
+    IN PVOID Object,
+    IN ACCESS_MASK GrantedAccess,
+    IN ULONG ProcessHandleCount,
+    IN ULONG SystemHandleCount
 );
 
 /* plugplay.c */
@@ -557,7 +561,7 @@
 VOID 
 FASTCALL
 xHalIoAssignDriveLetters(
-    IN PLOADER_PARAMETER_BLOCK LoaderBlock,
+    IN PROS_LOADER_PARAMETER_BLOCK LoaderBlock,
     IN PSTRING NtDeviceName,
     OUT PUCHAR NtSystemPath,
     OUT PSTRING NtSystemPathString
Index: ntoskrnl/include/internal/mm.h
===================================================================
--- ntoskrnl/include/internal/mm.h	(revision 21808)
+++ ntoskrnl/include/internal/mm.h	(working copy)
@@ -5,6 +5,8 @@
 
 /* TYPES *********************************************************************/
 
+struct _ROS_EPROCESS;
+
 extern ULONG MiFreeSwapPages;
 extern ULONG MiUsedSwapPages;
 extern ULONG MmPagedPoolSize;
@@ -192,7 +194,7 @@
     PMM_SECTION_SEGMENT Segments;
 } MM_IMAGE_SECTION_OBJECT, *PMM_IMAGE_SECTION_OBJECT;
 
-typedef struct _SECTION_OBJECT
+typedef struct _ROS_SECTION_OBJECT
 {
     CSHORT Type;
     CSHORT Size;
@@ -205,7 +207,7 @@
         PMM_IMAGE_SECTION_OBJECT ImageSection;
         PMM_SECTION_SEGMENT Segment;
     };
-} SECTION_OBJECT, *PSECTION_OBJECT;
+} ROS_SECTION_OBJECT, *PROS_SECTION_OBJECT;
 
 typedef struct _MEMORY_AREA
 {
@@ -224,7 +226,7 @@
     {
         struct
         {
-            SECTION_OBJECT* Section;
+            ROS_SECTION_OBJECT* Section;
             ULONG ViewOffset;
             PMM_SECTION_SEGMENT Segment;
             BOOLEAN WriteCopyView;
@@ -237,17 +239,15 @@
     } Data;
 } MEMORY_AREA, *PMEMORY_AREA;
 
-#ifndef _MMTYPES_H
 typedef struct _MADDRESS_SPACE
 {
     PMEMORY_AREA MemoryAreaRoot;
     FAST_MUTEX Lock;
     PVOID LowestAddress;
-    struct _EPROCESS* Process;
+    struct _ROS_EPROCESS* Process;
     PUSHORT PageTableRefCountTable;
     ULONG PageTableRefCountTableSize;
 } MADDRESS_SPACE, *PMADDRESS_SPACE;
-#endif
 
 typedef struct
 {
@@ -362,7 +362,7 @@
 NTSTATUS
 NTAPI
 MmInitializeAddressSpace(
-    struct _EPROCESS* Process,
+    struct _ROS_EPROCESS* Process,
     PMADDRESS_SPACE AddressSpace);
 
 NTSTATUS
@@ -445,7 +445,7 @@
 VOID
 STDCALL
 MmReleaseMemoryAreaIfDecommitted(
-    PEPROCESS Process,
+    struct _ROS_EPROCESS *Process,
     PMADDRESS_SPACE AddressSpace,
     PVOID BaseAddress
 );
@@ -621,18 +621,18 @@
 NTSTATUS
 STDCALL
 MmCreateProcessAddressSpace(
-    IN struct _EPROCESS* Process,
-    IN PSECTION_OBJECT Section OPTIONAL
+    IN struct _ROS_EPROCESS* Process,
+    IN PROS_SECTION_OBJECT Section OPTIONAL
 );
 
 NTSTATUS
 STDCALL
-MmCreatePeb(PEPROCESS Process);
+MmCreatePeb(struct _ROS_EPROCESS *Process);
 
 struct _TEB*
 STDCALL
 MmCreateTeb(
-    PEPROCESS Process,
+    struct _ROS_EPROCESS *Process,
     PCLIENT_ID ClientId,
     PINITIAL_TEB InitialTeb
 );
@@ -640,7 +640,7 @@
 VOID
 STDCALL
 MmDeleteTeb(
-    PEPROCESS Process,
+    struct _ROS_EPROCESS *Process,
     struct _TEB* Teb
 );
 
@@ -706,7 +706,7 @@
 VOID
 NTAPI
 MmFreeVirtualMemory(
-    struct _EPROCESS* Process,
+    struct _ROS_EPROCESS* Process,
     PMEMORY_AREA MemoryArea
 );
 
@@ -860,7 +860,7 @@
 NTAPI
 MmInsertRmap(
     PFN_TYPE Page,
-    PEPROCESS Process,
+    struct _ROS_EPROCESS *Process,
     PVOID Address
 );
 
@@ -869,14 +869,14 @@
 MmDeleteAllRmaps(
     PFN_TYPE Page,
     PVOID Context,
-    VOID (*DeleteMapping)(PVOID Context, PEPROCESS Process, PVOID Address)
+    VOID (*DeleteMapping)(PVOID Context, struct _ROS_EPROCESS *Process, PVOID Address)
 );
 
 VOID
 NTAPI
 MmDeleteRmap(
     PFN_TYPE Page,
-    PEPROCESS Process,
+    struct _ROS_EPROCESS *Process,
     PVOID Address
 );
 
@@ -994,7 +994,7 @@
 NTSTATUS
 NTAPI
 MmCreateVirtualMapping(
-    struct _EPROCESS* Process,
+    struct _ROS_EPROCESS* Process,
     PVOID Address,
     ULONG flProtect,
     PPFN_TYPE Pages,
@@ -1004,7 +1004,7 @@
 NTSTATUS
 NTAPI
 MmCreateVirtualMappingUnsafe(
-    struct _EPROCESS* Process,
+    struct _ROS_EPROCESS* Process,
     PVOID Address,
     ULONG flProtect,
     PPFN_TYPE Pages,
@@ -1014,13 +1014,13 @@
 ULONG
 NTAPI
 MmGetPageProtect(
-    struct _EPROCESS* Process,
+    struct _ROS_EPROCESS* Process,
     PVOID Address);
 
 VOID
 NTAPI
 MmSetPageProtect(
-    struct _EPROCESS* Process,
+    struct _ROS_EPROCESS* Process,
     PVOID Address,
     ULONG flProtect
 );
@@ -1028,7 +1028,7 @@
 BOOLEAN
 NTAPI
 MmIsPagePresent(
-    struct _EPROCESS* Process,
+    struct _ROS_EPROCESS* Process,
     PVOID Address
 );
 
@@ -1039,7 +1039,7 @@
 VOID
 NTAPI
 MmDisableVirtualMapping(
-    PEPROCESS Process,
+    struct _ROS_EPROCESS *Process,
     PVOID Address,
     BOOLEAN* WasDirty,
     PPFN_TYPE Page
@@ -1048,7 +1048,7 @@
 VOID
 NTAPI
 MmEnableVirtualMapping(
-    PEPROCESS Process,
+    struct _ROS_EPROCESS *Process,
     PVOID Address
 );
 
@@ -1059,7 +1059,7 @@
 VOID
 NTAPI
 MmDeletePageFileMapping(
-    PEPROCESS Process,
+    struct _ROS_EPROCESS *Process,
     PVOID Address,
     SWAPENTRY* SwapEntry
 );
@@ -1067,7 +1067,7 @@
 NTSTATUS
 NTAPI
 MmCreatePageFileMapping(
-    PEPROCESS Process,
+    struct _ROS_EPROCESS *Process,
     PVOID Address,
     SWAPENTRY SwapEntry
 );
@@ -1075,7 +1075,7 @@
 BOOLEAN
 NTAPI
 MmIsPageSwapEntry(
-    PEPROCESS Process,
+    struct _ROS_EPROCESS *Process,
     PVOID Address
 );
 
@@ -1089,7 +1089,7 @@
 VOID
 NTAPI
 MmSetDirtyPage(
-    PEPROCESS Process,
+    struct _ROS_EPROCESS *Process,
     PVOID Address
 );
 
@@ -1125,7 +1125,7 @@
 BOOLEAN
 NTAPI
 MmIsAccessedAndResetAccessPage(
-    PEPROCESS Process,
+    struct _ROS_EPROCESS *Process,
     PVOID Address
 );
 
@@ -1160,7 +1160,7 @@
 VOID
 NTAPI
 MmSetCleanPage(
-    PEPROCESS Process,
+    struct _ROS_EPROCESS *Process,
     PVOID Address
 );
 
@@ -1171,37 +1171,37 @@
 VOID
 NTAPI
 MmDeletePageTable(
-    PEPROCESS Process,
+    struct _ROS_EPROCESS *Process,
     PVOID Address
 );
 
 PFN_TYPE
 NTAPI
 MmGetPfnForProcess(
-    PEPROCESS Process,
+    struct _ROS_EPROCESS *Process,
     PVOID Address
 );
 
 NTSTATUS
 STDCALL
 MmCopyMmInfo(
-    PEPROCESS Src,
-    PEPROCESS Dest,
+    struct _ROS_EPROCESS *Src,
+    struct _ROS_EPROCESS *Dest,
     PPHYSICAL_ADDRESS DirectoryTableBase
 );
 
 NTSTATUS
 NTAPI
-MmReleaseMmInfo(PEPROCESS Process);
+MmReleaseMmInfo(struct _ROS_EPROCESS *Process);
 
 NTSTATUS
 NTAPI
-Mmi386ReleaseMmInfo(PEPROCESS Process);
+Mmi386ReleaseMmInfo(struct _ROS_EPROCESS *Process);
 
 VOID
 NTAPI
 MmDeleteVirtualMapping(
-    PEPROCESS Process,
+    struct _ROS_EPROCESS *Process,
     PVOID Address,
     BOOLEAN FreePage,
     BOOLEAN* WasDirty,
@@ -1211,7 +1211,7 @@
 BOOLEAN
 NTAPI
 MmIsDirtyPage(
-    PEPROCESS Process,
+    struct _ROS_EPROCESS *Process,
     PVOID Address
 );
 
@@ -1226,7 +1226,7 @@
 VOID
 NTAPI
 MmUpdatePageDir(
-    PEPROCESS Process,
+    struct _ROS_EPROCESS *Process,
     PVOID Address,
     ULONG Size
 );
@@ -1301,21 +1301,6 @@
 
 NTSTATUS
 NTAPI
-MmMapViewOfSection(
-    IN PVOID SectionObject,
-    IN PEPROCESS Process,
-    IN OUT PVOID *BaseAddress,
-    IN ULONG ZeroBits,
-    IN ULONG CommitSize,
-    IN OUT PLARGE_INTEGER SectionOffset OPTIONAL,
-    IN OUT PULONG ViewSize,
-    IN SECTION_INHERIT InheritDisposition,
-    IN ULONG AllocationType,
-    IN ULONG Protect
-);
-
-NTSTATUS
-NTAPI
 MmProtectSectionView(
     PMADDRESS_SPACE AddressSpace,
     PMEMORY_AREA MemoryArea,
Index: ntoskrnl/include/internal/ntoskrnl.h
===================================================================
--- ntoskrnl/include/internal/ntoskrnl.h	(revision 21808)
+++ ntoskrnl/include/internal/ntoskrnl.h	(working copy)
@@ -14,6 +14,7 @@
 #include "ke.h"
 #include "i386/mm.h"
 #include "i386/fpu.h"
+#include "i386/v86m.h"
 #include "ob.h"
 #include "mm.h"
 #include "ps.h"
@@ -51,7 +52,7 @@
 /*
  * Initalization functions (called once by main())
  */
-VOID MmInitSystem(ULONG Phase, PLOADER_PARAMETER_BLOCK LoaderBlock, ULONG LastKernelAddress);
+VOID MmInitSystem(ULONG Phase, PROS_LOADER_PARAMETER_BLOCK LoaderBlock, ULONG LastKernelAddress);
 VOID IoInit(VOID);
 VOID IoInit2(BOOLEAN BootLog);
 VOID STDCALL IoInit3(VOID);
@@ -63,7 +64,7 @@
 VOID CmShutdownRegistry(VOID);
 BOOLEAN CmImportSystemHive(PCHAR ChunkBase, ULONG ChunkSize);
 BOOLEAN CmImportHardwareHive(PCHAR ChunkBase, ULONG ChunkSize);
-VOID KdInitSystem(ULONG Reserved, PLOADER_PARAMETER_BLOCK LoaderBlock);
+VOID KdInitSystem(ULONG Reserved, PROS_LOADER_PARAMETER_BLOCK LoaderBlock);
 
 /* FIXME - RtlpCreateUnicodeString is obsolete and should be removed ASAP! */
 BOOLEAN FASTCALL
Index: ntoskrnl/include/internal/ex.h
===================================================================
--- ntoskrnl/include/internal/ex.h	(revision 21808)
+++ ntoskrnl/include/internal/ex.h	(working copy)
@@ -8,10 +8,10 @@
 extern ULONG ExpTimeZoneId;
 extern POBJECT_TYPE ExEventPairObjectType;
 
-#define EX_OBJ_TO_HDR(eob) ((POBJECT_HEADER)((ULONG_PTR)(eob) &                \
+#define EX_OBJ_TO_HDR(eob) ((PROS_OBJECT_HEADER)((ULONG_PTR)(eob) &                \
   ~(EX_HANDLE_ENTRY_PROTECTFROMCLOSE | EX_HANDLE_ENTRY_INHERITABLE |           \
   EX_HANDLE_ENTRY_AUDITONCLOSE)))
-#define EX_HTE_TO_HDR(hte) ((POBJECT_HEADER)((ULONG_PTR)((hte)->u1.Object) &   \
+#define EX_HTE_TO_HDR(hte) ((PROS_OBJECT_HEADER)((ULONG_PTR)((hte)->Object) &   \
   ~(EX_HANDLE_ENTRY_PROTECTFROMCLOSE | EX_HANDLE_ENTRY_INHERITABLE |           \
   EX_HANDLE_ENTRY_AUDITONCLOSE)))
 
Index: ntoskrnl/include/internal/lpc.h
===================================================================
--- ntoskrnl/include/internal/lpc.h	(revision 21808)
+++ ntoskrnl/include/internal/lpc.h	(working copy)
@@ -93,8 +93,11 @@
 VOID 
 STDCALL
 LpcpClosePort(
-    PVOID ObjectBody,
-    ULONG HandleCount
+    IN PEPROCESS Process OPTIONAL,
+    IN PVOID Object,
+    IN ACCESS_MASK GrantedAccess,
+    IN ULONG ProcessHandleCount,
+    IN ULONG SystemHandleCount
 );
 
 VOID
Index: ntoskrnl/include/internal/po.h
===================================================================
--- ntoskrnl/include/internal/po.h	(revision 21808)
+++ ntoskrnl/include/internal/po.h	(working copy)
@@ -6,7 +6,7 @@
 VOID
 NTAPI
 PoInit(
-    PLOADER_PARAMETER_BLOCK LoaderBlock, 
+    PROS_LOADER_PARAMETER_BLOCK LoaderBlock, 
     BOOLEAN ForceAcpiDisable
 );
 
Index: ntoskrnl/include/internal/ps.h
===================================================================
--- ntoskrnl/include/internal/ps.h	(revision 21808)
+++ ntoskrnl/include/internal/ps.h	(working copy)
@@ -8,6 +8,203 @@
 
 #include <internal/arch/ps.h>
 
+//
+// ROS Process
+//
+typedef struct _ROS_EPROCESS
+{
+    KPROCESS Pcb;
+    EX_PUSH_LOCK ProcessLock;
+    LARGE_INTEGER CreateTime;
+    LARGE_INTEGER ExitTime;
+    EX_RUNDOWN_REF RundownProtect;
+    HANDLE UniqueProcessId;
+    LIST_ENTRY ActiveProcessLinks;
+    ULONG QuotaUsage[3];
+    ULONG QuotaPeak[3];
+    ULONG CommitCharge;
+    ULONG PeakVirtualSize;
+    ULONG VirtualSize;
+    LIST_ENTRY SessionProcessLinks;
+    PVOID DebugPort;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    union
+    {
+        PVOID ExceptionPortData;
+        ULONG ExceptionPortValue;
+        UCHAR ExceptionPortState:3;
+    };
+#else
+    PVOID ExceptionPort;
+#endif
+    PHANDLE_TABLE ObjectTable;
+    EX_FAST_REF Token;
+    ULONG WorkingSetPage;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    EX_PUSH_LOCK AddressCreationLock;
+    PETHREAD RotateInProgress;
+#else
+    KGUARDED_MUTEX AddressCreationLock;
+    KSPIN_LOCK HyperSpaceLock;
+#endif
+    PETHREAD ForkInProgress;
+    ULONG HardwareTrigger;
+    MM_AVL_TABLE PhysicalVadroot;
+    PVOID CloneRoot;
+    ULONG NumberOfPrivatePages;
+    ULONG NumberOfLockedPages;
+    PVOID *Win32Process;
+    struct _EJOB *Job;
+    PVOID SectionObject;
+    PVOID SectionBaseAddress;
+    PEPROCESS_QUOTA_BLOCK QuotaBlock;
+    PPAGEFAULT_HISTORY WorkingSetWatch;
+    PVOID Win32WindowStation;
+    HANDLE InheritedFromUniqueProcessId;
+    PVOID LdtInformation;
+    PVOID VadFreeHint;
+    PVOID VdmObjects;
+    PVOID DeviceMap;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    ULONG AlpcPagedPoolQuotaCache;
+    PVOID EtwDataSource;
+    PVOID FreeTebHint;
+#else
+    PVOID Spare0[3];
+#endif
+    union
+    {
+        HARDWARE_PTE_X86 PagedirectoryPte;
+        ULONGLONG Filler;
+    };
+    ULONG Session;
+    CHAR ImageFileName[16];
+    LIST_ENTRY JobLinks;
+    PVOID LockedPagesList;
+    LIST_ENTRY ThreadListHead;
+    PVOID SecurityPort;
+    PVOID PaeTop;
+    ULONG ActiveThreads;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    ULONG ImagePathHash;
+#else
+    ACCESS_MASK GrantedAccess;
+#endif
+    ULONG DefaultHardErrorProcessing;
+    NTSTATUS LastThreadExitStatus;
+    struct _PEB* Peb;
+    EX_FAST_REF PrefetchTrace;
+    LARGE_INTEGER ReadOperationCount;
+    LARGE_INTEGER WriteOperationCount;
+    LARGE_INTEGER OtherOperationCount;
+    LARGE_INTEGER ReadTransferCount;
+    LARGE_INTEGER WriteTransferCount;
+    LARGE_INTEGER OtherTransferCount;
+    ULONG CommitChargeLimit;
+    ULONG CommitChargePeak;
+    PVOID AweInfo;
+    SE_AUDIT_PROCESS_CREATION_INFO SeAuditProcessCreationInfo;
+    MMSUPPORT Vm;
+    LIST_ENTRY MmProcessLinks;
+    ULONG ModifiedPageCount;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    union
+    {
+        struct
+        {
+            ULONG JobNotReallyActive:1;
+            ULONG AccountingFolded:1;
+            ULONG NewProcessReported:1;
+            ULONG ExitProcessReported:1;
+            ULONG ReportCommitChanges:1;
+            ULONG LastReportMemory:1;
+            ULONG ReportPhysicalPageChanges:1;
+            ULONG HandleTableRundown:1;
+            ULONG NeedsHandleRundown:1;
+            ULONG RefTraceEnabled:1;
+            ULONG NumaAware:1;
+            ULONG ProtectedProcess:1;
+            ULONG DefaultPagePriority:3;
+            ULONG ProcessDeleteSelf:1;
+            ULONG ProcessVerifierTarget:1;
+        };
+        ULONG Flags2;
+    };
+#else
+    ULONG JobStatus;
+#endif
+    union
+    {
+        struct
+        {
+            ULONG CreateReported:1;
+            ULONG NoDebugInherit:1;
+            ULONG ProcessExiting:1;
+            ULONG ProcessDelete:1;
+            ULONG Wow64SplitPages:1;
+            ULONG VmDeleted:1;
+            ULONG OutswapEnabled:1;
+            ULONG Outswapped:1;
+            ULONG ForkFailed:1;
+            ULONG Wow64VaSpace4Gb:1;
+            ULONG AddressSpaceInitialized:2;
+            ULONG SetTimerResolution:1;
+            ULONG BreakOnTermination:1;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+            ULONG DeprioritizeViews:1;
+#else
+            ULONG SessionCreationUnderway:1;
+#endif
+            ULONG WriteWatch:1;
+            ULONG ProcessInSession:1;
+            ULONG OverrideAddressSpace:1;
+            ULONG HasAddressSpace:1;
+            ULONG LaunchPrefetched:1;
+            ULONG InjectInpageErrors:1;
+            ULONG VmTopDown:1;
+            ULONG ImageNotifyDone:1;
+            ULONG PdeUpdateNeeded:1;
+            ULONG VdmAllowed:1;
+            ULONG SmapAllowed:1;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+            ULONG ProcessInserted:1;
+#else
+            ULONG CreateFailed:1;
+#endif
+            ULONG DefaultIoPriority:3;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+            ULONG SparePsFlags1:2;
+#else
+            ULONG Spare1:1;
+            ULONG Spare2:1;
+#endif
+        };
+        ULONG Flags;
+    };
+    NTSTATUS ExitStatus;
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+    USHORT Spare7;
+#else
+    USHORT NextPageColor;
+#endif
+    union
+    {
+        struct
+        {
+            UCHAR SubSystemMinorVersion;
+            UCHAR SubSystemMajorVersion;
+        };
+        USHORT SubSystemVersion;
+    };
+    UCHAR PriorityClass;
+    MM_AVL_TABLE VadRoot;
+    ULONG Cookie;
+    KEVENT LockEvent;
+    ULONG LockCount;
+    struct _KTHREAD *LockOwner;
+    MADDRESS_SPACE AddressSpace;
+} ROS_EPROCESS, *PROS_EPROCESS;
+
 extern LCID PsDefaultThreadLocaleId;
 extern LCID PsDefaultSystemLocaleId;
 extern LIST_ENTRY PspReaperListHead;
@@ -368,12 +565,12 @@
 NTSTATUS 
 NTAPI
 PsLockProcess(
-    PEPROCESS Process,
+    PROS_EPROCESS Process,
     BOOLEAN Timeout
 );
 
 VOID
 NTAPI
-PsUnlockProcess(PEPROCESS Process);
+PsUnlockProcess(PROS_EPROCESS Process);
 
 #endif /* __INCLUDE_INTERNAL_PS_H */
Index: ntoskrnl/ntoskrnl.rbuild
===================================================================
--- ntoskrnl/ntoskrnl.rbuild	(revision 21808)
+++ ntoskrnl/ntoskrnl.rbuild	(working copy)
@@ -45,7 +45,6 @@
 				<file>vdm.c</file>
 			</directory>
 		</if>
-		<compilationunit name="ke.c">
 			<file>apc.c</file>
 			<file>bug.c</file>
 			<file>clock.c</file>
@@ -68,26 +67,21 @@
 			<file>timer.c</file>
 			<file>usercall.c</file>
 			<file>wait.c</file>
-		</compilationunit>
 	</directory>
 	<directory name="cc">
-		<compilationunit name="cc.c">
 			<file>cacheman.c</file>
 			<file>copy.c</file>
 			<file>fs.c</file>
 			<file>mdl.c</file>
 			<file>pin.c</file>
 			<file>view.c</file>
-		</compilationunit>
 	</directory>
 	<directory name="cm">
-		<compilationunit name="cm.c">
 			<file>import.c</file>
 			<file>ntfunc.c</file>
 			<file>regfile.c</file>
 			<file>registry.c</file>
 			<file>regobj.c</file>
-		</compilationunit>
 	</directory>
 	<directory name="kdbg">
 		<if property="ARCH" value="i386">
@@ -125,7 +119,6 @@
 				<file>fastinterlck_asm.S</file>
 			</directory>
 		</if>
-		<compilationunit name="ex.c">
 			<file>atom.c</file>
 			<file>callback.c</file>
 			<file>dbgctrl.c</file>
@@ -150,11 +143,9 @@
 			<file>win32k.c</file>
 			<file>work.c</file>
 			<file>zone.c</file>
-		</compilationunit>
 		<file>zw.S</file>
 	</directory>
 	<directory name="fs">
-		<compilationunit name="fs.c">
 			<file>context.c</file>
 			<file>fastio.c</file>
 			<file>filelock.c</file>
@@ -166,13 +157,11 @@
 			<file>tunnel.c</file>
 			<file>unc.c</file>
 			<file>util.c</file>
-		</compilationunit>
 	</directory>
 	<directory name="inbv">
 		<file>inbv.c</file>
 	</directory>
 	<directory name="io">
-		<compilationunit name="io.c">
 			<file>adapter.c</file>
 			<file>arcname.c</file>
 			<file>bootlog.c</file>
@@ -205,11 +194,9 @@
 			<file>timer.c</file>
 			<file>vpb.c</file>
 			<file>wmi.c</file>
-		</compilationunit>
 		<file>file.c</file>
 	</directory>
 	<directory name="kd">
-		<compilationunit name="kd.c">
 			<directory name="wrappers">
 				<file>bochs.c</file>
 				<file>gdbstub.c</file>
@@ -217,16 +204,12 @@
 			<file>kdinit.c</file>
 			<file>kdio.c</file>
 			<file>kdmain.c</file>
-		</compilationunit>
 	</directory>
 	<directory name="ldr">
-		<compilationunit name="ldr.c">
 			<file>loader.c</file>
 			<file>rtl.c</file>
-		</compilationunit>
 	</directory>
 	<directory name="lpc">
-		<compilationunit name="lpc.c">
 			<file>close.c</file>
 			<file>complete.c</file>
 			<file>connect.c</file>
@@ -238,7 +221,6 @@
 			<file>receive.c</file>
 			<file>reply.c</file>
 			<file>send.c</file>
-		</compilationunit>
 	</directory>
 	<directory name="mm">
 		<if property="ARCH" value="i386">
@@ -248,7 +230,6 @@
 				<file>pfault.c</file>
 			</directory>
 		</if>
-		<compilationunit name="mm.c">
 			<file>anonmem.c</file>
 			<file>aspace.c</file>
 			<file>balance.c</file>
@@ -280,12 +261,10 @@
 			<file>verifier.c</file>
 			<file>virtual.c</file>
 			<file>wset.c</file>
-		</compilationunit>
 		<file>elf32.c</file>
 		<file>elf64.c</file>
 	</directory>
 	<directory name="ob">
-		<compilationunit name="ob.c">
 			<file>dirobj.c</file>
 			<file>handle.c</file>
 			<file>namespc.c</file>
@@ -295,13 +274,11 @@
 			<file>security.c</file>
 			<file>symlink.c</file>
 			<file>wait.c</file>
-		</compilationunit>
 	</directory>
 	<directory name="po">
 		<file>power.c</file>
 	</directory>
 	<directory name="ps">
-		<compilationunit name="ps.c">
 			<file>debug.c</file>
 			<file>idle.c</file>
 			<file>job.c</file>
@@ -316,7 +293,6 @@
 			<file>suspend.c</file>
 			<file>thread.c</file>
 			<file>win32.c</file>
-		</compilationunit>
 	</directory>
 	<directory name="rtl">
 		<if property="ARCH" value="i386">
@@ -325,16 +301,13 @@
 				<file>seh.s</file>
 			</directory>
 		</if>
-		<compilationunit name="rtl.c">
 			<file>libsupp.c</file>
 			<file>misc.c</file>
 			<file>nls.c</file>
 			<file>regio.c</file>
 			<file>strtok.c</file>
-		</compilationunit>
 	</directory>
 	<directory name="se">
-		<compilationunit name="se.c">
 			<file>access.c</file>
 			<file>acl.c</file>
 			<file>audit.c</file>
@@ -345,7 +318,6 @@
 			<file>semgr.c</file>
 			<file>sid.c</file>
 			<file>token.c</file>
-		</compilationunit>
 	</directory>
 	<file>ntoskrnl.rc</file>
 	<linkerflag>-nostartfiles</linkerflag>
Index: ntoskrnl/inbv/inbv.c
===================================================================
--- ntoskrnl/inbv/inbv.c	(revision 21808)
+++ ntoskrnl/inbv/inbv.c	(working copy)
@@ -19,6 +19,13 @@
 #pragma alloc_text(INIT, InbvEnableBootDriver)
 #endif
 
+/* ROS Internal. Please deprecate */
+NTHALAPI
+VOID
+NTAPI
+HalReleaseDisplayOwnership(
+    VOID
+);
 
 /* GLOBALS *******************************************************************/
 
Index: ntoskrnl/kd/kdinit.c
===================================================================
--- ntoskrnl/kd/kdinit.c	(revision 21808)
+++ ntoskrnl/kd/kdinit.c	(working copy)
@@ -44,7 +44,7 @@
 PCHAR
 STDCALL
 KdpGetWrapperDebugMode(PCHAR Currentp2,
-                       PLOADER_PARAMETER_BLOCK LoaderBlock)
+                       PROS_LOADER_PARAMETER_BLOCK LoaderBlock)
 {
     PCHAR p2 = Currentp2;
 
@@ -160,7 +160,7 @@
 VOID
 INIT_FUNCTION
 KdInitSystem(ULONG BootPhase,
-             PLOADER_PARAMETER_BLOCK LoaderBlock)
+             PROS_LOADER_PARAMETER_BLOCK LoaderBlock)
 {
     ULONG Value;
     ULONG i;
Index: ntoskrnl/cm/cm.h
===================================================================
--- ntoskrnl/cm/cm.h	(revision 21808)
+++ ntoskrnl/cm/cm.h	(working copy)
@@ -459,6 +459,7 @@
 
 NTSTATUS STDCALL
 CmiObjectQueryName (PVOID ObjectBody,
+                    IN BOOLEAN HasObjectName,
 		    POBJECT_NAME_INFORMATION ObjectNameInfo,
 		    ULONG Length,
 		    PULONG ReturnLength);
Index: ntoskrnl/cm/registry.c
===================================================================
--- ntoskrnl/cm/registry.c	(revision 21808)
+++ ntoskrnl/cm/registry.c	(working copy)
@@ -369,7 +369,7 @@
   ObjectTypeInitializer.ValidAccessMask = KEY_ALL_ACCESS;
   ObjectTypeInitializer.UseDefaultObject = TRUE;
   ObjectTypeInitializer.DeleteProcedure = CmiObjectDelete;
-  ObjectTypeInitializer.ParseProcedure = CmiObjectParse;
+  ObjectTypeInitializer.ParseProcedure = (PVOID)CmiObjectParse;
   ObjectTypeInitializer.SecurityProcedure = CmiObjectSecurity;
   ObjectTypeInitializer.QueryNameProcedure = CmiObjectQueryName;
 
Index: ntoskrnl/cm/regobj.c
===================================================================
--- ntoskrnl/cm/regobj.c	(revision 21808)
+++ ntoskrnl/cm/regobj.c	(working copy)
@@ -486,6 +486,7 @@
 
 NTSTATUS STDCALL
 CmiObjectQueryName (PVOID ObjectBody,
+            IN BOOLEAN HasName,
 		    POBJECT_NAME_INFORMATION ObjectNameInfo,
 		    ULONG Length,
 		    PULONG ReturnLength)
Index: ntoskrnl/ke/device.c
===================================================================
--- ntoskrnl/ke/device.c	(revision 21808)
+++ ntoskrnl/ke/device.c	(working copy)
@@ -71,9 +71,9 @@
         else
         {
             /* Try to get a match */
-            if (Child->Component.Class == Class &&
-                Child->Component.Type == Type &&
-                (Child->Component.Key & Mask) == Key)
+            if (Child->ComponentEntry.Class == Class &&
+                Child->ComponentEntry.Type == Type &&
+                (Child->ComponentEntry.Key & Mask) == Key)
             {
                 /* Match found */
                 return Child;
@@ -93,9 +93,9 @@
             else
             {
                 /* Try to get a match */
-                if (Sibling->Component.Class == Class &&
-                    Sibling->Component.Type == Type &&
-                    (Sibling->Component.Key & Mask) == Key)
+                if (Sibling->ComponentEntry.Class == Class &&
+                    Sibling->ComponentEntry.Type == Type &&
+                    (Sibling->ComponentEntry.Key & Mask) == Key)
                 {
                     /* Match found */
                     return Sibling;
Index: ntoskrnl/ke/dpc.c
===================================================================
--- ntoskrnl/ke/dpc.c	(revision 21808)
+++ ntoskrnl/ke/dpc.c	(working copy)
@@ -439,13 +439,9 @@
     Process = CurrentThread->ApcState.Process;
 
     /* Set DPC Event if requested */
-    if (Prcb->DpcSetEventRequest) {
-        /*
-         * FIXME:
-         *   Prcb->DpcEvent is not initialized.
-         */
-        KEBUGCHECK(0);
-        KeSetEvent(Prcb->DpcEvent, 0, 0);
+    if (Prcb->DpcSetEventRequest)
+    {
+        KeSetEvent(&Prcb->DpcEvent, 0, 0);
     }
 
     /* Check if Quantum expired */
Index: ntoskrnl/ke/i386/usertrap.c
===================================================================
--- ntoskrnl/ke/i386/usertrap.c	(revision 21808)
+++ ntoskrnl/ke/i386/usertrap.c	(working copy)
@@ -61,7 +61,7 @@
 	  current_entry != NULL)
      {
 	current =
-	  CONTAINING_RECORD(current_entry, LDR_DATA_TABLE_ENTRY, InLoadOrderModuleList);
+	  CONTAINING_RECORD(current_entry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks);
 
 	if (address >= (PVOID)current->DllBase &&
 	    address < (PVOID)((char*)current->DllBase + current->SizeOfImage))
Index: ntoskrnl/ke/i386/kernel.c
===================================================================
--- ntoskrnl/ke/i386/kernel.c	(revision 21808)
+++ ntoskrnl/ke/i386/kernel.c	(working copy)
@@ -139,7 +139,7 @@
    if (MaxCpuidLevel >= 0x80000006)
    {
       Ki386Cpuid(0x80000006, &Dummy, &Dummy, &Ecx, &Dummy);
-      Pcr->L2CacheSize = Ecx >> 16;
+      Pcr->SecondLevelCacheSize = Ecx >> 16;
    }
 }
 
@@ -494,9 +494,9 @@
 
       DPRINT("Ke386L1CacheSize: %dkB\n", Ke386L1CacheSize);
    }
-   if (Pcr->L2CacheSize)
+   if (Pcr->SecondLevelCacheSize)
    {
-      DPRINT("Ke386L2CacheSize: %dkB\n", Pcr->L2CacheSize);
+      DPRINT("Ke386L2CacheSize: %dkB\n", Pcr->SecondLevelCacheSize);
    }
 }
 
@@ -532,7 +532,7 @@
    SharedUserData->ProcessorFeatures[PF_3DNOW_INSTRUCTIONS_AVAILABLE] =
        (Ke386CpuidExFlags & X86_EXT_FEATURE_3DNOW) ? TRUE : FALSE;
    SharedUserData->ProcessorFeatures[PF_RDTSC_INSTRUCTION_AVAILABLE] =
-       (Pcr->PrcbData.FeatureBits & X86_FEATURE_TSC) ? TRUE : FALSE;
+       (Pcr->PrcbData.FeatureBits & KF_RDTSC) ? TRUE : FALSE;
    SharedUserData->ProcessorFeatures[PF_PAE_ENABLED] = Ke386Pae;
    SharedUserData->ProcessorFeatures[PF_XMMI64_INSTRUCTIONS_AVAILABLE] =
        (Pcr->PrcbData.FeatureBits & X86_FEATURE_SSE2) ? TRUE : FALSE;
Index: ntoskrnl/ke/i386/irq.c
===================================================================
--- ntoskrnl/ke/i386/irq.c	(revision 21808)
+++ ntoskrnl/ke/i386/irq.c	(working copy)
@@ -19,6 +19,7 @@
 
 #include <ntoskrnl.h>
 #include <../hal/halx86/include/halirq.h>
+#include <../hal/halx86/include/mps.h>
 
 #define NDEBUG
 #include <internal/debug.h>
Index: ntoskrnl/ke/i386/exp.c
===================================================================
--- ntoskrnl/ke/i386/exp.c	(revision 21808)
+++ ntoskrnl/ke/i386/exp.c	(working copy)
@@ -118,7 +118,7 @@
      while (current_entry != &ModuleListHead)
        {
           current =
-            CONTAINING_RECORD(current_entry, LDR_DATA_TABLE_ENTRY, InLoadOrderModuleList);
+            CONTAINING_RECORD(current_entry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks);
 
           if (address >= (PVOID)current->DllBase &&
               address < (PVOID)((ULONG_PTR)current->DllBase + current->SizeOfImage))
Index: ntoskrnl/ke/i386/bios.c
===================================================================
--- ntoskrnl/ke/i386/bios.c	(revision 21808)
+++ ntoskrnl/ke/i386/bios.c	(working copy)
@@ -24,11 +24,12 @@
 /* FUNCTIONS *****************************************************************/
 
 NTSTATUS STDCALL
-Ke386CallBios(UCHAR Int, PKV86M_REGISTERS Regs)
+Ke386CallBios(ULONG Int, PCONTEXT regs)
 {
   PUCHAR Ip;
   KV86M_REGISTERS ORegs;
   NTSTATUS Status;
+  PKV86M_REGISTERS Regs = (PKV86M_REGISTERS)regs;
 
   /*
    * Set up a trampoline for executing the BIOS interrupt
Index: ntoskrnl/ke/bug.c
===================================================================
--- ntoskrnl/ke/bug.c	(revision 21808)
+++ ntoskrnl/ke/bug.c	(working copy)
@@ -19,6 +19,14 @@
 #pragma alloc_text(INIT, KiInitializeBugCheck)
 #endif
 
+/* ROS Internal. Please deprecate */
+NTHALAPI
+VOID
+NTAPI
+HalReleaseDisplayOwnership(
+    VOID
+);
+
 /* GLOBALS ******************************************************************/
 
 static LIST_ENTRY BugcheckCallbackListHead = {NULL,NULL};
@@ -315,7 +323,7 @@
         Address = (PVOID)Tf->Eip;
 
         /* Try to get information on the module */
-        LIST_FOR_EACH(CurrentModule, &ModuleListHead, LDR_DATA_TABLE_ENTRY, InLoadOrderModuleList)
+        LIST_FOR_EACH(CurrentModule, &ModuleListHead, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks)
         {
             /* Check if this is the right one */
             if ((Address != NULL && (Address >= (PVOID)CurrentModule->DllBase &&
Index: ntoskrnl/ke/process.c
===================================================================
--- ntoskrnl/ke/process.c	(revision 21808)
+++ ntoskrnl/ke/process.c	(working copy)
@@ -22,8 +22,6 @@
 {
     { MainSSDT, NULL, NUMBER_OF_SYSCALLS, MainSSPT },
     { NULL,     NULL,   0,   NULL   },
-    { NULL,     NULL,   0,   NULL   },
-    { NULL,     NULL,   0,   NULL   }
 };
 
 KSERVICE_TABLE_DESCRIPTOR
@@ -31,8 +29,6 @@
 {
     { MainSSDT, NULL, NUMBER_OF_SYSCALLS, MainSSPT },
     { NULL,     NULL,   0,   NULL   },
-    { NULL,     NULL,   0,   NULL   },
-    { NULL,     NULL,   0,   NULL   }
 };
 
 /* FUNCTIONS *****************************************************************/
@@ -60,8 +56,8 @@
      * To prevent this, make sure the page directory of the process we're
      * attaching to is up-to-date.
      */
-    MmUpdatePageDir((PEPROCESS)Process, (PVOID)Thread->StackLimit, KERNEL_STACK_SIZE);
-    MmUpdatePageDir((PEPROCESS)Process, (PVOID)Thread, sizeof(ETHREAD));
+    MmUpdatePageDir((PROS_EPROCESS)Process, (PVOID)Thread->StackLimit, KERNEL_STACK_SIZE);
+    MmUpdatePageDir((PROS_EPROCESS)Process, (PVOID)Thread, sizeof(ETHREAD));
 }
 
 VOID
Index: ntoskrnl/ke/ipi.c
===================================================================
--- ntoskrnl/ke/ipi.c	(revision 21808)
+++ ntoskrnl/ke/ipi.c	(working copy)
@@ -43,9 +43,9 @@
  * @implemented
  */
 BOOLEAN
-STDCALL
+NTAPI
 KiIpiServiceRoutine(IN PKTRAP_FRAME TrapFrame,
-                    IN PKEXCEPTION_FRAME ExceptionFrame)
+                    IN PVOID ExceptionFrame)
 {
 #ifdef DBG
    LARGE_INTEGER StartTime, CurrentTime, Frequency;
Index: ntoskrnl/ke/kthread.c
===================================================================
--- ntoskrnl/ke/kthread.c	(revision 21808)
+++ ntoskrnl/ke/kthread.c	(working copy)
@@ -154,7 +154,7 @@
                 IdleProcessorMask |= Affinity;
             }
 
-            MmUpdatePageDir(PsGetCurrentProcess(),((PETHREAD)CurrentThread)->ThreadsProcess, sizeof(EPROCESS));
+            MmUpdatePageDir((PROS_EPROCESS)PsGetCurrentProcess(),((PETHREAD)CurrentThread)->ThreadsProcess, sizeof(ROS_EPROCESS));
 
             /* Special note for Filip: This will release the Dispatcher DB Lock ;-) -- Alex */
             DPRINT("You are : %x, swapping to: %x\n", OldThread, CurrentThread);
@@ -864,8 +864,8 @@
      * while handling page faults. At this point it isn't possible to call the
      * page fault handler for the missing pde's.
      */
-    MmUpdatePageDir((PEPROCESS)Process, (PVOID)Thread->StackLimit, KERNEL_STACK_SIZE);
-    MmUpdatePageDir((PEPROCESS)Process, (PVOID)Thread, sizeof(ETHREAD));
+    MmUpdatePageDir((PROS_EPROCESS)Process, (PVOID)Thread->StackLimit, KERNEL_STACK_SIZE);
+    MmUpdatePageDir((PROS_EPROCESS)Process, (PVOID)Thread, sizeof(ETHREAD));
 
     /* Initalize the Thread Context */
     DPRINT("Initializing the Context for the thread: %x\n", Thread);
Index: ntoskrnl/ke/main.c
===================================================================
--- ntoskrnl/ke/main.c	(revision 21808)
+++ ntoskrnl/ke/main.c	(working copy)
@@ -26,7 +26,7 @@
 ULONG NtGlobalFlag = 0;
 CHAR  KeNumberProcessors;
 KAFFINITY KeActiveProcessors = 1;
-LOADER_PARAMETER_BLOCK KeLoaderBlock;
+ROS_LOADER_PARAMETER_BLOCK KeLoaderBlock;
 ULONG KeDcacheFlushCount = 0;
 ULONG KeIcacheFlushCount = 0;
 ULONG KiDmaIoCoherency = 0; /* RISC Architectures only */
@@ -66,7 +66,7 @@
 extern unsigned int _image_base__;
 ULONG_PTR KERNEL_BASE = (ULONG_PTR)&_image_base__;
 
-VOID INIT_FUNCTION _main(ULONG MultiBootMagic, PLOADER_PARAMETER_BLOCK _LoaderBlock);
+VOID INIT_FUNCTION _main(ULONG MultiBootMagic, PROS_LOADER_PARAMETER_BLOCK _LoaderBlock);
 
 #if defined (ALLOC_PRAGMA)
 #pragma alloc_text(INIT, _main)
@@ -146,7 +146,7 @@
 VOID
 INIT_FUNCTION
 _main(ULONG MultiBootMagic,
-      PLOADER_PARAMETER_BLOCK _LoaderBlock)
+      PROS_LOADER_PARAMETER_BLOCK _LoaderBlock)
 {
     ULONG i;
     ULONG size;
@@ -282,7 +282,7 @@
     }
 
     /* Initialize the Debugger */
-    KdInitSystem (0, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock);
+    KdInitSystem (0, &KeLoaderBlock);
 
     /* Initialize HAL */
     HalInitSystem (0, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock);
Index: ntoskrnl/ke/clock.c
===================================================================
--- ntoskrnl/ke/clock.c	(revision 21808)
+++ ntoskrnl/ke/clock.c	(working copy)
@@ -42,7 +42,7 @@
 /*
  * Number of timer interrupts since initialisation
  */
-volatile ULONGLONG KeTickCount = 0;
+volatile KSYSTEM_TIME KeTickCount = {0};
 volatile ULONG KiRawTicks = 0;
 
 extern LIST_ENTRY KiTimerListHead;
@@ -165,7 +165,7 @@
  *         TickCount (OUT) = Points to storage for the number of ticks
  */
 {
-    TickCount->QuadPart = KeTickCount;
+    TickCount->QuadPart = *(PULONGLONG)&KeTickCount;
 }
 
 /*
@@ -352,7 +352,7 @@
    /*
     * Increment the number of timers ticks
     */
-   KeTickCount++;
+   (*(PULONGLONG)&KeTickCount)++;
    SharedUserData->TickCountLowDeprecated++;
 
    Time.u.LowPart = SharedUserData->InterruptTime.LowPart;
Index: ntoskrnl/ob/wait.c
===================================================================
--- ntoskrnl/ob/wait.c	(revision 21808)
+++ ntoskrnl/ob/wait.c	(working copy)
@@ -35,7 +35,7 @@
     LARGE_INTEGER SafeTimeOut;
     BOOLEAN LockInUse;
     PHANDLE_TABLE_ENTRY HandleEntry;
-    POBJECT_HEADER ObjectHeader;
+    PROS_OBJECT_HEADER ObjectHeader;
     PHANDLE_TABLE HandleTable;
     ACCESS_MASK GrantedAccess;
     PVOID DefaultObject;
@@ -132,7 +132,7 @@
         }
 
         /* Check for synchronize access */
-        GrantedAccess = HandleEntry->u2.GrantedAccess;
+        GrantedAccess = HandleEntry->GrantedAccess;
         if ((PreviousMode != KernelMode) && (!(GrantedAccess & SYNCHRONIZE)))
         {
             /* Unlock the entry and fail */
Index: ntoskrnl/ob/namespc.c
===================================================================
--- ntoskrnl/ob/namespc.c	(revision 21808)
+++ ntoskrnl/ob/namespc.c	(working copy)
@@ -50,7 +50,7 @@
                   PUNICODE_STRING ObjectName,
                   POBJECT_TYPE ObjectType,
                   ULONG ObjectSize,
-                  POBJECT_HEADER *ObjectHeader);
+                  PROS_OBJECT_HEADER *ObjectHeader);
 
 /* FUNCTIONS **************************************************************/
 
@@ -247,7 +247,7 @@
 VOID
 NTAPI
 ObpAddEntryDirectory(PDIRECTORY_OBJECT Parent,
-		     POBJECT_HEADER Header,
+		     PROS_OBJECT_HEADER Header,
 		     PWSTR Name)
 /*
  * FUNCTION: Add an entry to a namespace directory
@@ -270,7 +270,7 @@
 
 VOID
 NTAPI
-ObpRemoveEntryDirectory(POBJECT_HEADER Header)
+ObpRemoveEntryDirectory(PROS_OBJECT_HEADER Header)
 /*
  * FUNCTION: Remove an entry from a namespace directory
  * ARGUMENTS:
@@ -293,10 +293,10 @@
 NTSTATUS
 STDCALL
 ObpCreateDirectory(OB_OPEN_REASON Reason,
+                   PEPROCESS Process,
                    PVOID ObjectBody,
-                   PEPROCESS Process,
-                   ULONG HandleCount,
-                   ACCESS_MASK GrantedAccess)
+                   ACCESS_MASK GrantedAccess,
+                   ULONG HandleCount)
 {
     PDIRECTORY_OBJECT Directory = ObjectBody;
     
@@ -315,7 +315,7 @@
 		      ULONG Attributes)
 {
    PLIST_ENTRY current = DirectoryObject->head.Flink;
-   POBJECT_HEADER current_obj;
+   PROS_OBJECT_HEADER current_obj;
 
    DPRINT("ObFindEntryDirectory(dir %x, name %S)\n",DirectoryObject, Name);
 
@@ -333,7 +333,7 @@
      }
    while (current!=(&(DirectoryObject->head)))
      {
-	current_obj = CONTAINING_RECORD(current,OBJECT_HEADER,Entry);
+	current_obj = CONTAINING_RECORD(current,ROS_OBJECT_HEADER,Entry);
 	DPRINT("  Scanning: %S for: %S\n",HEADER_TO_OBJECT_NAME(current_obj)->Name.Buffer, Name);
 	if (Attributes & OBJ_CASE_INSENSITIVE)
 	  {
@@ -458,7 +458,7 @@
     ObjectTypeInitializer.ValidAccessMask = DIRECTORY_ALL_ACCESS;
     ObjectTypeInitializer.UseDefaultObject = FALSE;
     ObjectTypeInitializer.OpenProcedure = ObpCreateDirectory;
-    ObjectTypeInitializer.ParseProcedure = ObpParseDirectory;
+    ObjectTypeInitializer.ParseProcedure = (OB_PARSE_METHOD)ObpParseDirectory;
     ObjectTypeInitializer.MaintainTypeList = FALSE;
     ObjectTypeInitializer.GenericMapping = ObpDirectoryMapping;
     ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(DIRECTORY_OBJECT);
@@ -526,8 +526,8 @@
     
     /* Insert the two objects we already created but couldn't add */
     /* NOTE: Uses TypeList & Creator Info in OB 2.0 */
-    ObpAddEntryDirectory(ObpTypeDirectoryObject, BODY_TO_HEADER(ObTypeObjectType), NULL);
-    ObpAddEntryDirectory(ObpTypeDirectoryObject, BODY_TO_HEADER(ObDirectoryType), NULL);
+    ObpAddEntryDirectory(ObpTypeDirectoryObject, (PROS_OBJECT_HEADER)BODY_TO_HEADER(ObTypeObjectType), NULL);
+    ObpAddEntryDirectory(ObpTypeDirectoryObject, (PROS_OBJECT_HEADER)BODY_TO_HEADER(ObDirectoryType), NULL);
 
     /* Create 'symbolic link' object type */
     ObInitSymbolicLinkImplementation();
@@ -543,7 +543,7 @@
                     PUNICODE_STRING TypeName,
                     POBJECT_TYPE *ObjectType)
 {
-    POBJECT_HEADER Header;
+    PROS_OBJECT_HEADER Header;
     POBJECT_TYPE LocalObjectType;
     ULONG HeaderSize;
     NTSTATUS Status;
@@ -555,7 +555,7 @@
                                TypeName,
                                ObTypeObjectType, 
                                OBJECT_ALLOC_SIZE(sizeof(OBJECT_TYPE)),
-                               &Header);
+                               (PROS_OBJECT_HEADER*)&Header);
     if (!NT_SUCCESS(Status))
     {
         DPRINT1("ObpAllocateObject failed!\n");
@@ -601,7 +601,7 @@
     }
 
     /* Calculate how much space our header'll take up */
-    HeaderSize = sizeof(OBJECT_HEADER) + sizeof(OBJECT_HEADER_NAME_INFO) +
+    HeaderSize = sizeof(ROS_OBJECT_HEADER) + sizeof(OBJECT_HEADER_NAME_INFO) +
                  (ObjectTypeInitializer->MaintainHandleCount ? 
                  sizeof(OBJECT_HEADER_HANDLE_INFO) : 0);
 
Index: ntoskrnl/ob/object.c
===================================================================
--- ntoskrnl/ob/object.c	(revision 21808)
+++ ntoskrnl/ob/object.c	(working copy)
@@ -22,7 +22,7 @@
 typedef struct _RETENTION_CHECK_PARAMS
 {
   WORK_QUEUE_ITEM WorkItem;
-  POBJECT_HEADER ObjectHeader;
+  PROS_OBJECT_HEADER ObjectHeader;
 } RETENTION_CHECK_PARAMS, *PRETENTION_CHECK_PARAMS;
 
 /* FUNCTIONS ************************************************************/
@@ -298,7 +298,7 @@
   PVOID NextObject;
   PVOID CurrentObject;
   PVOID RootObject;
-  POBJECT_HEADER CurrentHeader;
+  PROS_OBJECT_HEADER CurrentHeader;
   NTSTATUS Status;
   PWSTR current;
   UNICODE_STRING PathString;
@@ -384,7 +384,7 @@
 	     DPRINT("Current object can't parse\n");
 	     break;
 	  }
-	Status = CurrentHeader->Type->TypeInfo.ParseProcedure(CurrentObject,
+	Status = ((OB_ROS_PARSE_METHOD)CurrentHeader->Type->TypeInfo.ParseProcedure)(CurrentObject,
 						  &NextObject,
 						  &PathString,
 						  &current,
@@ -441,7 +441,7 @@
                   OUT PULONG ReturnLength)
 {
     POBJECT_HEADER_NAME_INFO LocalInfo;
-    POBJECT_HEADER ObjectHeader;
+    PROS_OBJECT_HEADER ObjectHeader;
     PDIRECTORY_OBJECT ParentDirectory;
     ULONG NameSize;
     PWCH ObjectName;
@@ -459,6 +459,7 @@
         /* Call the procedure */
         DPRINT("Calling Object's Procedure\n");
         Status = ObjectHeader->Type->TypeInfo.QueryNameProcedure(Object,
+                                                                 TRUE, //fixme
                                                                  ObjectNameInfo,
                                                                  Length,
                                                                  ReturnLength);
@@ -618,9 +619,9 @@
                   PUNICODE_STRING ObjectName,
                   POBJECT_TYPE ObjectType,
                   ULONG ObjectSize,
-                  POBJECT_HEADER *ObjectHeader)
+                  PROS_OBJECT_HEADER *ObjectHeader)
 {
-    POBJECT_HEADER Header;
+    PROS_OBJECT_HEADER Header;
     BOOLEAN HasHandleInfo = FALSE;
     BOOLEAN HasNameInfo = FALSE;
     BOOLEAN HasCreatorInfo = FALSE;
@@ -684,7 +685,7 @@
         HandleInfo = (POBJECT_HEADER_HANDLE_INFO)Header;
         DPRINT("Info: %x\n", HandleInfo);
         HandleInfo->SingleEntry.HandleCount = 0;
-        Header = (POBJECT_HEADER)(HandleInfo + 1);
+        Header = (PROS_OBJECT_HEADER)(HandleInfo + 1);
     }
        
     /* Initialize the Object Name Info */
@@ -694,7 +695,7 @@
         DPRINT("Info: %x %wZ\n", NameInfo, ObjectName);
         NameInfo->Name = *ObjectName;
         NameInfo->Directory = NULL;
-        Header = (POBJECT_HEADER)(NameInfo + 1);
+        Header = (PROS_OBJECT_HEADER)(NameInfo + 1);
     }
     
     /* Initialize Creator Info */
@@ -706,7 +707,7 @@
          * CreatorInfo->CreatorUniqueProcess = PsGetCurrentProcessId();
          */
         InitializeListHead(&CreatorInfo->TypeList);
-        Header = (POBJECT_HEADER)(CreatorInfo + 1);
+        Header = (PROS_OBJECT_HEADER)(CreatorInfo + 1);
     }
     
     /* Initialize the object header */
@@ -777,7 +778,7 @@
     NTSTATUS Status;
     POBJECT_CREATE_INFORMATION ObjectCreateInfo;
     UNICODE_STRING ObjectName;
-    POBJECT_HEADER Header;
+    PROS_OBJECT_HEADER Header;
     
     DPRINT("ObCreateObject(Type %p ObjectAttributes %p, Object %p)\n", 
             Type, ObjectAttributes, Object);
@@ -845,7 +846,7 @@
 			   IN POBJECT_TYPE ObjectType,
 			   IN KPROCESSOR_MODE AccessMode)
 {
-   POBJECT_HEADER Header;
+   PROS_OBJECT_HEADER Header;
 
    /* NOTE: should be possible to reference an object above APC_LEVEL! */
 
@@ -938,7 +939,7 @@
 
 
 static NTSTATUS
-ObpDeleteObject(POBJECT_HEADER Header)
+ObpDeleteObject(PROS_OBJECT_HEADER Header)
 {
   PVOID HeaderLocation = Header;
   POBJECT_HEADER_HANDLE_INFO HandleInfo;
@@ -1015,7 +1016,7 @@
 
 
 STATIC NTSTATUS
-ObpDeleteObjectDpcLevel(IN POBJECT_HEADER ObjectHeader,
+ObpDeleteObjectDpcLevel(IN PROS_OBJECT_HEADER ObjectHeader,
 			IN LONG OldPointerCount)
 {
 #if 0
@@ -1094,7 +1095,7 @@
 VOID FASTCALL
 ObfReferenceObject(IN PVOID Object)
 {
-  POBJECT_HEADER Header;
+  PROS_OBJECT_HEADER Header;
 
   ASSERT(Object);
 
@@ -1127,7 +1128,7 @@
 VOID FASTCALL
 ObfDereferenceObject(IN PVOID Object)
 {
-  POBJECT_HEADER Header;
+  PROS_OBJECT_HEADER Header;
   LONG NewPointerCount;
   BOOL Permanent;
 
@@ -1222,7 +1223,7 @@
 ULONG STDCALL
 ObGetObjectPointerCount(PVOID Object)
 {
-  POBJECT_HEADER Header;
+  PROS_OBJECT_HEADER Header;
 
   PAGED_CODE();
 
@@ -1250,7 +1251,7 @@
 NTAPI
 ObGetObjectHandleCount(PVOID Object)
 {
-  POBJECT_HEADER Header;
+  PROS_OBJECT_HEADER Header;
 
   PAGED_CODE();
 
Index: ntoskrnl/ob/symlink.c
===================================================================
--- ntoskrnl/ob/symlink.c	(revision 21808)
+++ ntoskrnl/ob/symlink.c	(working copy)
@@ -152,7 +152,7 @@
   ObjectTypeInitializer.PoolType = NonPagedPool;
   ObjectTypeInitializer.ValidAccessMask = SYMBOLIC_LINK_ALL_ACCESS;
   ObjectTypeInitializer.UseDefaultObject = TRUE;
-  ObjectTypeInitializer.ParseProcedure = ObpParseSymbolicLink;
+  ObjectTypeInitializer.ParseProcedure = (OB_PARSE_METHOD)ObpParseSymbolicLink;
   ObjectTypeInitializer.DeleteProcedure = ObpDeleteSymbolicLink;
   ObpCreateTypeObject(&ObjectTypeInitializer, &Name, &ObSymbolicLinkType);
 }
Index: ntoskrnl/ob/security.c
===================================================================
--- ntoskrnl/ob/security.c	(revision 21808)
+++ ntoskrnl/ob/security.c	(working copy)
@@ -66,7 +66,7 @@
 		    OUT PSECURITY_DESCRIPTOR *SecurityDescriptor,
 		    OUT PBOOLEAN MemoryAllocated)
 {
-  POBJECT_HEADER Header;
+  PROS_OBJECT_HEADER Header;
   ULONG Length;
   NTSTATUS Status;
 
@@ -161,7 +161,7 @@
 {
     KPROCESSOR_MODE PreviousMode;
     PVOID Object;
-    POBJECT_HEADER Header;
+    PROS_OBJECT_HEADER Header;
     ACCESS_MASK DesiredAccess = (ACCESS_MASK)0;
     NTSTATUS Status = STATUS_SUCCESS;
 
@@ -240,7 +240,7 @@
 {
     KPROCESSOR_MODE PreviousMode;
     PVOID Object;
-    POBJECT_HEADER Header;
+    PROS_OBJECT_HEADER Header;
     SECURITY_DESCRIPTOR_RELATIVE *CapturedSecurityDescriptor;
     ACCESS_MASK DesiredAccess = (ACCESS_MASK)0;
     NTSTATUS Status;
Index: ntoskrnl/ob/dirobj.c
===================================================================
--- ntoskrnl/ob/dirobj.c	(revision 21808)
+++ ntoskrnl/ob/dirobj.c	(working copy)
@@ -223,7 +223,7 @@
                                            BufferLength);
     if(TemporaryBuffer != NULL)
     {
-      POBJECT_HEADER EntryHeader;
+      PROS_OBJECT_HEADER EntryHeader;
       PLIST_ENTRY ListEntry;
       KIRQL OldLevel;
       ULONG RequiredSize = sizeof(OBJECT_DIRECTORY_INFORMATION);
@@ -244,7 +244,7 @@
           PUNICODE_STRING Name, Type;
           ULONG EntrySize;
 
-          EntryHeader = CONTAINING_RECORD(ListEntry, OBJECT_HEADER, Entry);
+          EntryHeader = CONTAINING_RECORD(ListEntry, ROS_OBJECT_HEADER, Entry);
 
           /* calculate the size of the required buffer space for this entry */
           Name = (HEADER_TO_OBJECT_NAME(EntryHeader)->Name.Length != 0 ? &HEADER_TO_OBJECT_NAME(EntryHeader)->Name : NULL);
Index: ntoskrnl/ob/handle.c
===================================================================
--- ntoskrnl/ob/handle.c	(revision 21808)
+++ ntoskrnl/ob/handle.c	(working copy)
@@ -52,7 +52,7 @@
 static VOID
 ObpDecrementHandleCount(PVOID ObjectBody)
 {
-  POBJECT_HEADER ObjectHeader = BODY_TO_HEADER(ObjectBody);
+  PROS_OBJECT_HEADER ObjectHeader = BODY_TO_HEADER(ObjectBody);
   LONG NewHandleCount = InterlockedDecrement(&ObjectHeader->HandleCount);
   DPRINT("Header: %x\n", ObjectHeader);
   DPRINT("NewHandleCount: %x\n", NewHandleCount);
@@ -63,7 +63,7 @@
   {
     /* the handle count should be decremented but we pass the previous value
        to the callback */
-    ObjectHeader->Type->TypeInfo.CloseProcedure(ObjectBody, NewHandleCount + 1);
+    ObjectHeader->Type->TypeInfo.CloseProcedure(NULL, ObjectBody, 0, NewHandleCount + 1, NewHandleCount + 1);
   }
 
   if(NewHandleCount == 0)
@@ -75,7 +75,7 @@
       /* delete the object from the namespace when the last handle got closed.
          Only do this if it's actually been inserted into the namespace and
          if it's not a permanent object. */
-      ObpRemoveEntryDirectory(ObjectHeader);
+      ObpRemoveEntryDirectory((PROS_OBJECT_HEADER)ObjectHeader);
     }
 
     /* remove the keep-alive reference */
@@ -123,8 +123,8 @@
                                           Handle);
   if (HandleTableEntry != NULL)
   {
-    HandleInfo->Inherit = (HandleTableEntry->u1.ObAttributes & EX_HANDLE_ENTRY_INHERITABLE) != 0;
-    HandleInfo->ProtectFromClose = (HandleTableEntry->u1.ObAttributes & EX_HANDLE_ENTRY_PROTECTFROMCLOSE) != 0;
+    HandleInfo->Inherit = (HandleTableEntry->ObAttributes & EX_HANDLE_ENTRY_INHERITABLE) != 0;
+    HandleInfo->ProtectFromClose = (HandleTableEntry->ObAttributes & EX_HANDLE_ENTRY_PROTECTFROMCLOSE) != 0;
 
     ExUnlockHandleTableEntry(Process->ObjectTable,
                              HandleTableEntry);
@@ -183,14 +183,14 @@
   if (HandleTableEntry != NULL)
   {
     if (HandleInfo->Inherit)
-      HandleTableEntry->u1.ObAttributes |= EX_HANDLE_ENTRY_INHERITABLE;
+      HandleTableEntry->ObAttributes |= EX_HANDLE_ENTRY_INHERITABLE;
     else
-      HandleTableEntry->u1.ObAttributes &= ~EX_HANDLE_ENTRY_INHERITABLE;
+      HandleTableEntry->ObAttributes &= ~EX_HANDLE_ENTRY_INHERITABLE;
 
     if (HandleInfo->ProtectFromClose)
-      HandleTableEntry->u1.ObAttributes |= EX_HANDLE_ENTRY_PROTECTFROMCLOSE;
+      HandleTableEntry->ObAttributes |= EX_HANDLE_ENTRY_PROTECTFROMCLOSE;
     else
-      HandleTableEntry->u1.ObAttributes &= ~EX_HANDLE_ENTRY_PROTECTFROMCLOSE;
+      HandleTableEntry->ObAttributes &= ~EX_HANDLE_ENTRY_PROTECTFROMCLOSE;
 
     /* FIXME: Do we need to set anything in the object header??? */
 
@@ -216,7 +216,7 @@
 {
    PHANDLE_TABLE_ENTRY HandleEntry;
    PVOID Body;
-   POBJECT_HEADER ObjectHeader;
+   PROS_OBJECT_HEADER ObjectHeader;
    PHANDLE_TABLE ObjectTable;
 
    PAGED_CODE();
@@ -231,7 +231,7 @@
                                       Handle);
    if(HandleEntry != NULL)
    {
-     if(HandleEntry->u1.ObAttributes & EX_HANDLE_ENTRY_PROTECTFROMCLOSE)
+     if(HandleEntry->ObAttributes & EX_HANDLE_ENTRY_PROTECTFROMCLOSE)
      {
        ExUnlockHandleTableEntry(ObjectTable,
                                 HandleEntry);
@@ -274,7 +274,7 @@
   HANDLE_TABLE_ENTRY NewHandleEntry;
   BOOLEAN AttachedToProcess = FALSE;
   PVOID ObjectBody;
-  POBJECT_HEADER ObjectHeader;
+  PROS_OBJECT_HEADER ObjectHeader;
   ULONG NewHandleCount;
   HANDLE NewTargetHandle;
   PEPROCESS CurrentProcess;
@@ -316,17 +316,17 @@
   ObjectHeader = EX_HTE_TO_HDR(SourceHandleEntry);
   ObjectBody = &ObjectHeader->Body;
 
-  NewHandleEntry.u1.Object = SourceHandleEntry->u1.Object;
+  NewHandleEntry.Object = SourceHandleEntry->Object;
   if(HandleAttributes & OBJ_INHERIT)
-    NewHandleEntry.u1.ObAttributes |= EX_HANDLE_ENTRY_INHERITABLE;
+    NewHandleEntry.ObAttributes |= EX_HANDLE_ENTRY_INHERITABLE;
   else
-    NewHandleEntry.u1.ObAttributes &= ~EX_HANDLE_ENTRY_INHERITABLE;
-  NewHandleEntry.u2.GrantedAccess = ((Options & DUPLICATE_SAME_ACCESS) ?
-                                     SourceHandleEntry->u2.GrantedAccess :
+    NewHandleEntry.ObAttributes &= ~EX_HANDLE_ENTRY_INHERITABLE;
+  NewHandleEntry.GrantedAccess = ((Options & DUPLICATE_SAME_ACCESS) ?
+                                     SourceHandleEntry->GrantedAccess :
                                      DesiredAccess);
   if (Options & DUPLICATE_SAME_ACCESS)
   {
-    NewHandleEntry.u2.GrantedAccess = SourceHandleEntry->u2.GrantedAccess;
+    NewHandleEntry.GrantedAccess = SourceHandleEntry->GrantedAccess;
   }
   else
   {
@@ -335,7 +335,7 @@
       RtlMapGenericMask(&DesiredAccess,
                         &ObjectHeader->Type->TypeInfo.GenericMapping);
     }
-    NewHandleEntry.u2.GrantedAccess = DesiredAccess;
+    NewHandleEntry.GrantedAccess = DesiredAccess;
   }
 
   /* reference the object so it doesn't get deleted after releasing the lock
@@ -613,7 +613,7 @@
                     ULONG GrantedAccess,
                     PVOID Context)
 {
-  POBJECT_HEADER ObjectHeader;
+  PROS_OBJECT_HEADER ObjectHeader;
   PVOID ObjectBody;
 
   PAGED_CODE();
@@ -629,12 +629,12 @@
                         PHANDLE_TABLE_ENTRY HandleTableEntry,
                         PVOID Context)
 {
-  POBJECT_HEADER ObjectHeader;
+  PROS_OBJECT_HEADER ObjectHeader;
   BOOLEAN Ret = FALSE;
 
   PAGED_CODE();
 
-  Ret = (HandleTableEntry->u1.ObAttributes & EX_HANDLE_ENTRY_INHERITABLE) != 0;
+  Ret = (HandleTableEntry->ObAttributes & EX_HANDLE_ENTRY_INHERITABLE) != 0;
   if(Ret)
   {
     ObjectHeader = EX_HTE_TO_HDR(HandleTableEntry);
@@ -709,7 +709,7 @@
 {
    HANDLE_TABLE_ENTRY NewEntry;
    PEPROCESS Process, CurrentProcess;
-   POBJECT_HEADER ObjectHeader;
+   PROS_OBJECT_HEADER ObjectHeader;
    HANDLE Handle;
    KAPC_STATE ApcState;
    BOOLEAN AttachedToProcess = FALSE;
@@ -739,12 +739,12 @@
 		         &ObjectHeader->Type->TypeInfo.GenericMapping);
      }
 
-   NewEntry.u1.Object = ObjectHeader;
+   NewEntry.Object = ObjectHeader;
    if(HandleAttributes & OBJ_INHERIT)
-     NewEntry.u1.ObAttributes |= EX_HANDLE_ENTRY_INHERITABLE;
+     NewEntry.ObAttributes |= EX_HANDLE_ENTRY_INHERITABLE;
    else
-     NewEntry.u1.ObAttributes &= ~EX_HANDLE_ENTRY_INHERITABLE;
-   NewEntry.u2.GrantedAccess = GrantedAccess;
+     NewEntry.ObAttributes &= ~EX_HANDLE_ENTRY_INHERITABLE;
+   NewEntry.GrantedAccess = GrantedAccess;
 
    if ((HandleAttributes & OBJ_KERNEL_HANDLE) &&
        ExGetPreviousMode == KernelMode)
@@ -834,7 +834,7 @@
                                      Handle);
   if(HandleEntry != NULL)
   {
-    *GenerateOnClose = (HandleEntry->u1.ObAttributes & EX_HANDLE_ENTRY_AUDITONCLOSE) != 0;
+    *GenerateOnClose = (HandleEntry->ObAttributes & EX_HANDLE_ENTRY_AUDITONCLOSE) != 0;
 
     ExUnlockHandleTableEntry(Process->ObjectTable,
                              HandleEntry);
@@ -877,7 +877,7 @@
 			  POBJECT_HANDLE_INFORMATION HandleInformation)
 {
    PHANDLE_TABLE_ENTRY HandleEntry;
-   POBJECT_HEADER ObjectHeader;
+   PROS_OBJECT_HEADER ObjectHeader;
    PVOID ObjectBody;
    ACCESS_MASK GrantedAccess;
    ULONG Attributes;
@@ -1013,7 +1013,7 @@
                           &BODY_TO_HEADER(ObjectBody)->Type->TypeInfo.GenericMapping);
      }
 
-   GrantedAccess = HandleEntry->u2.GrantedAccess;
+   GrantedAccess = HandleEntry->GrantedAccess;
 
    /* Unless running as KernelMode, deny access if caller desires more access
       rights than the handle can grant */
@@ -1036,7 +1036,7 @@
 
    ObReferenceObject(ObjectBody);
 
-   Attributes = HandleEntry->u1.ObAttributes & (EX_HANDLE_ENTRY_PROTECTFROMCLOSE |
+   Attributes = HandleEntry->ObAttributes & (EX_HANDLE_ENTRY_PROTECTFROMCLOSE |
                                                 EX_HANDLE_ENTRY_INHERITABLE |
                                                 EX_HANDLE_ENTRY_AUDITONCLOSE);
 
@@ -1141,10 +1141,10 @@
                OUT PHANDLE Handle)
 {
     POBJECT_CREATE_INFORMATION ObjectCreateInfo;
-    POBJECT_HEADER Header;
+    PROS_OBJECT_HEADER Header;
     POBJECT_HEADER_NAME_INFO ObjectNameInfo;
     PVOID FoundObject = NULL;
-    POBJECT_HEADER FoundHeader = NULL;
+    PROS_OBJECT_HEADER FoundHeader = NULL;
     NTSTATUS Status = STATUS_SUCCESS;
     UNICODE_STRING RemainingPath;
     BOOLEAN ObjectAttached = FALSE; 
@@ -1203,7 +1203,7 @@
         PWSTR BufferPos = RemainingPath.Buffer;
         ULONG Delta = 0;
         
-        ObpAddEntryDirectory(FoundObject, Header, NULL);
+        ObpAddEntryDirectory(FoundObject, (PROS_OBJECT_HEADER)Header, NULL);
         ObjectAttached = TRUE;
         
         ObjectNameInfo = HEADER_TO_OBJECT_NAME(Header);
@@ -1251,8 +1251,8 @@
         {
             DPRINT("Calling %x\n", Header->Type->TypeInfo.OpenProcedure);
             Status = Header->Type->TypeInfo.OpenProcedure(ObCreateHandle,
+                                                                NULL,
                                                                 &Header->Body,
-                                                                NULL,
                                                                 0,
                                                                 0);
         }
@@ -1262,7 +1262,7 @@
             DPRINT("Create Failed\n");
             if (ObjectAttached == TRUE)
             {
-                ObpRemoveEntryDirectory(Header);
+                ObpRemoveEntryDirectory((PROS_OBJECT_HEADER)Header);
             }
             if (FoundObject)
             {
Index: ntoskrnl/ob/ntobj.c
===================================================================
--- ntoskrnl/ob/ntobj.c	(revision 21808)
+++ ntoskrnl/ob/ntobj.c	(working copy)
@@ -86,7 +86,7 @@
 	       OUT PULONG ResultLength  OPTIONAL)
 {
   OBJECT_HANDLE_INFORMATION HandleInfo;
-  POBJECT_HEADER ObjectHeader;
+  PROS_OBJECT_HEADER ObjectHeader;
   ULONG InfoLength;
   PVOID Object;
   NTSTATUS Status;
@@ -220,7 +220,7 @@
 VOID FASTCALL
 ObpSetPermanentObject (IN PVOID ObjectBody, IN BOOLEAN Permanent)
 {
-  POBJECT_HEADER ObjectHeader;
+  PROS_OBJECT_HEADER ObjectHeader;
 
   ObjectHeader = BODY_TO_HEADER(ObjectBody);
   ASSERT (ObjectHeader->PointerCount > 0);
@@ -234,7 +234,7 @@
      if (ObjectHeader->HandleCount == 0 && HEADER_TO_OBJECT_NAME(ObjectHeader)->Directory)
      {
         /* Remove the object from the namespace */
-        ObpRemoveEntryDirectory(ObjectHeader);
+        ObpRemoveEntryDirectory((PROS_OBJECT_HEADER)ObjectHeader);
      }
   }
 }
Index: ntoskrnl/rtl/libsupp.c
===================================================================
--- ntoskrnl/rtl/libsupp.c	(revision 21808)
+++ ntoskrnl/rtl/libsupp.c	(working copy)
@@ -292,8 +292,8 @@
    HANDLE Handle;
    USHORT HandleIndex;
    
-   ExEntry.u1.Object = Entry;
-   ExEntry.u2.GrantedAccess = 0x1; /* FIXME - valid handle */
+   ExEntry.Object = Entry;
+   ExEntry.GrantedAccess = 0x1; /* FIXME - valid handle */
    
    Handle = ExCreateHandle(AtomTable->ExHandleTable,
                                 &ExEntry);
@@ -330,7 +330,7 @@
                                   (HANDLE)((ULONG_PTR)Index << 2));
    if (ExEntry != NULL)
    {
-      Entry = ExEntry->u1.Object;
+      Entry = ExEntry->Object;
       
       ExUnlockHandleTableEntry(AtomTable->ExHandleTable,
                                ExEntry);
Index: ntoskrnl/se/semgr.c
===================================================================
--- ntoskrnl/se/semgr.c	(revision 21808)
+++ ntoskrnl/se/semgr.c	(working copy)
@@ -212,7 +212,7 @@
   PISECURITY_DESCRIPTOR ObjectSd;
   PISECURITY_DESCRIPTOR NewSd;
   PISECURITY_DESCRIPTOR SecurityDescriptor = _SecurityDescriptor;
-  POBJECT_HEADER Header = BODY_TO_HEADER(Object);
+  PROS_OBJECT_HEADER Header = BODY_TO_HEADER(Object);
   PSID Owner = 0;
   PSID Group = 0;
   PACL Dacl = 0;
Index: ntoskrnl/io/efi.c
===================================================================
--- ntoskrnl/io/efi.c	(revision 21808)
+++ ntoskrnl/io/efi.c	(working copy)
@@ -39,8 +39,8 @@
 NTSTATUS
 STDCALL
 NtEnumerateBootEntries(
-	IN ULONG Unknown1,
-	IN ULONG Unknown2
+    IN PVOID Buffer,
+    IN PULONG BufferLength
 	)
 {
 	UNIMPLEMENTED;
@@ -50,8 +50,8 @@
 NTSTATUS
 STDCALL
 NtQueryBootEntryOrder(
-	IN ULONG Unknown1,
-	IN ULONG Unknown2
+    IN PULONG Ids,
+    IN PULONG Count
 	)
 {
 	UNIMPLEMENTED;
@@ -61,8 +61,8 @@
 NTSTATUS
 STDCALL
 NtQueryBootOptions(
-	IN ULONG Unknown1,
-	IN ULONG Unknown2
+    IN PBOOT_OPTIONS BootOptions,
+    IN PULONG BootOptionsLength
 	)
 {
 	UNIMPLEMENTED;
@@ -72,8 +72,8 @@
 NTSTATUS
 STDCALL
 NtSetBootEntryOrder(
-	IN ULONG Unknown1,
-	IN ULONG Unknown2
+    IN PULONG Ids,
+    IN PULONG Count
 	)
 {
 	UNIMPLEMENTED;
@@ -83,8 +83,8 @@
 NTSTATUS
 STDCALL
 NtSetBootOptions(
-	ULONG Unknown1,
-	ULONG Unknown2
+    IN PBOOT_OPTIONS BootOptions,
+    IN ULONG FieldsToChange
 	)
 {
 	UNIMPLEMENTED;
@@ -94,9 +94,10 @@
 NTSTATUS
 STDCALL
 NtTranslateFilePath(
-	ULONG Unknown1,
-	ULONG Unknown2,
-	ULONG Unknown3
+    PFILE_PATH InputFilePath,
+    ULONG OutputType,
+    PFILE_PATH OutputFilePath,
+    ULONG OutputFilePathLength
 	)
 {
 	UNIMPLEMENTED;
Index: ntoskrnl/io/disk.c
===================================================================
--- ntoskrnl/io/disk.c	(revision 21808)
+++ ntoskrnl/io/disk.c	(working copy)
@@ -65,7 +65,26 @@
 
 HAL_PRIVATE_DISPATCH HalPrivateDispatchTable =
 {
-    HAL_PRIVATE_DISPATCH_VERSION
+    HAL_PRIVATE_DISPATCH_VERSION,
+    (pHalHandlerForBus) NULL,
+    (pHalHandlerForConfigSpace) NULL,
+    (pHalLocateHiberRanges) NULL,
+    (pHalRegisterBusHandler) NULL,
+    (pHalSetWakeEnable) NULL,
+    (pHalSetWakeAlarm) NULL,
+    (pHalTranslateBusAddress) NULL,
+    (pHalAssignSlotResources) NULL,
+    (pHalHaltSystem) NULL,
+    (pHalFindBusAddressTranslation) NULL,
+    (pHalResetDisplay) NULL,
+    (pHalAllocateMapRegisters) NULL,
+    (pKdSetupPciDeviceForDebugging) NULL,
+    (pKdReleasePciDeviceForDebugging) NULL,
+    (pKdGetAcpiTablePhase0) NULL,
+    (pKdCheckPowerButton) NULL,
+    (pHalVectorToIDTEntry) NULL,
+    (pKdMapPhysicalMemory64) NULL,
+    (pKdUnmapVirtualAddress) NULL
 };
 
 const WCHAR DiskMountString[] = L"\\DosDevices\\%C:";
@@ -597,7 +616,7 @@
 
 
 VOID FASTCALL
-xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
+xHalIoAssignDriveLetters(IN PROS_LOADER_PARAMETER_BLOCK LoaderBlock,
 			 IN PSTRING NtDeviceName,
 			 OUT PUCHAR NtSystemPath,
 			 OUT PSTRING NtSystemPathString)
Index: ntoskrnl/io/driver.c
===================================================================
--- ntoskrnl/io/driver.c	(revision 21808)
+++ ntoskrnl/io/driver.c	(working copy)
@@ -15,8 +15,6 @@
 #include <internal/debug.h>
 
 /* ke/main.c */
-extern LOADER_PARAMETER_BLOCK KeLoaderBlock;
-extern ULONG KeTickCount;
 extern BOOLEAN SetupMode;
 extern BOOLEAN NoGuiBoot;
 
Index: ntoskrnl/io/iomgr.c
===================================================================
--- ntoskrnl/io/iomgr.c	(revision 21808)
+++ ntoskrnl/io/iomgr.c	(working copy)
@@ -424,7 +424,7 @@
     KdbInit();
 
     /* I/O is now setup for disk access, so phase 3 */
-    KdInitSystem(3, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock);
+    KdInitSystem(3, (PROS_LOADER_PARAMETER_BLOCK)&KeLoaderBlock);
 
     /* Load services for devices found by PnP manager */
     IopInitializePnpServices(IopRootDeviceNode, FALSE);
Index: ntoskrnl/io/file.c
===================================================================
--- ntoskrnl/io/file.c	(revision 21808)
+++ ntoskrnl/io/file.c	(working copy)
@@ -397,6 +397,7 @@
 NTSTATUS
 STDCALL
 IopQueryNameFile(PVOID ObjectBody,
+                 IN BOOLEAN HasName,
                  POBJECT_NAME_INFORMATION ObjectNameInfo,
                  ULONG Length,
                  PULONG ReturnLength)
@@ -456,8 +457,11 @@
 
 VOID
 STDCALL
-IopCloseFile(PVOID ObjectBody,
-             ULONG HandleCount)
+IopCloseFile(IN PEPROCESS Process OPTIONAL,
+             IN PVOID ObjectBody,
+             IN ACCESS_MASK GrantedAccess,
+             IN ULONG HandleCount,
+             IN ULONG SystemHandleCount)
 {
     PFILE_OBJECT FileObject = (PFILE_OBJECT)ObjectBody;
     KEVENT Event;
Index: ntoskrnl/io/plugplay.c
===================================================================
--- ntoskrnl/io/plugplay.c	(revision 21808)
+++ ntoskrnl/io/plugplay.c	(working copy)
@@ -539,8 +539,8 @@
     _SEH_TRY
     {
 	Relation = RelatedDeviceData->Relation;
-	MaximumLength = RelatedDeviceData->RelatedDeviceInstance.MaximumLength;
-	ProbeForWrite(RelatedDeviceData->RelatedDeviceInstance.Buffer,
+	MaximumLength = RelatedDeviceData->RelatedDeviceInstanceLength;
+	ProbeForWrite(RelatedDeviceData->RelatedDeviceInstance,
 	              MaximumLength,
 		      sizeof(WCHAR));
     }
@@ -622,10 +622,10 @@
     /* Copy related device instance name */
     _SEH_TRY
     {
-        RtlCopyMemory(RelatedDeviceData->RelatedDeviceInstance.Buffer,
+        RtlCopyMemory(RelatedDeviceData->RelatedDeviceInstance,
                       RelatedDeviceNode->InstancePath.Buffer,
                       RelatedDeviceNode->InstancePath.Length);
-        RelatedDeviceData->RelatedDeviceInstance.Length = RelatedDeviceNode->InstancePath.Length;
+        RelatedDeviceData->RelatedDeviceInstanceLength = RelatedDeviceNode->InstancePath.Length;
     }
     _SEH_HANDLE
     {
Index: ntoskrnl/kdbg/kdb.c
===================================================================
--- ntoskrnl/kdbg/kdb.c	(revision 21808)
+++ ntoskrnl/kdbg/kdb.c	(working copy)
@@ -80,7 +80,7 @@
 };
 
 /* Exception descriptions */
-STATIC CONST PCHAR ExceptionNrToString[] =
+STATIC CONST CHAR *ExceptionNrToString[] =
 {
    "Divide Error",
    "Debug Trap",
@@ -122,6 +122,14 @@
 KiEspToTrapFrame(IN PKTRAP_FRAME TrapFrame,
                  IN ULONG Esp);
 
+/* ROS Internal. Please deprecate */
+NTHALAPI
+VOID
+NTAPI
+HalReleaseDisplayOwnership(
+    VOID
+);
+
 /* FUNCTIONS *****************************************************************/
 
 STATIC VOID
@@ -183,7 +191,7 @@
    KAPC_STATE ApcState;
 
    /* Get the protection for the address. */
-   Protect = MmGetPageProtect(Process, (PVOID)PAGE_ROUND_DOWN(Address));
+   Protect = MmGetPageProtect((PROS_EPROCESS)Process, (PVOID)PAGE_ROUND_DOWN(Address));
 
    /* Return if that page isn't present. */
    if (Protect & PAGE_NOACCESS)
@@ -200,7 +208,7 @@
    /* Make the page writeable if it is read only. */
    if (Protect & (PAGE_READONLY|PAGE_EXECUTE|PAGE_EXECUTE_READ))
    {
-      MmSetPageProtect(Process, (PVOID)PAGE_ROUND_DOWN(Address),
+      MmSetPageProtect((PROS_EPROCESS)Process, (PVOID)PAGE_ROUND_DOWN(Address),
 	               (Protect & ~(PAGE_READONLY|PAGE_EXECUTE|PAGE_EXECUTE_READ)) | PAGE_READWRITE);
    }
 
@@ -212,7 +220,7 @@
       {
          if (Protect & (PAGE_READONLY|PAGE_EXECUTE|PAGE_EXECUTE_READ))
          {
-            MmSetPageProtect(Process, (PVOID)PAGE_ROUND_DOWN(Address), Protect);
+            MmSetPageProtect((PROS_EPROCESS)Process, (PVOID)PAGE_ROUND_DOWN(Address), Protect);
          }
          /* Detach from process */
          if (CurrentProcess != Process)
@@ -229,7 +237,7 @@
    /* Restore the page protection. */
    if (Protect & (PAGE_READONLY|PAGE_EXECUTE|PAGE_EXECUTE_READ))
    {
-      MmSetPageProtect(Process, (PVOID)PAGE_ROUND_DOWN(Address), Protect);
+      MmSetPageProtect((PROS_EPROCESS)Process, (PVOID)PAGE_ROUND_DOWN(Address), Protect);
    }
 
    /* Detach from process */
@@ -643,13 +651,13 @@
  */
 STATIC LONG
 KdbpIsBreakPointOurs(
-   IN ULONG ExpNr,
+   IN NTSTATUS ExceptionCode,
    IN PKTRAP_FRAME TrapFrame)
 {
    UINT i;
-   ASSERT(ExpNr == 1 || ExpNr == 3);
+   ASSERT(ExceptionCode == STATUS_SINGLE_STEP || ExceptionCode == STATUS_BREAKPOINT);
 
-   if (ExpNr == 3) /* Software interrupt */
+   if (ExceptionCode == STATUS_BREAKPOINT) /* Software interrupt */
    {
       ULONG_PTR BpEip = (ULONG_PTR)TrapFrame->Eip - 1; /* Get EIP of INT3 instruction */
       for (i = 0; i < KdbSwBreakPointCount; i++)
@@ -663,7 +671,7 @@
          }
       }
    }
-   else if (ExpNr == 1) /* Hardware interrupt */
+   else if (ExceptionCode == STATUS_SINGLE_STEP) /* Hardware interrupt */
    {
       UCHAR DebugReg;
       for (i = 0; i < KdbHwBreakPointCount; i++)
@@ -1156,6 +1164,55 @@
    KbdEnableMouse();
 }
 
+STATIC ULONG
+KdbpGetExceptionNumberFromStatus(IN NTSTATUS ExceptionCode)
+{
+    ULONG Ret;
+
+    switch (ExceptionCode)
+    {
+        case STATUS_INTEGER_DIVIDE_BY_ZERO:
+            Ret = 0;
+            break;
+        case STATUS_SINGLE_STEP:
+            Ret = 1;
+            break;
+        case STATUS_BREAKPOINT:
+            Ret = 3;
+            break;
+        case STATUS_INTEGER_OVERFLOW:
+            Ret = 4;
+            break;
+        case STATUS_ARRAY_BOUNDS_EXCEEDED:
+            Ret = 5;
+            break;
+        case STATUS_ILLEGAL_INSTRUCTION:
+            Ret = 6;
+            break;
+        case STATUS_FLOAT_INVALID_OPERATION:
+            Ret = 7;
+            break;
+        case STATUS_STACK_OVERFLOW:
+            Ret = 12;
+            break;
+        case STATUS_ACCESS_VIOLATION:
+            Ret = 14;
+            break;
+        case STATUS_DATATYPE_MISALIGNMENT:
+            Ret = 17;
+            break;
+        case STATUS_FLOAT_MULTIPLE_TRAPS:
+            Ret = 18;
+            break;
+
+        default:
+            Ret = RTL_NUMBER_OF(KdbEnterConditions) - 1;
+            break;
+    }
+
+    return Ret;
+}
+
 /*!\brief KDB Exception filter
  *
  * Called by the exception dispatcher.
@@ -1177,25 +1234,28 @@
    IN OUT PKTRAP_FRAME TrapFrame,
    IN BOOLEAN FirstChance)
 {
-   ULONG ExpNr = (ULONG)TrapFrame->DbgArgMark;
    KDB_ENTER_CONDITION EnterCondition;
    KD_CONTINUE_TYPE ContinueType = kdHandleException;
    PKDB_BREAKPOINT BreakPoint;
-   ULONG ul;
+   ULONG ExpNr;
    ULONGLONG ull;
    BOOLEAN Resume = FALSE;
    BOOLEAN EnterConditionMet = TRUE;
    ULONG OldEflags;
+   NTSTATUS ExceptionCode;
 
+   ExceptionCode = (ExceptionRecord != NULL ? ExceptionRecord->ExceptionCode : STATUS_BREAKPOINT);
+
    KdbCurrentProcess = PsGetCurrentProcess();
 
    /* Set continue type to kdContinue for single steps and breakpoints */
-   if (ExpNr == 1 || ExpNr == 3)
+   if (ExceptionCode == STATUS_SINGLE_STEP || ExceptionCode == STATUS_BREAKPOINT)
       ContinueType = kdContinue;
 
    /* Check if we should handle the exception. */
-   ul = min(ExpNr, RTL_NUMBER_OF(KdbEnterConditions) - 1);
-   EnterCondition = KdbEnterConditions[ul][FirstChance ? 0 : 1];
+   /* FIXME - won't get all exceptions here :( */
+   ExpNr = KdbpGetExceptionNumberFromStatus(ExceptionCode);
+   EnterCondition = KdbEnterConditions[ExpNr][FirstChance ? 0 : 1];
    if (EnterCondition == KdbDoNotEnter ||
        (EnterCondition == KdbEnterFromUmode && PreviousMode == KernelMode) ||
        (EnterCondition == KdbEnterFromKmode && PreviousMode != KernelMode))
@@ -1207,12 +1267,12 @@
    KdbLastBreakPointNr = -1;
    KdbEnteredOnSingleStep = FALSE;
 
-   if (FirstChance && (ExpNr == 1 || ExpNr == 3) &&
-       (KdbLastBreakPointNr = KdbpIsBreakPointOurs(ExpNr, TrapFrame)) >= 0)
+   if (FirstChance && (ExceptionCode == STATUS_SINGLE_STEP || ExceptionCode == STATUS_BREAKPOINT) &&
+       (KdbLastBreakPointNr = KdbpIsBreakPointOurs(ExceptionCode, TrapFrame)) >= 0)
    {
       BreakPoint = KdbBreakPoints + KdbLastBreakPointNr;
 
-      if (ExpNr == 3)
+      if (ExceptionCode == STATUS_BREAKPOINT)
       {
          /*
           * The breakpoint will point to the next instruction by default so
@@ -1272,7 +1332,7 @@
       else if (BreakPoint->Type == KdbBreakPointSoftware ||
                BreakPoint->Type == KdbBreakPointTemporary)
       {
-         ASSERT(ExpNr == 3);
+         ASSERT(ExceptionCode == STATUS_BREAKPOINT);
          TrapFrame->EFlags |= X86_EFLAGS_TF;
          KdbBreakPointToReenable = BreakPoint;
       }
@@ -1322,7 +1382,7 @@
 
       }
    }
-   else if (ExpNr == 1)
+   else if (ExceptionCode == STATUS_SINGLE_STEP)
    {
       /* Silently ignore a debugger initiated single step. */
       if ((TrapFrame->Dr6 & 0xf) == 0 && KdbBreakPointToReenable != NULL)
@@ -1380,7 +1440,7 @@
          DbgPrint("Entered debugger on unexpected debug trap!\n");
       }
    }
-   else if (ExpNr == 3)
+   else if (ExceptionCode == STATUS_BREAKPOINT)
    {
       if (KdbInitFileBuffer != NULL)
       {
@@ -1397,7 +1457,7 @@
    }
    else
    {
-      CONST PCHAR ExceptionString = (ExpNr < RTL_NUMBER_OF(ExceptionNrToString)) ?
+      CONST CHAR *ExceptionString = (ExpNr < RTL_NUMBER_OF(ExceptionNrToString)) ?
                                     (ExceptionNrToString[ExpNr]) :
                                     ("Unknown/User defined exception");
 
@@ -1406,9 +1466,10 @@
          return ContinueType;
       }
 
-      DbgPrint("Entered debugger on %s-chance exception number %d (%s)\n",
-               FirstChance ? "first" : "last", ExpNr, ExceptionString);
-      if (ExpNr == 14)
+      DbgPrint("Entered debugger on %s-chance exception (Exception Code: 0x%x) (%s)\n",
+               FirstChance ? "first" : "last", ExceptionCode, ExceptionString);
+      if (ExceptionCode == STATUS_ACCESS_VIOLATION &&
+          ExceptionRecord != NULL && ExceptionRecord->NumberParameters != 0)
       {
          /* FIXME: Add noexec memory stuff */
          ULONG_PTR Cr2;
@@ -1491,7 +1552,7 @@
 
 continue_execution:
    /* Clear debug status */
-   if (ExpNr == 1 || ExpNr == 3) /* FIXME: Why clear DR6 on INT3? */
+   if (ExceptionCode == STATUS_SINGLE_STEP || ExceptionCode == STATUS_BREAKPOINT) /* FIXME: Why clear DR6 on INT3? */
    {
       /* Set the RF flag so we don't trigger the same breakpoint again. */
       if (Resume)
Index: ntoskrnl/kdbg/kdb_cli.c
===================================================================
--- ntoskrnl/kdbg/kdb_cli.c	(revision 21808)
+++ ntoskrnl/kdbg/kdb_cli.c	(working copy)
@@ -1453,7 +1453,7 @@
              Pcr->IDR, Pcr->KdVersionBlock, Pcr->IDT, Pcr->GDT, Pcr->TSS,
              Pcr->MajorVersion, Pcr->MinorVersion, Pcr->SetMember, Pcr->StallScaleFactor,
              Pcr->Number, Pcr->L2CacheAssociativity,
-             Pcr->VdmAlert, Pcr->L2CacheSize, Pcr->InterruptMode);
+             Pcr->VdmAlert, Pcr->SecondLevelCacheSize, Pcr->InterruptMode);
 
    return TRUE;
 }
Index: ntoskrnl/kdbg/kdb_symbols.c
===================================================================
--- ntoskrnl/kdbg/kdb_symbols.c	(revision 21808)
+++ ntoskrnl/kdbg/kdb_symbols.c	(working copy)
@@ -73,7 +73,7 @@
   while (current_entry != &Peb->Ldr->InLoadOrderModuleList &&
          current_entry != NULL)
     {
-      current = CONTAINING_RECORD(current_entry, LDR_DATA_TABLE_ENTRY, InLoadOrderModuleList);
+      current = CONTAINING_RECORD(current_entry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks);
       Length = min(current->BaseDllName.Length / sizeof(WCHAR), 255);
       if ((Address != NULL && (Address >= (PVOID)current->DllBase &&
                                Address < (PVOID)((char *)current->DllBase + current->SizeOfImage))) ||
@@ -115,7 +115,7 @@
 
   while (current_entry != &ModuleListHead)
     {
-      current = CONTAINING_RECORD(current_entry, LDR_DATA_TABLE_ENTRY, InLoadOrderModuleList);
+      current = CONTAINING_RECORD(current_entry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks);
 
       Length = min(current->BaseDllName.Length / sizeof(WCHAR), 255);
       if ((Address != NULL && (Address >= (PVOID)current->DllBase &&
@@ -537,7 +537,7 @@
   while (CurrentEntry != &Peb->Ldr->InLoadOrderModuleList &&
 	 CurrentEntry != NULL)
     {
-      Current = CONTAINING_RECORD(CurrentEntry, LDR_DATA_TABLE_ENTRY, InLoadOrderModuleList);
+      Current = CONTAINING_RECORD(CurrentEntry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks);
 
       KdbpSymUnloadModuleSymbols(Current->PatchInformation);
 
Index: ntoskrnl/ntoskrnl.def
===================================================================
--- ntoskrnl/ntoskrnl.def	(revision 21808)
+++ ntoskrnl/ntoskrnl.def	(working copy)
@@ -1116,8 +1116,8 @@
 RtlIpv4StringToAddressExW@16
 RtlIpv4StringToAddressW@16
 RtlIpv6AddressToStringA@8
-RtlIpv6AddressToStringExA@16
-RtlIpv6AddressToStringExW@16
+RtlIpv6AddressToStringExA@20
+RtlIpv6AddressToStringExW@20
 RtlIpv6AddressToStringW@8
 RtlIpv6StringToAddressA@12
 RtlIpv6StringToAddressExA@16
Index: ntoskrnl/mm/section.c
===================================================================
--- ntoskrnl/mm/section.c	(revision 21808)
+++ ntoskrnl/mm/section.c	(working copy)
@@ -60,7 +60,7 @@
 
 typedef struct
 {
-   PSECTION_OBJECT Section;
+   PROS_SECTION_OBJECT Section;
    PMM_SECTION_SEGMENT Segment;
    ULONG Offset;
    BOOLEAN WasDirty;
@@ -316,7 +316,7 @@
 
 BOOLEAN
 NTAPI
-MmUnsharePageEntrySectionSegment(PSECTION_OBJECT Section,
+MmUnsharePageEntrySectionSegment(PROS_SECTION_OBJECT Section,
                                  PMM_SECTION_SEGMENT Segment,
                                  ULONG Offset,
                                  BOOLEAN Dirty,
@@ -646,7 +646,7 @@
    PFN_TYPE Page;
    NTSTATUS Status;
    PVOID PAddress;
-   PSECTION_OBJECT Section;
+   PROS_SECTION_OBJECT Section;
    PMM_SECTION_SEGMENT Segment;
    ULONG Entry;
    ULONG Entry1;
@@ -1162,7 +1162,7 @@
                          BOOLEAN Locked)
 {
    PMM_SECTION_SEGMENT Segment;
-   PSECTION_OBJECT Section;
+   PROS_SECTION_OBJECT Section;
    PFN_TYPE OldPage;
    PFN_TYPE NewPage;
    NTSTATUS Status;
@@ -1329,7 +1329,7 @@
 }
 
 VOID
-MmPageOutDeleteMapping(PVOID Context, PEPROCESS Process, PVOID Address)
+MmPageOutDeleteMapping(PVOID Context, PROS_EPROCESS Process, PVOID Address)
 {
    MM_SECTION_PAGEOUT_CONTEXT* PageOutContext;
    BOOLEAN WasDirty;
@@ -1353,7 +1353,7 @@
    if (!PageOutContext->Private)
    {
       MmLockSectionSegment(PageOutContext->Segment);
-      MmUnsharePageEntrySectionSegment(PageOutContext->Section,
+      MmUnsharePageEntrySectionSegment((PROS_SECTION_OBJECT)PageOutContext->Section,
                                        PageOutContext->Segment,
                                        PageOutContext->Offset,
                                        PageOutContext->WasDirty,
@@ -1734,7 +1734,7 @@
                        PMM_PAGEOP PageOp)
 {
    ULONG Offset;
-   PSECTION_OBJECT Section;
+   PROS_SECTION_OBJECT Section;
    PMM_SECTION_SEGMENT Segment;
    PFN_TYPE Page;
    SWAPENTRY SwapEntry;
@@ -1980,7 +1980,7 @@
 {
    PMM_REGION Region;
    PVOID RegionBaseAddress;
-   PSECTION_OBJECT Section;
+   PROS_SECTION_OBJECT Section;
    PMM_SECTION_SEGMENT Segment;
 
    Region = MmFindRegion((PVOID)MemoryArea->StartingAddress,
@@ -2054,7 +2054,7 @@
 VOID STDCALL
 MmpDeleteSection(PVOID ObjectBody)
 {
-   PSECTION_OBJECT Section = (PSECTION_OBJECT)ObjectBody;
+   PROS_SECTION_OBJECT Section = (PROS_SECTION_OBJECT)ObjectBody;
 
    DPRINT("MmpDeleteSection(ObjectBody %x)\n", ObjectBody);
    if (Section->AllocationAttributes & SEC_IMAGE)
@@ -2123,11 +2123,14 @@
 }
 
 VOID STDCALL
-MmpCloseSection(PVOID ObjectBody,
-                ULONG HandleCount)
+MmpCloseSection(IN PEPROCESS Process OPTIONAL,
+                IN PVOID Object,
+                IN ACCESS_MASK GrantedAccess,
+                IN ULONG ProcessHandleCount,
+                IN ULONG SystemHandleCount)
 {
    DPRINT("MmpCloseSection(OB %x, HC %d) RC %d\n",
-          ObjectBody, HandleCount, ObGetObjectPointerCount(ObjectBody));
+          Object, ProcessHandleCount, ObGetObjectPointerCount(Object));
 }
 
 NTSTATUS
@@ -2135,7 +2138,7 @@
 NTAPI
 MmCreatePhysicalMemorySection(VOID)
 {
-   PSECTION_OBJECT PhysSection;
+   PROS_SECTION_OBJECT PhysSection;
    NTSTATUS Status;
    OBJECT_ATTRIBUTES Obj;
    UNICODE_STRING Name = RTL_CONSTANT_STRING(L"\\Device\\PhysicalMemory");
@@ -2206,7 +2209,7 @@
 
 NTSTATUS
 NTAPI
-MmCreatePageFileSection(PSECTION_OBJECT *SectionObject,
+MmCreatePageFileSection(PROS_SECTION_OBJECT *SectionObject,
                         ACCESS_MASK DesiredAccess,
                         POBJECT_ATTRIBUTES ObjectAttributes,
                         PLARGE_INTEGER UMaximumSize,
@@ -2217,7 +2220,7 @@
  */
 {
    LARGE_INTEGER MaximumSize;
-   PSECTION_OBJECT Section;
+   PROS_SECTION_OBJECT Section;
    PMM_SECTION_SEGMENT Segment;
    NTSTATUS Status;
 
@@ -2278,7 +2281,7 @@
 
 NTSTATUS
 NTAPI
-MmCreateDataFileSection(PSECTION_OBJECT *SectionObject,
+MmCreateDataFileSection(PROS_SECTION_OBJECT *SectionObject,
                         ACCESS_MASK DesiredAccess,
                         POBJECT_ATTRIBUTES ObjectAttributes,
                         PLARGE_INTEGER UMaximumSize,
@@ -2289,7 +2292,7 @@
  * Create a section backed by a data file
  */
 {
-   PSECTION_OBJECT Section;
+   PROS_SECTION_OBJECT Section;
    NTSTATUS Status;
    LARGE_INTEGER MaximumSize;
    PFILE_OBJECT FileObject;
@@ -3170,7 +3173,7 @@
 }
 
 NTSTATUS
-MmCreateImageSection(PSECTION_OBJECT *SectionObject,
+MmCreateImageSection(PROS_SECTION_OBJECT *SectionObject,
                      ACCESS_MASK DesiredAccess,
                      POBJECT_ATTRIBUTES ObjectAttributes,
                      PLARGE_INTEGER UMaximumSize,
@@ -3178,7 +3181,7 @@
                      ULONG AllocationAttributes,
                      HANDLE FileHandle)
 {
-   PSECTION_OBJECT Section;
+   PROS_SECTION_OBJECT Section;
    NTSTATUS Status;
    PFILE_OBJECT FileObject;
    PMM_SECTION_SEGMENT SectionSegments;
@@ -3484,7 +3487,7 @@
 
 NTSTATUS STATIC
 MmMapViewOfSegment(PMADDRESS_SPACE AddressSpace,
-                   PSECTION_OBJECT Section,
+                   PROS_SECTION_OBJECT Section,
                    PMM_SECTION_SEGMENT Segment,
                    PVOID* BaseAddress,
                    SIZE_T ViewSize,
@@ -3591,8 +3594,8 @@
    PVOID SafeBaseAddress;
    LARGE_INTEGER SafeSectionOffset;
    SIZE_T SafeViewSize;
-   PSECTION_OBJECT Section;
-   PEPROCESS Process;
+   PROS_SECTION_OBJECT Section;
+   PROS_EPROCESS Process;
    KPROCESSOR_MODE PreviousMode;
    PMADDRESS_SPACE AddressSpace;
    NTSTATUS Status = STATUS_SUCCESS;
@@ -3689,7 +3692,7 @@
    }
 
    Status = MmMapViewOfSection(Section,
-                               Process,
+                               (PEPROCESS)Process,
                                (BaseAddress != NULL ? &SafeBaseAddress : NULL),
                                ZeroBits,
                                CommitSize,
@@ -3741,7 +3744,7 @@
    SWAPENTRY SavedSwapEntry;
    PMM_PAGEOP PageOp;
    NTSTATUS Status;
-   PSECTION_OBJECT Section;
+   PROS_SECTION_OBJECT Section;
    PMM_SECTION_SEGMENT Segment;
    PMADDRESS_SPACE AddressSpace;
 
@@ -3843,7 +3846,7 @@
 {
    NTSTATUS Status;
    PMEMORY_AREA MemoryArea;
-   PSECTION_OBJECT Section;
+   PROS_SECTION_OBJECT Section;
    PMM_SECTION_SEGMENT Segment;
    PLIST_ENTRY CurrentEntry;
    PMM_REGION CurrentRegion;
@@ -3899,7 +3902,7 @@
    NTSTATUS Status;
    PMEMORY_AREA MemoryArea;
    PMADDRESS_SPACE AddressSpace;
-   PSECTION_OBJECT Section;
+   PROS_SECTION_OBJECT Section;
    PMM_PAGEOP PageOp;
    ULONG_PTR Offset;
 
@@ -3908,7 +3911,7 @@
 
    ASSERT(Process);
 
-   AddressSpace = &Process->AddressSpace;
+   AddressSpace = &((PROS_EPROCESS)Process)->AddressSpace;
    
    MmLockAddressSpace(AddressSpace);
    MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace,
@@ -4088,7 +4091,7 @@
                IN ULONG SectionInformationLength,
                OUT PULONG ResultLength  OPTIONAL)
 {
-   PSECTION_OBJECT Section;
+   PROS_SECTION_OBJECT Section;
    KPROCESSOR_MODE PreviousMode;
    NTSTATUS Status = STATUS_SUCCESS;
 
@@ -4216,7 +4219,7 @@
                 IN PLARGE_INTEGER NewMaximumSize)
 {
    LARGE_INTEGER SafeNewMaximumSize;
-   PSECTION_OBJECT Section;
+   PROS_SECTION_OBJECT Section;
    KPROCESSOR_MODE PreviousMode;
    NTSTATUS Status = STATUS_SUCCESS;
 
@@ -4408,7 +4411,7 @@
                    IN ULONG AllocationType,
                    IN ULONG Protect)
 {
-   PSECTION_OBJECT Section;
+   PROS_SECTION_OBJECT Section;
    PMADDRESS_SPACE AddressSpace;
    ULONG ViewOffset;
    NTSTATUS Status = STATUS_SUCCESS;
@@ -4428,8 +4431,8 @@
    }
 
 
-   Section = (PSECTION_OBJECT)SectionObject;
-   AddressSpace = &Process->AddressSpace;
+   Section = (PROS_SECTION_OBJECT)SectionObject;
+   AddressSpace = &((PROS_EPROCESS)Process)->AddressSpace;
 
    AllocationType |= (Section->AllocationAttributes & SEC_NO_CHANGE);
 
@@ -4655,13 +4658,13 @@
                         OUT PVOID * MappedBase,
                         IN OUT PULONG ViewSize)
 {
-   PSECTION_OBJECT Section;
+   PROS_SECTION_OBJECT Section;
    PMADDRESS_SPACE AddressSpace;
    NTSTATUS Status;
 
    DPRINT("MmMapViewInSystemSpace() called\n");
 
-   Section = (PSECTION_OBJECT)SectionObject;
+   Section = (PROS_SECTION_OBJECT)SectionObject;
    AddressSpace = MmGetKernelAddressSpace();
 
    MmLockAddressSpace(AddressSpace);
@@ -4823,7 +4826,7 @@
                  IN PFILE_OBJECT  File      OPTIONAL)
 {
    ULONG Protection;
-   PSECTION_OBJECT *SectionObject = (PSECTION_OBJECT *)Section;
+   PROS_SECTION_OBJECT *SectionObject = (PROS_SECTION_OBJECT *)Section;
 
    /*
     * Check the protection
Index: ntoskrnl/mm/mm.c
===================================================================
--- ntoskrnl/mm/mm.c	(revision 21808)
+++ ntoskrnl/mm/mm.c	(working copy)
@@ -30,7 +30,7 @@
 
 NTSTATUS 
 NTAPI
-MmReleaseMmInfo(PEPROCESS Process)
+MmReleaseMmInfo(PROS_EPROCESS Process)
 {
    PVOID Address;
    PMEMORY_AREA MemoryArea;
@@ -47,7 +47,7 @@
          case MEMORY_AREA_SECTION_VIEW:
              Address = (PVOID)MemoryArea->StartingAddress;
              MmUnlockAddressSpace(&Process->AddressSpace);
-             MmUnmapViewOfSection(Process, Address);
+             MmUnmapViewOfSection((PEPROCESS)Process, Address);
              MmLockAddressSpace(&Process->AddressSpace);
              break;
 
@@ -114,7 +114,7 @@
    }
    else
    {
-      AddressSpace = &PsGetCurrentProcess()->AddressSpace;
+      AddressSpace = &((PROS_EPROCESS)PsGetCurrentProcess())->AddressSpace;
    }
 
    MmLockAddressSpace(AddressSpace);
@@ -171,7 +171,7 @@
    }
    else
    {
-      AddressSpace = &PsGetCurrentProcess()->AddressSpace;
+      AddressSpace = &((PROS_EPROCESS)PsGetCurrentProcess())->AddressSpace;
    }
 
    if (!FromMdl)
@@ -304,7 +304,7 @@
    }
    else
    {
-      AddressSpace = &PsGetCurrentProcess()->AddressSpace;
+      AddressSpace = &((PROS_EPROCESS)PsGetCurrentProcess())->AddressSpace;
    }
 
    if (!FromMdl)
@@ -357,7 +357,7 @@
          case MEMORY_AREA_SHARED_DATA:
 	    Pfn = MmSharedDataPagePhysicalAddress.QuadPart >> PAGE_SHIFT;
             Status =
-               MmCreateVirtualMapping(PsGetCurrentProcess(),
+               MmCreateVirtualMapping((PROS_EPROCESS)PsGetCurrentProcess(),
                                       (PVOID)PAGE_ROUND_DOWN(Address),
                                       PAGE_READONLY,
                                       &Pfn,
Index: ntoskrnl/mm/mdl.c
===================================================================
--- ntoskrnl/mm/mdl.c	(revision 21808)
+++ ntoskrnl/mm/mdl.c	(working copy)
@@ -241,7 +241,7 @@
    /* Unmap all the pages. */
    for (i = 0; i < PageCount; i++)
    {
-      MmDeleteVirtualMapping(Mdl->Process,
+      MmDeleteVirtualMapping((PROS_EPROCESS)Mdl->Process,
                              (char*)BaseAddress + (i * PAGE_SIZE),
                              FALSE,
                              NULL,
@@ -273,14 +273,14 @@
 
       ASSERT(Mdl->Process == PsGetCurrentProcess());
 
-      Marea = MmLocateMemoryAreaByAddress( &Mdl->Process->AddressSpace, BaseAddress );
+      Marea = MmLocateMemoryAreaByAddress( &((PROS_EPROCESS)Mdl->Process)->AddressSpace, BaseAddress );
       if (Marea == NULL)
       {
          DPRINT1( "Couldn't open memory area when unmapping user-space pages!\n" );
          KEBUGCHECK(0);
       }
 
-      MmFreeMemoryArea( &Mdl->Process->AddressSpace, Marea, NULL, NULL );
+      MmFreeMemoryArea( &((PROS_EPROCESS)Mdl->Process)->AddressSpace, Marea, NULL, NULL );
 
       Mdl->Process = NULL;
    }
@@ -411,7 +411,7 @@
       /* FIXME: why isn't AccessMode used? */
       Mode = UserMode;
       Mdl->Process = CurrentProcess;
-      AddressSpace = &CurrentProcess->AddressSpace;
+      AddressSpace = &((PROS_EPROCESS)CurrentProcess)->AddressSpace;
    }
 
 
@@ -771,7 +771,7 @@
    KIRQL oldIrql;
    ULONG PageCount;
    ULONG StartingOffset;
-   PEPROCESS CurrentProcess;
+   PROS_EPROCESS CurrentProcess;
    NTSTATUS Status;
    ULONG Protect;
 
@@ -803,7 +803,7 @@
       BoundaryAddressMultiple.QuadPart = 0;
       Base = BaseAddress;
 
-      CurrentProcess = PsGetCurrentProcess();
+      CurrentProcess = (PROS_EPROCESS)PsGetCurrentProcess();
 
       MmLockAddressSpace(&CurrentProcess->AddressSpace);
       Status = MmCreateMemoryArea(&CurrentProcess->AddressSpace,
@@ -828,7 +828,7 @@
          ASSERT(0);
       }
 
-      Mdl->Process = CurrentProcess;
+      Mdl->Process = (PEPROCESS)CurrentProcess;
    }
    else /* if (AccessMode == KernelMode) */
    {
Index: ntoskrnl/mm/process.c
===================================================================
--- ntoskrnl/mm/process.c	(revision 21808)
+++ ntoskrnl/mm/process.c	(working copy)
@@ -25,7 +25,7 @@
 
 PVOID
 STDCALL
-MiCreatePebOrTeb(PEPROCESS Process,
+MiCreatePebOrTeb(PROS_EPROCESS Process,
                  PVOID BaseAddress)
 {
     NTSTATUS Status;
@@ -107,7 +107,7 @@
 
 VOID
 STDCALL
-MmDeleteTeb(PEPROCESS Process,
+MmDeleteTeb(PROS_EPROCESS Process,
             PTEB Teb)
 {
     PMADDRESS_SPACE ProcessAddressSpace = &Process->AddressSpace;
@@ -220,7 +220,7 @@
 
 NTSTATUS
 STDCALL
-MmCreatePeb(PEPROCESS Process)
+MmCreatePeb(PROS_EPROCESS Process)
 {
     PPEB Peb = NULL;
     LARGE_INTEGER SectionOffset;
@@ -241,7 +241,7 @@
     /* Map NLS Tables */
     DPRINT("Mapping NLS\n");
     Status = MmMapViewOfSection(NlsSectionObject,
-                                Process,
+                                (PEPROCESS)Process,
                                 &TableBase,
                                 0,
                                 0,
@@ -357,7 +357,7 @@
 
 PTEB
 STDCALL
-MmCreateTeb(PEPROCESS Process,
+MmCreateTeb(PROS_EPROCESS Process,
             PCLIENT_ID ClientId,
             PINITIAL_TEB InitialTeb)
 {
@@ -366,7 +366,7 @@
 
     /* Attach to the process */
     DPRINT("MmCreateTeb\n");
-    if (Process != PsGetCurrentProcess())
+    if (Process != (PROS_EPROCESS)PsGetCurrentProcess())
     {
         /* Attach to Target */
         KeAttachProcess(&Process->Pcb);
@@ -407,8 +407,8 @@
 
 NTSTATUS
 STDCALL
-MmCreateProcessAddressSpace(IN PEPROCESS Process,
-                            IN PSECTION_OBJECT Section OPTIONAL)
+MmCreateProcessAddressSpace(IN PROS_EPROCESS Process,
+                            IN PROS_SECTION_OBJECT Section OPTIONAL)
 {
     NTSTATUS Status;
     PMADDRESS_SPACE ProcessAddressSpace = &Process->AddressSpace;
@@ -491,7 +491,7 @@
         DPRINT("Mapping process image. Section: %p, Process: %p, ImageBase: %p\n",
                  Section, Process, &ImageBase);
         Status = MmMapViewOfSection(Section,
-                                    Process,
+                                    (PEPROCESS)Process,
                                     (PVOID*)&ImageBase,
                                     0,
                                     0,
Index: ntoskrnl/mm/marea.c
===================================================================
--- ntoskrnl/mm/marea.c	(revision 21808)
+++ ntoskrnl/mm/marea.c	(working copy)
@@ -747,7 +747,7 @@
    PMEMORY_AREA *ParentReplace;
    ULONG_PTR Address;
    PVOID EndAddress;
-   PEPROCESS CurrentProcess = PsGetCurrentProcess();
+   PROS_EPROCESS CurrentProcess = (PROS_EPROCESS)PsGetCurrentProcess();
 
    if (AddressSpace->Process != NULL &&
        AddressSpace->Process != CurrentProcess)
@@ -1025,7 +1025,7 @@
 
 
 VOID STDCALL
-MmReleaseMemoryAreaIfDecommitted(PEPROCESS Process,
+MmReleaseMemoryAreaIfDecommitted(PROS_EPROCESS Process,
                                  PMADDRESS_SPACE AddressSpace,
                                  PVOID BaseAddress)
 {
Index: ntoskrnl/mm/virtual.c
===================================================================
--- ntoskrnl/mm/virtual.c	(revision 21808)
+++ ntoskrnl/mm/virtual.c	(working copy)
@@ -119,7 +119,7 @@
                       OUT PULONG ResultLength)
 {
    NTSTATUS Status;
-   PEPROCESS Process;
+   PROS_EPROCESS Process;
    MEMORY_AREA* MemoryArea;
    PMADDRESS_SPACE AddressSpace;
 
@@ -393,7 +393,7 @@
       PAGE_ROUND_DOWN(*BaseAddress);
    *BaseAddress = (PVOID)PAGE_ROUND_DOWN(*BaseAddress);
 
-   AddressSpace = &Process->AddressSpace;
+   AddressSpace = &((PROS_EPROCESS)Process)->AddressSpace;
 
    MmLockAddressSpace(AddressSpace);
    MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace, *BaseAddress);
Index: ntoskrnl/mm/anonmem.c
===================================================================
--- ntoskrnl/mm/anonmem.c	(revision 21808)
+++ ntoskrnl/mm/anonmem.c	(working copy)
@@ -544,7 +544,7 @@
  * RETURNS: Status
  */
 {
-   PEPROCESS Process;
+   PROS_EPROCESS Process;
    MEMORY_AREA* MemoryArea;
    ULONG_PTR MemoryAreaLength;
    ULONG Type;
@@ -784,7 +784,7 @@
          MmFreeSwapPage(SavedSwapEntry);
          MmSetSavedSwapEntryPage(Page, 0);
       }
-      MmDeleteRmap(Page, Process, Address);
+      MmDeleteRmap(Page, (PROS_EPROCESS)Process, Address);
       MmReleasePageMemoryConsumer(MC_USER, Page);
    }
    else if (SwapEntry != 0)
@@ -795,7 +795,7 @@
 
 VOID
 NTAPI
-MmFreeVirtualMemory(PEPROCESS Process,
+MmFreeVirtualMemory(PROS_EPROCESS Process,
                     PMEMORY_AREA MemoryArea)
 {
    PLIST_ENTRY current_entry;
@@ -889,7 +889,7 @@
 {
    MEMORY_AREA* MemoryArea;
    NTSTATUS Status;
-   PEPROCESS Process;
+   PROS_EPROCESS Process;
    PMADDRESS_SPACE AddressSpace;
    PVOID BaseAddress;
    ULONG RegionSize;
Index: ntoskrnl/mm/rmap.c
===================================================================
--- ntoskrnl/mm/rmap.c	(revision 21808)
+++ ntoskrnl/mm/rmap.c	(working copy)
@@ -62,7 +62,7 @@
    PMADDRESS_SPACE AddressSpace;
    ULONG Type;
    PVOID Address;
-   PEPROCESS Process;
+   PROS_EPROCESS Process;
    PMM_PAGEOP PageOp;
    ULONG Offset;
    NTSTATUS Status = STATUS_SUCCESS;
@@ -78,7 +78,7 @@
       ExReleaseFastMutex(&RmapListLock);
       return(STATUS_UNSUCCESSFUL);
    }
-   Process = entry->Process;
+   Process = (PROS_EPROCESS)entry->Process;
    Address = entry->Address;
    if ((((ULONG_PTR)Address) & 0xFFF) != 0)
    {
@@ -196,7 +196,7 @@
    PMADDRESS_SPACE AddressSpace;
    ULONG Type;
    PVOID Address;
-   PEPROCESS Process;
+   PROS_EPROCESS Process;
    PMM_PAGEOP PageOp;
    ULONG Offset;
    NTSTATUS Status = STATUS_SUCCESS;
@@ -208,7 +208,7 @@
       ExReleaseFastMutex(&RmapListLock);
       return(STATUS_UNSUCCESSFUL);
    }
-   Process = entry->Process;
+   Process = (PROS_EPROCESS)entry->Process;
    Address = entry->Address;
    if ((((ULONG_PTR)Address) & 0xFFF) != 0)
    {
@@ -326,7 +326,7 @@
    }
    while (current_entry != NULL)
    {
-      MmSetCleanPage(current_entry->Process, current_entry->Address);
+      MmSetCleanPage((PROS_EPROCESS)current_entry->Process, current_entry->Address);
       current_entry = current_entry->Next;
    }
    ExReleaseFastMutex(&RmapListLock);
@@ -347,7 +347,7 @@
    }
    while (current_entry != NULL)
    {
-      MmSetDirtyPage(current_entry->Process, current_entry->Address);
+      MmSetDirtyPage((PROS_EPROCESS)current_entry->Process, current_entry->Address);
       current_entry = current_entry->Next;
    }
    ExReleaseFastMutex(&RmapListLock);
@@ -368,7 +368,7 @@
    }
    while (current_entry != NULL)
    {
-      if (MmIsDirtyPage(current_entry->Process, current_entry->Address))
+      if (MmIsDirtyPage((PROS_EPROCESS)current_entry->Process, current_entry->Address))
       {
          ExReleaseFastMutex(&RmapListLock);
          return(TRUE);
@@ -381,7 +381,7 @@
 
 VOID
 NTAPI
-MmInsertRmap(PFN_TYPE Page, PEPROCESS Process,
+MmInsertRmap(PFN_TYPE Page, PROS_EPROCESS Process,
              PVOID Address)
 {
    PMM_RMAP_ENTRY current_entry;
@@ -396,7 +396,7 @@
       KEBUGCHECK(0);
    }
    new_entry->Address = Address;
-   new_entry->Process = Process;
+   new_entry->Process = (PEPROCESS)Process;
 #ifdef DBG
    new_entry->Caller = __builtin_return_address(0);
 #endif   
@@ -433,7 +433,7 @@
    ExReleaseFastMutex(&RmapListLock);
    if (Process == NULL)
    {
-      Process = PsInitialSystemProcess;
+      Process = (PROS_EPROCESS)PsInitialSystemProcess;
    }
    if (Process)
    {
@@ -448,7 +448,7 @@
 VOID
 NTAPI
 MmDeleteAllRmaps(PFN_TYPE Page, PVOID Context,
-                 VOID (*DeleteMapping)(PVOID Context, PEPROCESS Process,
+                 VOID (*DeleteMapping)(PVOID Context, PROS_EPROCESS Process,
                                        PVOID Address))
 {
    PMM_RMAP_ENTRY current_entry;
@@ -470,7 +470,7 @@
       current_entry = current_entry->Next;
       if (DeleteMapping)
       {
-         DeleteMapping(Context, previous_entry->Process,
+         DeleteMapping(Context, (PROS_EPROCESS)previous_entry->Process,
                        previous_entry->Address);
       }
       Process = previous_entry->Process;
@@ -488,7 +488,7 @@
 
 VOID
 NTAPI
-MmDeleteRmap(PFN_TYPE Page, PEPROCESS Process,
+MmDeleteRmap(PFN_TYPE Page, PROS_EPROCESS Process,
              PVOID Address)
 {
    PMM_RMAP_ENTRY current_entry, previous_entry;
@@ -498,7 +498,7 @@
    current_entry = MmGetRmapListHeadPage(Page);
    while (current_entry != NULL)
    {
-      if (current_entry->Process == Process &&
+      if (current_entry->Process == (PEPROCESS)Process &&
             current_entry->Address == Address)
       {
          if (previous_entry == NULL)
@@ -513,7 +513,7 @@
          ExFreeToNPagedLookasideList(&RmapLookasideList, current_entry);
 	 if (Process == NULL)
 	 {
-	    Process = PsInitialSystemProcess;
+	    Process = (PROS_EPROCESS)PsInitialSystemProcess;
 	 }
 	 if (Process)
 	 {
Index: ntoskrnl/mm/i386/page.c
===================================================================
--- ntoskrnl/mm/i386/page.c	(revision 21808)
+++ ntoskrnl/mm/i386/page.c	(working copy)
@@ -203,7 +203,7 @@
 
 NTSTATUS
 NTAPI
-Mmi386ReleaseMmInfo(PEPROCESS Process)
+Mmi386ReleaseMmInfo(PROS_EPROCESS Process)
 {
    PUSHORT LdtDescriptor;
    ULONG LdtBase;
@@ -329,8 +329,8 @@
 
 NTSTATUS
 STDCALL
-MmCopyMmInfo(PEPROCESS Src,
-             PEPROCESS Dest,
+MmCopyMmInfo(PROS_EPROCESS Src,
+             PROS_EPROCESS Dest,
              PPHYSICAL_ADDRESS DirectoryTableBase)
 {
    NTSTATUS Status;
@@ -408,9 +408,9 @@
 
 VOID
 NTAPI
-MmDeletePageTable(PEPROCESS Process, PVOID Address)
+MmDeletePageTable(PROS_EPROCESS Process, PVOID Address)
 {
-   PEPROCESS CurrentProcess = PsGetCurrentProcess();
+   PROS_EPROCESS CurrentProcess = (PROS_EPROCESS)PsGetCurrentProcess();
 
    if (Process != NULL && Process != CurrentProcess)
    {
@@ -441,9 +441,9 @@
 
 VOID
 NTAPI
-MmFreePageTable(PEPROCESS Process, PVOID Address)
+MmFreePageTable(PROS_EPROCESS Process, PVOID Address)
 {
-   PEPROCESS CurrentProcess = PsGetCurrentProcess();
+   PROS_EPROCESS CurrentProcess = (PROS_EPROCESS)PsGetCurrentProcess();
    ULONG i;
    PFN_TYPE Pfn;
 
@@ -504,7 +504,7 @@
 }
 
 static PULONGLONG
-MmGetPageTableForProcessForPAE(PEPROCESS Process, PVOID Address, BOOLEAN Create)
+MmGetPageTableForProcessForPAE(PROS_EPROCESS Process, PVOID Address, BOOLEAN Create)
 {
    NTSTATUS Status;
    PFN_TYPE Pfn;
@@ -520,7 +520,7 @@
    {
       KEBUGCHECK(0);
    }
-   if (Address < MmSystemRangeStart && Process && Process != PsGetCurrentProcess())
+   if (Address < MmSystemRangeStart && Process && Process != (PROS_EPROCESS)PsGetCurrentProcess())
    {
       PageDirTable = MmCreateHyperspaceMapping(PAE_PTE_TO_PFN(Process->Pcb.DirectoryTableBase.QuadPart));
       if (PageDirTable == NULL)
@@ -618,7 +618,7 @@
 }
 
 static PULONG
-MmGetPageTableForProcess(PEPROCESS Process, PVOID Address, BOOLEAN Create)
+MmGetPageTableForProcess(PROS_EPROCESS Process, PVOID Address, BOOLEAN Create)
 {
    ULONG PdeOffset = ADDR_TO_PDE_OFFSET(Address);
    NTSTATUS Status;
@@ -626,7 +626,7 @@
    ULONG Entry;
    PULONG Pt, PageDir;
 
-   if (Address < MmSystemRangeStart && Process && Process != PsGetCurrentProcess())
+   if (Address < MmSystemRangeStart && Process && Process != (PROS_EPROCESS)PsGetCurrentProcess())
    {
       PageDir = MmCreateHyperspaceMapping(PTE_TO_PFN(Process->Pcb.DirectoryTableBase.QuadPart));
       if (PageDir == NULL)
@@ -736,7 +736,7 @@
    return FALSE;
 }
 
-static ULONGLONG MmGetPageEntryForProcessForPAE(PEPROCESS Process, PVOID Address)
+static ULONGLONG MmGetPageEntryForProcessForPAE(PROS_EPROCESS Process, PVOID Address)
 {
    ULONGLONG Pte;
    PULONGLONG Pt;
@@ -751,7 +751,7 @@
    return 0;
 }
 
-static ULONG MmGetPageEntryForProcess(PEPROCESS Process, PVOID Address)
+static ULONG MmGetPageEntryForProcess(PROS_EPROCESS Process, PVOID Address)
 {
    ULONG Pte;
    PULONG Pt;
@@ -768,7 +768,7 @@
 
 PFN_TYPE
 NTAPI
-MmGetPfnForProcess(PEPROCESS Process,
+MmGetPfnForProcess(PROS_EPROCESS Process,
                    PVOID Address)
 {
 
@@ -796,7 +796,7 @@
 
 VOID
 NTAPI
-MmDisableVirtualMapping(PEPROCESS Process, PVOID Address, BOOLEAN* WasDirty, PPFN_TYPE Page)
+MmDisableVirtualMapping(PROS_EPROCESS Process, PVOID Address, BOOLEAN* WasDirty, PPFN_TYPE Page)
 /*
  * FUNCTION: Delete a virtual mapping
  */
@@ -916,7 +916,7 @@
 
 VOID
 NTAPI
-MmDeleteVirtualMapping(PEPROCESS Process, PVOID Address, BOOLEAN FreePage,
+MmDeleteVirtualMapping(PROS_EPROCESS Process, PVOID Address, BOOLEAN FreePage,
                        BOOLEAN* WasDirty, PPFN_TYPE Page)
 /*
  * FUNCTION: Delete a virtual mapping
@@ -1060,7 +1060,7 @@
 
 VOID
 NTAPI
-MmDeletePageFileMapping(PEPROCESS Process, PVOID Address,
+MmDeletePageFileMapping(PROS_EPROCESS Process, PVOID Address,
                         SWAPENTRY* SwapEntry)
 /*
  * FUNCTION: Delete a virtual mapping
@@ -1199,7 +1199,7 @@
 
 BOOLEAN
 NTAPI
-MmIsDirtyPage(PEPROCESS Process, PVOID Address)
+MmIsDirtyPage(PROS_EPROCESS Process, PVOID Address)
 {
    if (Ke386Pae)
    {
@@ -1213,7 +1213,7 @@
 
 BOOLEAN
 NTAPI
-MmIsAccessedAndResetAccessPage(PEPROCESS Process, PVOID Address)
+MmIsAccessedAndResetAccessPage(PROS_EPROCESS Process, PVOID Address)
 {
    if (Address < MmSystemRangeStart && Process == NULL)
    {
@@ -1280,7 +1280,7 @@
 
 VOID
 NTAPI
-MmSetCleanPage(PEPROCESS Process, PVOID Address)
+MmSetCleanPage(PROS_EPROCESS Process, PVOID Address)
 {
    if (Address < MmSystemRangeStart && Process == NULL)
    {
@@ -1345,7 +1345,7 @@
 
 VOID
 NTAPI
-MmSetDirtyPage(PEPROCESS Process, PVOID Address)
+MmSetDirtyPage(PROS_EPROCESS Process, PVOID Address)
 {
    if (Address < MmSystemRangeStart && Process == NULL)
    {
@@ -1406,7 +1406,7 @@
 
 VOID
 NTAPI
-MmEnableVirtualMapping(PEPROCESS Process, PVOID Address)
+MmEnableVirtualMapping(PROS_EPROCESS Process, PVOID Address)
 {
    if (Ke386Pae)
    {
@@ -1462,7 +1462,7 @@
 
 BOOLEAN
 NTAPI
-MmIsPagePresent(PEPROCESS Process, PVOID Address)
+MmIsPagePresent(PROS_EPROCESS Process, PVOID Address)
 {
    if (Ke386Pae)
    {
@@ -1476,7 +1476,7 @@
 
 BOOLEAN
 NTAPI
-MmIsPageSwapEntry(PEPROCESS Process, PVOID Address)
+MmIsPageSwapEntry(PROS_EPROCESS Process, PVOID Address)
 {
    if (Ke386Pae)
    {
@@ -1622,7 +1622,7 @@
 
 NTSTATUS
 NTAPI
-MmCreatePageFileMapping(PEPROCESS Process,
+MmCreatePageFileMapping(PROS_EPROCESS Process,
                         PVOID Address,
                         SWAPENTRY SwapEntry)
 {
@@ -1710,7 +1710,7 @@
 
 NTSTATUS
 NTAPI
-MmCreateVirtualMappingUnsafe(PEPROCESS Process,
+MmCreateVirtualMappingUnsafe(PROS_EPROCESS Process,
                              PVOID Address,
                              ULONG flProtect,
                              PPFN_TYPE Pages,
@@ -1916,7 +1916,7 @@
 
 NTSTATUS
 NTAPI
-MmCreateVirtualMapping(PEPROCESS Process,
+MmCreateVirtualMapping(PROS_EPROCESS Process,
                        PVOID Address,
                        ULONG flProtect,
                        PPFN_TYPE Pages,
@@ -1942,7 +1942,7 @@
 
 ULONG
 NTAPI
-MmGetPageProtect(PEPROCESS Process, PVOID Address)
+MmGetPageProtect(PROS_EPROCESS Process, PVOID Address)
 {
    ULONG Entry;
    ULONG Protect;
@@ -1988,7 +1988,7 @@
 
 VOID
 NTAPI
-MmSetPageProtect(PEPROCESS Process, PVOID Address, ULONG flProtect)
+MmSetPageProtect(PROS_EPROCESS Process, PVOID Address, ULONG flProtect)
 {
    ULONG Attributes = 0;
    BOOLEAN NoExecute = FALSE;
@@ -2273,7 +2273,7 @@
 
 VOID
 NTAPI
-MmUpdatePageDir(PEPROCESS Process, PVOID Address, ULONG Size)
+MmUpdatePageDir(PROS_EPROCESS Process, PVOID Address, ULONG Size)
 {
    ULONG StartOffset, EndOffset, Offset;
 
@@ -2307,7 +2307,7 @@
 	    EndOffset = 511;
 	 }
 
-         if (Process != NULL && Process != PsGetCurrentProcess())
+         if (Process != NULL && Process != (PROS_EPROCESS)PsGetCurrentProcess())
          {
             PageDirTable = MmCreateHyperspaceMapping(PAE_PTE_TO_PFN(Process->Pcb.DirectoryTableBase.QuadPart));
             Pde = (PULONGLONG)MmCreateHyperspaceMapping(PTE_TO_PFN(PageDirTable[i]));
@@ -2334,7 +2334,7 @@
       StartOffset = ADDR_TO_PDE_OFFSET(Address);
       EndOffset = ADDR_TO_PDE_OFFSET((PVOID)((ULONG_PTR)Address + Size));
 
-      if (Process != NULL && Process != PsGetCurrentProcess())
+      if (Process != NULL && Process != (PROS_EPROCESS)PsGetCurrentProcess())
       {
          Pde = MmCreateHyperspaceMapping(PTE_TO_PFN(Process->Pcb.DirectoryTableBase.u.LowPart));
       }
Index: ntoskrnl/mm/aspace.c
===================================================================
--- ntoskrnl/mm/aspace.c	(revision 21808)
+++ ntoskrnl/mm/aspace.c	(working copy)
@@ -64,7 +64,7 @@
 NTAPI
 MmGetCurrentAddressSpace(VOID)
 {
-   return(&PsGetCurrentProcess()->AddressSpace);
+   return(&((PROS_EPROCESS)PsGetCurrentProcess())->AddressSpace);
 }
 
 PMADDRESS_SPACE
@@ -76,7 +76,7 @@
 
 NTSTATUS
 NTAPI
-MmInitializeAddressSpace(PEPROCESS Process,
+MmInitializeAddressSpace(PROS_EPROCESS Process,
                          PMADDRESS_SPACE AddressSpace)
 {
    AddressSpace->MemoryAreaRoot = NULL;
Index: ntoskrnl/ex/profile.c
===================================================================
--- ntoskrnl/ex/profile.c	(revision 21808)
+++ ntoskrnl/ex/profile.c	(working copy)
@@ -45,14 +45,14 @@
     Profile = (PEPROFILE)ObjectBody;
 
     /* Check if there if the Profile was started */
-    if (Profile->LockedBuffer)
+    if (Profile->LockedBufferAddress)
     {
         /* Stop the Profile */
-        State = KeStopProfile(Profile->KeProfile);
+        State = KeStopProfile(Profile->ProfileObject);
         ASSERT(State != FALSE);
 
         /* Unmap the Locked Buffer */
-        MmUnmapLockedPages(Profile->LockedBuffer, Profile->Mdl);
+        MmUnmapLockedPages(Profile->LockedBufferAddress, Profile->Mdl);
         MmUnlockPages(Profile->Mdl);
         ExFreePool(Profile->Mdl);
     }
@@ -89,8 +89,8 @@
 NTAPI
 NtCreateProfile(OUT PHANDLE ProfileHandle,
                 IN HANDLE Process OPTIONAL,
-                IN PVOID ImageBase,
-                IN ULONG ImageSize,
+                IN PVOID RangeBase,
+                IN ULONG RangeSize,
                 IN ULONG BucketSize,
                 IN PVOID Buffer,
                 IN ULONG BufferSize,
@@ -110,17 +110,17 @@
     if(!BufferSize) return STATUS_INVALID_PARAMETER_7;
 
     /* Check if this is a low-memory profile */
-    if ((!BucketSize) && (ImageBase < (PVOID)(0x10000)))
+    if ((!BucketSize) && (RangeBase < (PVOID)(0x10000)))
     {
         /* Validate size */
         if (BufferSize < sizeof(ULONG)) return STATUS_INVALID_PARAMETER_7;
 
         /* This will become a segmented profile object */
-        Segment = (ULONG)ImageBase;
-        ImageBase = 0;
+        Segment = (ULONG)RangeBase;
+        RangeBase = 0;
 
         /* Recalculate the bucket size */
-        BucketSize = ImageSize / (BufferSize / sizeof(ULONG));
+        BucketSize = RangeSize / (BufferSize / sizeof(ULONG));
 
         /* Convert it to log2 */
         BucketSize--;
@@ -136,14 +136,14 @@
     }
 
     /* Make sure that the buckets can map the range */
-    if ((ImageSize >> (BucketSize - 2)) > BufferSize)
+    if ((RangeSize >> (BucketSize - 2)) > BufferSize)
     {
         DPRINT1("Bucket size too small\n");
         return STATUS_BUFFER_TOO_SMALL;
     }
 
     /* Make sure that the range isn't too gigantic */
-    if (((ULONG_PTR)ImageBase + ImageSize) < ImageSize)
+    if (((ULONG_PTR)RangeBase + RangeSize) < RangeSize)
     {
         DPRINT1("Range too big\n");
         return STATUS_BUFFER_OVERFLOW;
@@ -219,12 +219,12 @@
     if (!NT_SUCCESS(Status)) return(Status);
 
     /* Initialize it */
-    Profile->ImageBase = ImageBase;
-    Profile->ImageSize = ImageSize;
+    Profile->RangeBase = RangeBase;
+    Profile->RangeSize = RangeSize;
     Profile->Buffer = Buffer;
     Profile->BufferSize = BufferSize;
     Profile->BucketSize = BucketSize;
-    Profile->LockedBuffer = NULL;
+    Profile->LockedBufferAddress = NULL;
     Profile->Segment = Segment;
     Profile->ProfileSource = ProfileSource;
     Profile->Affinity = Affinity;
@@ -319,9 +319,9 @@
 NtStartProfile(IN HANDLE ProfileHandle)
 {
     PEPROFILE Profile;
-    PKPROFILE KeProfile;
+    PKPROFILE ProfileObject;
     KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
-    PVOID TempLockedBuffer;
+    PVOID TempLockedBufferAddress;
     NTSTATUS Status;
     PAGED_CODE();
 
@@ -342,7 +342,7 @@
                           NULL);
 
     /* The Profile can still be enabled though, so handle that */
-    if (Profile->LockedBuffer)
+    if (Profile->LockedBufferAddress)
     {
         /* Release our lock, dereference and return */
         KeReleaseMutex(&ExpProfileMutex, FALSE);
@@ -351,7 +351,7 @@
     }
 
     /* Allocate a Kernel Profile Object. */
-    KeProfile = ExAllocatePoolWithTag(NonPagedPool,
+    ProfileObject = ExAllocatePoolWithTag(NonPagedPool,
                                       sizeof(EPROFILE),
                                       TAG_PROFILE);
 
@@ -362,23 +362,23 @@
     MmProbeAndLockPages(Profile->Mdl, PreviousMode, IoWriteAccess);
 
     /* Map the pages */
-    TempLockedBuffer = MmMapLockedPages(Profile->Mdl, KernelMode);
+    TempLockedBufferAddress = MmMapLockedPages(Profile->Mdl, KernelMode);
 
     /* Initialize the Kernel Profile Object */
-    Profile->KeProfile = KeProfile;
-    KeInitializeProfile(KeProfile,
+    Profile->ProfileObject = ProfileObject;
+    KeInitializeProfile(ProfileObject,
                         (PKPROCESS)Profile->Process,
-                        Profile->ImageBase,
-                        Profile->ImageSize,
+                        Profile->RangeBase,
+                        Profile->RangeSize,
                         Profile->BucketSize,
                         Profile->ProfileSource,
                         Profile->Affinity);
 
     /* Start the Profiling */
-    KeStartProfile(KeProfile, TempLockedBuffer);
+    KeStartProfile(ProfileObject, TempLockedBufferAddress);
 
     /* Now it's safe to save this */
-    Profile->LockedBuffer = TempLockedBuffer;
+    Profile->LockedBufferAddress = TempLockedBufferAddress;
 
     /* Release mutex, dereference and return */
     KeReleaseMutex(&ExpProfileMutex, FALSE);
@@ -412,22 +412,22 @@
                           NULL);
 
     /* Make sure the Profile Object is really Started */
-    if (!Profile->LockedBuffer)
+    if (!Profile->LockedBufferAddress)
     {
         Status = STATUS_PROFILING_NOT_STARTED;
         goto Exit;
     }
 
     /* Stop the Profile */
-    KeStopProfile(Profile->KeProfile);
+    KeStopProfile(Profile->ProfileObject);
 
     /* Unlock the Buffer */
-    MmUnmapLockedPages(Profile->LockedBuffer, Profile->Mdl);
+    MmUnmapLockedPages(Profile->LockedBufferAddress, Profile->Mdl);
     MmUnlockPages(Profile->Mdl);
-    ExFreePool(Profile->KeProfile);
+    ExFreePool(Profile->ProfileObject);
 
     /* Clear the Locked Buffer pointer, meaning the Object is Stopped */
-    Profile->LockedBuffer = NULL;
+    Profile->LockedBufferAddress = NULL;
 
 Exit:
     /* Release Mutex, Dereference and Return */
Index: ntoskrnl/ex/init.c
===================================================================
--- ntoskrnl/ex/init.c	(revision 21808)
+++ ntoskrnl/ex/init.c	(working copy)
@@ -261,6 +261,7 @@
     ASSERT(FIELD_OFFSET(KPCR, Tib.ExceptionList) == KPCR_EXCEPTION_LIST);
     ASSERT(FIELD_OFFSET(KPCR, Self) == KPCR_SELF);
     ASSERT(FIELD_OFFSET(KIPCR, PrcbData) + FIELD_OFFSET(KPRCB, CurrentThread) == KPCR_CURRENT_THREAD);
+    DPRINT1("NPXThread offset: %lx\n", FIELD_OFFSET(KIPCR, PrcbData) + FIELD_OFFSET(KPRCB, NpxThread));
     ASSERT(FIELD_OFFSET(KIPCR, PrcbData) + FIELD_OFFSET(KPRCB, NpxThread) == KPCR_NPX_THREAD);
     ASSERT(FIELD_OFFSET(KTSS, Esp0) == KTSS_ESP0);
     ASSERT(FIELD_OFFSET(KTSS, IoMapBase) == KTSS_IOMAPBASE);
@@ -610,13 +611,13 @@
     ExpInitializeCallbacks();
 
     /* Call KD Providers at Phase 1 */
-    KdInitSystem(1, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock);
+    KdInitSystem(1, (PROS_LOADER_PARAMETER_BLOCK)&KeLoaderBlock);
 
     /* Initialize I/O Objects, Filesystems, Error Logging and Shutdown */
     IoInit();
 
     /* TBD */
-    PoInit((PLOADER_PARAMETER_BLOCK)&KeLoaderBlock, ForceAcpiDisable);
+    PoInit((PROS_LOADER_PARAMETER_BLOCK)&KeLoaderBlock, ForceAcpiDisable);
 
     /* Initialize the Registry (Hives are NOT yet loaded!) */
     CmInitializeRegistry();
@@ -640,7 +641,7 @@
     if (NoGuiBoot) ExpDisplayNotice();
 
     /* Call KD Providers at Phase 2 */
-    KdInitSystem(2, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock);
+    KdInitSystem(2, (PROS_LOADER_PARAMETER_BLOCK)&KeLoaderBlock);
 
     /* Import and create NLS Data and Sections */
     RtlpInitNls();
Index: ntoskrnl/ex/win32k.c
===================================================================
--- ntoskrnl/ex/win32k.c	(revision 21808)
+++ ntoskrnl/ex/win32k.c	(working copy)
@@ -36,10 +36,10 @@
 };
 
 OB_OPEN_METHOD ExpWindowStationObjectOpen = NULL;
-OB_PARSE_METHOD ExpWindowStationObjectParse = NULL;
+OB_ROS_PARSE_METHOD ExpWindowStationObjectParse = NULL;
 OB_DELETE_METHOD ExpWindowStationObjectDelete = NULL;
-OB_FIND_METHOD ExpWindowStationObjectFind = NULL;
-OB_CREATE_METHOD ExpDesktopObjectCreate = NULL;
+OB_ROS_FIND_METHOD ExpWindowStationObjectFind = NULL;
+OB_ROS_CREATE_METHOD ExpDesktopObjectCreate = NULL;
 OB_DELETE_METHOD ExpDesktopObjectDelete = NULL;
 
 /* FUNCTIONS ****************************************************************/
@@ -133,9 +133,9 @@
     ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
     ObjectTypeInitializer.GenericMapping = ExpWindowStationMapping;
     ObjectTypeInitializer.PoolType = NonPagedPool;
-    ObjectTypeInitializer.OpenProcedure = ExpWinStaObjectOpen;
+    ObjectTypeInitializer.OpenProcedure = (OB_OPEN_METHOD)ExpWinStaObjectOpen;
     ObjectTypeInitializer.DeleteProcedure = ExpWinStaObjectDelete;
-    ObjectTypeInitializer.ParseProcedure = ExpWinStaObjectParse;
+    ObjectTypeInitializer.ParseProcedure = (OB_PARSE_METHOD)ExpWinStaObjectParse;
     ObpCreateTypeObject(&ObjectTypeInitializer,
                         &Name,
                         &ExWindowStationObjectType);
Index: ntoskrnl/ex/dbgctrl.c
===================================================================
--- ntoskrnl/ex/dbgctrl.c	(revision 21808)
+++ ntoskrnl/ex/dbgctrl.c	(working copy)
@@ -17,7 +17,7 @@
 
 NTSTATUS
 STDCALL
-NtSystemDebugControl(DEBUG_CONTROL_CODE ControlCode,
+NtSystemDebugControl(SYSDBG_COMMAND ControlCode,
                      PVOID InputBuffer,
                      ULONG InputBufferLength,
                      PVOID OutputBuffer,
@@ -26,15 +26,15 @@
 {
     switch (ControlCode)
     {
-        case DebugGetTraceInformation:
-        case DebugSetInternalBreakpoint:
-        case DebugSetSpecialCall:
-        case DebugClearSpecialCalls:
-        case DebugQuerySpecialCalls:
-        case DebugDbgBreakPoint:
+        case SysDbgQueryTraceInformation:
+        case SysDbgSetTracepoint:
+        case SysDbgSetSpecialCall:
+        case SysDbgClearSpecialCalls:
+        case SysDbgQuerySpecialCalls:
+        case SysDbgBreakPoint:
             break;
 
-        case DebugDbgLoadSymbols:
+        case SysDbgQueryVersion:
             KDB_LOADUSERMODULE_HOOK((PLDR_DATA_TABLE_ENTRY) InputBuffer);
             break;
 
Index: ntoskrnl/ex/sysinfo.c
===================================================================
--- ntoskrnl/ex/sysinfo.c	(revision 21808)
+++ ntoskrnl/ex/sysinfo.c	(working copy)
@@ -581,11 +581,12 @@
 		do
 		{
 			PSYSTEM_PROCESS_INFORMATION SpiCur;
-			int curSize, i = 0;
+			int curSize;
 			ANSI_STRING	imgName;
 			int inLen=32; // image name len in bytes
 			PLIST_ENTRY current_entry;
 			PETHREAD current;
+            PSYSTEM_THREAD_INFORMATION ThreadInfo;
 
 			SpiCur = (PSYSTEM_PROCESS_INFORMATION)pCur;
 
@@ -645,7 +646,8 @@
 			SpiCur->QuotaNonPagedPoolUsage = pr->QuotaUsage[1];
 			SpiCur->PagefileUsage = pr->QuotaUsage[3];
 			SpiCur->PeakPagefileUsage = pr->QuotaPeak[3];
-			SpiCur->PrivateUsage = pr->CommitCharge;
+			SpiCur->PrivatePageCount = pr->CommitCharge;
+            ThreadInfo = (PSYSTEM_THREAD_INFORMATION)(SpiCur + 1);
 
 		        current_entry = pr->ThreadListHead.Flink;
         		while (current_entry != &pr->ThreadListHead)
@@ -653,18 +655,19 @@
 				current = CONTAINING_RECORD(current_entry, ETHREAD,
 				                            ThreadListEntry);
 
-				SpiCur->TH[i].KernelTime.QuadPart = current->Tcb.KernelTime * 100000LL;
-				SpiCur->TH[i].UserTime.QuadPart = current->Tcb.UserTime * 100000LL;
+                
+				ThreadInfo->KernelTime.QuadPart = current->Tcb.KernelTime * 100000LL;
+				ThreadInfo->UserTime.QuadPart = current->Tcb.UserTime * 100000LL;
 //				SpiCur->TH[i].CreateTime = current->CreateTime;
-				SpiCur->TH[i].WaitTime = current->Tcb.WaitTime;
-				SpiCur->TH[i].StartAddress = (PVOID) current->StartAddress;
-				SpiCur->TH[i].ClientId = current->Cid;
-				SpiCur->TH[i].Priority = current->Tcb.Priority;
-				SpiCur->TH[i].BasePriority = current->Tcb.BasePriority;
-				SpiCur->TH[i].ContextSwitches = current->Tcb.ContextSwitches;
-				SpiCur->TH[i].ThreadState = current->Tcb.State;
-				SpiCur->TH[i].WaitReason = current->Tcb.WaitReason;
-				i++;
+				ThreadInfo->WaitTime = current->Tcb.WaitTime;
+				ThreadInfo->StartAddress = (PVOID) current->StartAddress;
+				ThreadInfo->ClientId = current->Cid;
+				ThreadInfo->Priority = current->Tcb.Priority;
+				ThreadInfo->BasePriority = current->Tcb.BasePriority;
+				ThreadInfo->ContextSwitches = current->Tcb.ContextSwitches;
+				ThreadInfo->ThreadState = current->Tcb.State;
+				ThreadInfo->WaitReason = current->Tcb.WaitReason;
+				ThreadInfo++;
 				current_entry = current_entry->Flink;
 			}
 
@@ -986,15 +989,15 @@
 /* Class 21 - File Cache Information */
 QSI_DEF(SystemFileCacheInformation)
 {
-	SYSTEM_CACHE_INFORMATION *Sci = (SYSTEM_CACHE_INFORMATION *) Buffer;
+	SYSTEM_FILECACHE_INFORMATION *Sci = (SYSTEM_FILECACHE_INFORMATION *) Buffer;
 
-	if (Size < sizeof (SYSTEM_CACHE_INFORMATION))
+	if (Size < sizeof (SYSTEM_FILECACHE_INFORMATION))
 	{
-		* ReqSize = sizeof (SYSTEM_CACHE_INFORMATION);
+		* ReqSize = sizeof (SYSTEM_FILECACHE_INFORMATION);
 		return (STATUS_INFO_LENGTH_MISMATCH);
 	}
 
-	RtlZeroMemory(Sci, sizeof(SYSTEM_CACHE_INFORMATION));
+	RtlZeroMemory(Sci, sizeof(SYSTEM_FILECACHE_INFORMATION));
 
 	/* Return the Byte size not the page size. */
 	Sci->CurrentSize =
@@ -1011,7 +1014,7 @@
 
 SSI_DEF(SystemFileCacheInformation)
 {
-	if (Size < sizeof (SYSTEM_CACHE_INFORMATION))
+	if (Size < sizeof (SYSTEM_FILECACHE_INFORMATION))
 	{
 		return (STATUS_INFO_LENGTH_MISMATCH);
 	}
@@ -1545,7 +1548,7 @@
       /*
        * Check the request is valid.
        */
-      if (SystemInformationClass >= SystemInformationClassMax)
+      if (SystemInformationClass >= MaxSystemInfoClass)
         {
           return (STATUS_INVALID_INFO_CLASS);
         }
@@ -1621,7 +1624,7 @@
 	 * Check the request is valid.
 	 */
 	if (	(SystemInformationClass >= SystemBasicInformation)
-		&& (SystemInformationClass < SystemInformationClassMax)
+		&& (SystemInformationClass < MaxSystemInfoClass)
 		)
 	{
 		if (NULL != CallQS [SystemInformationClass].Set)
Index: ntoskrnl/ex/handle.c
===================================================================
--- ntoskrnl/ex/handle.c	(revision 21808)
+++ ntoskrnl/ex/handle.c	(working copy)
@@ -18,6 +18,11 @@
 
 /* INCLUDES *****************************************************************/
 
+//
+// Uses Win2K semantics
+//
+#define NTDDI_VERSION 0x50000000
+
 #include <ntoskrnl.h>
 
 #define NDEBUG
@@ -206,10 +211,10 @@
               curee != laste;
               curee++)
           {
-            if(curee->u1.Object != NULL && SweepHandleCallback != NULL)
+            if(curee->Object != NULL && SweepHandleCallback != NULL)
             {
-              curee->u1.ObAttributes |= EX_HANDLE_ENTRY_LOCKED;
-              SweepHandleCallback(HandleTable, curee->u1.Object, curee->u2.GrantedAccess, Context);
+              curee->ObAttributes |= EX_HANDLE_ENTRY_LOCKED;
+              SweepHandleCallback(HandleTable, curee->Object, curee->GrantedAccess, Context);
             }
           }
         }
@@ -414,7 +419,7 @@
                 srcstbl++, stbl++, eli++)
             {
               /* try to duplicate the source handle */
-              if(srcstbl->u1.Object != NULL &&
+              if(srcstbl->Object != NULL &&
                  ExLockHandleTableEntry(SourceHandleTable,
                                         srcstbl))
               {
@@ -426,15 +431,15 @@
                 {
                   /* free the entry and chain it into the free list */
                   HandleTable->HandleCount--;
-                  stbl->u1.Object = NULL;
-                  stbl->u2.NextFreeTableEntry = HandleTable->FirstFreeTableEntry;
+                  stbl->Object = NULL;
+                  stbl->NextFreeTableEntry = HandleTable->FirstFreeTableEntry;
                   HandleTable->FirstFreeTableEntry = BUILD_HANDLE(tli, mli, eli);
                 }
                 else
                 {
                   /* duplicate the handle and unlock it */
-                  stbl->u2.GrantedAccess = srcstbl->u2.GrantedAccess;
-                  stbl->u1.ObAttributes = srcstbl->u1.ObAttributes & ~EX_HANDLE_ENTRY_LOCKED;
+                  stbl->GrantedAccess = srcstbl->GrantedAccess;
+                  stbl->ObAttributes = srcstbl->ObAttributes & ~EX_HANDLE_ENTRY_LOCKED;
                 }
                 ExUnlockHandleTableEntry(SourceHandleTable,
                                          srcstbl);
@@ -492,9 +497,9 @@
       *Handle = EX_HANDLE_TO_HANDLE(HandleTable->FirstFreeTableEntry);
 
       /* save the index to the next free handle (if available) */
-      HandleTable->FirstFreeTableEntry = Entry->u2.NextFreeTableEntry;
-      Entry->u2.NextFreeTableEntry = 0;
-      Entry->u1.Object = NULL;
+      HandleTable->FirstFreeTableEntry = Entry->NextFreeTableEntry;
+      Entry->NextFreeTableEntry = 0;
+      Entry->Object = NULL;
 
       HandleTable->HandleCount++;
     }
@@ -595,8 +600,8 @@
 
       /* let's just use the very first entry */
       Entry = ntbl;
-      Entry->u1.ObAttributes = EX_HANDLE_ENTRY_LOCKED;
-      Entry->u2.NextFreeTableEntry = 0;
+      Entry->ObAttributes = EX_HANDLE_ENTRY_LOCKED;
+      Entry->NextFreeTableEntry = 0;
 
       *Handle = EX_HANDLE_TO_HANDLE(HandleTable->NextIndexNeedingPool);
 
@@ -609,11 +614,11 @@
           cure != laste;
           cure++, i++)
       {
-        cure->u1.Object = NULL;
-        cure->u2.NextFreeTableEntry = i;
+        cure->Object = NULL;
+        cure->NextFreeTableEntry = i;
       }
       /* truncate the free entry list */
-      (cure - 1)->u2.NextFreeTableEntry = -1;
+      (cure - 1)->NextFreeTableEntry = -1;
 
       /* save the pointers to the allocated list(s) */
       (void)InterlockedExchangePointer(&nmtbl[mli], ntbl);
@@ -651,8 +656,8 @@
   /* automatically unlock the entry if currently locked. We however don't notify
      anyone who waited on the handle because we're holding an exclusive lock after
      all and these locks will fail then */
-  (void)InterlockedExchangePointer(&Entry->u1.Object, NULL);
-  Entry->u2.NextFreeTableEntry = HandleTable->FirstFreeTableEntry;
+  (void)InterlockedExchangePointer(&Entry->Object, NULL);
+  Entry->NextFreeTableEntry = HandleTable->FirstFreeTableEntry;
   HandleTable->FirstFreeTableEntry = Handle;
 
   HandleTable->HandleCount--;
@@ -679,10 +684,10 @@
 
     mlp = HandleTable->Table[tli];
     if(Handle < HandleTable->NextIndexNeedingPool &&
-       mlp != NULL && mlp[mli] != NULL && mlp[mli][eli].u1.Object != NULL)
+       mlp != NULL && mlp[mli] != NULL && mlp[mli][eli].Object != NULL)
     {
       Entry = &mlp[mli][eli];
-      DPRINT("handle lookup 0x%x -> entry 0x%p [HT:0x%p] ptr: 0x%p\n", Handle, Entry, HandleTable, mlp[mli][eli].u1.Object);
+      DPRINT("handle lookup 0x%x -> entry 0x%p [HT:0x%p] ptr: 0x%p\n", Handle, Entry, HandleTable, mlp[mli][eli].Object);
     }
   }
   else
@@ -708,7 +713,7 @@
 
   for(;;)
   {
-    Current = (volatile ULONG_PTR)Entry->u1.Object;
+    Current = (volatile ULONG_PTR)Entry->Object;
 
     if(!Current || (HandleTable->Flags & EX_HANDLE_TABLE_CLOSING))
     {
@@ -719,7 +724,7 @@
     if(!(Current & EX_HANDLE_ENTRY_LOCKED))
     {
       New = Current | EX_HANDLE_ENTRY_LOCKED;
-      if(InterlockedCompareExchangePointer(&Entry->u1.Object,
+      if(InterlockedCompareExchangePointer(&Entry->Object,
                                            (PVOID)New,
                                            (PVOID)Current) == (PVOID)Current)
       {
@@ -756,13 +761,13 @@
 
   DPRINT("ExUnlockHandleTableEntry HT:0x%p Entry:0x%p\n", HandleTable, Entry);
 
-  Current = (volatile ULONG_PTR)Entry->u1.Object;
+  Current = (volatile ULONG_PTR)Entry->Object;
 
   ASSERT(Current & EX_HANDLE_ENTRY_LOCKED);
 
   New = Current & ~EX_HANDLE_ENTRY_LOCKED;
 
-  (void)InterlockedExchangePointer(&Entry->u1.Object,
+  (void)InterlockedExchangePointer(&Entry->Object,
                                    (PVOID)New);
 
   /* we unlocked the entry, pulse the contention event so threads who're waiting
@@ -784,10 +789,10 @@
   ASSERT(HandleTable);
   ASSERT(Entry);
 
-  /* The highest bit in Entry->u1.Object has to be 1 so we make sure it's a
+  /* The highest bit in Entry->Object has to be 1 so we make sure it's a
      pointer to kmode memory. It will cleared though because it also indicates
      the lock */
-  ASSERT((ULONG_PTR)Entry->u1.Object & EX_HANDLE_ENTRY_LOCKED);
+  ASSERT((ULONG_PTR)Entry->Object & EX_HANDLE_ENTRY_LOCKED);
 
   KeEnterCriticalRegion();
   ExAcquireHandleTableLockExclusive(HandleTable);
@@ -855,7 +860,7 @@
   ASSERT(Entry);
 
   /* This routine requires the entry to be locked */
-  ASSERT((ULONG_PTR)Entry->u1.Object & EX_HANDLE_ENTRY_LOCKED);
+  ASSERT((ULONG_PTR)Entry->Object & EX_HANDLE_ENTRY_LOCKED);
 
   DPRINT("DestroyHandleByEntry HT:0x%p Entry:0x%p\n", HandleTable, Entry);
 
Index: ntoskrnl/ex/power.c
===================================================================
--- ntoskrnl/ex/power.c	(revision 21808)
+++ ntoskrnl/ex/power.c	(working copy)
@@ -15,9 +15,13 @@
 
 /* FUNCTIONS *****************************************************************/
 
-VOID STDCALL
-KeSetTargetProcessorDpc (IN	PKDPC	Dpc,
-			 IN	CCHAR	Number);
+/* ROS Internal. Please deprecate */
+NTHALAPI
+VOID
+NTAPI
+HalReleaseDisplayOwnership(
+    VOID
+);
 
 VOID STDCALL
 KiHaltProcessorDpcRoutine(IN PKDPC Dpc,
Index: ntoskrnl/ex/rundown.c
===================================================================
--- ntoskrnl/ex/rundown.c	(revision 21808)
+++ ntoskrnl/ex/rundown.c	(working copy)
@@ -230,7 +230,7 @@
     if (InterlockedExchangeAddSizeT(&WaitBlock->Count, -1))
     {
         /* We're down to 0 now, so signal the event */
-        KeSetEvent(&WaitBlock->RundownEvent, IO_NO_INCREMENT, FALSE);
+        KeSetEvent(&WaitBlock->WakeEvent, IO_NO_INCREMENT, FALSE);
     }
 }
 
@@ -290,7 +290,7 @@
         (LONG)Count)
     {
         /* We're down to 0 now, so signal the event */
-        KeSetEvent(&WaitBlock->RundownEvent, IO_NO_INCREMENT, FALSE);
+        KeSetEvent(&WaitBlock->WakeEvent, IO_NO_INCREMENT, FALSE);
     }
 }
 
@@ -339,12 +339,12 @@
         if (Count || !Event)
         {
             /* Initialize the event */
-            KeInitializeEvent(&WaitBlock.RundownEvent,
+            KeInitializeEvent(&WaitBlock.WakeEvent,
                               NotificationEvent,
                               FALSE);
 
             /* Set the pointer */
-            Event = &WaitBlock.RundownEvent;
+            Event = &WaitBlock.WakeEvent;
         }
 
         /* Set the count */
Index: ntoskrnl/lpc/close.c
===================================================================
--- ntoskrnl/lpc/close.c	(revision 21808)
+++ ntoskrnl/lpc/close.c	(working copy)
@@ -28,7 +28,11 @@
  * REVISIONS
  */
 VOID STDCALL
-LpcpClosePort (PVOID	ObjectBody, ULONG	HandleCount)
+LpcpClosePort (IN PEPROCESS Process OPTIONAL,
+               IN PVOID ObjectBody,
+               IN ACCESS_MASK GrantedAccess,
+               IN ULONG HandleCount,
+               IN ULONG SystemHandleCount)
 {
   PEPORT Port = (PEPORT)ObjectBody;
   PORT_MESSAGE Message;
Index: ntoskrnl/po/power.c
===================================================================
--- ntoskrnl/po/power.c	(revision 21808)
+++ ntoskrnl/po/power.c	(working copy)
@@ -298,7 +298,7 @@
 VOID
 INIT_FUNCTION
 NTAPI
-PoInit(PLOADER_PARAMETER_BLOCK LoaderBlock,
+PoInit(PROS_LOADER_PARAMETER_BLOCK LoaderBlock,
        BOOLEAN ForceAcpiDisable)
 {
   if (ForceAcpiDisable)
Index: base/services/umpnpmgr/umpnpmgr.c
===================================================================
--- base/services/umpnpmgr/umpnpmgr.c	(revision 21808)
+++ base/services/umpnpmgr/umpnpmgr.c	(working copy)
@@ -298,9 +298,8 @@
 
     PlugPlayData.Relation = Relationship;
 
-    PlugPlayData.RelatedDeviceInstance.Length = 0;
-    PlugPlayData.RelatedDeviceInstance.MaximumLength = Length;
-    PlugPlayData.RelatedDeviceInstance.Buffer = RelatedDeviceId;
+    PlugPlayData.RelatedDeviceInstanceLength = Length;
+    PlugPlayData.RelatedDeviceInstance = RelatedDeviceId;
 
     Status = NtPlugPlayControl(PlugPlayControlGetRelatedDevice,
                                (PVOID)&PlugPlayData,
Index: base/applications/taskmgr/perfdata.c
===================================================================
--- base/applications/taskmgr/perfdata.c	(revision 21808)
+++ base/applications/taskmgr/perfdata.c	(working copy)
@@ -35,7 +35,7 @@
 LARGE_INTEGER                    liOldSystemTime = {{0,0}};
 SYSTEM_PERFORMANCE_INFORMATION    SystemPerfInfo;
 SYSTEM_BASIC_INFORMATION        SystemBasicInfo;
-SYSTEM_CACHE_INFORMATION        SystemCacheInfo;
+SYSTEM_FILECACHE_INFORMATION        SystemCacheInfo;
 SYSTEM_HANDLE_INFORMATION        SystemHandleInfo;
 PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION SystemProcessorTimeInfo = NULL;
 PSID                             SystemUserSid = NULL;
@@ -95,7 +95,7 @@
     HANDLE                            hProcessToken;
     SYSTEM_PERFORMANCE_INFORMATION    SysPerfInfo;
     SYSTEM_TIMEOFDAY_INFORMATION      SysTimeInfo;
-    SYSTEM_CACHE_INFORMATION        SysCacheInfo;
+    SYSTEM_FILECACHE_INFORMATION        SysCacheInfo;
     LPBYTE                            SysHandleInfoData;
     PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION SysProcessorTimeInfo;
     double                            CurrentKernelTime;
@@ -170,7 +170,7 @@
     /*
      * Save system cache info
      */
-    memcpy(&SystemCacheInfo, &SysCacheInfo, sizeof(SYSTEM_CACHE_INFORMATION));
+    memcpy(&SystemCacheInfo, &SysCacheInfo, sizeof(SYSTEM_FILECACHE_INFORMATION));
 
     /*
      * Save system processor time info
Index: dll/win32/advapi32/sec/ac.c
===================================================================
--- dll/win32/advapi32/sec/ac.c	(revision 21808)
+++ dll/win32/advapi32/sec/ac.c	(working copy)
@@ -578,8 +578,6 @@
         {
             /* directly copy the array, this works as the size of the EXPLICIT_ACCESS_A
                structure matches the size of the EXPLICIT_ACCESS_W version */
-            ASSERT(sizeof(EXPLICIT_ACCESS_A) == sizeof(EXPLICIT_ACCESS_W));
-
             RtlCopyMemory(ListOfExplicitEntriesW,
                           pListOfExplicitEntries,
                           cCountOfExplicitEntries * sizeof(EXPLICIT_ACCESS_W));
Index: dll/win32/kernel32/file/create.c
===================================================================
--- dll/win32/kernel32/file/create.c	(revision 21808)
+++ dll/win32/kernel32/file/create.c	(working copy)
@@ -14,6 +14,10 @@
 
 /* INCLUDES *****************************************************************/
 
+/* File contains Vista Semantics */
+#undef _WIN32_WINNT
+#define _WIN32_WINNT 0x0600
+
 #include <k32.h>
 
 #define NDEBUG
@@ -399,14 +403,14 @@
 
     switch(RtlDetermineDosPathNameType_U(lpTargetFileName))
     {
-    case INVALID_PATH:
-    case ABSOLUTE_PATH:
-    case RELATIVE_PATH:
+    case RtlPathTypeUnknown:
+    case RtlPathTypeRooted:
+    case RtlPathTypeRelative:
         bRelativePath = TRUE;
         RtlInitUnicodeString(&TargetFileName, lpTargetFileName);
         break;
 
-    case RELATIVE_DRIVE_PATH:
+    case RtlPathTypeDriveRelative:
         {
             LPWSTR FilePart;
             SIZE_T cchTargetFullFileName;
@@ -438,10 +442,10 @@
 
         // fallthrough
 
-    case UNC_PATH:
-    case ABSOLUTE_DRIVE_PATH:
-    case DEVICE_PATH:
-    case UNC_DOT_PATH:
+    case RtlPathTypeUncAbsolute:
+    case RtlPathTypeDriveAbsolute:
+    case RtlPathTypeLocalDevice:
+    case RtlPathTypeRootLocalDevice:
     default:
         if(!RtlDosPathNameToNtPathName_U(lpTargetFileName, &TargetFileName, NULL, NULL))
         {
Index: dll/win32/kernel32/file/file.c
===================================================================
--- dll/win32/kernel32/file/file.c	(revision 21808)
+++ dll/win32/kernel32/file/file.c	(working copy)
@@ -12,6 +12,10 @@
 
 /* INCLUDES *****************************************************************/
 
+/* File contains Vista Semantics */
+#undef _WIN32_WINNT
+#define _WIN32_WINNT 0x0600
+
 #include <k32.h>
 
 #define NDEBUG
Index: dll/win32/kernel32/misc/recovery.c
===================================================================
--- dll/win32/kernel32/misc/recovery.c	(revision 21808)
+++ dll/win32/kernel32/misc/recovery.c	(working copy)
@@ -30,6 +30,10 @@
  *                  10/28/2005 Created stubs (w3)
  */
 
+/* File contains Vista Semantics */
+#undef _WIN32_WINNT
+#define _WIN32_WINNT 0x0600
+
 #include <k32.h>
 
 #define NDEBUG
Index: dll/win32/kernel32/misc/profile.c
===================================================================
--- dll/win32/kernel32/misc/profile.c	(revision 21808)
+++ dll/win32/kernel32/misc/profile.c	(working copy)
@@ -756,7 +756,7 @@
 
     GetWindowsDirectoryW( windirW, MAX_PATH );
 
-    if ((RtlDetermineDosPathNameType_U(filename) == RELATIVE_PATH) &&
+    if ((RtlDetermineDosPathNameType_U(filename) == RtlPathTypeRelative) &&
         !wcschr(filename, '\\') && !wcschr(filename, '/'))
     {
         static const WCHAR wszSeparator[] = {'\\', 0};
Index: dll/win32/kernel32/misc/utils.c
===================================================================
--- dll/win32/kernel32/misc/utils.c	(revision 21808)
+++ dll/win32/kernel32/misc/utils.c	(working copy)
@@ -9,6 +9,7 @@
 /* INCLUDES ****************************************************************/
 
 #include <k32.h>
+#include "i386/ketypes.h"
 
 #define NDEBUG
 #include "../include/debug.h"
Index: dll/win32/kernel32/misc/console.c
===================================================================
--- dll/win32/kernel32/misc/console.c	(revision 21808)
+++ dll/win32/kernel32/misc/console.c	(working copy)
@@ -14,6 +14,10 @@
 
 /* INCLUDES ******************************************************************/
 
+/* File contains Vista Semantics */
+#undef _WIN32_WINNT
+#define _WIN32_WINNT 0x0600
+
 #include <k32.h>
 
 #define NDEBUG
Index: dll/win32/kernel32/misc/ldr.c
===================================================================
--- dll/win32/kernel32/misc/ldr.c	(revision 21808)
+++ dll/win32/kernel32/misc/ldr.c	(working copy)
@@ -196,14 +196,14 @@
     {
         /* Call the API Properly */
         Status = LdrLoadDll(SearchPath,
-                            (ULONG)&DllCharacteristics, // Silence compiler
+                            &DllCharacteristics,
                             &DllName,
                             (PVOID*)&hInst);
     }
     else
     {
         /* Call the ROS API. NOTE: Don't fix this, I have a patch to merge later. */
-        Status = LdrLoadDll(SearchPath, dwFlags, &DllName, (PVOID*)&hInst);
+        Status = LdrLoadDll(SearchPath, &dwFlags, &DllName, (PVOID*)&hInst);
     }
 	RtlFreeHeap(RtlGetProcessHeap(), 0, SearchPath);
 	if ( !NT_SUCCESS(Status))
@@ -305,7 +305,7 @@
 
 	while (Entry != ModuleListHead)
 	{
-		Module = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY, InLoadOrderModuleList);
+		Module = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks);
 		if (Module->DllBase == (PVOID)hModule)
 		{
 			if (nSize * sizeof(WCHAR) < Module->FullDllName.Length)
@@ -372,7 +372,7 @@
 	Entry = ModuleListHead->Flink;
 	while (Entry != ModuleListHead)
 	{
-		Module = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY, InLoadOrderModuleList);
+		Module = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks);
 
 		if (Module->DllBase == (PVOID)hModule)
 		{
Index: dll/win32/kernel32/misc/toolhelp.c
===================================================================
--- dll/win32/kernel32/misc/toolhelp.c	(revision 21808)
+++ dll/win32/kernel32/misc/toolhelp.c	(working copy)
@@ -92,8 +92,8 @@
 /* INTERNAL FUNCTIONS *********************************************************/
 
 static VOID
-TH32FreeAllocatedResources(PRTL_DEBUG_BUFFER HeapDebug,
-                           PRTL_DEBUG_BUFFER ModuleDebug,
+TH32FreeAllocatedResources(PRTL_DEBUG_INFORMATION HeapDebug,
+                           PRTL_DEBUG_INFORMATION ModuleDebug,
                            PVOID ProcThrdInfo,
                            SIZE_T ProcThrdInfoSize)
 {
@@ -118,8 +118,8 @@
 static NTSTATUS
 TH32CreateSnapshot(DWORD dwFlags,
                    DWORD th32ProcessID,
-                   PRTL_DEBUG_BUFFER *HeapDebug,
-                   PRTL_DEBUG_BUFFER *ModuleDebug,
+                   PRTL_DEBUG_INFORMATION *HeapDebug,
+                   PRTL_DEBUG_INFORMATION *ModuleDebug,
                    PVOID *ProcThrdInfo,
                    SIZE_T *ProcThrdInfoSize)
 {
@@ -221,8 +221,8 @@
 static NTSTATUS
 TH32CreateSnapshotSectionInitialize(DWORD dwFlags,
                                     DWORD th32ProcessID,
-                                    PRTL_DEBUG_BUFFER HeapDebug,
-                                    PRTL_DEBUG_BUFFER ModuleDebug,
+                                    PRTL_DEBUG_INFORMATION HeapDebug,
+                                    PRTL_DEBUG_INFORMATION ModuleDebug,
                                     PVOID ProcThrdInfo,
                                     HANDLE *SectionHandle)
 {
@@ -248,8 +248,8 @@
    */
   if(dwFlags & TH32CS_SNAPHEAPLIST)
   {
-    hi = (PRTL_PROCESS_HEAPS)HeapDebug->HeapInformation;
-    nHeaps = hi->HeapCount;
+    hi = (PRTL_PROCESS_HEAPS)HeapDebug->Heaps;
+    nHeaps = hi->NumberOfHeaps;
     RequiredSnapshotSize += nHeaps * sizeof(HEAPLIST32);
   }
 
@@ -258,8 +258,8 @@
    */
   if(dwFlags & TH32CS_SNAPMODULE)
   {
-    mi = (PRTL_PROCESS_MODULES)ModuleDebug->ModuleInformation;
-    nModules = mi->ModuleCount;
+    mi = (PRTL_PROCESS_MODULES)ModuleDebug->Modules;
+    nModules = mi->NumberOfModules;
     RequiredSnapshotSize += nModules * sizeof(MODULEENTRY32W);
   }
 
@@ -350,13 +350,13 @@
     {
       HeapListEntry->dwSize = sizeof(HEAPLIST32);
       HeapListEntry->th32ProcessID = th32ProcessID;
-      HeapListEntry->th32HeapID = (ULONG_PTR)hi->HeapEntry[i].Base;
-      HeapListEntry->dwFlags = hi->HeapEntry[i].Flags;
+      HeapListEntry->th32HeapID = (ULONG_PTR)hi->Heaps[i].BaseAddress;
+      HeapListEntry->dwFlags = hi->Heaps[i].Flags;
 
       HeapListEntry++;
     }
 
-    DataOffset += hi->HeapCount * sizeof(HEAPLIST32);
+    DataOffset += hi->NumberOfHeaps * sizeof(HEAPLIST32);
   }
 
   /* initialize the module list */
@@ -370,22 +370,22 @@
       ModuleListEntry->dwSize = sizeof(MODULEENTRY32W);
       ModuleListEntry->th32ModuleID = 1; /* no longer used, always set to one! */
       ModuleListEntry->th32ProcessID = th32ProcessID;
-      ModuleListEntry->GlblcntUsage = mi->ModuleEntry[i].LoadCount;
-      ModuleListEntry->ProccntUsage = mi->ModuleEntry[i].LoadCount;
-      ModuleListEntry->modBaseAddr = (BYTE*)mi->ModuleEntry[i].Base;
-      ModuleListEntry->modBaseSize = mi->ModuleEntry[i].Size;
-      ModuleListEntry->hModule = (HMODULE)mi->ModuleEntry[i].Base;
+      ModuleListEntry->GlblcntUsage = mi->Modules[i].LoadCount;
+      ModuleListEntry->ProccntUsage = mi->Modules[i].LoadCount;
+      ModuleListEntry->modBaseAddr = (BYTE*)mi->Modules[i].ImageBase;
+      ModuleListEntry->modBaseSize = mi->Modules[i].ImageSize;
+      ModuleListEntry->hModule = (HMODULE)mi->Modules[i].ImageBase;
 
       MultiByteToWideChar(CP_ACP,
                           0,
-                          &mi->ModuleEntry[i].ImageName[mi->ModuleEntry[i].ModuleNameOffset],
+                          &mi->Modules[i].FullPathName[mi->Modules[i].OffsetToFileName],
                           -1,
                           ModuleListEntry->szModule,
                           sizeof(ModuleListEntry->szModule) / sizeof(ModuleListEntry->szModule[0]));
 
       MultiByteToWideChar(CP_ACP,
                           0,
-                          mi->ModuleEntry[i].ImageName,
+                          mi->Modules[i].FullPathName,
                           -1,
                           ModuleListEntry->szExePath,
                           sizeof(ModuleListEntry->szExePath) / sizeof(ModuleListEntry->szExePath[0]));
@@ -393,7 +393,7 @@
       ModuleListEntry++;
     }
 
-    DataOffset += mi->ModuleCount * sizeof(MODULEENTRY32W);
+    DataOffset += mi->NumberOfModules * sizeof(MODULEENTRY32W);
   }
 
   /* initialize the process list */
@@ -1113,7 +1113,7 @@
 STDCALL
 CreateToolhelp32Snapshot(DWORD dwFlags, DWORD th32ProcessID)
 {
-  PRTL_DEBUG_BUFFER HeapDebug, ModuleDebug;
+  PRTL_DEBUG_INFORMATION HeapDebug, ModuleDebug;
   PVOID ProcThrdInfo;
   SIZE_T ProcThrdInfoSize;
   NTSTATUS Status;
Index: dll/win32/kernel32/kernel32.rbuild
===================================================================
--- dll/win32/kernel32/kernel32.rbuild	(revision 21808)
+++ dll/win32/kernel32/kernel32.rbuild	(working copy)
@@ -5,11 +5,10 @@
 	<define name="_DISABLE_TIDENTS" />
 	<define name="_SEH_NO_NATIVE_NLG" />
 	<define name="__USE_W32API" />
-	<define name="_WIN32_WINNT">0x0600</define>
+	<define name="_WIN32_WINNT">0x0502</define>
 	<define name="__NO_CTYPE_INLINES" />
-	<define name="WINVER">0x0600</define>
+	<define name="WINVER">0x502</define>
 	<pch>k32.h</pch>
-	<compilationunit name="unit.c">
 	<directory name="debug">
 		<file>break.c</file>
 		<file>debugger.c</file>
@@ -104,7 +103,6 @@
 		<file>thread.c</file>
 		<file>tls.c</file>
 	</directory>
-	</compilationunit>
 	<directory name="misc">
 		<file>lcformat.c</file>
 		<file>profile.c</file>
Index: dll/win32/kernel32/thread/tls.c
===================================================================
--- dll/win32/kernel32/thread/tls.c	(revision 21808)
+++ dll/win32/kernel32/thread/tls.c	(working copy)
@@ -17,8 +17,6 @@
 #define NDEBUG
 #include "../include/debug.h"
 
-#define TLS_EXPANSION_SLOTS (8 * sizeof(((PPEB)NULL)->TlsExpansionBitmapBits))
-
 /* FUNCTIONS *****************************************************************/
 
 /*
Index: dll/win32/kernel32/process/create.c
===================================================================
--- dll/win32/kernel32/process/create.c	(revision 21808)
+++ dll/win32/kernel32/process/create.c	(working copy)
@@ -883,7 +883,7 @@
             PathType = RtlDetermineDosPathNameType_U(lpApplicationName);
                     
             /* If it's not relative, try to get the error */
-            if (PathType != RELATIVE_PATH)
+            if (PathType != RtlPathTypeRelative)
             {
                 /* This should fail, and give us a detailed LastError */
                 hFile = CreateFileW(lpApplicationName,
Index: dll/win32/psapi/psapi.c
===================================================================
--- dll/win32/psapi/psapi.c	(revision 21808)
+++ dll/win32/psapi/psapi.c	(working copy)
@@ -42,7 +42,7 @@
 } ENUM_DEVICE_DRIVERS_CONTEXT, *PENUM_DEVICE_DRIVERS_CONTEXT;
 
 NTSTATUS STDCALL
-EnumDeviceDriversCallback(IN PSYSTEM_MODULE_INFORMATION_ENTRY CurrentModule,
+EnumDeviceDriversCallback(IN PRTL_PROCESS_MODULE_INFORMATION CurrentModule,
                           IN OUT PVOID CallbackContext)
 {
   PENUM_DEVICE_DRIVERS_CONTEXT Context = (PENUM_DEVICE_DRIVERS_CONTEXT)CallbackContext;
@@ -54,7 +54,7 @@
   }
 
   /* return current module */
-  *Context->lpImageBase = CurrentModule->Base;
+  *Context->lpImageBase = CurrentModule->ImageBase;
 
   /* go to next array slot */
   Context->lpImageBase++;
@@ -141,22 +141,22 @@
 } GET_DEVICE_DRIVER_NAME_CONTEXT, *PGET_DEVICE_DRIVER_NAME_CONTEXT;
 
 NTSTATUS STDCALL
-GetDeviceDriverNameCallback(IN PSYSTEM_MODULE_INFORMATION_ENTRY CurrentModule,
+GetDeviceDriverNameCallback(IN PRTL_PROCESS_MODULE_INFORMATION CurrentModule,
                             IN OUT PVOID CallbackContext)
 {
   PGET_DEVICE_DRIVER_NAME_CONTEXT Context = (PGET_DEVICE_DRIVER_NAME_CONTEXT)CallbackContext;
 
   /* module found */
-  if(Context->ImageBase == CurrentModule->Base)
+  if(Context->ImageBase == CurrentModule->ImageBase)
   {
     PCHAR pcModuleName;
     ULONG l;
 
     /* get the full name or just the filename part */
     if(Context->bFullName)
-      pcModuleName = &CurrentModule->ImageName[0];
+      pcModuleName = &CurrentModule->FullPathName[0];
     else
-      pcModuleName = &CurrentModule->ImageName[CurrentModule->PathLength];
+      pcModuleName = &CurrentModule->FullPathName[CurrentModule->OffsetToFileName];
 
     /* get the length of the name */
     l = strlen(pcModuleName);
Index: dll/ntdll/ldr/utils.c
===================================================================
--- dll/ntdll/ldr/utils.c	(revision 21808)
+++ dll/ntdll/ldr/utils.c	(working copy)
@@ -73,7 +73,7 @@
 LdrpLoadUserModuleSymbols(PLDR_DATA_TABLE_ENTRY LdrModule)
 {
   NtSystemDebugControl(
-    DebugDbgLoadSymbols,
+    SysDbgQueryVersion,
     (PVOID)LdrModule,
     0,
     NULL,
@@ -255,7 +255,7 @@
        Entry = ModuleListHead->Flink;
        while (Entry != ModuleListHead)
          {
-           Module = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY, InLoadOrderModuleList);
+           Module = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks);
            if (Module->LoadCount == 0xFFFF &&
                Module->TlsIndex != 0xFFFF)
              {
@@ -498,7 +498,7 @@
 
   RtlEnterCriticalSection (NtCurrentPeb()->LoaderLock);
   InsertTailList(&NtCurrentPeb()->Ldr->InLoadOrderModuleList,
-                 &Module->InLoadOrderModuleList);
+                 &Module->InLoadOrderLinks);
   RtlLeaveCriticalSection(NtCurrentPeb()->LoaderLock);
 
   return(Module);
@@ -727,7 +727,7 @@
  */
 NTSTATUS NTAPI
 LdrLoadDll (IN PWSTR SearchPath OPTIONAL,
-            IN ULONG LoadFlags,
+            IN PULONG LoadFlags,
             IN PUNICODE_STRING Name,
             OUT PVOID *BaseAddress OPTIONAL)
 {
@@ -747,8 +747,8 @@
 
   *BaseAddress = NULL;
 
-  Status = LdrpLoadModule(SearchPath, LoadFlags, Name, &Module, BaseAddress);
-  if (NT_SUCCESS(Status) && 0 == (LoadFlags & LOAD_LIBRARY_AS_DATAFILE))
+  Status = LdrpLoadModule(SearchPath, *LoadFlags, Name, &Module, BaseAddress);
+  if (NT_SUCCESS(Status) && 0 == (*LoadFlags & LOAD_LIBRARY_AS_DATAFILE))
     {
       RtlEnterCriticalSection(NtCurrentPeb()->LoaderLock);
       Status = LdrpAttachProcess();
@@ -802,7 +802,7 @@
 
   while (Entry != ModuleListHead)
     {
-      ModulePtr = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY, InLoadOrderModuleList);
+      ModulePtr = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks);
 
       DPRINT("Scanning %wZ at %p\n", &ModulePtr->BaseDllName, ModulePtr->DllBase);
 
@@ -901,7 +901,7 @@
     }
   while (Entry != ModuleListHead)
     {
-      ModulePtr = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY, InLoadOrderModuleList);
+      ModulePtr = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks);
 
       DPRINT("Scanning %wZ %wZ\n", &ModulePtr->BaseDllName, &AdjustedName);
 
@@ -970,8 +970,9 @@
          */
         if (!NT_SUCCESS(Status))
           {
+             ULONG Flags = LDRP_PROCESS_CREATION_TIME;
              Status = LdrLoadDll(NULL,
-                                 LDRP_PROCESS_CREATION_TIME,
+                                 &Flags,
                                  &DllName,
                                  &BaseAddress);
              if (NT_SUCCESS(Status))
@@ -1289,7 +1290,7 @@
           ProtectPage2 = NULL;
         }
 
-      RelocationDir = LdrProcessRelocationBlock(Page,
+      RelocationDir = LdrProcessRelocationBlock((ULONG_PTR)Page,
                                                 Count,
                                                 TypeOffset,
                                                 Delta);
@@ -2269,7 +2270,7 @@
     Entry = ModuleListHead->Flink;
     while (Entry != ModuleListHead)
       {
-        Module = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY, InLoadOrderModuleList);
+        Module = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks);
 
         DPRINT("BaseDllName %wZ BaseAddress %p\n", &Module->BaseDllName, Module->DllBase);
 
@@ -2346,7 +2347,7 @@
     Entry = ModuleListHead->Flink;
     while (Entry != ModuleListHead)
     {
-        Module = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY, InLoadOrderModuleList);
+        Module = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks);
 
         if (Module->DllBase == BaseAddress)
         {
@@ -2385,7 +2386,7 @@
     Entry = ModuleListHead->Flink;
     while (Entry != ModuleListHead)
       {
-        Module = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY, InLoadOrderModuleList);
+        Module = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks);
 
         if ((ULONG_PTR)PcValue >= (ULONG_PTR)Module->DllBase &&
             (ULONG_PTR)PcValue < (ULONG_PTR)Module->DllBase + Module->SizeOfImage)
@@ -2520,7 +2521,7 @@
                ((UnloadAll && Module->LoadCount != 0xFFFF) || Module->LoadCount == 0))
              {
                /* remove the module entry from the list */
-               RemoveEntryList (&Module->InLoadOrderModuleList);
+               RemoveEntryList (&Module->InLoadOrderLinks);
                RemoveEntryList (&Module->InInitializationOrderModuleList);
 
                NtUnmapViewOfSection (NtCurrentProcess (), Module->DllBase);
@@ -2653,7 +2654,7 @@
         }
 
       Entry = NtCurrentPeb()->Ldr->InLoadOrderModuleList.Flink;
-      Module = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY, InLoadOrderModuleList);
+      Module = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks);
       LdrpTlsCallback(Module, DLL_THREAD_ATTACH);
     }
 
@@ -2741,7 +2742,7 @@
   PCHAR p;
 
   DPRINT("LdrQueryProcessModuleInformation() called\n");
-
+ // FIXME: This code is ultra-duplicated. see lib\rtl\dbgbuffer.c
   RtlEnterCriticalSection (NtCurrentPeb()->LoaderLock);
 
   if (ModuleInformation == NULL || Size == 0)
@@ -2750,8 +2751,8 @@
     }
   else
     {
-      ModuleInformation->ModuleCount = 0;
-      ModulePtr = &ModuleInformation->ModuleEntry[0];
+      ModuleInformation->NumberOfModules = 0;
+      ModulePtr = &ModuleInformation->Modules[0];
       Status = STATUS_SUCCESS;
     }
 
@@ -2760,7 +2761,7 @@
 
   while (Entry != ModuleListHead)
     {
-      Module = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY, InLoadOrderModuleList);
+      Module = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks);
 
       DPRINT("  Module %wZ\n",
              &Module->FullDllName);
@@ -2771,28 +2772,30 @@
         }
       else if (ModuleInformation != NULL)
         {
-          ModulePtr->Reserved[0] = ModulePtr->Reserved[1] = 0;      // FIXME: ??
-          ModulePtr->Base = Module->DllBase;
-          ModulePtr->Size = Module->SizeOfImage;
-          ModulePtr->Flags = Module->Flags;
-          ModulePtr->Index = 0;      // FIXME: index ??
-          ModulePtr->Unknown = 0;      // FIXME: ??
-          ModulePtr->LoadCount = Module->LoadCount;
+          ModulePtr->Section = 0;
+          ModulePtr->MappedBase = NULL;      // FIXME: ??
+          ModulePtr->ImageBase        = Module->DllBase;
+          ModulePtr->ImageSize        = Module->SizeOfImage;
+          ModulePtr->Flags       = Module->Flags;
+          ModulePtr->LoadOrderIndex       = 0;      // FIXME:  ??
+          ModulePtr->InitOrderIndex     = 0;      // FIXME: ??
+          ModulePtr->LoadCount   = Module->LoadCount;
 
-          AnsiString.Length = 0;
+          AnsiString.Length        = 0;
           AnsiString.MaximumLength = 256;
-          AnsiString.Buffer = ModulePtr->ImageName;
+          AnsiString.Buffer        = ModulePtr->FullPathName;
           RtlUnicodeStringToAnsiString(&AnsiString,
                                        &Module->FullDllName,
                                        FALSE);
-          p = strrchr(ModulePtr->ImageName, '\\');
+
+          p = strrchr(ModulePtr->FullPathName, '\\');
           if (p != NULL)
-            ModulePtr->ModuleNameOffset = p - ModulePtr->ImageName + 1;
+            ModulePtr->OffsetToFileName = p - ModulePtr->FullPathName + 1;
           else
-            ModulePtr->ModuleNameOffset = 0;
+            ModulePtr->OffsetToFileName = 0;
 
           ModulePtr++;
-          ModuleInformation->ModuleCount++;
+          ModuleInformation->NumberOfModules++;
         }
       UsedSize += sizeof(RTL_PROCESS_MODULE_INFORMATION);
 
@@ -3154,10 +3157,10 @@
 
 
 PIMAGE_BASE_RELOCATION NTAPI
-LdrProcessRelocationBlock(IN PVOID Address,
-			  IN USHORT Count,
+LdrProcessRelocationBlock(IN ULONG_PTR Address,
+			  IN ULONG Count,
 			  IN PUSHORT TypeOffset,
-			  IN ULONG_PTR Delta)
+			  IN LONG_PTR Delta)
 {
   SHORT Offset;
   USHORT Type;
Index: dll/ntdll/ldr/startup.c
===================================================================
--- dll/ntdll/ldr/startup.c	(revision 21808)
+++ dll/ntdll/ldr/startup.c	(working copy)
@@ -415,7 +415,7 @@
        NtModule->TimeDateStamp = NTHeaders->FileHeader.TimeDateStamp;
 
        InsertTailList(&Peb->Ldr->InLoadOrderModuleList,
-                      &NtModule->InLoadOrderModuleList);
+                      &NtModule->InLoadOrderLinks);
        InsertTailList(&Peb->Ldr->InInitializationOrderModuleList,
                       &NtModule->InInitializationOrderModuleList);
 
@@ -463,7 +463,7 @@
        ExeModule->TimeDateStamp = NTHeaders->FileHeader.TimeDateStamp;
 
        InsertHeadList(&Peb->Ldr->InLoadOrderModuleList,
-                      &ExeModule->InLoadOrderModuleList);
+                      &ExeModule->InLoadOrderLinks);
 
        LdrpInitLoader();
 
Index: dll/ntdll/ntdll.rbuild
===================================================================
--- dll/ntdll/ntdll.rbuild	(revision 21808)
+++ dll/ntdll/ntdll.rbuild	(working copy)
@@ -6,7 +6,7 @@
 	<define name="__NTDLL__" />
 	<define name="_DISABLE_TIDENTS" />
 	<define name="__USE_W32API" />
-	<define name="_WIN32_WINNT">0x0600</define>
+	<define name="_WIN32_WINNT">0x0502</define>
 	<define name="_NTOSKRNL_" />
 	<define name="__NO_CTYPE_INLINES" />
 	<library>rtl</library>
Index: dll/ntdll/def/ntdll.def
===================================================================
--- dll/ntdll/def/ntdll.def	(revision 21808)
+++ dll/ntdll/def/ntdll.def	(working copy)
@@ -522,8 +522,8 @@
 RtlIpv4StringToAddressExW@16
 RtlIpv4StringToAddressW@16
 RtlIpv6AddressToStringA@8
-RtlIpv6AddressToStringExA@16
-RtlIpv6AddressToStringExW@16
+RtlIpv6AddressToStringExA@20
+RtlIpv6AddressToStringExW@20
 RtlIpv6AddressToStringW@8
 RtlIpv6StringToAddressA@12
 RtlIpv6StringToAddressExA@16
Index: drivers/storage/diskdump/diskdump.c
===================================================================
--- drivers/storage/diskdump/diskdump.c	(revision 21808)
+++ drivers/storage/diskdump/diskdump.c	(working copy)
@@ -33,9 +33,8 @@
 #include <ntddscsi.h>
 #include <include/class2.h>
 #include <diskdump/diskdump.h>
-
-#include <ndk/extypes.h>
 #include <ndk/rtlfuncs.h>
+
 #include "../scsiport/scsiport_int.h"
 
 #define NDEBUG
Index: drivers/video/videoprt/videoprt.h
===================================================================
--- drivers/video/videoprt/videoprt.h	(revision 21808)
+++ drivers/video/videoprt/videoprt.h	(working copy)
@@ -41,6 +41,14 @@
 
 #define DPFLTR_IHVVIDEO_ID 0 /* FIXME */
 
+/* ROS Internal. Please deprecate */
+NTHALAPI
+VOID
+NTAPI
+HalReleaseDisplayOwnership(
+    VOID
+);
+
 typedef struct _VIDEO_PORT_ADDRESS_MAPPING
 {
    LIST_ENTRY List;
Index: drivers/video/videoprt/int10.c
===================================================================
--- drivers/video/videoprt/int10.c	(revision 21808)
+++ drivers/video/videoprt/int10.c	(working copy)
@@ -22,7 +22,7 @@
  */
 
 #include "videoprt.h"
-#include "internal/ke.h"
+#include "internal/i386/v86m.h"
 
 /* PRIVATE FUNCTIONS **********************************************************/
 
@@ -178,7 +178,7 @@
    Regs.Ds = BiosArguments->SegDs;
    DPRINT("- Input register SegEs: %x\n", BiosArguments->SegEs);
    Regs.Es = BiosArguments->SegEs;
-   Status = Ke386CallBios(0x10, &Regs);
+   Status = Ke386CallBios(0x10, (PCONTEXT)&Regs);
    BiosArguments->Eax = Regs.Eax;
    BiosArguments->Ebx = Regs.Ebx;
    BiosArguments->Ecx = Regs.Ecx;
@@ -234,7 +234,7 @@
    Regs.Edi = BiosArguments->Edi;
    DPRINT("- Input register Ebp: %x\n", BiosArguments->Ebp);
    Regs.Ebp = BiosArguments->Ebp;
-   Status = Ke386CallBios(0x10, &Regs);
+   Status = Ke386CallBios(0x10, (PCONTEXT)&Regs);
    BiosArguments->Eax = Regs.Eax;
    BiosArguments->Ebx = Regs.Ebx;
    BiosArguments->Ecx = Regs.Ecx;
Index: drivers/filesystems/ms/msfs.h
===================================================================
--- drivers/filesystems/ms/msfs.h	(revision 21808)
+++ drivers/filesystems/ms/msfs.h	(working copy)
@@ -2,7 +2,7 @@
 #define __SERVICES_FS_MS_MSFS_H
 
 #include <ntifs.h>
-#include <ndk/ntndk.h>
+#include <iotypes.h>
 
 /* 
  * FIXME: GCC doesn't have a working option for defaulting to a calling
Index: drivers/filesystems/vfat/vfat.h
===================================================================
--- drivers/filesystems/vfat/vfat.h	(revision 21808)
+++ drivers/filesystems/vfat/vfat.h	(working copy)
@@ -4,7 +4,6 @@
 #include <reactos/helper.h>
 
 #ifdef __GNUC__
-#include <ndk/ntndk.h>
 #include <ccros.h>
 
 #define USE_ROS_CC_AND_FS
Index: drivers/network/tcpip/include/precomp.h
===================================================================
--- drivers/network/tcpip/include/precomp.h	(revision 21808)
+++ drivers/network/tcpip/include/precomp.h	(working copy)
@@ -1,6 +1,7 @@
 #include <roscfg.h>
 #include <limits.h>
 #include <ntddk.h>
+#include <ntifs.h>
 #include <tdi.h>
 #include <tdistat.h>
 #include <../recmutex/recmutex.h>
@@ -37,5 +38,4 @@
 #include <interface.h>
 #include <ports.h>
 #include <ipifcons.h>
-#include <ndk/ntndk.h>
 #include <chew/chew.h>
Index: drivers/base/blue/blue.c
===================================================================
--- drivers/base/blue/blue.c	(revision 21808)
+++ drivers/base/blue/blue.c	(working copy)
@@ -18,11 +18,18 @@
 
 #include <wincon.h>
 #include <blue/ntddblue.h>
-#include <ndk/halfuncs.h>
 
 #define NDEBUG
 #include <debug.h>
 
+// ROS Internal. Please deprecate.
+NTHALAPI
+BOOLEAN
+NTAPI
+HalQueryDisplayOwnership(
+    VOID
+);
+
 /* DEFINITIONS ***************************************************************/
 
 #define VIDMEM_BASE        0xb8000
Index: drivers/multimedia/audio/sound/wave.c
===================================================================
--- drivers/multimedia/audio/sound/wave.c	(revision 21808)
+++ drivers/multimedia/audio/sound/wave.c	(working copy)
@@ -13,7 +13,6 @@
 /* FUNCTIONS **************************************************************/
 
 #include <ntddk.h>
-#include <halfuncs.h>
 #include <string.h>
 #include <devices.h>
 

