Part 1 of <many> ntoskrnl header cleanups
Modified: trunk/reactos/include/ndk/ketypes.h
Modified: trunk/reactos/include/ndk/pstypes.h
Modified: trunk/reactos/ntoskrnl/include/internal/ex.h
Modified: trunk/reactos/ntoskrnl/include/internal/ke.h
Modified: trunk/reactos/ntoskrnl/include/internal/mm.h
Modified: trunk/reactos/ntoskrnl/include/internal/ps.h
Modified: trunk/reactos/ntoskrnl/include/internal/se.h
Modified: trunk/reactos/ntoskrnl/include/internal/test.h
Modified: trunk/reactos/ntoskrnl/include/internal/v86m.h
Modified: trunk/reactos/ntoskrnl/kdbg/kdb.c
Modified: trunk/reactos/ntoskrnl/kdbg/kdb_cli.c
Modified: trunk/reactos/ntoskrnl/kdbg/kdb_symbols.c
Modified: trunk/reactos/ntoskrnl/ke/process.c
Modified: trunk/reactos/ntoskrnl/ke/usercall.c
Modified: trunk/reactos/ntoskrnl/ps/idle.c
Modified: trunk/reactos/ntoskrnl/ps/job.c
Modified: trunk/reactos/ntoskrnl/ps/locale.c
Modified: trunk/reactos/ntoskrnl/ps/process.c
Modified: trunk/reactos/ntoskrnl/ps/psmgr.c
Modified: trunk/reactos/ntoskrnl/ps/win32.c
Modified: trunk/reactos/ntoskrnl/se/acl.c
Modified: trunk/reactos/ntoskrnl/se/luid.c
Modified: trunk/reactos/ntoskrnl/se/priv.c
Modified: trunk/reactos/ntoskrnl/se/sd.c
Modified: trunk/reactos/ntoskrnl/se/semgr.c
Modified: trunk/reactos/ntoskrnl/se/sid.c
Modified: trunk/reactos/ntoskrnl/se/token.c

Modified: trunk/reactos/include/ndk/ketypes.h
--- trunk/reactos/include/ndk/ketypes.h	2005-09-13 23:04:32 UTC (rev 17843)
+++ trunk/reactos/include/ndk/ketypes.h	2005-09-13 23:28:21 UTC (rev 17844)
@@ -147,6 +147,13 @@
     DeferredReady,
 } KTHREAD_STATE, *PKTHREAD_STATE;
 
+typedef enum _KPROCESS_STATE
+{
+    ProcessInMemory,
+    ProcessOutOfMemory,
+    ProcessInTransition,
+} KPROCESS_STATE, *PKPROCESS_STATE;
+
 /* FUNCTION TYPES ************************************************************/
 
 #ifdef NTOS_MODE_USER

Modified: trunk/reactos/include/ndk/pstypes.h
--- trunk/reactos/include/ndk/pstypes.h	2005-09-13 23:04:32 UTC (rev 17843)
+++ trunk/reactos/include/ndk/pstypes.h	2005-09-13 23:28:21 UTC (rev 17844)
@@ -56,6 +56,11 @@
 #define PROCESS_PRIORITY_CLASS_BELOW_NORMAL     5
 #define PROCESS_PRIORITY_CLASS_ABOVE_NORMAL     6
 
+/* Process base priorities */
+#define PROCESS_PRIORITY_IDLE                   3
+#define PROCESS_PRIORITY_NORMAL                 8
+#define PROCESS_PRIORITY_NORMAL_FOREGROUND      9
+
 /* Global Flags */
 #define FLG_STOP_ON_EXCEPTION          0x00000001
 #define FLG_SHOW_LDR_SNAPS             0x00000002

Modified: trunk/reactos/ntoskrnl/include/internal/ex.h
--- trunk/reactos/ntoskrnl/include/internal/ex.h	2005-09-13 23:04:32 UTC (rev 17843)
+++ trunk/reactos/ntoskrnl/include/internal/ex.h	2005-09-13 23:28:21 UTC (rev 17844)
@@ -200,6 +200,7 @@
 ExpSetTimeZoneInformation(PTIME_ZONE_INFORMATION TimeZoneInformation);
 
 NTSTATUS
+NTAPI
 ExpAllocateLocallyUniqueId(OUT LUID *LocallyUniqueId);
 
 VOID

Modified: trunk/reactos/ntoskrnl/include/internal/ke.h
--- trunk/reactos/ntoskrnl/include/internal/ke.h	2005-09-13 23:04:32 UTC (rev 17843)
+++ trunk/reactos/ntoskrnl/include/internal/ke.h	2005-09-13 23:28:21 UTC (rev 17844)
@@ -416,6 +416,75 @@
 VOID
 KiSetSystemTime(PLARGE_INTEGER NewSystemTime);
 
