Part 1 of <many> ntoskrnl header cleanups

svn path=/trunk/; revision=17844
This commit is contained in:
Alex Ionescu 2005-09-13 23:28:21 +00:00
parent 10f2fdca23
commit 11272023e5
27 changed files with 644 additions and 361 deletions

View file

@ -147,6 +147,13 @@ typedef enum _KTHREAD_STATE
DeferredReady, DeferredReady,
} KTHREAD_STATE, *PKTHREAD_STATE; } KTHREAD_STATE, *PKTHREAD_STATE;
typedef enum _KPROCESS_STATE
{
ProcessInMemory,
ProcessOutOfMemory,
ProcessInTransition,
} KPROCESS_STATE, *PKPROCESS_STATE;
/* FUNCTION TYPES ************************************************************/ /* FUNCTION TYPES ************************************************************/
#ifdef NTOS_MODE_USER #ifdef NTOS_MODE_USER

View file

@ -56,6 +56,11 @@ extern NTSYSAPI POBJECT_TYPE PsProcessType;
#define PROCESS_PRIORITY_CLASS_BELOW_NORMAL 5 #define PROCESS_PRIORITY_CLASS_BELOW_NORMAL 5
#define PROCESS_PRIORITY_CLASS_ABOVE_NORMAL 6 #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 */ /* Global Flags */
#define FLG_STOP_ON_EXCEPTION 0x00000001 #define FLG_STOP_ON_EXCEPTION 0x00000001
#define FLG_SHOW_LDR_SNAPS 0x00000002 #define FLG_SHOW_LDR_SNAPS 0x00000002

View file

@ -200,6 +200,7 @@ NTSTATUS
ExpSetTimeZoneInformation(PTIME_ZONE_INFORMATION TimeZoneInformation); ExpSetTimeZoneInformation(PTIME_ZONE_INFORMATION TimeZoneInformation);
NTSTATUS NTSTATUS
NTAPI
ExpAllocateLocallyUniqueId(OUT LUID *LocallyUniqueId); ExpAllocateLocallyUniqueId(OUT LUID *LocallyUniqueId);
VOID VOID

View file

