ReactOS 0.4.15-dev-7674-gc0b4db1
psmgr.c File Reference
#include <ntoskrnl.h>
#include <debug.h>
Include dependency graph for psmgr.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

static CODE_SEG ("INIT")
 
NTSTATUS NTAPI PspMapSystemDll (IN PEPROCESS Process, IN PVOID *DllBase, IN BOOLEAN UseLargePages)
 
NTSTATUS NTAPI PsLocateSystemDll (VOID)
 
NTSTATUS NTAPI PspInitializeSystemDll (VOID)
 
BOOLEAN NTAPI PspInitPhase1 (VOID)
 
BOOLEAN NTAPI PspInitPhase0 (IN PLOADER_PARAMETER_BLOCK LoaderBlock)
 
BOOLEAN NTAPI PsInitSystem (IN PLOADER_PARAMETER_BLOCK LoaderBlock)
 
BOOLEAN NTAPI PsGetVersion (OUT PULONG MajorVersion OPTIONAL, OUT PULONG MinorVersion OPTIONAL, OUT PULONG BuildNumber OPTIONAL, OUT PUNICODE_STRING CSDVersion OPTIONAL)
 

Variables

ULONG ExpInitializationPhase
 
PVOID KeUserPopEntrySListEnd
 
PVOID KeUserPopEntrySListFault
 
PVOID KeUserPopEntrySListResume
 
GENERIC_MAPPING PspProcessMapping
 
GENERIC_MAPPING PspThreadMapping
 
PVOID PspSystemDllBase
 
PVOID PspSystemDllSection
 
PVOID PspSystemDllEntryPoint
 
UNICODE_STRING PsNtDllPathName
 
PHANDLE_TABLE PspCidTable
 
PEPROCESS PsInitialSystemProcess = NULL
 
PEPROCESS PsIdleProcess = NULL
 
HANDLE PspInitialSystemProcessHandle = NULL
 
ULONG PsMinimumWorkingSet
 
ULONG PsMaximumWorkingSet
 
struct {
   LIST_ENTRY   List
 