+/* 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;
+
+NTSTATUS 
+STDCALL
+Ke386CallBios(
+    UCHAR Int, 
+    PKV86M_REGISTERS Regs
+);
+
+ULONG
+KeV86Exception(
+    ULONG ExceptionNr, 
+    PKTRAP_FRAME Tf, 
+    ULONG address
+);
+
 #define MAXIMUM_PROCESSORS      32
 
 #endif /* __NTOSKRNL_INCLUDE_INTERNAL_KE_H */

Modified: trunk/reactos/ntoskrnl/include/internal/mm.h
--- trunk/reactos/ntoskrnl/include/internal/mm.h	2005-09-13 23:04:32 UTC (rev 17843)
+++ trunk/reactos/ntoskrnl/include/internal/mm.h	2005-09-13 23:28:21 UTC (rev 17844)
@@ -888,4 +888,13 @@
 
 VOID MiStopPagerThread(VOID);
 
+
+NTSTATUS FASTCALL
+MiQueryVirtualMemory (IN HANDLE ProcessHandle,
+                      IN PVOID Address,
+                      IN CINT VirtualMemoryInformationClass,
+                      OUT PVOID VirtualMemoryInformation,
+                      IN ULONG Length,
+                      OUT PULONG ResultLength);
+
 #endif

Modified: trunk/reactos/ntoskrnl/include/internal/ps.h
--- trunk/reactos/ntoskrnl/include/internal/ps.h	2005-09-13 23:04:32 UTC (rev 17843)
+++ trunk/reactos/ntoskrnl/include/internal/ps.h	2005-09-13 23:28:21 UTC (rev 17844)
@@ -10,97 +10,206 @@
 
 extern LCID PsDefaultThreadLocaleId;
 extern LCID PsDefaultSystemLocaleId;
+extern LIST_ENTRY PspReaperListHead;
+extern WORK_QUEUE_ITEM PspReaperWorkItem;
+extern BOOLEAN PspReaping;
+extern PEPROCESS PsInitialSystemProcess;
+extern PEPROCESS PsIdleProcess;
+extern LIST_ENTRY PsActiveProcessHead;
+extern FAST_MUTEX PspActiveProcessMutex;
+extern LARGE_INTEGER ShortPsLockDelay, PsLockTimeout;
+extern EPROCESS_QUOTA_BLOCK PspDefaultQuotaBlock;
 
 /* Top level irp definitions. */
-#define	FSRTL_FSP_TOP_LEVEL_IRP			(0x01)
-#define	FSRTL_CACHE_TOP_LEVEL_IRP		(0x02)
-#define	FSRTL_MOD_WRITE_TOP_LEVEL_IRP		(0x03)
-#define	FSRTL_FAST_IO_TOP_LEVEL_IRP		(0x04)
-#define	FSRTL_MAX_TOP_LEVEL_IRP_FLAG		(0x04)
+#define	FSRTL_FSP_TOP_LEVEL_IRP         (0x01)
+#define	FSRTL_CACHE_TOP_LEVEL_IRP       (0x02)
+#define	FSRTL_MOD_WRITE_TOP_LEVEL_IRP   (0x03)
+#define	FSRTL_FAST_IO_TOP_LEVEL_IRP     (0x04)
+#define	FSRTL_MAX_TOP_LEVEL_IRP_FLAG    (0x04)
 
-#define PROCESS_STATE_TERMINATED (1)
-#define PROCESS_STATE_ACTIVE     (2)
+#define MAX_PROCESS_NOTIFY_ROUTINE_COUNT    8
+#define MAX_LOAD_IMAGE_NOTIFY_ROUTINE_COUNT  8
 
