2006-07-23 05:43:28 +00:00
|
|
|
/*
|
2006-11-30 04:16:35 +00:00
|
|
|
* PROJECT: ReactOS Kernel
|
|
|
|
* LICENSE: GPL - See COPYING in the top level directory
|
2015-10-04 11:54:25 +00:00
|
|
|
* FILE: ntoskrnl/include/internal/ps.h
|
2006-11-30 04:16:35 +00:00
|
|
|
* PURPOSE: Internal header for the Process Manager
|
|
|
|
* PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
|
|
|
|
*/
|
2006-07-23 05:43:28 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Define this if you want debugging support
|
|
|
|
//
|
2009-06-01 06:21:12 +00:00
|
|
|
#define _PS_DEBUG_ 0x00
|
2006-07-23 05:43:28 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// These define the Debug Masks Supported
|
|
|
|
//
|
|
|
|
#define PS_THREAD_DEBUG 0x01
|
|
|
|
#define PS_PROCESS_DEBUG 0x02
|
|
|
|
#define PS_SECURITY_DEBUG 0x04
|
|
|
|
#define PS_JOB_DEBUG 0x08
|
|
|
|
#define PS_NOTIFICATIONS_DEBUG 0x10
|
|
|
|
#define PS_WIN32K_DEBUG 0x20
|
|
|
|
#define PS_STATE_DEBUG 0x40
|
|
|
|
#define PS_QUOTA_DEBUG 0x80
|
2006-07-23 07:13:19 +00:00
|
|
|
#define PS_KILL_DEBUG 0x100
|
2006-07-23 19:45:16 +00:00
|
|
|
#define PS_REF_DEBUG 0x200
|
2006-07-23 05:43:28 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Debug/Tracing support
|
|
|
|
//
|
|
|
|
#if _PS_DEBUG_
|
|
|
|
#ifdef NEW_DEBUG_SYSTEM_IMPLEMENTED // enable when Debug Filters are implemented
|
2006-07-23 07:13:19 +00:00
|
|
|
#define PSTRACE(x, ...) \
|
|
|
|
{ \
|
|
|
|
DbgPrintEx("%s [%.16s] - ", \
|
|
|
|
__FUNCTION__, \
|
|
|
|
PsGetCurrentProcess()->ImageFileName); \
|
|
|
|
DbgPrintEx(__VA_ARGS__); \
|
|
|
|
}
|
2006-07-23 05:43:28 +00:00
|
|
|
#else
|
2006-07-23 07:13:19 +00:00
|
|
|
#define PSTRACE(x, ...) \
|
|
|
|
if (x & PspTraceLevel) \
|
|
|
|
{ \
|
|
|
|
DbgPrint("%s [%.16s] - ", \
|
|
|
|
__FUNCTION__, \
|
|
|
|
PsGetCurrentProcess()->ImageFileName); \
|
|
|
|
DbgPrint(__VA_ARGS__); \
|
|
|
|
}
|
2006-07-23 05:43:28 +00:00
|
|
|
#endif
|
2006-07-23 19:45:16 +00:00
|
|
|
#define PSREFTRACE(x) \
|
|
|
|
PSTRACE(PS_REF_DEBUG, \
|
2006-07-23 21:38:31 +00:00
|
|
|
"Pointer Count [%p] @%d: %lx\n", \
|
2006-07-23 20:12:45 +00:00
|
|
|
x, \
|
|
|
|
__LINE__, \
|
2009-06-01 06:21:12 +00:00
|
|
|
OBJECT_TO_OBJECT_HEADER(x)->PointerCount)
|
2006-07-23 05:43:28 +00:00
|
|
|
#else
|
2011-08-01 22:59:44 +00:00
|
|
|
#define PSTRACE(x, fmt, ...) DPRINT(fmt, ##__VA_ARGS__)
|
2006-07-23 19:45:16 +00:00
|
|
|
#define PSREFTRACE(x)
|
2006-07-23 05:43:28 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
//
|
|
|
|
// Maximum Count of Notification Routines
|
|
|
|
//
|
2006-07-17 22:18:44 +00:00
|
|
|
#define PSP_MAX_CREATE_THREAD_NOTIFY 8
|
|
|
|
#define PSP_MAX_LOAD_IMAGE_NOTIFY 8
|
|
|
|
#define PSP_MAX_CREATE_PROCESS_NOTIFY 8
|
2005-09-13 23:28:21 +00:00
|
|
|
|
2006-07-23 05:43:28 +00:00
|
|
|
//
|
|
|
|
// Maximum Job Scheduling Classes
|
|
|
|
//
|
2006-07-21 19:28:38 +00:00
|
|
|
#define PSP_JOB_SCHEDULING_CLASSES 10
|
|
|
|
|
2021-12-30 19:58:37 +00:00
|
|
|
//
|
|
|
|
// Process Quota Threshold Values
|
|
|
|
//
|
|
|
|
#define PSP_NON_PAGED_POOL_QUOTA_THRESHOLD 0x10000
|
|
|
|
#define PSP_PAGED_POOL_QUOTA_THRESHOLD 0x80000
|
|
|
|
|
2008-06-06 21:51:21 +00:00
|
|
|
//
|
|
|
|
// Thread "Set/Get Context" Context Structure
|
|
|
|
//
|
|
|
|
typedef struct _GET_SET_CTX_CONTEXT
|
|
|
|
{
|
|
|
|
KAPC Apc;
|
|
|
|
KEVENT Event;
|
|
|
|
KPROCESSOR_MODE Mode;
|
|
|
|
CONTEXT Context;
|
|
|
|
} GET_SET_CTX_CONTEXT, *PGET_SET_CTX_CONTEXT;
|
|
|
|
|
2006-07-23 05:43:28 +00:00
|
|
|
//
|
|
|
|
// Initialization Functions
|
|
|
|
//
|
2005-09-13 23:28:21 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
2006-07-23 05:43:28 +00:00
|
|
|
PspShutdownProcessManager(
|
|
|
|
VOID
|
|
|
|
);
|
2005-09-13 23:28:21 +00:00
|
|
|
|
2021-05-11 15:13:14 +00:00
|
|
|
CODE_SEG("INIT")
|
2006-10-01 19:43:18 +00:00
|
|
|
BOOLEAN
|
|
|
|
NTAPI
|
2006-10-02 15:52:58 +00:00
|
|
|
PsInitSystem(
|
2007-01-25 01:13:09 +00:00
|
|
|
IN PLOADER_PARAMETER_BLOCK LoaderBlock
|
2006-10-01 19:43:18 +00:00
|
|
|
);
|
|
|
|
|
2006-07-23 05:43:28 +00:00
|
|
|
//
|
|
|
|
// Utility Routines
|
|
|
|
//
|
|
|
|
PETHREAD
|
|
|
|
NTAPI
|
|
|
|
PsGetNextProcessThread(
|
|
|
|
IN PEPROCESS Process,
|
|
|
|
IN PETHREAD Thread OPTIONAL
|
|
|
|
);
|
|
|
|
|
|
|
|
PEPROCESS
|
|
|
|
NTAPI
|
|
|
|
PsGetNextProcess(
|
|
|
|
IN PEPROCESS OldProcess OPTIONAL
|
|
|
|
);
|
2005-09-13 23:28:21 +00:00
|
|
|
|
2006-07-23 05:43:28 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
PspMapSystemDll(
|
|
|
|
IN PEPROCESS Process,
|
2007-09-26 16:41:35 +00:00
|
|
|
OUT PVOID *DllBase,
|
|
|
|
IN BOOLEAN UseLargePages
|
2006-07-23 05:43:28 +00:00
|
|
|
);
|
|
|
|
|
2021-05-11 15:13:14 +00:00
|
|
|
CODE_SEG("INIT")
|
2006-07-23 05:43:28 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
PsLocateSystemDll(
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
2006-07-23 17:01:43 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
PsChangeQuantumTable(
|
|
|
|
IN BOOLEAN Immediate,
|
|
|
|
IN ULONG PrioritySeparation
|
|
|
|
);
|
|
|
|
|
2006-07-27 00:22:36 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
PsReferenceProcessFilePointer(
|
|
|
|
IN PEPROCESS Process,
|
|
|
|
OUT PFILE_OBJECT *FileObject
|
|
|
|
);
|
|
|
|
|
2006-09-17 05:20:24 +00:00
|
|
|
//
|
|
|
|
// Process Routines
|
|
|
|
//
|
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
PspCreateProcess(
|
|
|
|
OUT PHANDLE ProcessHandle,
|
|
|
|
IN ACCESS_MASK DesiredAccess,
|
|
|
|
IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
|
|
|
|
IN HANDLE ParentProcess OPTIONAL,
|
|
|
|
IN ULONG Flags,
|
|
|
|
IN HANDLE SectionHandle OPTIONAL,
|
|
|
|
IN HANDLE DebugPort OPTIONAL,
|
|
|
|
IN HANDLE ExceptionPort OPTIONAL,
|
|
|
|
IN BOOLEAN InJob
|
|
|
|
);
|
|
|
|
|
2006-07-23 05:43:28 +00:00
|
|
|
//
|
|
|
|
// Security Routines
|
|
|
|
//
|
2005-09-13 23:28:21 +00:00
|
|
|
PACCESS_TOKEN
|
2006-07-23 05:43:28 +00:00
|
|
|
NTAPI
|
2005-09-13 23:28:21 +00:00
|
|
|
PsReferenceEffectiveToken(
|
2006-07-23 05:43:28 +00:00
|
|
|
IN PETHREAD Thread,
|
2018-06-25 13:21:33 +00:00
|
|
|
OUT IN PTOKEN_TYPE TokenType,
|
|
|
|
OUT PBOOLEAN EffectiveOnly,
|
|
|
|
OUT PSECURITY_IMPERSONATION_LEVEL ImpersonationLevel
|
2005-09-13 23:28:21 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
NTSTATUS
|
2006-07-23 05:43:28 +00:00
|
|
|
NTAPI
|
2005-09-13 23:28:21 +00:00
|
|
|
PsOpenTokenOfProcess(
|
2006-07-23 05:43:28 +00:00
|
|
|
IN HANDLE ProcessHandle,
|
|
|
|
OUT PACCESS_TOKEN* Token
|
2005-09-13 23:28:21 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
NTSTATUS
|
2006-07-22 16:03:12 +00:00
|
|
|
NTAPI
|
|
|
|
PspSetPrimaryToken(
|
|
|
|
IN PEPROCESS Process,
|
|
|
|
IN HANDLE TokenHandle OPTIONAL,
|
2007-01-18 09:44:49 +00:00
|
|
|
IN PACCESS_TOKEN Token OPTIONAL
|
2005-09-13 23:28:21 +00:00
|
|
|
);
|
|
|
|
|
2006-07-23 05:43:28 +00:00
|
|
|
NTSTATUS
|
2006-07-09 18:54:13 +00:00
|
|
|
NTAPI
|
2006-07-23 05:43:28 +00:00
|
|
|
PspInitializeProcessSecurity(
|
2006-07-09 18:54:13 +00:00
|
|
|
IN PEPROCESS Process,
|
2006-07-23 05:43:28 +00:00
|
|
|
IN PEPROCESS Parent OPTIONAL
|
|
|
|
);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
PspDeleteProcessSecurity(
|
|
|
|
IN PEPROCESS Process
|
|
|
|
);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
PspDeleteThreadSecurity(
|
|
|
|
IN PETHREAD Thread
|
2006-07-09 18:54:13 +00:00
|
|
|
);
|
|
|
|
|
2006-07-23 05:43:28 +00:00
|
|
|
//
|
|
|
|
// Reaping and Deletion
|
|
|
|
//
|
2005-09-13 23:28:21 +00:00
|
|
|
VOID
|
2006-07-23 05:43:28 +00:00
|
|
|
NTAPI
|
2005-09-13 23:28:21 +00:00
|
|
|
PsExitSpecialApc(
|
|
|
|
PKAPC Apc,
|
|
|
|
PKNORMAL_ROUTINE *NormalRoutine,
|
|
|
|
PVOID *NormalContext,
|
|
|
|
PVOID *SystemArgument1,
|
|
|
|
PVOID *SystemArgument2
|
|
|
|
);
|
2000-07-01 22:38:15 +00:00
|
|
|
|
2005-04-22 12:52:25 +00:00
|
|
|
VOID
|
2005-09-13 23:28:21 +00:00
|
|
|
NTAPI
|
2006-07-23 05:43:28 +00:00
|
|
|
PspReapRoutine(
|
|
|
|
IN PVOID Context
|
2005-09-13 23:28:21 +00:00
|
|
|
);
|
1999-01-16 21:03:00 +00:00
|
|
|
|
2005-05-09 01:38:29 +00:00
|
|
|
VOID
|
2006-07-23 05:43:28 +00:00
|
|
|
NTAPI
|
|
|
|
PspExitThread(
|
|
|
|
IN NTSTATUS ExitStatus
|
|
|
|
);
|
Thread/Process Termination/Repeaing Rewrite + Fixes
---------------------------------------------------
- ps/cid.c:
* Moved CID Lookup functions here
- ps/security.c:
* Moved all security related functions here. Makes other files neater and security functions
easier to locate.
- ps/thread.c:
* Moved most of the Thread Scheduling/Dispatching code that belongs in the Kernel to /ke and
renamed functions from Ps to Ki.
* Implemented PsIsSystemThread.
* Removed Reaper Thread Init (now obsolete).
* Renamed PiDeleteThread to PspDeleteThread.
* Moved Thread State functions from tinfo.c to here.
- ps/process.c:
* Removed Query/Set Process functions and moved to ps/query.c
* Renamed PiDeletePRocess to PspDeleteProcess
* Removed obsoleted Process Termination functions, moved persistent one to kill.c
- ps/create.c:
* Moved the security APIs to security.c
* Correctly implemented PsCreateSystemThread to actually create system threads.
- ps/suspend.c
* Rewrote Nt Executive functions to use Kernel functions.
* Moved Ps* Routines into ke/kthread.c and fixed them. The implementation was wrong in
some aspects, especially the issue of the APC looping around the KeWaitXxx call and the
fact that the routines excluded/ignored the FreezeCount.
- ps/debug.c
* Fixed completely broken implementation of Get/SetThreadContext. The old version crashed
when called and did not work at all. Suspend Regression test now works.
* Moved Context<->TrapFrame functions to ke/i386/
* Combined Set/GetThreadContext APCs into a single one, and used special context structure.
- ps/query.c:
* Moved Thread/Process Query/Set Routines here.
- ps/tinfo.c:
* Removed.
- ps/kill.c
* Removed complicated Process Termination semantics and useless Attach/Detach in favor for
a much more lightweight function which performs the same tasks as before and actually works.
TaskManager can now terminate foreign processes.
* Rewrote Thread Reaping to use the HyperCritical Work Queue instead of manually controlled
thread. This results in much less code as well as an increase in speed and less micro
management. The reaper is PspReapRoutine. Closing CMD.EXE now works properly without
requiring masks that were added as hacks to allow it.
* Renamed PiTerminateProcessThreads to PspTerminateProcessThreads. Fixed it to work with new
termination code.
* Added PspDeleteProcess to handle Process Object deletion. Kills the CID Handle here as done
by Hartmut.
* Added PspDeletethread here.
* Renamed and rewrote PsTerminateCurrentThread to PspExitThread. Used NT Implementation out-
lined in Windows Internals, Chapter 13. Uses less locks, a more concise order of actions,
actually parses the Termination Ports, handles Dbgk notification. Timers are now rundown,
and Mutex rundown is in a dedicated Kernel function. Final termination handled by KeTerminate
Thread as documented.
* Renamed PsTerminateOtherThread to PspTerminateThreadByPointer and modified implementation to
be compatible with the changes above.
* Renamed and regrouped Process Termination into PspExitProcess. Also implemented as described
above, and moved each subsystem specific termination helper into its own subsytem.
* Improved NtTerminateProcess and added more debugging messages.
* Improved NtTerminateThread and added check against System Thread and made it compatible with
new implementation.
* Corrected PsTerminateSystemThread now that we support System Threads.
* Corrected NtRegisterThreadTerminatePort to use same structure name as on windows for the
port, and added tag to pool allocation (documented in pooltag.txt)
include/internal/*.h:
* Defined Scheduler Functions and misc new functions or renamed functions.
ke/apc.c:
* Fixed critical bug where APCs were not delivered at all if the thread wastion and cancels any timers that are associated
to a thread, as well as their APCs and DPCs.
REGRESSIONS FOUND: NONE
BUGS/REGRESSIOSN FIXED:
* Thread/Get Set Context now works.
* Suspend Regression test now works.
* Task manager can now kill foreign processes, even hung ones (like it should).
* ExitProcess/closing cmd.exe with the 'x' button now works correctly without hacks.
KNOWN ISSUES: I left a bit of a mess in the headers and some stuff still needs to be moved into the right
places. I just wanted to have this first part ready first, so that it won't get too big.
svn path=/trunk/; revision=14174
2005-03-18 05:53:04 +00:00
|
|
|
|
2006-07-09 18:54:13 +00:00
|
|
|
NTSTATUS
|
2006-07-23 05:43:28 +00:00
|
|
|
NTAPI
|
2005-09-13 23:28:21 +00:00
|
|
|
PspTerminateThreadByPointer(
|
2006-07-23 05:43:28 +00:00
|
|
|
IN PETHREAD Thread,
|
|
|
|
IN NTSTATUS ExitStatus,
|
|
|
|
IN BOOLEAN bSelf
|
2005-09-13 23:28:21 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
VOID
|
2006-07-23 05:43:28 +00:00
|
|
|
NTAPI
|
|
|
|
PspExitProcess(
|
|
|
|
IN BOOLEAN LastThread,
|
|
|
|
IN PEPROCESS Process
|
|
|
|
);
|
Thread/Process Termination/Repeaing Rewrite + Fixes
---------------------------------------------------
- ps/cid.c:
* Moved CID Lookup functions here
- ps/security.c:
* Moved all security related functions here. Makes other files neater and security functions
easier to locate.
- ps/thread.c:
* Moved most of the Thread Scheduling/Dispatching code that belongs in the Kernel to /ke and
renamed functions from Ps to Ki.
* Implemented PsIsSystemThread.
* Removed Reaper Thread Init (now obsolete).
* Renamed PiDeleteThread to PspDeleteThread.
* Moved Thread State functions from tinfo.c to here.
- ps/process.c:
* Removed Query/Set Process functions and moved to ps/query.c
* Renamed PiDeletePRocess to PspDeleteProcess
* Removed obsoleted Process Termination functions, moved persistent one to kill.c
- ps/create.c:
* Moved the security APIs to security.c
* Correctly implemented PsCreateSystemThread to actually create system threads.
- ps/suspend.c
* Rewrote Nt Executive functions to use Kernel functions.
* Moved Ps* Routines into ke/kthread.c and fixed them. The implementation was wrong in
some aspects, especially the issue of the APC looping around the KeWaitXxx call and the
fact that the routines excluded/ignored the FreezeCount.
- ps/debug.c
* Fixed completely broken implementation of Get/SetThreadContext. The old version crashed
when called and did not work at all. Suspend Regression test now works.
* Moved Context<->TrapFrame functions to ke/i386/
* Combined Set/GetThreadContext APCs into a single one, and used special context structure.
- ps/query.c:
* Moved Thread/Process Query/Set Routines here.
- ps/tinfo.c:
* Removed.
- ps/kill.c
* Removed complicated Process Termination semantics and useless Attach/Detach in favor for
a much more lightweight function which performs the same tasks as before and actually works.
TaskManager can now terminate foreign processes.
* Rewrote Thread Reaping to use the HyperCritical Work Queue instead of manually controlled
thread. This results in much less code as well as an increase in speed and less micro
management. The reaper is PspReapRoutine. Closing CMD.EXE now works properly without
requiring masks that were added as hacks to allow it.
* Renamed PiTerminateProcessThreads to PspTerminateProcessThreads. Fixed it to work with new
termination code.
* Added PspDeleteProcess to handle Process Object deletion. Kills the CID Handle here as done
by Hartmut.
* Added PspDeletethread here.
* Renamed and rewrote PsTerminateCurrentThread to PspExitThread. Used NT Implementation out-
lined in Windows Internals, Chapter 13. Uses less locks, a more concise order of actions,
actually parses the Termination Ports, handles Dbgk notification. Timers are now rundown,
and Mutex rundown is in a dedicated Kernel function. Final termination handled by KeTerminate
Thread as documented.
* Renamed PsTerminateOtherThread to PspTerminateThreadByPointer and modified implementation to
be compatible with the changes above.
* Renamed and regrouped Process Termination into PspExitProcess. Also implemented as described
above, and moved each subsystem specific termination helper into its own subsytem.
* Improved NtTerminateProcess and added more debugging messages.
* Improved NtTerminateThread and added check against System Thread and made it compatible with
new implementation.
* Corrected PsTerminateSystemThread now that we support System Threads.
* Corrected NtRegisterThreadTerminatePort to use same structure name as on windows for the
port, and added tag to pool allocation (documented in pooltag.txt)
include/internal/*.h:
* Defined Scheduler Functions and misc new functions or renamed functions.
ke/apc.c:
* Fixed critical bug where APCs were not delivered at all if the thread wastion and cancels any timers that are associated
to a thread, as well as their APCs and DPCs.
REGRESSIONS FOUND: NONE
BUGS/REGRESSIOSN FIXED:
* Thread/Get Set Context now works.
* Suspend Regression test now works.
* Task manager can now kill foreign processes, even hung ones (like it should).
* ExitProcess/closing cmd.exe with the 'x' button now works correctly without hacks.
KNOWN ISSUES: I left a bit of a mess in the headers and some stuff still needs to be moved into the right
places. I just wanted to have this first part ready first, so that it won't get too big.
svn path=/trunk/; revision=14174
2005-03-18 05:53:04 +00:00
|
|
|
|
2006-10-19 20:08:52 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
PsTerminateProcess(
|
|
|
|
IN PEPROCESS Process,
|
|
|
|
IN NTSTATUS ExitStatus
|
|
|
|
);
|
|
|
|
|
2005-05-09 01:38:29 +00:00
|
|
|
VOID
|
2006-07-23 05:43:28 +00:00
|
|
|
NTAPI
|
|
|
|
PspDeleteProcess(
|
|
|
|
IN PVOID ObjectBody
|
|
|
|
);
|
2002-01-27 01:11:24 +00:00
|
|
|
|
2005-09-13 23:28:21 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
2006-07-23 05:43:28 +00:00
|
|
|
PspDeleteThread(
|
|
|
|
IN PVOID ObjectBody
|
|
|
|
);
|
2004-09-22 22:31:46 +00:00
|
|
|
|
2006-07-23 05:43:28 +00:00
|
|
|
//
|
|
|
|
// Thread/Process Startup
|
|
|
|
//
|
2005-08-01 11:21:42 +00:00
|
|
|
VOID
|
2006-07-23 05:43:28 +00:00
|
|
|
NTAPI
|
|
|
|
PspSystemThreadStartup(
|
|
|
|
PKSTART_ROUTINE StartRoutine,
|
|
|
|
PVOID StartContext
|
2005-09-13 23:28:21 +00:00
|
|
|
);
|
2005-08-01 11:21:42 +00:00
|
|
|
|
|
|
|
VOID
|
2006-07-23 05:43:28 +00:00
|
|
|
NTAPI
|
|
|
|
PsIdleThreadMain(
|
|
|
|
IN PVOID Context
|
2005-08-05 03:44:24 +00:00
|
|
|
);
|
|
|
|
|
2006-07-23 05:43:28 +00:00
|
|
|
//
|
|
|
|
// Quota Support
|
|
|
|
//
|
2006-07-09 18:54:13 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
2006-07-23 05:43:28 +00:00
|
|
|
PspInheritQuota(
|
2021-12-30 19:58:37 +00:00
|
|
|
_In_ PEPROCESS Process,
|
|
|
|
_In_ PEPROCESS ParentProcess
|
2006-07-09 18:54:13 +00:00
|
|
|
);
|
|
|
|
|
2006-07-23 05:43:28 +00:00
|
|
|
VOID
|
2006-07-09 18:54:13 +00:00
|
|
|
NTAPI
|
2021-12-30 19:58:37 +00:00
|
|
|
PspDereferenceQuotaBlock(
|
|
|
|
_In_opt_ PEPROCESS Process,
|
|
|
|
_In_ PEPROCESS_QUOTA_BLOCK QuotaBlock
|
|
|
|
);
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
PsReturnProcessPageFileQuota(
|
|
|
|
_In_ PEPROCESS Process,
|
|
|
|
_In_ SIZE_T Amount
|
|
|
|
);
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
PsChargeProcessPageFileQuota(
|
|
|
|
_In_ PEPROCESS Process,
|
|
|
|
_In_ SIZE_T Amount
|
|
|
|
);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
PsReturnSharedPoolQuota(
|
|
|
|
_In_ PEPROCESS_QUOTA_BLOCK QuotaBlock,
|
|
|
|
_In_ SIZE_T AmountToReturnPaged,
|
|
|
|
_In_ SIZE_T AmountToReturnNonPaged
|
|
|
|
);
|
|
|
|
|
|
|
|
PEPROCESS_QUOTA_BLOCK
|
|
|
|
NTAPI
|
|
|
|
PsChargeSharedPoolQuota(
|
|
|
|
_In_ PEPROCESS Process,
|
|
|
|
_In_ SIZE_T AmountToChargePaged,
|
|
|
|
_In_ SIZE_T AmountToChargeNonPaged
|
2006-07-23 05:43:28 +00:00
|
|
|
);
|
2006-07-09 18:54:13 +00:00
|
|
|
|
2014-02-18 18:12:30 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
PspSetQuotaLimits(
|
2014-11-03 09:52:08 +00:00
|
|
|
_In_ PEPROCESS Process,
|
2014-02-18 18:12:30 +00:00
|
|
|
_In_ ULONG Unused,
|
|
|
|
_In_ PVOID QuotaLimits,
|
|
|
|
_In_ ULONG QuotaLimitsLength,
|
|
|
|
_In_ KPROCESSOR_MODE PreviousMode);
|
|
|
|
|
2009-10-29 10:04:15 +00:00
|
|
|
#if defined(_X86_)
|
2006-07-23 05:43:28 +00:00
|
|
|
//
|
2009-10-29 10:04:15 +00:00
|
|
|
// VDM and LDT Support
|
2006-07-23 05:43:28 +00:00
|
|
|
//
|
2015-03-18 20:43:22 +00:00
|
|
|
VOID
|
2006-07-09 18:54:13 +00:00
|
|
|
NTAPI
|
2006-07-23 05:43:28 +00:00
|
|
|
PspDeleteLdt(
|
|
|
|
IN PEPROCESS Process
|
|
|
|
);
|
2006-07-09 18:54:13 +00:00
|
|
|
|
2015-03-18 20:43:22 +00:00
|
|
|
VOID
|
2006-07-09 18:54:13 +00:00
|
|
|
NTAPI
|
2006-07-23 05:43:28 +00:00
|
|
|
PspDeleteVdmObjects(
|
|
|
|
IN PEPROCESS Process
|
|
|
|
);
|
2006-07-09 18:54:13 +00:00
|
|
|
|
2009-10-29 10:04:15 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
PspQueryDescriptorThread(
|
|
|
|
IN PETHREAD Thread,
|
|
|
|
IN PVOID ThreadInformation,
|
|
|
|
IN ULONG ThreadInformationLength,
|
|
|
|
OUT PULONG ReturnLength OPTIONAL
|
|
|
|
);
|
|
|
|
#endif
|
|
|
|
|
2006-07-23 05:43:28 +00:00
|
|
|
//
|
|
|
|
// Job Routines
|
|
|
|
//
|
2006-07-09 18:54:13 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
PspExitProcessFromJob(
|
|
|
|
IN PEJOB Job,
|
|
|
|
IN PEPROCESS Process
|
|
|
|
);
|
|
|
|
|
2006-07-23 05:43:28 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
PspRemoveProcessFromJob(
|
|
|
|
IN PEPROCESS Process,
|
|
|
|
IN PEJOB Job
|
|
|
|
);
|
|
|
|
|
2021-05-11 15:13:14 +00:00
|
|
|
CODE_SEG("INIT")
|
2006-09-17 05:20:24 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
PspInitializeJobStructures(
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
PspDeleteJob(
|
|
|
|
IN PVOID ObjectBody
|
|
|
|
);
|
|
|
|
|
2006-10-20 05:16:04 +00:00
|
|
|
//
|
|
|
|
// State routines
|
|
|
|
//
|
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
PsResumeThread(
|
|
|
|
IN PETHREAD Thread,
|
|
|
|
OUT PULONG PreviousCount OPTIONAL
|
|
|
|
);
|
|
|
|
|
2006-11-30 01:57:25 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
PsSuspendThread(
|
|
|
|
IN PETHREAD Thread,
|
|
|
|
OUT PULONG PreviousCount OPTIONAL
|
|
|
|
);
|
|
|
|
|
2008-06-06 21:51:21 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
PspGetOrSetContextKernelRoutine(
|
|
|
|
IN PKAPC Apc,
|
|
|
|
IN OUT PKNORMAL_ROUTINE* NormalRoutine,
|
|
|
|
IN OUT PVOID* NormalContext,
|
|
|
|
IN OUT PVOID* SystemArgument1,
|
|
|
|
IN OUT PVOID* SystemArgument2
|
|
|
|
);
|
|
|
|
|
[CACHE]
The cache manager rewrite I started years ago has finally appeared in
ReactOS' trunk and although at this point it's not quite perfectly
integrated, it's enough to boot up the bootcd or livecd. To check out
the more mature original, check out arty-newcc-reactos, branch
arty-newcc on bitbucket.org . Amine Khaldi encouraged me quite a bit
to not give up on it, and was able to reach out and be an advocate
when i really wasn't able to. Others agree that the time has come to
begin removing the old cache manager. I expect the remaining problems
in the version going to trunk will be taken care of relatively
quickly.
The motivation for this effort lies in the particularly hairy
relationship between ReactOS' cache manager and data sections. This
code completely removes page sharing between cache manager and section
and reimagines cache manager as being a facility layered on the memory
manager, not really caring about individual pages, but simply managing
data section objects where caching might occur.
It took me about 2 years to do the first pass of this rewrite and most
of this year to fix some lingering issues, properly implement demand
paging in ReactOS (code which didn't come with this patch in a
recognizable form), and finish getting the PrivateCacheMap and
SharedCacheMap relationship correct.
Currently, the new ntoskrnl/cache directory contains an own
implementation of data file sections. After things have settled down,
we can begin to deprecate and remove the parts of ReactOS' section
implementation that depend on a close relationship with cache
manager. Eventually, I think that the extra code added to
ntoskrnl/cache/section will be removed and ReactOS' own sections will
replace the use of the special MM_CACHE_SECTION_SEGMENT in the cache
path.
Note also, that this makes all cache manager (and new section parts)
use wide file offsets. If my section code were to take over other
parts of the ReactOS memory manager, they would also benefit from
these improvements.
I invite anyone who wants to to peek at this code and fix whatever
bugs can be found.
svn path=/trunk/; revision=49423
2010-11-02 02:32:39 +00:00
|
|
|
BOOLEAN
|
|
|
|
NTAPI
|
|
|
|
PspIsProcessExiting(IN PEPROCESS Process);
|
|
|
|
|
2015-09-05 11:49:54 +00:00
|
|
|
//
|
|
|
|
// Apphelp functions
|
|
|
|
//
|
2021-05-11 15:13:14 +00:00
|
|
|
CODE_SEG("INIT")
|
2015-09-05 11:49:54 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
ApphelpCacheInitialize(VOID);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
ApphelpCacheShutdown(VOID);
|
|
|
|
|
2006-07-23 05:43:28 +00:00
|
|
|
//
|
|
|
|
// Global data inside the Process Manager
|
|
|
|
//
|
|
|
|
extern ULONG PspTraceLevel;
|
2006-07-17 22:18:44 +00:00
|
|
|
extern LCID PsDefaultThreadLocaleId;
|
|
|
|
extern LCID PsDefaultSystemLocaleId;
|
|
|
|
extern LIST_ENTRY PspReaperListHead;
|
|
|
|
extern WORK_QUEUE_ITEM PspReaperWorkItem;
|
|
|
|
extern BOOLEAN PspReaping;
|
|
|
|
extern PEPROCESS PsIdleProcess;
|
|
|
|
extern LIST_ENTRY PsActiveProcessHead;
|
2006-07-20 16:26:10 +00:00
|
|
|
extern KGUARDED_MUTEX PspActiveProcessMutex;
|
2006-07-20 17:44:30 +00:00
|
|
|
extern LARGE_INTEGER ShortPsLockDelay;
|
2006-07-17 22:18:44 +00:00
|
|
|
extern EPROCESS_QUOTA_BLOCK PspDefaultQuotaBlock;
|
2006-07-20 16:26:10 +00:00
|
|
|
extern PHANDLE_TABLE PspCidTable;
|
2007-01-16 15:09:53 +00:00
|
|
|
extern EX_CALLBACK PspThreadNotifyRoutine[PSP_MAX_CREATE_THREAD_NOTIFY];
|
|
|
|
extern EX_CALLBACK PspProcessNotifyRoutine[PSP_MAX_CREATE_PROCESS_NOTIFY];
|
|
|
|
extern EX_CALLBACK PspLoadImageNotifyRoutine[PSP_MAX_LOAD_IMAGE_NOTIFY];
|
2006-07-17 22:18:44 +00:00
|
|
|
extern PLEGO_NOTIFY_ROUTINE PspLegoNotifyRoutine;
|
2007-01-16 15:09:53 +00:00
|
|
|
extern ULONG PspThreadNotifyRoutineCount, PspProcessNotifyRoutineCount;
|
2006-11-12 22:37:52 +00:00
|
|
|
extern BOOLEAN PsImageNotifyEnabled;
|
2006-07-20 16:26:10 +00:00
|
|
|
extern PKWIN32_PROCESS_CALLOUT PspW32ProcessCallout;
|
|
|
|
extern PKWIN32_THREAD_CALLOUT PspW32ThreadCallout;
|
|
|
|
extern PVOID PspSystemDllEntryPoint;
|
|
|
|
extern PVOID PspSystemDllBase;
|
2006-07-21 19:28:38 +00:00
|
|
|
extern BOOLEAN PspUseJobSchedulingClasses;
|
|
|
|
extern CHAR PspJobSchedulingClasses[PSP_JOB_SCHEDULING_CLASSES];
|
2006-07-23 17:01:43 +00:00
|
|
|
extern ULONG PsRawPrioritySeparation;
|
2015-09-23 05:10:58 +00:00
|
|
|
extern ULONG PsPrioritySeparation;
|
2007-01-08 07:42:38 +00:00
|
|
|
extern POBJECT_TYPE _PsThreadType, _PsProcessType;
|
2006-09-17 05:20:24 +00:00
|
|
|
extern PTOKEN PspBootAccessToken;
|
|
|
|
extern GENERIC_MAPPING PspJobMapping;
|
|
|
|
extern POBJECT_TYPE PsJobType;
|
|
|
|
extern LARGE_INTEGER ShortPsLockDelay;
|
2006-11-12 22:37:52 +00:00
|
|
|
extern UNICODE_STRING PsNtDllPathName;
|
- Add EXCEPTION_RECORD64 and LIST_ENTRY64, KeTryToAcquireSpinLockAtDpcLevel, BREAKPOINT_COMMAND_STRING, Ke386SetCr2, Ke386SetDr3, Ke386SetDr6.
- Remove non-kernel routines from kdfuncs.h and remove deprecated routines from ke.h.
- Implement KiRestoreProcessorControlState, KeFreezeExecution, KeThawExecution, ExAcquireTimeRefreshLock, ExReleaseTimeRefreshLock.
- Rename ModuleLoadList to PsLoadedModuleList. Add PsNtosImageBase and set value in it.
- Add skeleton wdbgexts.h with what's needed until now, this is a PSDK header.
- Add kddll.h for KDCOM/1394/USB2.DLL prototypes.
- Add windbgkd.h with KD protocol definitions. Used to be an NT5 DDK header, but was removed, so this goes into include\reactos.
svn path=/branches/alex-kd-branch/; revision=25833
2007-02-18 07:21:03 +00:00
|
|
|
extern LIST_ENTRY PsLoadedModuleList;
|
2009-11-12 19:41:39 +00:00
|
|
|
extern KSPIN_LOCK PsLoadedModuleSpinLock;
|
|
|
|
extern ERESOURCE PsLoadedModuleResource;
|
2009-10-04 16:53:15 +00:00
|
|
|
extern ULONG_PTR PsNtosImageBase;
|
2006-07-17 22:18:44 +00:00
|
|
|
|
2006-07-23 05:43:28 +00:00
|
|
|
//
|
|
|
|
// Inlined Functions
|
|
|
|
//
|
|
|
|
#include "ps_x.h"
|