   KGUARDED_MUTEX   Lock
 
PspWorkingSetChangeHead
 
ULONG PspDefaultPagedLimit
 
ULONG PspDefaultNonPagedLimit
 
ULONG PspDefaultPagefileLimit
 
BOOLEAN PspDoingGiveBacks
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 12 of file psmgr.c.

Function Documentation

◆ CODE_SEG()

static CODE_SEG ( "INIT"  )
static

Definition at line 65 of file psmgr.c.

70{
71 /* Call the internal API */
73 Name,
74 EntryPoint,
75 NULL,
77}
#define NULL
Definition: types.h:112
NTSTATUS NTAPI RtlpFindExportedRoutineByName(_In_ PVOID ImageBase, _In_ PCSTR ExportName, _Out_ PVOID *Function, _Out_opt_ PBOOLEAN IsForwarder, _In_ NTSTATUS NotFoundStatus)
ReactOS-only helper routine for RtlFindExportedRoutineByName(), that provides a finer granularity reg...
Definition: sysldr.c:308
#define STATUS_PROCEDURE_NOT_FOUND
Definition: ntstatus.h:358
PVOID PspSystemDllBase
Definition: psmgr.c:41

◆ PsGetVersion()

BOOLEAN NTAPI PsGetVersion ( OUT PULONG MajorVersion  OPTIONAL,
OUT PULONG MinorVersion  OPTIONAL,
OUT PULONG BuildNumber  OPTIONAL,
OUT PUNICODE_STRING CSDVersion  OPTIONAL 
)

Definition at line 566 of file psmgr.c.

570{
573 if (BuildNumber ) *BuildNumber = NtBuildNumber & 0x3FFF;
574
575 if (CSDVersion)
576 {
577 CSDVersion->Length = CmCSDVersionString.Length;
578 CSDVersion->MaximumLength = CmCSDVersionString.MaximumLength;
579 CSDVersion->Buffer = CmCSDVersionString.Buffer;
580 }
581
582 /* Return TRUE if this is a Checked Build */
583 return (NtBuildNumber >> 28) == 0xC;
584}
ULONG BuildNumber
Definition: ros_glue.cpp:6
ULONG MajorVersion
Definition: ros_glue.cpp:4
ULONG MinorVersion
Definition: ros_glue.cpp:5
ULONG NtMajorVersion
Definition: init.c:45
ULONG NtMinorVersion
Definition: init.c:46
UNICODE_STRING CmCSDVersionString
Definition: init.c:62
ULONG NtBuildNumber
Definition: init.c:50
USHORT MaximumLength
Definition: env_spec_w32.h:370

◆ PsInitSystem()

BOOLEAN NTAPI PsInitSystem ( IN PLOADER_PARAMETER_BLOCK  LoaderBlock)

Definition at line 532 of file psmgr.c.

533{
534 /* Check the initialization phase */
536 {
537 case 0:
538
539 /* Do Phase 0 */
540 return PspInitPhase0(LoaderBlock);
541
542 case 1:
543
544 /* Do Phase 1 */
545 return PspInitPhase1();
546
547 default:
548
549 /* Don't know any other phase! Bugcheck! */
550 KeBugCheckEx(UNEXPECTED_INITIALIZATION_CALL,
551 1,
553 0,
554 0);
555 return FALSE;
556 }
557}
#define FALSE
Definition: types.h:117
ULONG ExpInitializationPhase
Definition: init.c:68
BOOLEAN NTAPI PspInitPhase1(VOID)
Definition: psmgr.c:304
BOOLEAN NTAPI PspInitPhase0(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: psmgr.c:314
VOID NTAPI KeBugCheckEx(_In_ ULONG BugCheckCode, _In_ ULONG_PTR BugCheckParameter1, _In_ ULONG_PTR BugCheckParameter2, _In_ ULONG_PTR BugCheckParameter3, _In_ ULONG_PTR BugCheckParameter4)
Definition: rtlcompat.c:108

Referenced by ExpInitializeExecutive(), and Phase1InitializationDiscard().

◆ PsLocateSystemDll()

NTSTATUS NTAPI PsLocateSystemDll ( VOID  )

Definition at line 187 of file psmgr.c.

188{
191 HANDLE FileHandle, SectionHandle;
193 ULONG_PTR HardErrorParameters;
194 ULONG HardErrorResponse;
195
196 /* Locate and open NTDLL to determine ImageBase and LdrStartup */
199 0,
200 NULL,
201 NULL);
207 0);
208 if (!NT_SUCCESS(Status))
209 {
210 /* Failed, bugcheck */
211 KeBugCheckEx(PROCESS1_INITIALIZATION_FAILED, Status, 2, 0, 0);
212 }
213
214 /* Check if the image is valid */
217 {
218 /* Raise a hard error */
219 HardErrorParameters = (ULONG_PTR)&PsNtDllPathName;
221 1,
222 1,
223 &HardErrorParameters,
224 OptionOk,
225 &HardErrorResponse);
226 return Status;
227 }
228
229 /* Create a section for NTDLL */
230 Status = ZwCreateSection(&SectionHandle,
232 NULL,
233 NULL,
235 SEC_IMAGE,
236 FileHandle);
238 if (!NT_SUCCESS(Status))
239 {
240 /* Failed, bugcheck */
241 KeBugCheckEx(PROCESS1_INITIALIZATION_FAILED, Status, 3, 0, 0);
242 }
243
244 /* Reference the Section */
245 Status = ObReferenceObjectByHandle(SectionHandle,
250 NULL);
251 ZwClose(SectionHandle);
252 if (!NT_SUCCESS(Status))
253 {
254 /* Failed, bugcheck */
255 KeBugCheckEx(PROCESS1_INITIALIZATION_FAILED, Status, 4, 0, 0);
256 }
257
258 /* Map it */
260 if (!NT_SUCCESS(Status))
261 {
262 /* Failed, bugcheck */
263 KeBugCheckEx(PROCESS1_INITIALIZATION_FAILED, Status, 5, 0, 0);
264 }
265
266 /* Return status */
267 return Status;
268}
LONG NTSTATUS
Definition: precomp.h:26
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
#define TRUE
Definition: types.h:120
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define FILE_SHARE_READ
Definition: compat.h:136
#define ULONG_PTR
Definition: config.h:101
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE FileHandle
Definition: fltkernel.h:1231
Status
Definition: gdiplustypes.h:25
NTSTATUS NTAPI NtRaiseHardError(IN NTSTATUS ErrorStatus, IN ULONG NumberOfParameters, IN ULONG UnicodeStringParameterMask, IN PULONG_PTR Parameters, IN ULONG ValidResponseOptions, OUT PULONG Response)
Definition: harderr.c:551
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define KernelMode
Definition: asm.h:34
@ OptionOk
Definition: extypes.h:187
NTSYSAPI NTSTATUS NTAPI ZwOpenFile(_Out_ PHANDLE FileHandle, _In_ ACCESS_MASK DesiredAccess, _In_ POBJECT_ATTRIBUTES ObjectAttributes, _Out_ PIO_STATUS_BLOCK IoStatusBlock, _In_ ULONG ShareAccess, _In_ ULONG OpenOptions)
#define SEC_IMAGE
Definition: mmtypes.h:97
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
#define SECTION_ALL_ACCESS
Definition: nt_native.h:1293
#define PAGE_EXECUTE
Definition: nt_native.h:1306
#define FILE_READ_ACCESS
Definition: nt_native.h:610
NTSTATUS NTAPI MmCheckSystemImage(IN HANDLE ImageHandle, IN BOOLEAN PurgeSection)
Definition: sysldr.c:2744
#define STATUS_IMAGE_CHECKSUM_MISMATCH
Definition: ntstatus.h:677
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
Definition: obref.c:494
NTSTATUS NTAPI PspMapSystemDll(IN PEPROCESS Process, IN PVOID *DllBase, IN BOOLEAN UseLargePages)
Definition: psmgr.c:153
UNICODE_STRING PsNtDllPathName
Definition: psmgr.c:45
PVOID PspSystemDllSection
Definition: psmgr.c:42
POBJECT_TYPE MmSectionObjectType
Definition: section.c:194
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59
#define PsGetCurrentProcess
Definition: psfuncs.h:17