-VOID PiInitDefaultLocale(VOID);
-VOID PiInitProcessManager(VOID);
-VOID PiShutdownProcessManager(VOID);
-VOID PsInitThreadManagment(VOID);
-VOID PsInitProcessManagment(VOID);
-VOID PsInitIdleThread(VOID);
-VOID PiTerminateProcessThreads(PEPROCESS Process, NTSTATUS ExitStatus);
-VOID PsTerminateCurrentThread(NTSTATUS ExitStatus);
-VOID PsTerminateOtherThread(PETHREAD Thread, NTSTATUS ExitStatus);
-VOID PsReleaseThread(PETHREAD Thread);
-VOID PsBeginThread(PKSTART_ROUTINE StartRoutine, PVOID StartContext);
-VOID PsBeginThreadWithContextInternal(VOID);
-VOID PiKillMostProcesses(VOID);
-NTSTATUS STDCALL PiTerminateProcess(PEPROCESS Process, NTSTATUS ExitStatus);
-VOID PiInitApcManagement(VOID);
-VOID STDCALL PiDeleteThread(PVOID ObjectBody);
-VOID PsReapThreads(VOID);
-VOID PsInitializeThreadReaper(VOID);
-VOID PsQueueThreadReap(PETHREAD Thread);
+VOID
+NTAPI
+PiInitDefaultLocale(VOID);
+
+VOID
+NTAPI
+PiInitProcessManager(VOID);
+
+VOID
+NTAPI
+PiShutdownProcessManager(VOID);
+
+VOID
+NTAPI
+PsInitThreadManagment(VOID);
+
+VOID
+NTAPI
+PsInitProcessManagment(VOID);
+
+VOID
+NTAPI
+PsInitIdleThread(VOID);
+
+VOID
+NTAPI
+PiTerminateProcessThreads(
+    PEPROCESS Process,
+    NTSTATUS ExitStatus
+);
+
+VOID
+NTAPI
+PsTerminateCurrentThread(NTSTATUS ExitStatus);
+
+VOID
+NTAPI
+PsTerminateOtherThread(
+    PETHREAD Thread,
+    NTSTATUS ExitStatus
+);
+
+VOID
+NTAPI
+PsReleaseThread(PETHREAD Thread);
+
+VOID
+NTAPI
+PsBeginThread(
+    PKSTART_ROUTINE StartRoutine,
+    PVOID StartContext
+);
+
+VOID
+NTAPI
+PsBeginThreadWithContextInternal(VOID);
+
+VOID
+NTAPI
+PiKillMostProcesses(VOID);
+
 NTSTATUS
-PsInitializeThread(PEPROCESS Process,
-		   PETHREAD* ThreadPtr,
-		   POBJECT_ATTRIBUTES ObjectAttributes,
-		   KPROCESSOR_MODE AccessMode,
-		   BOOLEAN First);
+STDCALL
+PiTerminateProcess(
+    PEPROCESS Process,
+    NTSTATUS ExitStatus
+);
 
-PACCESS_TOKEN STDCALL PsReferenceEffectiveToken(PETHREAD Thread,
-					PTOKEN_TYPE TokenType,
-					PUCHAR b,
-					PSECURITY_IMPERSONATION_LEVEL Level);
+VOID
+NTAPI
+PiInitApcManagement(VOID);
 
-NTSTATUS STDCALL PsOpenTokenOfProcess(HANDLE ProcessHandle,
-			      PACCESS_TOKEN* Token);
 VOID
 STDCALL
-PspTerminateProcessThreads(PEPROCESS Process,
-                           NTSTATUS ExitStatus);
-NTSTATUS PsSuspendThread(PETHREAD Thread, PULONG PreviousCount);
-NTSTATUS PsResumeThread(PETHREAD Thread, PULONG PreviousCount);
+PiDeleteThread(PVOID ObjectBody);
+
+VOID
+NTAPI
+PsReapThreads(VOID);
+
+VOID
+NTAPI
+PsInitializeThreadReaper(VOID);
+
+VOID
+NTAPI
+PsQueueThreadReap(PETHREAD Thread);
+
 NTSTATUS
+NTAPI
+PsInitializeThread(
+    PEPROCESS Process,
+    PETHREAD* ThreadPtr,
+    POBJECT_ATTRIBUTES ObjectAttributes,
+    KPROCESSOR_MODE AccessMode,
+    BOOLEAN First
+);
+
+PACCESS_TOKEN
 STDCALL
-PspAssignPrimaryToken(PEPROCESS Process,
-                      HANDLE TokenHandle);
-VOID STDCALL PsExitSpecialApc(PKAPC Apc,
-		      PKNORMAL_ROUTINE *NormalRoutine,
-		      PVOID *NormalContext,
-		      PVOID *SystemArgument1,
-		      PVOID *SystemArgument2);
+PsReferenceEffectiveToken(
+    PETHREAD Thread,
+    PTOKEN_TYPE TokenType,
+    PUCHAR b,
+    PSECURITY_IMPERSONATION_LEVEL Level
+);
 
 NTSTATUS
 STDCALL
-PspInitializeProcessSecurity(PEPROCESS Process,
-                             PEPROCESS Parent OPTIONAL);
+PsOpenTokenOfProcess(
+    HANDLE ProcessHandle,
+    PACCESS_TOKEN* Token
+);
 
