mirror of
https://github.com/reactos/reactos.git
synced 2024-10-01 23:14:53 +00:00
- Move a bunch of externs to ps.h and delete many dupped/tripped ones.
- Change FAST_MUTEX PsActiveProcessMutex to KGUARDED_MUTEX. - Define PS Flags and use them, isntead of magic numbers. (For magic mushrooms, you'll have to wait a while, these aren't implemented yet). svn path=/trunk/; revision=23194
This commit is contained in:
parent
a74eda7fe8
commit
a92681004e
|
@ -180,6 +180,37 @@ extern NTSYSAPI POBJECT_TYPE PsProcessType;
|
||||||
#define STA_ADDRESS_SPACE_OWNER_BIT 0x4
|
#define STA_ADDRESS_SPACE_OWNER_BIT 0x4
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//
|
||||||
|
// Process Flags
|
||||||
|
//
|
||||||
|
#define PSF_CREATE_REPORTED_BIT 0x1
|
||||||
|
#define PSF_NO_DEBUG_INHERIT_BIT 0x2
|
||||||
|
#define PSF_PROCESS_EXITING_BIT 0x4
|
||||||
|
#define PSF_PROCESS_DELETE_BIT 0x8
|
||||||
|
#define PSF_WOW64_SPLIT_PAGES_BIT 0x10
|
||||||
|
#define PSF_VM_DELETED_BIT 0x20
|
||||||
|
#define PSF_OUTSWAP_ENABLED_BIT 0x40
|
||||||
|
#define PSF_OUTSWAPPED_BIT 0x80
|
||||||
|
#define PSF_FORK_FAILED_BIT 0x100
|
||||||
|
#define PSF_WOW64_VA_SPACE_4GB_BIT 0x200
|
||||||
|
#define PSF_ADDRESS_SPACE_INITIALIZED_BIT 0x400
|
||||||
|
#define PSF_SET_TIMER_RESOLUTION_BIT 0x1000
|
||||||
|
#define PSF_BREAK_ON_TERMINATION_BIT 0x2000
|
||||||
|
#define PSF_SESSION_CREATION_UNDERWAY_BIT 0x4000
|
||||||
|
#define PSF_WRITE_WATCH_BIT 0x8000
|
||||||
|
#define PSF_PROCESS_IN_SESSION_BIT 0x10000
|
||||||
|
#define PSF_OVERRIDE_ADDRESS_SPACE_BIT 0x20000
|
||||||
|
#define PSF_HAS_ADDRESS_SPACE_BIT 0x40000
|
||||||
|
#define PSF_LAUNCH_PREFETCHED_BIT 0x80000
|
||||||
|
#define PSF_INJECT_INPAGE_ERRORS_BIT 0x100000
|
||||||
|
#define PSF_VM_TOP_DOWN_BIT 0x200000
|
||||||
|
#define PSF_IMAGE_NOTIFY_DONE_BIT 0x400000
|
||||||
|
#define PSF_PDE_UPDATE_NEEDED_BIT 0x800000
|
||||||
|
#define PSF_VDM_ALLOWED_BIT 0x1000000
|
||||||
|
#define PSF_SWAP_ALLOWED_BIT 0x2000000
|
||||||
|
#define PSF_CREATE_FAILED_BIT 0x4000000
|
||||||
|
#define PSF_DEFAULT_IO_PRIORITY_BIT 0x8000000
|
||||||
|
|
||||||
#ifdef NTOS_MODE_USER
|
#ifdef NTOS_MODE_USER
|
||||||
//
|
//
|
||||||
// Current Process/Thread built-in 'special' handles
|
// Current Process/Thread built-in 'special' handles
|
||||||
|
|
|
@ -20,6 +20,7 @@ DbgkCopyProcessDebugPort(
|
||||||
IN PEPROCESS Parent
|
IN PEPROCESS Parent
|
||||||
);
|
);
|
||||||
|
|
||||||
|
extern POBJECT_TYPE DbgkDebugObjectType;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -390,9 +390,10 @@ extern BOOLEAN PspReaping;
|
||||||
extern PEPROCESS PsInitialSystemProcess;
|
extern PEPROCESS PsInitialSystemProcess;
|
||||||
extern PEPROCESS PsIdleProcess;
|
extern PEPROCESS PsIdleProcess;
|
||||||
extern LIST_ENTRY PsActiveProcessHead;
|
extern LIST_ENTRY PsActiveProcessHead;
|
||||||
extern FAST_MUTEX PspActiveProcessMutex;
|
extern KGUARDED_MUTEX PspActiveProcessMutex;
|
||||||
extern LARGE_INTEGER ShortPsLockDelay, PsLockTimeout;
|
extern LARGE_INTEGER ShortPsLockDelay, PsLockTimeout;
|
||||||
extern EPROCESS_QUOTA_BLOCK PspDefaultQuotaBlock;
|
extern EPROCESS_QUOTA_BLOCK PspDefaultQuotaBlock;
|
||||||
|
extern PHANDLE_TABLE PspCidTable;
|
||||||
extern PCREATE_THREAD_NOTIFY_ROUTINE
|
extern PCREATE_THREAD_NOTIFY_ROUTINE
|
||||||
PspThreadNotifyRoutine[PSP_MAX_CREATE_THREAD_NOTIFY];
|
PspThreadNotifyRoutine[PSP_MAX_CREATE_THREAD_NOTIFY];
|
||||||
extern PCREATE_PROCESS_NOTIFY_ROUTINE
|
extern PCREATE_PROCESS_NOTIFY_ROUTINE
|
||||||
|
@ -401,6 +402,10 @@ extern PLOAD_IMAGE_NOTIFY_ROUTINE
|
||||||
PspLoadImageNotifyRoutine[PSP_MAX_LOAD_IMAGE_NOTIFY];
|
PspLoadImageNotifyRoutine[PSP_MAX_LOAD_IMAGE_NOTIFY];
|
||||||
extern PLEGO_NOTIFY_ROUTINE PspLegoNotifyRoutine;
|
extern PLEGO_NOTIFY_ROUTINE PspLegoNotifyRoutine;
|
||||||
extern ULONG PspThreadNotifyRoutineCount;
|
extern ULONG PspThreadNotifyRoutineCount;
|
||||||
|
extern PKWIN32_PROCESS_CALLOUT PspW32ProcessCallout;
|
||||||
|
extern PKWIN32_THREAD_CALLOUT PspW32ThreadCallout;
|
||||||
|
extern PVOID PspSystemDllEntryPoint;
|
||||||
|
extern PVOID PspSystemDllBase;
|
||||||
|
|
||||||
#include "ps_x.h"
|
#include "ps_x.h"
|
||||||
|
|
||||||
|
|
|
@ -18,10 +18,6 @@
|
||||||
#pragma alloc_text(INIT, PsInitIdleThread)
|
#pragma alloc_text(INIT, PsInitIdleThread)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* GLOBALS *******************************************************************/
|
|
||||||
|
|
||||||
extern PEPROCESS PsIdleProcess;
|
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
/** System idle thread procedure
|
/** System idle thread procedure
|
||||||
|
|
|
@ -18,13 +18,6 @@
|
||||||
|
|
||||||
LIST_ENTRY PspReaperListHead = {0};
|
LIST_ENTRY PspReaperListHead = {0};
|
||||||
WORK_QUEUE_ITEM PspReaperWorkItem;
|
WORK_QUEUE_ITEM PspReaperWorkItem;
|
||||||
extern LIST_ENTRY PsActiveProcessHead;
|
|
||||||
extern FAST_MUTEX PspActiveProcessMutex;
|
|
||||||
extern PHANDLE_TABLE PspCidTable;
|
|
||||||
extern PKWIN32_PROCESS_CALLOUT PspW32ProcessCallout;
|
|
||||||
extern PKWIN32_THREAD_CALLOUT PspW32ThreadCallout;
|
|
||||||
extern PEPROCESS PsInitialSystemProcess;
|
|
||||||
extern PEPROCESS PsIdleProcess;
|
|
||||||
|
|
||||||
/* PRIVATE FUNCTIONS *********************************************************/
|
/* PRIVATE FUNCTIONS *********************************************************/
|
||||||
|
|
||||||
|
@ -45,7 +38,7 @@ PspTerminateProcess(IN PEPROCESS Process,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the delete flag */
|
/* Set the delete flag */
|
||||||
InterlockedOr((PLONG)&Process->Flags, 8);
|
InterlockedOr((PLONG)&Process->Flags, PSF_PROCESS_DELETE_BIT);
|
||||||
|
|
||||||
/* Get the first thread */
|
/* Get the first thread */
|
||||||
Thread = PsGetNextProcessThread(Process, Thread);
|
Thread = PsGetNextProcessThread(Process, Thread);
|
||||||
|
@ -147,9 +140,9 @@ PspDeleteProcess(PVOID ObjectBody)
|
||||||
if (Process->ActiveProcessLinks.Flink)
|
if (Process->ActiveProcessLinks.Flink)
|
||||||
{
|
{
|
||||||
/* Remove it from the Active List */
|
/* Remove it from the Active List */
|
||||||
ExAcquireFastMutex(&PspActiveProcessMutex);
|
KeAcquireGuardedMutex(&PspActiveProcessMutex);
|
||||||
RemoveEntryList(&Process->ActiveProcessLinks);
|
RemoveEntryList(&Process->ActiveProcessLinks);
|
||||||
ExReleaseFastMutex(&PspActiveProcessMutex);
|
KeReleaseGuardedMutex(&PspActiveProcessMutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for Auditing information */
|
/* Check for Auditing information */
|
||||||
|
@ -401,7 +394,7 @@ PspExitThread(NTSTATUS ExitStatus)
|
||||||
if (!(--CurrentProcess->ActiveThreads))
|
if (!(--CurrentProcess->ActiveThreads))
|
||||||
{
|
{
|
||||||
/* Set the delete flag */
|
/* Set the delete flag */
|
||||||
InterlockedOr((PLONG)&CurrentProcess->Flags, 8);
|
InterlockedOr((PLONG)&CurrentProcess->Flags, PSF_PROCESS_DELETE_BIT);
|
||||||
|
|
||||||
/* Remember we are last */
|
/* Remember we are last */
|
||||||
Last = TRUE;
|
Last = TRUE;
|
||||||
|
@ -820,7 +813,7 @@ PspTerminateThreadByPointer(PETHREAD Thread,
|
||||||
ASSERT_IRQL(PASSIVE_LEVEL);
|
ASSERT_IRQL(PASSIVE_LEVEL);
|
||||||
|
|
||||||
/* Mark it as terminated */
|
/* Mark it as terminated */
|
||||||
InterlockedOr((PLONG)&Thread->CrossThreadFlags, 1);
|
InterlockedOr((PLONG)&Thread->CrossThreadFlags, CT_TERMINATED_BIT);
|
||||||
|
|
||||||
/* Directly terminate the thread */
|
/* Directly terminate the thread */
|
||||||
PspExitThread(ExitStatus);
|
PspExitThread(ExitStatus);
|
||||||
|
@ -878,8 +871,8 @@ PspExitProcess(IN BOOLEAN LastThread,
|
||||||
ULONG Actual;
|
ULONG Actual;
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
/* Set Process Delete flag */
|
/* Set Process Exit flag */
|
||||||
InterlockedOr((PLONG)&Process->Flags, 4);
|
InterlockedOr((PLONG)&Process->Flags, PSF_PROCESS_EXITING_BIT);
|
||||||
|
|
||||||
/* Check if we are the last thread */
|
/* Check if we are the last thread */
|
||||||
if (LastThread)
|
if (LastThread)
|
||||||
|
@ -992,8 +985,9 @@ NtTerminateProcess(IN HANDLE ProcessHandle OPTIONAL,
|
||||||
/* Lock the Process */
|
/* Lock the Process */
|
||||||
ExAcquireRundownProtection(&Process->RundownProtect);
|
ExAcquireRundownProtection(&Process->RundownProtect);
|
||||||
|
|
||||||
/* Set the exit flag */
|
/* Set the delete flag */
|
||||||
if (!KillByHandle) InterlockedOr((PLONG)&Process->Flags, 8);
|
if (!KillByHandle) InterlockedOr((PLONG)&Process->Flags,
|
||||||
|
PSF_PROCESS_DELETE_BIT);
|
||||||
|
|
||||||
/* Get the first thread */
|
/* Get the first thread */
|
||||||
Status = STATUS_NOTHING_TO_TERMINATE;
|
Status = STATUS_NOTHING_TO_TERMINATE;
|
||||||
|
|
|
@ -18,14 +18,12 @@
|
||||||
PEPROCESS PsInitialSystemProcess = NULL;
|
PEPROCESS PsInitialSystemProcess = NULL;
|
||||||
PEPROCESS PsIdleProcess = NULL;
|
PEPROCESS PsIdleProcess = NULL;
|
||||||
POBJECT_TYPE PsProcessType = NULL;
|
POBJECT_TYPE PsProcessType = NULL;
|
||||||
extern PHANDLE_TABLE PspCidTable;
|
|
||||||
extern POBJECT_TYPE DbgkDebugObjectType;
|
|
||||||
|
|
||||||
EPROCESS_QUOTA_BLOCK PspDefaultQuotaBlock;
|
EPROCESS_QUOTA_BLOCK PspDefaultQuotaBlock;
|
||||||
ULONG PsMinimumWorkingSet, PsMaximumWorkingSet;
|
ULONG PsMinimumWorkingSet, PsMaximumWorkingSet;
|
||||||
|
|
||||||
LIST_ENTRY PsActiveProcessHead;
|
LIST_ENTRY PsActiveProcessHead;
|
||||||
FAST_MUTEX PspActiveProcessMutex;
|
KGUARDED_MUTEX PspActiveProcessMutex;
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
LARGE_INTEGER ShortPsLockDelay, PsLockTimeout;
|
LARGE_INTEGER ShortPsLockDelay, PsLockTimeout;
|
||||||
|
@ -182,7 +180,7 @@ PsGetNextProcess(IN PEPROCESS OldProcess)
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
/* Acquire the Active Process Lock */
|
/* Acquire the Active Process Lock */
|
||||||
ExAcquireFastMutex(&PspActiveProcessMutex);
|
KeAcquireGuardedMutex(&PspActiveProcessMutex);
|
||||||
|
|
||||||
/* Check if we're already starting somewhere */
|
/* Check if we're already starting somewhere */
|
||||||
if (OldProcess)
|
if (OldProcess)
|
||||||
|
@ -209,7 +207,7 @@ PsGetNextProcess(IN PEPROCESS OldProcess)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Release the lock */
|
/* Release the lock */
|
||||||
ExReleaseFastMutex(&PspActiveProcessMutex);
|
KeReleaseGuardedMutex(&PspActiveProcessMutex);
|
||||||
|
|
||||||
/* Reference the Process we had referenced earlier */
|
/* Reference the Process we had referenced earlier */
|
||||||
if (OldProcess) ObDereferenceObject(OldProcess);
|
if (OldProcess) ObDereferenceObject(OldProcess);
|
||||||
|
@ -396,7 +394,7 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
|
||||||
if (Flags & PS_NO_DEBUG_INHERIT)
|
if (Flags & PS_NO_DEBUG_INHERIT)
|
||||||
{
|
{
|
||||||
/* Set the process flag */
|
/* Set the process flag */
|
||||||
InterlockedOr((PLONG)&Process->Flags, 2);
|
InterlockedOr((PLONG)&Process->Flags, PSF_NO_DEBUG_INHERIT_BIT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -444,7 +442,7 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
|
||||||
&DirectoryTableBase);
|
&DirectoryTableBase);
|
||||||
|
|
||||||
/* We now have an address space */
|
/* We now have an address space */
|
||||||
InterlockedOr((PLONG)&Process->Flags, 0x40000);
|
InterlockedOr((PLONG)&Process->Flags, PSF_HAS_ADDRESS_SPACE_BIT);
|
||||||
|
|
||||||
/* Set the maximum WS */
|
/* Set the maximum WS */
|
||||||
Process->Vm.MaximumWorkingSetSize = MaxWs;
|
Process->Vm.MaximumWorkingSetSize = MaxWs;
|
||||||
|
@ -524,9 +522,9 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The process can now be activated */
|
/* The process can now be activated */
|
||||||
ExAcquireFastMutex(&PspActiveProcessMutex);
|
KeAcquireGuardedMutex(&PspActiveProcessMutex);
|
||||||
InsertTailList(&PsActiveProcessHead, &Process->ActiveProcessLinks);
|
InsertTailList(&PsActiveProcessHead, &Process->ActiveProcessLinks);
|
||||||
ExReleaseFastMutex(&PspActiveProcessMutex);
|
KeReleaseGuardedMutex(&PspActiveProcessMutex);
|
||||||
|
|
||||||
/* FIXME: SeCreateAccessStateEx */
|
/* FIXME: SeCreateAccessStateEx */
|
||||||
|
|
||||||
|
|
|
@ -157,7 +157,7 @@ PsInitProcessManagment(VOID)
|
||||||
ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &PsProcessType);
|
ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &PsProcessType);
|
||||||
|
|
||||||
InitializeListHead(&PsActiveProcessHead);
|
InitializeListHead(&PsActiveProcessHead);
|
||||||
ExInitializeFastMutex(&PspActiveProcessMutex);
|
KeInitializeGuardedMutex(&PspActiveProcessMutex);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize the default quota block.
|
* Initialize the default quota block.
|
||||||
|
|
|
@ -15,9 +15,6 @@
|
||||||
|
|
||||||
/* GLOBALS ******************************************************************/
|
/* GLOBALS ******************************************************************/
|
||||||
|
|
||||||
extern PVOID PspSystemDllEntryPoint;
|
|
||||||
extern PVOID PspSystemDllBase;
|
|
||||||
extern PHANDLE_TABLE PspCidTable;
|
|
||||||
extern BOOLEAN CcPfEnablePrefetcher;
|
extern BOOLEAN CcPfEnablePrefetcher;
|
||||||
extern ULONG MmReadClusterSize;
|
extern ULONG MmReadClusterSize;
|
||||||
POBJECT_TYPE PsThreadType = NULL;
|
POBJECT_TYPE PsThreadType = NULL;
|
||||||
|
|
Loading…
Reference in a new issue