Referenced by IoInitSystem().

◆ PspInitializeSystemDll()

NTSTATUS NTAPI PspInitializeSystemDll ( VOID  )

Definition at line 273 of file psmgr.c.

274{
276
277 /* Get user-mode startup thunk */
278 Status = PspLookupSystemDllEntryPoint("LdrInitializeThunk",
280 if (!NT_SUCCESS(Status))
281 {
282 /* Failed, bugcheck */
283 KeBugCheckEx(PROCESS1_INITIALIZATION_FAILED, Status, 7, 0, 0);
284 }
285
286 /* Get all the other entrypoints */
287 Status = PspLookupKernelUserEntryPoints();
288 if (!NT_SUCCESS(Status))
289 {
290 /* Failed, bugcheck */
291 KeBugCheckEx(PROCESS1_INITIALIZATION_FAILED, Status, 8, 0, 0);
292 }
293
294 /* Let KD know we are done */
296
297 /* Return status */
298 return Status;
299}
VOID NTAPI KdUpdateDataBlock(VOID)
Definition: kdinit.c:89
PVOID PspSystemDllEntryPoint
Definition: psmgr.c:43

Referenced by PspInitPhase1().

◆ PspInitPhase0()

BOOLEAN NTAPI PspInitPhase0 ( IN PLOADER_PARAMETER_BLOCK  LoaderBlock)

Definition at line 314 of file psmgr.c.

315{
318 HANDLE SysThreadHandle;
319 PETHREAD SysThread;
320 MM_SYSTEMSIZE SystemSize;
322 OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
323 ULONG i;
324
325 /* Get the system size */
326 SystemSize = MmQuerySystemSize();
327
328 /* Setup some memory options */
330 switch (SystemSize)
331 {
332 /* Medimum systems */
333 case MmMediumSystem:
334
335 /* Increase the WS sizes a bit */
337 PsMaximumWorkingSet += 100;
338
339 /* Large systems */
340 case MmLargeSystem:
341
342 /* Increase the WS sizes a bit more */
344 PsMaximumWorkingSet += 300;
345
346 /* Small and other systems */
347 default:
348 break;
349 }
350
351 /* Setup callbacks */
352 for (i = 0; i < PSP_MAX_CREATE_THREAD_NOTIFY; i++)
353 {
355 }
356 for (i = 0; i < PSP_MAX_CREATE_PROCESS_NOTIFY; i++)
357 {
359 }
360 for (i = 0; i < PSP_MAX_LOAD_IMAGE_NOTIFY; i++)
361 {
363 }
364
365 /* Setup the quantum table */
367
368 /* Set quota settings */
372 {
373 /* Enable give-backs */
375 }
376 else
377 {
378 /* Disable them */
380 }
381
382 /* Now multiply limits by 1MB */
386
387 /* Initialize the Active Process List */
390
391 /* Get the idle process */
393
394 /* Setup the locks */
397
398 /* Initialize the thread list */
400
401 /* Clear kernel time */
403
404 /* Initialize Object Initializer */
405 RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
406 ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
407 ObjectTypeInitializer.InvalidAttributes = OBJ_PERMANENT |
410 ObjectTypeInitializer.PoolType = NonPagedPool;
411 ObjectTypeInitializer.SecurityRequired = TRUE;
412
413 /* Initialize the Process type */
414 RtlInitUnicodeString(&Name, L"Process");
415 ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(EPROCESS);
416 ObjectTypeInitializer.GenericMapping = PspProcessMapping;
417 ObjectTypeInitializer.ValidAccessMask = PROCESS_ALL_ACCESS;
418 ObjectTypeInitializer.DeleteProcedure = PspDeleteProcess;
419 ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &PsProcessType);
420
421 /* Initialize the Thread type */
422 RtlInitUnicodeString(&Name, L"Thread");
423 ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
424 ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(ETHREAD);
425 ObjectTypeInitializer.GenericMapping = PspThreadMapping;
426 ObjectTypeInitializer.ValidAccessMask = THREAD_ALL_ACCESS;
427 ObjectTypeInitializer.DeleteProcedure = PspDeleteThread;
428 ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &PsThreadType);
429
430 /* Initialize the Job type */
432 ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
433 ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(EJOB);
434 ObjectTypeInitializer.GenericMapping = PspJobMapping;
435 ObjectTypeInitializer.InvalidAttributes = 0;
436 ObjectTypeInitializer.ValidAccessMask = JOB_OBJECT_ALL_ACCESS;
437 ObjectTypeInitializer.DeleteProcedure = PspDeleteJob;
438 ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &PsJobType);
439
440 /* Initialize job structures external to this file */
442
443 /* Initialize the Working Set data */
446
447 /* Create the CID Handle table */
449 if (!PspCidTable) return FALSE;
450
451 /* FIXME: Initialize LDT/VDM support */
452
453 /* Setup the reaper */
455
456 /* Set the boot access token */
458
459 /* Setup default object attributes */
461 NULL,
462 0,
463 NULL,
464 NULL);
465
466 /* Create the Initial System Process */
470 0,
471 FALSE,
472 0,
473 0,
474 0,
475 FALSE);
476 if (!NT_SUCCESS(Status)) return FALSE;
477
478 /* Get a reference to it */
480 0,
484 NULL);
485
486 /* Copy the process names */
489
490 /* Allocate a structure for the audit name */
494 TAG_SEPA);
496 {
497 /* Allocation failed */
498 return FALSE;
499 }
500
501 /* Zero it */
503 SeAuditProcessCreationInfo.ImageFileName,
505
506 /* Setup the system initialization thread */
507 Status = PsCreateSystemThread(&SysThreadHandle,
510 0,
511 NULL,
513 LoaderBlock);
514 if (!NT_SUCCESS(Status)) return FALSE;
515
516 /* Create a handle to it */
517 ObReferenceObjectByHandle(SysThreadHandle,
518 0,
521 (PVOID*)&SysThread,
522 NULL);
523 ObCloseHandle(SysThreadHandle, KernelMode);
524
525 /* Return success */
526 return TRUE;
527}
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
struct NameRec_ * Name
Definition: cdprocs.h:460
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define NonPagedPool
Definition: env_spec_w32.h:307
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define PagedPool
Definition: env_spec_w32.h:308
#define MAX_FAST_REFS
Definition: ex.h:133
#define ExInitializeRundownProtection
Definition: ex.h:137
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
VOID FASTCALL KeInitializeGuardedMutex(OUT PKGUARDED_MUTEX GuardedMutex)
Definition: gmutex.c:31
struct _EPROCESS EPROCESS
#define JOB_OBJECT_ALL_ACCESS
Definition: pstypes.h:205
struct _EJOB EJOB
struct _ETHREAD ETHREAD
#define OBJ_OPENIF
Definition: winternl.h:229
#define OBJ_EXCLUSIVE
Definition: winternl.h:227
#define OBJ_PERMANENT
Definition: winternl.h:226
MM_SYSTEMSIZE NTAPI MmQuerySystemSize(VOID)
Definition: mmsup.c:257
struct _TOKEN * PTOKEN
#define THREAD_ALL_ACCESS
Definition: nt_native.h:1339
#define PROCESS_ALL_ACCESS
Definition: nt_native.h:1324
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
VOID NTAPI ExInitializeCallBack(IN OUT PEX_CALLBACK Callback)
Definition: callback.c:46
PHANDLE_TABLE NTAPI ExCreateHandleTable(IN PEPROCESS Process OPTIONAL)
Definition: handle.c:801
VOID NTAPI Phase1Initialization(IN PVOID Context)
Definition: init.c:2023
POBJECT_TYPE PsProcessType
Definition: process.c:20
POBJECT_TYPE PsThreadType
Definition: thread.c:20
NTSTATUS NTAPI PsCreateSystemThread(OUT PHANDLE ThreadHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN HANDLE ProcessHandle, IN PCLIENT_ID ClientId, IN PKSTART_ROUTINE StartRoutine, IN PVOID StartContext)
Definition: thread.c:602
#define L(x)
Definition: ntvdm.h:50
NTSTATUS NTAPI ObCloseHandle(IN HANDLE Handle, IN KPROCESSOR_MODE AccessMode)
Definition: obhandle.c:3379
NTSTATUS NTAPI ObCreateObjectType(IN PUNICODE_STRING TypeName, IN POBJECT_TYPE_INITIALIZER ObjectTypeInitializer, IN PVOID Reserved, OUT POBJECT_TYPE *ObjectType)
Definition: oblife.c:1136
EX_CALLBACK PspLoadImageNotifyRoutine[PSP_MAX_LOAD_IMAGE_NOTIFY]
Definition: psnotify.c:23
VOID NTAPI PspDeleteProcess(IN PVOID ObjectBody)
Definition: kill.c:253
VOID NTAPI PspInitializeJobStructures(VOID)
Definition: job.c:111
#define PSP_MAX_CREATE_PROCESS_NOTIFY
Definition: ps.h:66
EX_CALLBACK PspThreadNotifyRoutine[PSP_MAX_CREATE_THREAD_NOTIFY]
Definition: psnotify.c:21
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)
Definition: process.c:347
LIST_ENTRY PsActiveProcessHead
Definition: process.c:22
VOID NTAPI PsChangeQuantumTable(IN BOOLEAN Immediate, IN ULONG PrioritySeparation)
Definition: process.c:235
VOID NTAPI PspDeleteThread(IN PVOID ObjectBody)
Definition: kill.c:391
VOID NTAPI PspDeleteJob(IN PVOID ObjectBody)
ULONG PsRawPrioritySeparation
Definition: process.c:27
#define PSP_MAX_LOAD_IMAGE_NOTIFY
Definition: ps.h:65
#define PSP_MAX_CREATE_THREAD_NOTIFY
Definition: ps.h:64
PTOKEN PspBootAccessToken
Definition: security.c:17
GENERIC_MAPPING PspJobMapping
Definition: job.c:41
WORK_QUEUE_ITEM PspReaperWorkItem
Definition: kill.c:20
VOID NTAPI PspReapRoutine(IN PVOID Context)
Definition: kill.c:167
KGUARDED_MUTEX PspActiveProcessMutex
Definition: process.c:23
EX_CALLBACK PspProcessNotifyRoutine[PSP_MAX_CREATE_PROCESS_NOTIFY]
Definition: psnotify.c:22
POBJECT_TYPE PsJobType
Definition: job.c:20
ULONG PspDefaultNonPagedLimit
Definition: psmgr.c:60
HANDLE PspInitialSystemProcessHandle
Definition: psmgr.c:52
ULONG PspDefaultPagefileLimit
Definition: psmgr.c:60
struct @1829 PspWorkingSetChangeHead
GENERIC_MAPPING PspProcessMapping
Definition: psmgr.c:21
PEPROCESS PsInitialSystemProcess
Definition: psmgr.c:50
PHANDLE_TABLE PspCidTable
Definition: psmgr.c:48
ULONG PsMaximumWorkingSet
Definition: psmgr.c:54
ULONG PsMinimumWorkingSet
Definition: psmgr.c:54
ULONG PspDefaultPagedLimit
Definition: psmgr.c:60
BOOLEAN PspDoingGiveBacks
Definition: psmgr.c:61
GENERIC_MAPPING PspThreadMapping
Definition: psmgr.c:32
PEPROCESS PsIdleProcess
Definition: psmgr.c:51
LIST_ENTRY ThreadListHead
Definition: pstypes.h:1329
KPROCESS Pcb
Definition: pstypes.h:1262
EX_FAST_REF Token
Definition: pstypes.h:1287
EX_PUSH_LOCK ProcessLock
Definition: pstypes.h:1263
SE_AUDIT_PROCESS_CREATION_INFO SeAuditProcessCreationInfo
Definition: pstypes.h:1355
CHAR ImageFileName[16]
Definition: pstypes.h:1326
EX_RUNDOWN_REF RundownProtect
Definition: pstypes.h:1266
ULONG_PTR Value
Definition: extypes.h:424
ULONG_PTR Value
Definition: extypes.h:465
ULONG KernelTime
Definition: ketypes.h:2102
GENERIC_MAPPING GenericMapping
Definition: obtypes.h:358
OB_DELETE_METHOD DeleteProcedure
Definition: obtypes.h:369
ULONG DefaultNonPagedPoolCharge
Definition: obtypes.h:365
POBJECT_NAME_INFORMATION ImageFileName
Definition: setypes.h:179
#define TAG_SEPA
Definition: tag.h:156
#define MAXULONG
Definition: typedefs.h:251
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define ExInitializeWorkItem(Item, Routine, Context)
Definition: exfuncs.h:265
enum _MM_SYSTEM_SIZE MM_SYSTEMSIZE
@ MmLargeSystem
Definition: mmtypes.h:147
@ MmMediumSystem
Definition: mmtypes.h:146