+VOID
+STDCALL
+PspTerminateProcessThreads(
+    PEPROCESS Process,
+    NTSTATUS ExitStatus
+);
 
+NTSTATUS
+NTAPI
+PsSuspendThread(
+    PETHREAD Thread,
+    PULONG PreviousCount
+);
+
+NTSTATUS
+NTAPI
+PsResumeThread(
+    PETHREAD Thread,
+    PULONG PreviousCount
+);
+
+NTSTATUS
+STDCALL
+PspAssignPrimaryToken(
+    PEPROCESS Process,
+    HANDLE TokenHandle
+);
+
 VOID
 STDCALL
-PspSystemThreadStartup(PKSTART_ROUTINE StartRoutine,
-                       PVOID StartContext);
+PsExitSpecialApc(
+    PKAPC Apc,
+    PKNORMAL_ROUTINE *NormalRoutine,
+    PVOID *NormalContext,
+    PVOID *SystemArgument1,
+    PVOID *SystemArgument2
+);
 
 NTSTATUS
-PsInitializeIdleOrFirstThread (
+STDCALL
+PspInitializeProcessSecurity(
     PEPROCESS Process,
+    PEPROCESS Parent OPTIONAL
+);
+
+VOID
+STDCALL
+PspSystemThreadStartup(
+    PKSTART_ROUTINE StartRoutine,
+    PVOID StartContext
+);
+
+NTSTATUS
+NTAPI
+PsInitializeIdleOrFirstThread(
+    PEPROCESS Process,
     PETHREAD* ThreadPtr,
     PKSTART_ROUTINE StartRoutine,
     KPROCESSOR_MODE AccessMode,
-    BOOLEAN First);
-/*
- * Internal thread priorities, added by Phillip Susi
- * TODO: rebalence these to make use of all priorities... the ones above 16
- * can not all be used right now
- */
-#define PROCESS_PRIO_IDLE			3
-#define PROCESS_PRIO_NORMAL			8
-#define PROCESS_PRIO_HIGH			13
-#define PROCESS_PRIO_RT				18
+    BOOLEAN First
+);
 
+VOID
+STDCALL
+PiDeleteProcess(PVOID ObjectBody);
 
-VOID STDCALL PiDeleteProcess(PVOID ObjectBody);
-
 VOID
 STDCALL
 PspReapRoutine(PVOID Context);
@@ -109,48 +218,75 @@
 STDCALL
 PspExitThread(NTSTATUS ExitStatus);
 
-extern LIST_ENTRY PspReaperListHead;
-extern WORK_QUEUE_ITEM PspReaperWorkItem;
-extern BOOLEAN PspReaping;
-extern PEPROCESS PsInitialSystemProcess;
-extern PEPROCESS PsIdleProcess;
-extern LIST_ENTRY PsActiveProcessHead;
-extern FAST_MUTEX PspActiveProcessMutex;
-extern LARGE_INTEGER ShortPsLockDelay, PsLockTimeout;
-extern EPROCESS_QUOTA_BLOCK PspDefaultQuotaBlock;
+VOID
+STDCALL
+PspTerminateThreadByPointer(
+    PETHREAD Thread,
+    NTSTATUS ExitStatus
+);
 
 VOID
+NTAPI
+PsUnfreezeOtherThread(PETHREAD Thread);
+
+VOID
+NTAPI
+PsFreezeOtherThread(PETHREAD Thread);
+
+VOID
+NTAPI
+PsFreezeProcessThreads(PEPROCESS Process);
+
+VOID
+NTAPI
+PsUnfreezeProcessThreads(PEPROCESS Process);
+
+ULONG
+NTAPI
+PsEnumThreadsByProcess(PEPROCESS Process);
+
+PEPROCESS
 STDCALL
-PspTerminateThreadByPointer(PETHREAD Thread,
-                            NTSTATUS ExitStatus);
+PsGetNextProcess(PEPROCESS OldProcess);
 
-VOID PsUnfreezeOtherThread(PETHREAD Thread);
-VOID PsFreezeOtherThread(PETHREAD Thread);
-VOID PsFreezeProcessThreads(PEPROCESS Process);
-VOID PsUnfreezeProcessThreads(PEPROCESS Process);
-ULONG PsEnumThreadsByProcess(PEPROCESS Process);
-PEPROCESS STDCALL PsGetNextProcess(PEPROCESS OldProcess);
 VOID
+NTAPI
 PsApplicationProcessorInit(VOID);
+
 VOID
+NTAPI
 PsPrepareForApplicationProcessorInit(ULONG Id);
-VOID STDCALL
+
+VOID
+STDCALL
 PsIdleThreadMain(PVOID Context);
 