@ -416,6 +416,75 @@ KeRosGetStackFrames(
VOID VOID
KiSetSystemTime(PLARGE_INTEGER NewSystemTime); 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 #define MAXIMUM_PROCESSORS 32
#endif /* __NTOSKRNL_INCLUDE_INTERNAL_KE_H */ #endif /* __NTOSKRNL_INCLUDE_INTERNAL_KE_H */

View file

@ -888,4 +888,13 @@ VOID MiStartPagerThread(VOID);
VOID MiStopPagerThread(VOID); 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 #endif

View file

@ -10,105 +10,6 @@ struct _EJOB;
extern LCID PsDefaultThreadLocaleId; extern LCID PsDefaultThreadLocaleId;
extern LCID PsDefaultSystemLocaleId; extern LCID PsDefaultSystemLocaleId;
/* 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 PROCESS_STATE_TERMINATED (1)
#define PROCESS_STATE_ACTIVE (2)
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);
NTSTATUS
PsInitializeThread(PEPROCESS Process,
PETHREAD* ThreadPtr,
POBJECT_ATTRIBUTES ObjectAttributes,
KPROCESSOR_MODE AccessMode,
BOOLEAN First);
PACCESS_TOKEN STDCALL PsReferenceEffectiveToken(PETHREAD Thread,
PTOKEN_TYPE TokenType,
PUCHAR b,
PSECURITY_IMPERSONATION_LEVEL Level);
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);
NTSTATUS
STDCALL
PspAssignPrimaryToken(PEPROCESS Process,
HANDLE TokenHandle);
VOID STDCALL PsExitSpecialApc(PKAPC Apc,
PKNORMAL_ROUTINE *NormalRoutine,
PVOID *NormalContext,
PVOID *SystemArgument1,
PVOID *SystemArgument2);
NTSTATUS
STDCALL
PspInitializeProcessSecurity(PEPROCESS Process,
PEPROCESS Parent OPTIONAL);
VOID
STDCALL
PspSystemThreadStartup(PKSTART_ROUTINE StartRoutine,
PVOID StartContext);
NTSTATUS
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
VOID STDCALL PiDeleteProcess(PVOID ObjectBody);
VOID
STDCALL
PspReapRoutine(PVOID Context);
VOID
STDCALL
PspExitThread(NTSTATUS ExitStatus);
extern LIST_ENTRY PspReaperListHead; extern LIST_ENTRY PspReaperListHead;
extern WORK_QUEUE_ITEM PspReaperWorkItem; extern WORK_QUEUE_ITEM PspReaperWorkItem;
extern BOOLEAN PspReaping; extern BOOLEAN PspReaping;
@ -119,38 +20,273 @@ extern FAST_MUTEX PspActiveProcessMutex;
extern LARGE_INTEGER ShortPsLockDelay, PsLockTimeout; extern LARGE_INTEGER ShortPsLockDelay, PsLockTimeout;
extern EPROCESS_QUOTA_BLOCK PspDefaultQuotaBlock; 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 MAX_PROCESS_NOTIFY_ROUTINE_COUNT 8
#define MAX_LOAD_IMAGE_NOTIFY_ROUTINE_COUNT 8
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
STDCALL
PiTerminateProcess(
PEPROCESS Process,
NTSTATUS ExitStatus
);
VOID
NTAPI
PiInitApcManagement(VOID);
VOID VOID
STDCALL STDCALL
PspTerminateThreadByPointer(PETHREAD Thread, PiDeleteThread(PVOID ObjectBody);
NTSTATUS ExitStatus);
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 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
PsReferenceEffectiveToken(
PETHREAD Thread,
PTOKEN_TYPE TokenType,
PUCHAR b,
PSECURITY_IMPERSONATION_LEVEL Level
);
NTSTATUS
STDCALL
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
PsExitSpecialApc(
PKAPC Apc,
PKNORMAL_ROUTINE *NormalRoutine,
PVOID *NormalContext,
PVOID *SystemArgument1,
PVOID *SystemArgument2
);
NTSTATUS
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
);
VOID
STDCALL
PiDeleteProcess(PVOID ObjectBody);
VOID
STDCALL
PspReapRoutine(PVOID Context);
VOID
STDCALL
PspExitThread(NTSTATUS ExitStatus);
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
PsGetNextProcess(PEPROCESS OldProcess);
VOID
NTAPI
PsApplicationProcessorInit(VOID); PsApplicationProcessorInit(VOID);
VOID VOID
NTAPI
PsPrepareForApplicationProcessorInit(ULONG Id); PsPrepareForApplicationProcessorInit(ULONG Id);
VOID STDCALL
VOID
STDCALL
PsIdleThreadMain(PVOID Context); PsIdleThreadMain(PVOID Context);
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 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
NTAPI
PsInitialiseSuspendImplementation(VOID); PsInitialiseSuspendImplementation(VOID);
NTSTATUS NTSTATUS
STDCALL STDCALL
PspExitProcess(PEPROCESS Process); PspExitProcess(PEPROCESS Process);
@ -163,37 +299,52 @@ VOID
STDCALL STDCALL
PspDeleteThread(PVOID ObjectBody); PspDeleteThread(PVOID ObjectBody);
extern LONG PiNrThreadsAwaitingReaping;
NTSTATUS NTSTATUS
PsInitWin32Thread (PETHREAD Thread); NTAPI
PsInitWin32Thread(PETHREAD Thread);
VOID VOID
PsTerminateWin32Process (PEPROCESS Process); NTAPI
PsTerminateWin32Process(PEPROCESS Process);
VOID VOID
PsTerminateWin32Thread (PETHREAD Thread); NTAPI
PsTerminateWin32Thread(PETHREAD Thread);
VOID VOID
NTAPI
PsInitialiseW32Call(VOID); PsInitialiseW32Call(VOID);
VOID VOID
STDCALL STDCALL
PspRunCreateThreadNotifyRoutines(PETHREAD, BOOLEAN); PspRunCreateThreadNotifyRoutines(
PETHREAD,
BOOLEAN
);
VOID VOID
STDCALL STDCALL
PspRunCreateProcessNotifyRoutines(PEPROCESS, BOOLEAN); PspRunCreateProcessNotifyRoutines(
PEPROCESS,
BOOLEAN
);
VOID VOID
STDCALL STDCALL
PspRunLegoRoutine(IN PKTHREAD Thread); PspRunLegoRoutine(IN PKTHREAD Thread);
VOID INIT_FUNCTION PsInitJobManagment(VOID); VOID
NTAPI
INIT_FUNCTION
PsInitJobManagment(VOID);
VOID VOID
STDCALL STDCALL
PspInheritQuota(PEPROCESS Process, PEPROCESS ParentProcess); PspInheritQuota(
PEPROCESS Process,
PEPROCESS ParentProcess
);
VOID VOID
STDCALL STDCALL
@ -214,17 +365,15 @@ NTSTATUS
STDCALL STDCALL
PspGetSystemDllEntryPoints(VOID); PspGetSystemDllEntryPoints(VOID);
/* CLIENT ID */ NTSTATUS
NTAPI
PsLockProcess(
PEPROCESS Process,
BOOLEAN Timeout
);
NTSTATUS PsLockProcess(PEPROCESS Process, BOOLEAN Timeout); VOID
VOID PsUnlockProcess(PEPROCESS Process); 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 */ #endif /* __INCLUDE_INTERNAL_PS_H */

View file

@ -83,114 +83,178 @@ extern PSECURITY_DESCRIPTOR SePublicOpenUnrestrictedSd;
extern PSECURITY_DESCRIPTOR SeSystemDefaultSd; extern PSECURITY_DESCRIPTOR SeSystemDefaultSd;
extern PSECURITY_DESCRIPTOR SeUnrestrictedSd; extern PSECURITY_DESCRIPTOR SeUnrestrictedSd;
/* Functions */ /* Functions */
BOOLEAN
BOOLEAN SeInit1(VOID); NTAPI
BOOLEAN SeInit2(VOID); SeInit1(VOID);
BOOLEAN SeInitSRM(VOID);
VOID SepInitLuid(VOID);
VOID SepInitPrivileges(VOID);
BOOLEAN SepInitSecurityIDs(VOID);
BOOLEAN SepInitDACLs(VOID);
BOOLEAN SepInitSDs(VOID);
VOID SeDeassignPrimaryToken(struct _EPROCESS *Process);
NTSTATUS STDCALL
SepCreateImpersonationTokenDacl(PTOKEN Token,
PTOKEN PrimaryToken,
PACL *Dacl);
VOID SepInitializeTokenImplementation(VOID);
PTOKEN STDCALL SepCreateSystemProcessToken(VOID);
NTSTATUS SeExchangePrimaryToken(struct _EPROCESS* Process,
PACCESS_TOKEN NewToken,
PACCESS_TOKEN* OldTokenP);
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);
VOID
SeReleaseLuidAndAttributesArray(PLUID_AND_ATTRIBUTES Privilege,
KPROCESSOR_MODE PreviousMode,
ULONG a);
BOOLEAN BOOLEAN
SepPrivilegeCheck(PTOKEN Token, NTAPI
PLUID_AND_ATTRIBUTES Privileges, SeInit2(VOID);
ULONG PrivilegeCount,
ULONG PrivilegeControl, BOOLEAN
KPROCESSOR_MODE PreviousMode); NTAPI
SeInitSRM(VOID);
VOID
NTAPI
SepInitLuid(VOID);
VOID
NTAPI
SepInitPrivileges(VOID);
BOOLEAN
NTAPI
SepInitSecurityIDs(VOID);
BOOLEAN
NTAPI
SepInitDACLs(VOID);
BOOLEAN
NTAPI
SepInitSDs(VOID);
VOID
NTAPI
SeDeassignPrimaryToken(struct _EPROCESS *Process);
NTSTATUS NTSTATUS
STDCALL STDCALL
SepDuplicateToken(PTOKEN Token, SepCreateImpersonationTokenDacl(
POBJECT_ATTRIBUTES ObjectAttributes, PTOKEN Token,
BOOLEAN EffectiveOnly, PTOKEN PrimaryToken,
TOKEN_TYPE TokenType, PACL *Dacl
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);
VOID VOID
SepReleaseSecurityQualityOfService(IN PSECURITY_QUALITY_OF_SERVICE CapturedSecurityQualityOfService OPTIONAL, NTAPI
IN KPROCESSOR_MODE AccessMode, SepInitializeTokenImplementation(VOID);
IN BOOLEAN CaptureIfKernel);
PTOKEN
STDCALL
SepCreateSystemProcessToken(VOID);
NTSTATUS NTSTATUS
SepCaptureSid(IN PSID InputSid, NTAPI
IN KPROCESSOR_MODE AccessMode, SeExchangePrimaryToken(
IN POOL_TYPE PoolType, struct _EPROCESS* Process,
IN BOOLEAN CaptureIfKernel, PACCESS_TOKEN NewToken,
OUT PSID *CapturedSid); PACCESS_TOKEN* OldTokenP
);
VOID
SepReleaseSid(IN PSID CapturedSid,
IN KPROCESSOR_MODE AccessMode,
IN BOOLEAN CaptureIfKernel);
NTSTATUS NTSTATUS
SepCaptureAcl(IN PACL InputAcl, NTAPI
IN KPROCESSOR_MODE AccessMode, SeCaptureLuidAndAttributesArray(
IN POOL_TYPE PoolType, PLUID_AND_ATTRIBUTES Src,
IN BOOLEAN CaptureIfKernel, ULONG PrivilegeCount,
OUT PACL *CapturedAcl); KPROCESSOR_MODE PreviousMode,
PLUID_AND_ATTRIBUTES AllocatedMem,
ULONG AllocatedLength,
POOL_TYPE PoolType,
ULONG d,
PLUID_AND_ATTRIBUTES* Dest,
PULONG Length
);
VOID VOID
SepReleaseAcl(IN PACL CapturedAcl, NTAPI
IN KPROCESSOR_MODE AccessMode, SeReleaseLuidAndAttributesArray(
IN BOOLEAN CaptureIfKernel); PLUID_AND_ATTRIBUTES Privilege,
KPROCESSOR_MODE PreviousMode,
ULONG a
);
BOOLEAN
NTAPI
SepPrivilegeCheck(
PTOKEN Token,
PLUID_AND_ATTRIBUTES Privileges,
ULONG PrivilegeCount,
ULONG PrivilegeControl,
KPROCESSOR_MODE PreviousMode
);
NTSTATUS NTSTATUS
STDCALL STDCALL
SeDefaultObjectMethod(PVOID Object, SepDuplicateToken(
SECURITY_OPERATION_CODE OperationType, PTOKEN Token,
SECURITY_INFORMATION SecurityInformation, POBJECT_ATTRIBUTES ObjectAttributes,
PSECURITY_DESCRIPTOR NewSecurityDescriptor, BOOLEAN EffectiveOnly,
PULONG ReturnLength, TOKEN_TYPE TokenType,
PSECURITY_DESCRIPTOR *OldSecurityDescriptor, SECURITY_IMPERSONATION_LEVEL Level,
POOL_TYPE PoolType, KPROCESSOR_MODE PreviousMode,
PGENERIC_MAPPING GenericMapping); PTOKEN* NewAccessToken
);
NTSTATUS
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
NTAPI
SepReleaseSecurityQualityOfService(
IN PSECURITY_QUALITY_OF_SERVICE CapturedSecurityQualityOfService OPTIONAL,
IN KPROCESSOR_MODE AccessMode,
IN BOOLEAN CaptureIfKernel
);
NTSTATUS
NTAPI
SepCaptureSid(
IN PSID InputSid,
IN KPROCESSOR_MODE AccessMode,
IN POOL_TYPE PoolType,
IN BOOLEAN CaptureIfKernel,
OUT PSID *CapturedSid
);
VOID
NTAPI
SepReleaseSid(
IN PSID CapturedSid,
IN KPROCESSOR_MODE AccessMode,
IN BOOLEAN CaptureIfKernel
);
NTSTATUS
NTAPI
SepCaptureAcl(
IN PACL InputAcl,
IN KPROCESSOR_MODE AccessMode,
IN POOL_TYPE PoolType,
IN BOOLEAN CaptureIfKernel,
OUT PACL *CapturedAcl
);
VOID
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
);
#define SepAcquireTokenLockExclusive(Token) \ #define SepAcquireTokenLockExclusive(Token) \
do { \ do { \

View file

@ -1,48 +1,39 @@
#ifndef __NTOSKRNL_INCLUDE_INTERNAL_TEST_H #ifndef __NTOSKRNL_INCLUDE_INTERNAL_TEST_H
#define __NTOSKRNL_INCLUDE_INTERNAL_TEST_H #define __NTOSKRNL_INCLUDE_INTERNAL_TEST_H
typedef VOID STDCALL typedef VOID
STDCALL
PExFreePool(PVOID Block); PExFreePool(PVOID Block);
typedef PMDL STDCALL typedef PMDL
PMmCreateMdl(PMDL Mdl, STDCALL
PVOID Base, PMmCreateMdl(
ULONG Length); PMDL Mdl,
PVOID Base,
ULONG Length
);
typedef VOID STDCALL typedef VOID
PMmProbeAndLockPages(PMDL Mdl, STDCALL
KPROCESSOR_MODE AccessMode, PMmProbeAndLockPages(
LOCK_OPERATION Operation); PMDL Mdl,
KPROCESSOR_MODE AccessMode,
LOCK_OPERATION Operation
);
typedef VOID FASTCALL typedef VOID
FASTCALL
PObDereferenceObject(PVOID Object); PObDereferenceObject(PVOID Object);
typedef NTSTATUS STDCALL typedef NTSTATUS
PObReferenceObjectByHandle(HANDLE Handle, STDCALL
ACCESS_MASK DesiredAccess, PObReferenceObjectByHandle(
POBJECT_TYPE ObjectType, HANDLE Handle,
KPROCESSOR_MODE AccessMode, ACCESS_MASK DesiredAccess,
PVOID* Object, POBJECT_TYPE ObjectType,
POBJECT_HANDLE_INFORMATION HandleInformation); 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 */ #endif /* __NTOSKRNL_INCLUDE_INTERNAL_TEST_H */

View file

@ -10,73 +10,6 @@
#ifndef __NTOSKRNL_INCLUDE_INTERNAL_V86M_H #ifndef __NTOSKRNL_INCLUDE_INTERNAL_V86M_H
#define __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;
} 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
);
#endif /* __NTOSKRNL_INCLUDE_INTERNAL_V86M_H */ #endif /* __NTOSKRNL_INCLUDE_INTERNAL_V86M_H */

View file

@ -194,7 +194,7 @@ KdbpOverwriteInstruction(
/* Attach to the process */ /* Attach to the process */
if (CurrentProcess != Process) if (CurrentProcess != Process)
{ {
KeStackAttachProcess(EPROCESS_TO_KPROCESS(Process), &ApcState); KeStackAttachProcess(&Process->Pcb, &ApcState);
} }
/* Make the page writeable if it is read only. */ /* Make the page writeable if it is read only. */
@ -1066,7 +1066,7 @@ KdbpAttachToThread(
} }
if (KdbOriginalProcess != Process) if (KdbOriginalProcess != Process)
{ {
KeStackAttachProcess(EPROCESS_TO_KPROCESS(Process), &KdbApcState); KeStackAttachProcess(&Process->Pcb, &KdbApcState);
} }
KdbCurrentProcess = Process; KdbCurrentProcess = Process;
} }