Referenced by PsInitSystem().

◆ PspInitPhase1()

BOOLEAN NTAPI PspInitPhase1 ( VOID  )

Definition at line 304 of file psmgr.c.

305{
306 /* Initialize the System DLL and return status of operation */
308 return TRUE;
309}
NTSTATUS NTAPI PspInitializeSystemDll(VOID)
Definition: psmgr.c:273

Referenced by PsInitSystem().

◆ PspMapSystemDll()

NTSTATUS NTAPI PspMapSystemDll ( IN PEPROCESS  Process,
IN PVOID DllBase,
IN BOOLEAN  UseLargePages 
)

Definition at line 153 of file psmgr.c.

156{
158 LARGE_INTEGER Offset = {{0, 0}};
159 SIZE_T ViewSize = 0;
160 PVOID ImageBase = 0;
161
162 /* Map the System DLL */
164 Process,
165 (PVOID*)&ImageBase,
166 0,
167 0,
168 &Offset,
169 &ViewSize,
170 ViewShare,
171 0,
173 if (Status != STATUS_SUCCESS)
174 {
175 /* Normalize status code */
177 }
178
179 /* Write the image base and return status */
180 if (DllBase) *DllBase = ImageBase;
181 return Status;
182}
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:223
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID _In_ ULONG_PTR _In_ SIZE_T _Inout_opt_ PLARGE_INTEGER _Inout_ PSIZE_T ViewSize
Definition: mmfuncs.h:408
#define PAGE_READWRITE
Definition: nt_native.h:1304
@ ViewShare
Definition: nt_native.h:1278
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
#define STATUS_CONFLICTING_ADDRESSES
Definition: ntstatus.h:261
NTSTATUS NTAPI MmMapViewOfSection(IN PVOID SectionObject, IN PEPROCESS Process, IN OUT PVOID *BaseAddress, IN ULONG_PTR ZeroBits, IN SIZE_T CommitSize, IN OUT PLARGE_INTEGER SectionOffset OPTIONAL, IN OUT PSIZE_T ViewSize, IN SECTION_INHERIT InheritDisposition, IN ULONG AllocationType, IN ULONG Protect)
Definition: section.c:3996
#define STATUS_SUCCESS
Definition: shellext.h:65
ULONG_PTR SIZE_T
Definition: typedefs.h:80