-VOID STDCALL
+VOID
+STDCALL
 PiSuspendThreadRundownRoutine(PKAPC Apc);
-VOID STDCALL
-PiSuspendThreadKernelRoutine(PKAPC Apc,
-			     PKNORMAL_ROUTINE* NormalRoutine,
-			     PVOID* NormalContext,
-			     PVOID* SystemArgument1,
-			     PVOID* SystemArguemnt2);
-VOID STDCALL
-PiSuspendThreadNormalRoutine(PVOID NormalContext,
-			     PVOID SystemArgument1,
-			     PVOID SystemArgument2);
+
 VOID
+STDCALL
+PiSuspendThreadKernelRoutine(
+    PKAPC Apc,
+    PKNORMAL_ROUTINE* NormalRoutine,
+    PVOID* NormalContext,
+    PVOID* SystemArgument1,
+    PVOID* SystemArguemnt2
+);
+
+VOID
+STDCALL
+PiSuspendThreadNormalRoutine(
+    PVOID NormalContext,
+    PVOID SystemArgument1,
+    PVOID SystemArgument2
+);
+
+VOID
+NTAPI
 PsInitialiseSuspendImplementation(VOID);
+
 NTSTATUS
 STDCALL
 PspExitProcess(PEPROCESS Process);
@@ -163,37 +299,52 @@
 STDCALL
 PspDeleteThread(PVOID ObjectBody);
 
-extern LONG PiNrThreadsAwaitingReaping;
 
 NTSTATUS
-PsInitWin32Thread (PETHREAD Thread);
+NTAPI
+PsInitWin32Thread(PETHREAD Thread);
 
 VOID
-PsTerminateWin32Process (PEPROCESS Process);
+NTAPI
+PsTerminateWin32Process(PEPROCESS Process);
 
 VOID
-PsTerminateWin32Thread (PETHREAD Thread);
+NTAPI
+PsTerminateWin32Thread(PETHREAD Thread);
 
 VOID
+NTAPI
 PsInitialiseW32Call(VOID);
 
 VOID
 STDCALL
-PspRunCreateThreadNotifyRoutines(PETHREAD, BOOLEAN);
+PspRunCreateThreadNotifyRoutines(
+    PETHREAD,
+    BOOLEAN
+);
 
 VOID
 STDCALL
-PspRunCreateProcessNotifyRoutines(PEPROCESS, BOOLEAN);
+PspRunCreateProcessNotifyRoutines(
+    PEPROCESS,
+    BOOLEAN
+);
 
 VOID
 STDCALL
 PspRunLegoRoutine(IN PKTHREAD Thread);
 
-VOID INIT_FUNCTION PsInitJobManagment(VOID);
+VOID
+NTAPI
+INIT_FUNCTION
+PsInitJobManagment(VOID);
 
 VOID
 STDCALL
-PspInheritQuota(PEPROCESS Process, PEPROCESS ParentProcess);
+PspInheritQuota(
+    PEPROCESS Process,
+    PEPROCESS ParentProcess
+);
 
 VOID
 STDCALL
@@ -214,17 +365,15 @@
 STDCALL
 PspGetSystemDllEntryPoints(VOID);
 
-/* CLIENT ID */
+NTSTATUS 
+NTAPI
+PsLockProcess(
+    PEPROCESS Process,
+    BOOLEAN Timeout
+);
 
-NTSTATUS PsLockProcess(PEPROCESS Process, BOOLEAN Timeout);
-VOID PsUnlockProcess(PEPROCESS Process);
+VOID
+NTAPI
+PsUnlockProcess(PEPROCESS Process);
 
-#define ETHREAD_TO_KTHREAD(pEThread) (&(pEThread)->Tcb)
-#define KTHREAD_TO_ETHREAD(pKThread) (CONTAINING_RECORD((pKThread), ETHREAD, Tcb))
-#define EPROCESS_TO_KPROCESS(pEProcess) (&(pEProcess)->Pcb)
-#define KPROCESS_TO_EPROCESS(pKProcess) (CONTAINING_RECORD((pKProcess), EPROCESS, Pcb))
-
-#define MAX_PROCESS_NOTIFY_ROUTINE_COUNT    8
-#define MAX_LOAD_IMAGE_NOTIFY_ROUTINE_COUNT  8
-
 #endif /* __INCLUDE_INTERNAL_PS_H */