View file

@ -1080,8 +1080,8 @@ KdbpCmdProc(ULONG Argc, PCHAR Argv[])
str2 = ""; str2 = "";
} }
State = ((Process->Pcb.State == PROCESS_STATE_TERMINATED) ? "Terminated" : State = ((Process->Pcb.State == ProcessInMemory) ? "In Memory" :
((Process->Pcb.State == PROCESS_STATE_ACTIVE) ? "Active" : "Unknown")); ((Process->Pcb.State == ProcessOutOfMemory) ? "Out of Memory" : "In Transition"));
KdbpPrint(" %s0x%08x %-10s %s%s\n", KdbpPrint(" %s0x%08x %-10s %s%s\n",
str1, str1,
@ -1134,8 +1134,8 @@ KdbpCmdProc(ULONG Argc, PCHAR Argv[])
} }
} }
State = ((Process->Pcb.State == PROCESS_STATE_TERMINATED) ? "Terminated" : State = ((Process->Pcb.State == ProcessInMemory) ? "In Memory" :
((Process->Pcb.State == PROCESS_STATE_ACTIVE) ? "Active" : "Unknown")); ((Process->Pcb.State == ProcessOutOfMemory) ? "Out of Memory" : "In Transition"));
KdbpPrint("%s" KdbpPrint("%s"
" PID: 0x%08x\n" " PID: 0x%08x\n"
" State: %s (0x%x)\n" " State: %s (0x%x)\n"

View file

@ -527,7 +527,7 @@ KdbSymFreeProcessSymbols(IN PEPROCESS Process)
CurrentProcess = PsGetCurrentProcess(); CurrentProcess = PsGetCurrentProcess();
if (CurrentProcess != Process) if (CurrentProcess != Process)
{ {
KeAttachProcess(EPROCESS_TO_KPROCESS(Process)); KeAttachProcess(&Process->Pcb);
} }
Peb = Process->Peb; Peb = Process->Peb;
ASSERT(Peb); ASSERT(Peb);

View file

@ -85,7 +85,7 @@ KeInitializeProcess(PKPROCESS Process,
Process->DirectoryTableBase = DirectoryTableBase; Process->DirectoryTableBase = DirectoryTableBase;
Process->AutoAlignment = TRUE; Process->AutoAlignment = TRUE;
Process->IopmOffset = 0xFFFF; Process->IopmOffset = 0xFFFF;
Process->State = PROCESS_STATE_ACTIVE; Process->State = ProcessInMemory;
/* Initialize the Thread List */ /* Initialize the Thread List */
InitializeListHead(&Process->ThreadListHead); InitializeListHead(&Process->ThreadListHead);

View file

@ -46,7 +46,9 @@ typedef struct
KSPIN_LOCK CallbackStackListLock; KSPIN_LOCK CallbackStackListLock;
static LIST_ENTRY CallbackStackListHead; static LIST_ENTRY CallbackStackListHead;
VOID INIT_FUNCTION VOID
INIT_FUNCTION
NTAPI
PsInitialiseW32Call(VOID) PsInitialiseW32Call(VOID)
{ {
InitializeListHead(&CallbackStackListHead); InitializeListHead(&CallbackStackListHead);
@ -227,7 +229,7 @@ KeUserModeCallback(IN ULONG RoutineIndex,
SavedState.SavedCallbackStack = Thread->Tcb.CallbackStack; SavedState.SavedCallbackStack = Thread->Tcb.CallbackStack;
SavedState.SavedExceptionStack = (PVOID)KeGetCurrentKPCR()->TSS->Esp0; SavedState.SavedExceptionStack = (PVOID)KeGetCurrentKPCR()->TSS->Esp0;
if ((Thread->Tcb.NpxState & NPX_STATE_VALID) && if ((Thread->Tcb.NpxState & NPX_STATE_VALID) &&
ETHREAD_TO_KTHREAD(Thread) != KeGetCurrentPrcb()->NpxThread) &Thread->Tcb != KeGetCurrentPrcb()->NpxThread)
{ {
RtlCopyMemory((char*)NewStack + StackSize - sizeof(FX_SAVE_AREA), RtlCopyMemory((char*)NewStack + StackSize - sizeof(FX_SAVE_AREA),
(char*)SavedState.SavedInitialStack - sizeof(FX_SAVE_AREA), (char*)SavedState.SavedInitialStack - sizeof(FX_SAVE_AREA),

View file

@ -51,6 +51,7 @@ PsIdleThreadMain(PVOID Context)
* creation until I can merge my fix for properly creating them. * creation until I can merge my fix for properly creating them.
*/ */
NTSTATUS NTSTATUS
NTAPI
PsInitializeIdleOrFirstThread(PEPROCESS Process, PsInitializeIdleOrFirstThread(PEPROCESS Process,
PETHREAD* ThreadPtr, PETHREAD* ThreadPtr,
PKSTART_ROUTINE StartRoutine, PKSTART_ROUTINE StartRoutine,
@ -93,6 +94,7 @@ PsInitializeIdleOrFirstThread(PEPROCESS Process,
*/ */
VOID VOID
INIT_FUNCTION INIT_FUNCTION
NTAPI
PsInitIdleThread(VOID) PsInitIdleThread(VOID)
{ {
PETHREAD IdleThread; PETHREAD IdleThread;

View file

@ -57,6 +57,7 @@ PiDeleteJob ( PVOID ObjectBody )
VOID VOID
INIT_FUNCTION INIT_FUNCTION
NTAPI
PsInitJobManagment ( VOID ) PsInitJobManagment ( VOID )
{ {
UNICODE_STRING Name; UNICODE_STRING Name;
@ -81,6 +82,7 @@ PsInitJobManagment ( VOID )
} }
NTSTATUS NTSTATUS
NTAPI
PspAssignProcessToJob ( PspAssignProcessToJob (
PEPROCESS Process, PEPROCESS Process,
PEJOB Job) PEJOB Job)
@ -90,6 +92,7 @@ PspAssignProcessToJob (
} }
NTSTATUS NTSTATUS
NTAPI
PspTerminateJobObject ( PspTerminateJobObject (
PEJOB Job, PEJOB Job,
KPROCESSOR_MODE AccessMode, KPROCESSOR_MODE AccessMode,

View file

@ -40,7 +40,9 @@ static LANGID PsInstallUILanguageId = 0;
* Returns: * Returns:
* None. * None.
*/ */
VOID INIT_FUNCTION VOID
INIT_FUNCTION
NTAPI
PiInitDefaultLocale(VOID) PiInitDefaultLocale(VOID)
{ {
OBJECT_ATTRIBUTES ObjectAttributes; OBJECT_ATTRIBUTES ObjectAttributes;

View file

@ -30,6 +30,7 @@ LARGE_INTEGER ShortPsLockDelay, PsLockTimeout;
/* INTERNAL FUNCTIONS *****************************************************************/ /* INTERNAL FUNCTIONS *****************************************************************/
NTSTATUS NTSTATUS
NTAPI
PsLockProcess(PEPROCESS Process, BOOLEAN Timeout) PsLockProcess(PEPROCESS Process, BOOLEAN Timeout)
{ {
ULONG Attempts = 0; ULONG Attempts = 0;
@ -88,6 +89,7 @@ PsLockProcess(PEPROCESS Process, BOOLEAN Timeout)
} }
VOID VOID
NTAPI
PsUnlockProcess(PEPROCESS Process) PsUnlockProcess(PEPROCESS Process)
{ {
PAGED_CODE(); PAGED_CODE();
@ -331,7 +333,7 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
/* Now initialize the Kernel Process */ /* Now initialize the Kernel Process */
DPRINT("Initialzing Kernel Process\n"); DPRINT("Initialzing Kernel Process\n");
KeInitializeProcess(&Process->Pcb, KeInitializeProcess(&Process->Pcb,
PROCESS_PRIO_NORMAL, PROCESS_PRIORITY_NORMAL,
Affinity, Affinity,
DirectoryTableBase); DirectoryTableBase);

View file

@ -49,14 +49,18 @@ VOID STDCALL PspKillMostProcesses();
/* FUNCTIONS ***************************************************************/ /* FUNCTIONS ***************************************************************/
VOID PiShutdownProcessManager(VOID) VOID
NTAPI
PiShutdownProcessManager(VOID)
{ {
DPRINT("PiShutdownProcessManager()\n"); DPRINT("PiShutdownProcessManager()\n");
PspKillMostProcesses(); PspKillMostProcesses();
} }
VOID INIT_FUNCTION VOID
INIT_FUNCTION
NTAPI
PiInitProcessManager(VOID) PiInitProcessManager(VOID)
{ {
PsInitJobManagment(); PsInitJobManagment();
@ -68,6 +72,7 @@ PiInitProcessManager(VOID)
VOID VOID
INIT_FUNCTION INIT_FUNCTION
NTAPI
PsInitClientIDManagment(VOID) PsInitClientIDManagment(VOID)
{ {
PspCidTable = ExCreateHandleTable(NULL); PspCidTable = ExCreateHandleTable(NULL);
@ -76,6 +81,7 @@ PsInitClientIDManagment(VOID)
VOID VOID
INIT_FUNCTION INIT_FUNCTION
NTAPI
PsInitThreadManagment(VOID) PsInitThreadManagment(VOID)
/* /*
* FUNCTION: Initialize thread managment * FUNCTION: Initialize thread managment
@ -118,6 +124,7 @@ PsInitThreadManagment(VOID)
VOID VOID
INIT_FUNCTION INIT_FUNCTION
NTAPI
PsInitProcessManagment(VOID) PsInitProcessManagment(VOID)
{ {
PKPROCESS KProcess; PKPROCESS KProcess;
@ -179,7 +186,7 @@ PsInitProcessManagment(VOID)
PsIdleProcess->Pcb.Affinity = 0xFFFFFFFF; PsIdleProcess->Pcb.Affinity = 0xFFFFFFFF;
PsIdleProcess->Pcb.IopmOffset = 0xffff; PsIdleProcess->Pcb.IopmOffset = 0xffff;
PsIdleProcess->Pcb.BasePriority = PROCESS_PRIO_IDLE; PsIdleProcess->Pcb.BasePriority = PROCESS_PRIORITY_IDLE;
PsIdleProcess->Pcb.QuantumReset = 6; PsIdleProcess->Pcb.QuantumReset = 6;
InitializeListHead(&PsIdleProcess->Pcb.ThreadListHead); InitializeListHead(&PsIdleProcess->Pcb.ThreadListHead);
InitializeListHead(&PsIdleProcess->ThreadListHead); InitializeListHead(&PsIdleProcess->ThreadListHead);
@ -215,7 +222,7 @@ PsInitProcessManagment(VOID)
RtlZeroMemory(PsInitialSystemProcess, sizeof(EPROCESS)); RtlZeroMemory(PsInitialSystemProcess, sizeof(EPROCESS));
PsInitialSystemProcess->Pcb.Affinity = KeActiveProcessors; PsInitialSystemProcess->Pcb.Affinity = KeActiveProcessors;
PsInitialSystemProcess->Pcb.IopmOffset = 0xffff; PsInitialSystemProcess->Pcb.IopmOffset = 0xffff;
PsInitialSystemProcess->Pcb.BasePriority = PROCESS_PRIO_NORMAL; PsInitialSystemProcess->Pcb.BasePriority = PROCESS_PRIORITY_NORMAL;
PsInitialSystemProcess->Pcb.QuantumReset = 6; PsInitialSystemProcess->Pcb.QuantumReset = 6;
InitializeListHead(&PsInitialSystemProcess->Pcb.ThreadListHead); InitializeListHead(&PsInitialSystemProcess->Pcb.ThreadListHead);
KeInitializeDispatcherHeader(&PsInitialSystemProcess->Pcb.Header, KeInitializeDispatcherHeader(&PsInitialSystemProcess->Pcb.Header,

View file

@ -61,6 +61,7 @@ PsEstablishWin32Callouts(PW32_CALLOUT_DATA CalloutData)
} }
NTSTATUS NTSTATUS
NTAPI
PsInitWin32Thread (PETHREAD Thread) PsInitWin32Thread (PETHREAD Thread)
{ {
PEPROCESS Process; PEPROCESS Process;
@ -89,6 +90,7 @@ PsInitWin32Thread (PETHREAD Thread)
VOID VOID
NTAPI
PsTerminateWin32Process (PEPROCESS Process) PsTerminateWin32Process (PEPROCESS Process)
{ {
if (Process->Win32Process == NULL) if (Process->Win32Process == NULL)
@ -105,6 +107,7 @@ PsTerminateWin32Process (PEPROCESS Process)
VOID VOID
NTAPI
PsTerminateWin32Thread (PETHREAD Thread) PsTerminateWin32Thread (PETHREAD Thread)
{ {
if (Thread->Tcb.Win32Thread != NULL) if (Thread->Tcb.Win32Thread != NULL)
@ -278,7 +281,7 @@ NtCallbackReturn (PVOID Result,
*/ */
KeRaiseIrql(HIGH_LEVEL, &oldIrql); KeRaiseIrql(HIGH_LEVEL, &oldIrql);
if ((Thread->Tcb.NpxState & NPX_STATE_VALID) && if ((Thread->Tcb.NpxState & NPX_STATE_VALID) &&
ETHREAD_TO_KTHREAD(Thread) != KeGetCurrentPrcb()->NpxThread) &Thread->Tcb != KeGetCurrentPrcb()->NpxThread)
{ {
RtlCopyMemory((char*)InitialStack - sizeof(FX_SAVE_AREA), RtlCopyMemory((char*)InitialStack - sizeof(FX_SAVE_AREA),
(char*)Thread->Tcb.InitialStack - sizeof(FX_SAVE_AREA), (char*)Thread->Tcb.InitialStack - sizeof(FX_SAVE_AREA),

View file

@ -26,7 +26,9 @@ PACL SeUnrestrictedDacl = NULL;
/* FUNCTIONS ****************************************************************/ /* FUNCTIONS ****************************************************************/
BOOLEAN INIT_FUNCTION BOOLEAN
INIT_FUNCTION
NTAPI
SepInitDACLs(VOID) SepInitDACLs(VOID)
{ {
ULONG AclLength; ULONG AclLength;
@ -261,6 +263,7 @@ SepCreateImpersonationTokenDacl(PTOKEN Token,
} }
NTSTATUS NTSTATUS
NTAPI
SepCaptureAcl(IN PACL InputAcl, SepCaptureAcl(IN PACL InputAcl,
IN KPROCESSOR_MODE AccessMode, IN KPROCESSOR_MODE AccessMode,
IN POOL_TYPE PoolType, IN POOL_TYPE PoolType,
@ -347,6 +350,7 @@ SepCaptureAcl(IN PACL InputAcl,
} }
VOID VOID
NTAPI
SepReleaseAcl(IN PACL CapturedAcl, SepReleaseAcl(IN PACL CapturedAcl,
IN KPROCESSOR_MODE AccessMode, IN KPROCESSOR_MODE AccessMode,
IN BOOLEAN CaptureIfKernel) IN BOOLEAN CaptureIfKernel)

View file

@ -20,7 +20,9 @@ static LARGE_INTEGER LuidValue;
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
VOID INIT_FUNCTION VOID
INIT_FUNCTION
NTAPI
SepInitLuid(VOID) SepInitLuid(VOID)
{ {
LUID DummyLuidValue = SYSTEM_LUID; LUID DummyLuidValue = SYSTEM_LUID;
@ -32,6 +34,7 @@ SepInitLuid(VOID)
NTSTATUS NTSTATUS
NTAPI
ExpAllocateLocallyUniqueId(OUT LUID *LocallyUniqueId) ExpAllocateLocallyUniqueId(OUT LUID *LocallyUniqueId)
{ {
LARGE_INTEGER NewLuid, PrevLuid; LARGE_INTEGER NewLuid, PrevLuid;

View file

@ -47,7 +47,9 @@ LUID SeEnableDelegationPrivilege;
/* FUNCTIONS ***************************************************************/ /* FUNCTIONS ***************************************************************/
VOID INIT_FUNCTION VOID
INIT_FUNCTION
NTAPI
SepInitPrivileges (VOID) SepInitPrivileges (VOID)
{ {
SeCreateTokenPrivilege.LowPart = SE_CREATE_TOKEN_PRIVILEGE; SeCreateTokenPrivilege.LowPart = SE_CREATE_TOKEN_PRIVILEGE;
@ -106,6 +108,7 @@ SepInitPrivileges (VOID)
BOOLEAN BOOLEAN
NTAPI
SepPrivilegeCheck (PTOKEN Token, SepPrivilegeCheck (PTOKEN Token,
PLUID_AND_ATTRIBUTES Privileges, PLUID_AND_ATTRIBUTES Privileges,
ULONG PrivilegeCount, ULONG PrivilegeCount,
@ -166,6 +169,7 @@ SepPrivilegeCheck (PTOKEN Token,
NTSTATUS NTSTATUS
NTAPI
SeCaptureLuidAndAttributesArray (PLUID_AND_ATTRIBUTES Src, SeCaptureLuidAndAttributesArray (PLUID_AND_ATTRIBUTES Src,
ULONG PrivilegeCount, ULONG PrivilegeCount,
KPROCESSOR_MODE PreviousMode, KPROCESSOR_MODE PreviousMode,
@ -221,6 +225,7 @@ SeCaptureLuidAndAttributesArray (PLUID_AND_ATTRIBUTES Src,
VOID VOID
NTAPI
SeReleaseLuidAndAttributesArray (PLUID_AND_ATTRIBUTES Privilege, SeReleaseLuidAndAttributesArray (PLUID_AND_ATTRIBUTES Privilege,
KPROCESSOR_MODE PreviousMode, KPROCESSOR_MODE PreviousMode,
ULONG a) ULONG a)

View file

@ -24,7 +24,9 @@ PSECURITY_DESCRIPTOR SeUnrestrictedSd = NULL;
/* FUNCTIONS ***************************************************************/ /* FUNCTIONS ***************************************************************/
BOOLEAN INIT_FUNCTION BOOLEAN
INIT_FUNCTION
NTAPI
SepInitSDs(VOID) SepInitSDs(VOID)
{ {
/* Create PublicDefaultSd */ /* Create PublicDefaultSd */
@ -180,6 +182,7 @@ SeSetWorldSecurityDescriptor(SECURITY_INFORMATION SecurityInformation,
NTSTATUS NTSTATUS
NTAPI
SepCaptureSecurityQualityOfService(IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, SepCaptureSecurityQualityOfService(IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
IN KPROCESSOR_MODE AccessMode, IN KPROCESSOR_MODE AccessMode,
IN POOL_TYPE PoolType, IN POOL_TYPE PoolType,
@ -331,6 +334,7 @@ SepCaptureSecurityQualityOfService(IN POBJECT_ATTRIBUTES ObjectAttributes OPTIO
VOID VOID
NTAPI
SepReleaseSecurityQualityOfService(IN PSECURITY_QUALITY_OF_SERVICE CapturedSecurityQualityOfService OPTIONAL, SepReleaseSecurityQualityOfService(IN PSECURITY_QUALITY_OF_SERVICE CapturedSecurityQualityOfService OPTIONAL,
IN KPROCESSOR_MODE AccessMode, IN KPROCESSOR_MODE AccessMode,
IN BOOLEAN CaptureIfKernel) IN BOOLEAN CaptureIfKernel)

View file

@ -29,7 +29,9 @@ static BOOLEAN SepInitExports(VOID);
/* FUNCTIONS ****************************************************************/ /* FUNCTIONS ****************************************************************/
BOOLEAN INIT_FUNCTION BOOLEAN
INIT_FUNCTION
NTAPI
SeInit1(VOID) SeInit1(VOID)
{ {
SepInitLuid(); SepInitLuid();
@ -55,7 +57,9 @@ SeInit1(VOID)
} }
BOOLEAN INIT_FUNCTION BOOLEAN
INIT_FUNCTION
NTAPI
SeInit2(VOID) SeInit2(VOID)
{ {
SepInitializeTokenImplementation(); SepInitializeTokenImplementation();
@ -65,6 +69,7 @@ SeInit2(VOID)
BOOLEAN BOOLEAN
NTAPI
SeInitSRM(VOID) SeInitSRM(VOID)
{ {
OBJECT_ATTRIBUTES ObjectAttributes; OBJECT_ATTRIBUTES ObjectAttributes;

View file

@ -56,7 +56,9 @@ PSID SeAnonymousLogonSid = NULL;
/* FUNCTIONS ****************************************************************/ /* FUNCTIONS ****************************************************************/
BOOLEAN INIT_FUNCTION BOOLEAN
INIT_FUNCTION
NTAPI
SepInitSecurityIDs(VOID) SepInitSecurityIDs(VOID)
{ {
ULONG SidLength0; ULONG SidLength0;
@ -221,6 +223,7 @@ SepInitSecurityIDs(VOID)
} }
NTSTATUS NTSTATUS
NTAPI
SepCaptureSid(IN PSID InputSid, SepCaptureSid(IN PSID InputSid,
IN KPROCESSOR_MODE AccessMode, IN KPROCESSOR_MODE AccessMode,
IN POOL_TYPE PoolType, IN POOL_TYPE PoolType,
@ -309,6 +312,7 @@ SepCaptureSid(IN PSID InputSid,
} }
VOID VOID
NTAPI
SepReleaseSid(IN PSID CapturedSid, SepReleaseSid(IN PSID CapturedSid,
IN KPROCESSOR_MODE AccessMode, IN KPROCESSOR_MODE AccessMode,
IN BOOLEAN CaptureIfKernel) IN BOOLEAN CaptureIfKernel)

View file

@ -68,18 +68,23 @@ static const INFORMATION_CLASS_INFO SeTokenInformationClass[] = {
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
VOID SepFreeProxyData(PVOID ProxyData) VOID
NTAPI
SepFreeProxyData(PVOID ProxyData)
{ {
UNIMPLEMENTED; UNIMPLEMENTED;
} }
NTSTATUS SepCopyProxyData(PVOID* Dest, PVOID Src) NTSTATUS
NTAPI
SepCopyProxyData(PVOID* Dest, PVOID Src)
{ {
UNIMPLEMENTED; UNIMPLEMENTED;
return(STATUS_NOT_IMPLEMENTED); return(STATUS_NOT_IMPLEMENTED);
} }
NTSTATUS NTSTATUS
NTAPI
SeExchangePrimaryToken(PEPROCESS Process, SeExchangePrimaryToken(PEPROCESS Process,
PACCESS_TOKEN NewTokenP, PACCESS_TOKEN NewTokenP,
PACCESS_TOKEN* OldTokenP) PACCESS_TOKEN* OldTokenP)
@ -109,6 +114,7 @@ SeExchangePrimaryToken(PEPROCESS Process,
} }
VOID VOID
NTAPI
SeDeassignPrimaryToken(PEPROCESS Process) SeDeassignPrimaryToken(PEPROCESS Process)
{ {
PTOKEN OldToken; PTOKEN OldToken;
@ -138,6 +144,7 @@ RtlLengthSidAndAttributes(ULONG Count,
NTSTATUS NTSTATUS
NTAPI
SepFindPrimaryGroupAndDefaultOwner(PTOKEN Token, SepFindPrimaryGroupAndDefaultOwner(PTOKEN Token,
PSID PrimaryGroup, PSID PrimaryGroup,
PSID DefaultOwner) PSID DefaultOwner)
@ -557,7 +564,9 @@ SepDeleteToken(PVOID ObjectBody)
} }
VOID INIT_FUNCTION VOID
INIT_FUNCTION
NTAPI
SepInitializeTokenImplementation(VOID) SepInitializeTokenImplementation(VOID)
{ {
UNICODE_STRING Name; UNICODE_STRING Name;