Referenced by PsLocateSystemDll().

Variable Documentation

◆ ExpInitializationPhase

ULONG ExpInitializationPhase
extern

Definition at line 68 of file init.c.

Referenced by PsInitSystem().

◆ KeUserPopEntrySListEnd

PVOID KeUserPopEntrySListEnd

Definition at line 17 of file psmgr.c.

◆ KeUserPopEntrySListFault

PVOID KeUserPopEntrySListFault

Definition at line 18 of file psmgr.c.

Referenced by KiCheckForSListFault().

◆ KeUserPopEntrySListResume

PVOID KeUserPopEntrySListResume

Definition at line 19 of file psmgr.c.

Referenced by KiCheckForSListFault().

◆ List

Definition at line 57 of file psmgr.c.

◆ Lock

Definition at line 58 of file psmgr.c.

◆ PsIdleProcess

PEPROCESS PsIdleProcess = NULL

◆ PsInitialSystemProcess

◆ PsMaximumWorkingSet

ULONG PsMaximumWorkingSet

Definition at line 54 of file psmgr.c.

Referenced by PspInitPhase0().

◆ PsMinimumWorkingSet

ULONG PsMinimumWorkingSet

Definition at line 54 of file psmgr.c.

Referenced by PspCreateProcess(), and PspInitPhase0().