Modified: trunk/reactos/ntoskrnl/include/internal/se.h
--- trunk/reactos/ntoskrnl/include/internal/se.h	2005-09-13 23:04:32 UTC (rev 17843)
+++ trunk/reactos/ntoskrnl/include/internal/se.h	2005-09-13 23:28:21 UTC (rev 17844)
@@ -83,114 +83,178 @@
 extern PSECURITY_DESCRIPTOR SeSystemDefaultSd;
 extern PSECURITY_DESCRIPTOR SeUnrestrictedSd;
 
-
 /* Functions */
+BOOLEAN
+NTAPI
+SeInit1(VOID);
 
-BOOLEAN SeInit1(VOID);
-BOOLEAN SeInit2(VOID);
-BOOLEAN SeInitSRM(VOID);
+BOOLEAN
+NTAPI
+SeInit2(VOID);
 
-VOID SepInitLuid(VOID);
-VOID SepInitPrivileges(VOID);
-BOOLEAN SepInitSecurityIDs(VOID);
-BOOLEAN SepInitDACLs(VOID);
-BOOLEAN SepInitSDs(VOID);
+BOOLEAN
+NTAPI
+SeInitSRM(VOID);
 
-VOID SeDeassignPrimaryToken(struct _EPROCESS *Process);
+VOID
+NTAPI
+SepInitLuid(VOID);
 
-NTSTATUS STDCALL
-SepCreateImpersonationTokenDacl(PTOKEN Token,
-                                PTOKEN PrimaryToken,
-                                PACL *Dacl);
+VOID
+NTAPI
+SepInitPrivileges(VOID);
 
-VOID SepInitializeTokenImplementation(VOID);
+BOOLEAN
+NTAPI
+SepInitSecurityIDs(VOID);
 
-PTOKEN STDCALL SepCreateSystemProcessToken(VOID);
+BOOLEAN
+NTAPI
+SepInitDACLs(VOID);
 
-NTSTATUS SeExchangePrimaryToken(struct _EPROCESS* Process,
-				PACCESS_TOKEN NewToken,
-				PACCESS_TOKEN* OldTokenP);
+BOOLEAN
+NTAPI
+SepInitSDs(VOID);
 
+VOID 
+NTAPI
+SeDeassignPrimaryToken(struct _EPROCESS *Process);
+
 NTSTATUS
-SeCaptureLuidAndAttributesArray(PLUID_AND_ATTRIBUTES Src,
-				ULONG PrivilegeCount,
-				KPROCESSOR_MODE PreviousMode,
-				PLUID_AND_ATTRIBUTES AllocatedMem,
-				ULONG AllocatedLength,
-				POOL_TYPE PoolType,
-				ULONG d,
-				PLUID_AND_ATTRIBUTES* Dest,
-				PULONG Length);
+STDCALL
+SepCreateImpersonationTokenDacl(
+    PTOKEN Token,
+    PTOKEN PrimaryToken,
+    PACL *Dacl
+);
 
 VOID
-SeReleaseLuidAndAttributesArray(PLUID_AND_ATTRIBUTES Privilege,
-				KPROCESSOR_MODE PreviousMode,
-				ULONG a);
+NTAPI
+SepInitializeTokenImplementation(VOID);
 
+PTOKEN
+STDCALL
+SepCreateSystemProcessToken(VOID);
+
+NTSTATUS
+NTAPI
+SeExchangePrimaryToken(
+    struct _EPROCESS* Process,
+    PACCESS_TOKEN NewToken,
+    PACCESS_TOKEN* OldTokenP
+);
+
+NTSTATUS
+NTAPI
+SeCaptureLuidAndAttributesArray(
+    PLUID_AND_ATTRIBUTES Src,
+    ULONG PrivilegeCount,
+    KPROCESSOR_MODE PreviousMode,
+    PLUID_AND_ATTRIBUTES AllocatedMem,
+    ULONG AllocatedLength,
+    POOL_TYPE PoolType,
+    ULONG d,
+    PLUID_AND_ATTRIBUTES* Dest,
+    PULONG Length
+);
+
+VOID
+NTAPI
+SeReleaseLuidAndAttributesArray(
+    PLUID_AND_ATTRIBUTES Privilege,
+    KPROCESSOR_MODE PreviousMode,
+    ULONG a
+);
+
 BOOLEAN
-SepPrivilegeCheck(PTOKEN Token,
-		  PLUID_AND_ATTRIBUTES Privileges,
-		  ULONG PrivilegeCount,
-		  ULONG PrivilegeControl,
-		  KPROCESSOR_MODE PreviousMode);
+NTAPI
+SepPrivilegeCheck(
+    PTOKEN Token,
+    PLUID_AND_ATTRIBUTES Privileges,
+    ULONG PrivilegeCount,
+    ULONG PrivilegeControl,
+    KPROCESSOR_MODE PreviousMode
+);
 
 NTSTATUS
 STDCALL
-SepDuplicateToken(PTOKEN Token,
-		  POBJECT_ATTRIBUTES ObjectAttributes,
-		  BOOLEAN EffectiveOnly,
-		  TOKEN_TYPE TokenType,
-		  SECURITY_IMPERSONATION_LEVEL Level,
-		  KPROCESSOR_MODE PreviousMode,
-		  PTOKEN* NewAccessToken);
+SepDuplicateToken(
+    PTOKEN Token,
+    POBJECT_ATTRIBUTES ObjectAttributes,
+    BOOLEAN EffectiveOnly,
+    TOKEN_TYPE TokenType,
+    SECURITY_IMPERSONATION_LEVEL Level,
+    KPROCESSOR_MODE PreviousMode,
+    PTOKEN* NewAccessToken
+);
 
 NTSTATUS
-SepCaptureSecurityQualityOfService(IN POBJECT_ATTRIBUTES ObjectAttributes  OPTIONAL,
-                                   IN KPROCESSOR_MODE AccessMode,
-                                   IN POOL_TYPE PoolType,
-                                   IN BOOLEAN CaptureIfKernel,
-                                   OUT PSECURITY_QUALITY_OF_SERVICE *CapturedSecurityQualityOfService,
-                                   OUT PBOOLEAN Present);
+NTAPI
+SepCaptureSecurityQualityOfService(
+    IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
+    IN KPROCESSOR_MODE AccessMode,
+    IN POOL_TYPE PoolType,
+    IN BOOLEAN CaptureIfKernel,
+    OUT PSECURITY_QUALITY_OF_SERVICE *CapturedSecurityQualityOfService,
+    OUT PBOOLEAN Present
+);
 
 VOID
-SepReleaseSecurityQualityOfService(IN PSECURITY_QUALITY_OF_SERVICE CapturedSecurityQualityOfService  OPTIONAL,
-                                   IN KPROCESSOR_MODE AccessMode,
-                                   IN BOOLEAN CaptureIfKernel);
+NTAPI
+SepReleaseSecurityQualityOfService(
+    IN PSECURITY_QUALITY_OF_SERVICE CapturedSecurityQualityOfService OPTIONAL,
+    IN KPROCESSOR_MODE AccessMode,
+    IN BOOLEAN CaptureIfKernel
+);
 
 NTSTATUS
-SepCaptureSid(IN PSID InputSid,
-              IN KPROCESSOR_MODE AccessMode,
-              IN POOL_TYPE PoolType,
-              IN BOOLEAN CaptureIfKernel,
-              OUT PSID *CapturedSid);
+NTAPI
+SepCaptureSid(
+    IN PSID InputSid,
+    IN KPROCESSOR_MODE AccessMode,
+    IN POOL_TYPE PoolType,
+    IN BOOLEAN CaptureIfKernel,
+    OUT PSID *CapturedSid
+);
 
 VOID
-SepReleaseSid(IN PSID CapturedSid,
-              IN KPROCESSOR_MODE AccessMode,
-              IN BOOLEAN CaptureIfKernel);
+NTAPI
+SepReleaseSid(
+    IN PSID CapturedSid,
+    IN KPROCESSOR_MODE AccessMode,
+    IN BOOLEAN CaptureIfKernel
+);
 
 NTSTATUS
-SepCaptureAcl(IN PACL InputAcl,
-              IN KPROCESSOR_MODE AccessMode,
-              IN POOL_TYPE PoolType,
-              IN BOOLEAN CaptureIfKernel,
-              OUT PACL *CapturedAcl);
+NTAPI
+SepCaptureAcl(
+    IN PACL InputAcl,
+    IN KPROCESSOR_MODE AccessMode,
+    IN POOL_TYPE PoolType,
+    IN BOOLEAN CaptureIfKernel,
+    OUT PACL *CapturedAcl
+);
 
 VOID
-SepReleaseAcl(IN PACL CapturedAcl,
-              IN KPROCESSOR_MODE AccessMode,
-              IN BOOLEAN CaptureIfKernel);
+NTAPI
+SepReleaseAcl(
+    IN PACL CapturedAcl,
+    IN KPROCESSOR_MODE AccessMode,
+    IN BOOLEAN CaptureIfKernel
+);
 
 NTSTATUS
 STDCALL