◆ PsNtDllPathName

UNICODE_STRING PsNtDllPathName
Initial value:
=
RTL_CONSTANT_STRING(L"\\SystemRoot\\System32\\ntdll.dll")
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14

Definition at line 45 of file psmgr.c.

Referenced by DbgkCreateThread(), and PsLocateSystemDll().

◆ PspCidTable

◆ PspDefaultNonPagedLimit

ULONG PspDefaultNonPagedLimit

Definition at line 60 of file psmgr.c.

Referenced by PspInitPhase0().

◆ PspDefaultPagedLimit

ULONG PspDefaultPagedLimit

Definition at line 60 of file psmgr.c.

Referenced by PspInitPhase0().

◆ PspDefaultPagefileLimit

ULONG PspDefaultPagefileLimit

Definition at line 60 of file psmgr.c.

Referenced by PspInitPhase0().

◆ PspDoingGiveBacks

BOOLEAN PspDoingGiveBacks

Definition at line 61 of file psmgr.c.

Referenced by PspInitPhase0().

◆ PspInitialSystemProcessHandle

HANDLE PspInitialSystemProcessHandle = NULL

Definition at line 52 of file psmgr.c.

Referenced by PspInitPhase0().

◆ PspProcessMapping

GENERIC_MAPPING PspProcessMapping
Initial value:
=
{
}
#define PROCESS_SUSPEND_RESUME
Definition: pstypes.h:167
#define PROCESS_TERMINATE
Definition: pstypes.h:157
#define PROCESS_VM_READ
Definition: pstypes.h:161
#define PROCESS_QUERY_INFORMATION
Definition: pstypes.h:166
#define PROCESS_VM_WRITE
Definition: pstypes.h:162
#define PROCESS_CREATE_THREAD
Definition: pstypes.h:158
#define PROCESS_VM_OPERATION
Definition: pstypes.h:160
#define PROCESS_SET_INFORMATION
Definition: pstypes.h:165
#define PROCESS_CREATE_PROCESS
Definition: pstypes.h:163
#define PROCESS_SET_QUOTA
Definition: pstypes.h:164
#define PROCESS_DUP_HANDLE
#define SYNCHRONIZE
Definition: nt_native.h:61
#define STANDARD_RIGHTS_READ
Definition: nt_native.h:65
#define STANDARD_RIGHTS_WRITE
Definition: nt_native.h:66
#define STANDARD_RIGHTS_EXECUTE
Definition: nt_native.h:67