-SeDefaultObjectMethod(PVOID Object,
-                      SECURITY_OPERATION_CODE OperationType,                         
-                      SECURITY_INFORMATION SecurityInformation,
-                      PSECURITY_DESCRIPTOR NewSecurityDescriptor,
-                      PULONG ReturnLength,
-                      PSECURITY_DESCRIPTOR *OldSecurityDescriptor,
-                      POOL_TYPE PoolType,
-                      PGENERIC_MAPPING GenericMapping);
+SeDefaultObjectMethod(
+    PVOID Object,
+    SECURITY_OPERATION_CODE OperationType,
+    SECURITY_INFORMATION SecurityInformation,
+    PSECURITY_DESCRIPTOR NewSecurityDescriptor,
+    PULONG ReturnLength,
+    PSECURITY_DESCRIPTOR *OldSecurityDescriptor,
+    POOL_TYPE PoolType,
+    PGENERIC_MAPPING GenericMapping
+);
 
 #define SepAcquireTokenLockExclusive(Token)                                    \
   do {                                                                         \

Modified: trunk/reactos/ntoskrnl/include/internal/test.h
--- trunk/reactos/ntoskrnl/include/internal/test.h	2005-09-13 23:04:32 UTC (rev 17843)
+++ trunk/reactos/ntoskrnl/include/internal/test.h	2005-09-13 23:28:21 UTC (rev 17844)
@@ -1,48 +1,39 @@
 #ifndef __NTOSKRNL_INCLUDE_INTERNAL_TEST_H
 #define __NTOSKRNL_INCLUDE_INTERNAL_TEST_H
 
-typedef VOID STDCALL
+typedef VOID
+STDCALL
 PExFreePool(PVOID Block);
 
-typedef PMDL STDCALL
-PMmCreateMdl(PMDL Mdl,
-  PVOID Base,
-  ULONG Length);
+typedef PMDL
+STDCALL
+PMmCreateMdl(
+    PMDL Mdl,
+    PVOID Base,
+    ULONG Length
+);
 
-typedef VOID STDCALL
-PMmProbeAndLockPages(PMDL Mdl,
-  KPROCESSOR_MODE AccessMode,
-  LOCK_OPERATION Operation);
+typedef VOID
+STDCALL
+PMmProbeAndLockPages(
+    PMDL Mdl,
+    KPROCESSOR_MODE AccessMode,
+    LOCK_OPERATION Operation
+);
 
-typedef VOID FASTCALL
+typedef VOID
+FASTCALL
 PObDereferenceObject(PVOID Object);
 
-typedef NTSTATUS STDCALL
-PObReferenceObjectByHandle(HANDLE Handle,
-  ACCESS_MASK DesiredAccess,
-  POBJECT_TYPE ObjectType,
-  KPROCESSOR_MODE AccessMode,
-  PVOID* Object,
-  POBJECT_HANDLE_INFORMATION HandleInformation);
+typedef NTSTATUS
+STDCALL
+PObReferenceObjectByHandle(
+    HANDLE Handle,
+    ACCESS_MASK DesiredAccess,
+    POBJECT_TYPE ObjectType,
+    KPROCESSOR_MODE AccessMode,
+    PVOID* Object,
+    POBJECT_HANDLE_INFORMATION HandleInformation
+);
 
-
-NTSTATUS STDCALL
-MiLockVirtualMemory(HANDLE ProcessHandle,
-  PVOID BaseAddress,
-  ULONG NumberOfBytesToLock,
-  PULONG NumberOfBytesLocked,
-  PObReferenceObjectByHandle pObReferenceObjectByHandle,
-  PMmCreateMdl pMmCreateMdl,
-  PObDereferenceObject pObDereferenceObject,
-  PMmProbeAndLockPages pMmProbeAndLockPages,
-  PExFreePool pExFreePool);
-
-NTSTATUS FASTCALL
-MiQueryVirtualMemory (IN HANDLE ProcessHandle,
-                      IN PVOID Address,
-                      IN CINT VirtualMemoryInformationClass,
-                      OUT PVOID VirtualMemoryInformation,
-                      IN ULONG Length,
-                      OUT PULONG ResultLength);
-
 #endif /* __NTOSKRNL_INCLUDE_INTERNAL_TEST_H */

Modified: trunk/reactos/ntoskrnl/include/internal/v86m.h
--- trunk/reactos/ntoskrnl/include/internal/v86m.h	2005-09-13 23:04:32 UTC (rev 17843)
+++ trunk/reactos/ntoskrnl/include/internal/v86m.h	2005-09-13 23:28:21 UTC (rev 17844)
@@ -10,73 +10,6 @@
 #ifndef __NTOSKRNL_INCLUDE_INTERNAL_V86M_H
 #define __NTOSKRNL_INCLUDE_INTERNAL_V86M_H
 
-/* 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;
[truncated at 1000 lines; 571 more skipped]