Definition at line 21 of file psmgr.c.

Referenced by PspInitPhase0().

◆ PspSystemDllBase

PVOID PspSystemDllBase

Definition at line 41 of file psmgr.c.

Referenced by CODE_SEG(), DbgkCreateThread(), PsLocateSystemDll(), and PspUserThreadStartup().

◆ PspSystemDllEntryPoint

PVOID PspSystemDllEntryPoint

Definition at line 43 of file psmgr.c.

Referenced by PspInitializeSystemDll(), and PspUserThreadStartup().

◆ PspSystemDllSection

PVOID PspSystemDllSection

Definition at line 42 of file psmgr.c.

Referenced by PsLocateSystemDll(), and PspMapSystemDll().

◆ PspThreadMapping

GENERIC_MAPPING PspThreadMapping
Initial value:
=
{
}
#define THREAD_QUERY_INFORMATION
Definition: pstypes.h:149
#define THREAD_SET_CONTEXT
#define THREAD_ALERT
#define THREAD_SUSPEND_RESUME
#define THREAD_GET_CONTEXT
#define THREAD_TERMINATE
Definition: nt_native.h:1336
#define THREAD_SET_INFORMATION
Definition: nt_native.h:1337

Definition at line 32 of file psmgr.c.

Referenced by PspInitPhase0().

◆ 

struct { ... } PspWorkingSetChangeHead

Referenced by PspInitPhase0().