2000-10-07 13:41:58 +00:00
|
|
|
/*
|
|
|
|
* ReactOS kernel
|
|
|
|
* Copyright (C) 2000 David Welch <welch@cwcom.net>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*/
|
2005-01-03 01:13:10 +00:00
|
|
|
/* $Id$
|
2001-09-07 21:37:47 +00:00
|
|
|
*
|
2000-10-07 13:41:58 +00:00
|
|
|
* FILE: ntoskrnl/ke/kthread.c
|
|
|
|
* PURPOSE: Process manager definitions
|
|
|
|
* PROGRAMMER: David Welch (welch@cwcom.net)
|
|
|
|
* UPDATE HISTORY:
|
|
|
|
* Created 22/05/98
|
|
|
|
*/
|
|
|
|
|
2000-06-29 23:35:53 +00:00
|
|
|
#ifndef __INCLUDE_INTERNAL_PS_H
|
|
|
|
#define __INCLUDE_INTERNAL_PS_H
|
1999-01-16 21:03:00 +00:00
|
|
|
|
2002-09-08 10:23:54 +00:00
|
|
|
#ifndef __ASM__
|
2000-12-23 02:37:41 +00:00
|
|
|
|
2002-08-14 20:58:39 +00:00
|
|
|
/* Forward declarations. */
|
|
|
|
struct _KTHREAD;
|
|
|
|
struct _KTRAPFRAME;
|
2004-09-22 14:53:26 +00:00
|
|
|
struct _EJOB;
|
2000-12-23 02:37:41 +00:00
|
|
|
|
2002-09-08 10:23:54 +00:00
|
|
|
#endif /* __ASM__ */
|
2000-10-07 13:41:58 +00:00
|
|
|
|
2002-08-14 20:58:39 +00:00
|
|
|
#include <internal/arch/ps.h>
|
2000-10-07 13:41:58 +00:00
|
|
|
|
2002-09-08 10:23:54 +00:00
|
|
|
#ifndef __ASM__
|
2000-10-07 13:41:58 +00:00
|
|
|
|
2000-07-04 08:52:47 +00:00
|
|
|
#include <internal/mm.h>
|
2002-09-08 10:23:54 +00:00
|
|
|
#include <napi/teb.h>
|
|
|
|
|
2003-10-15 17:04:39 +00:00
|
|
|
#ifndef KeGetCurrentProcessorNumber
|
2002-09-08 10:23:54 +00:00
|
|
|
#define KeGetCurrentProcessorNumber() (KeGetCurrentKPCR()->ProcessorNumber)
|
2003-07-15 16:26:18 +00:00
|
|
|
#endif
|
2000-10-07 13:41:58 +00:00
|
|
|
|
2001-07-12 17:23:42 +00:00
|
|
|
extern LCID PsDefaultThreadLocaleId;
|
|
|
|
extern LCID PsDefaultSystemLocaleId;
|
|
|
|
|
2004-01-05 14:28:21 +00:00
|
|
|
#include <pshpack1.h>
|
|
|
|
|
2002-09-08 10:23:54 +00:00
|
|
|
typedef struct _KTHREAD
|
|
|
|
{
|
|
|
|
/* For waiting on thread exit */
|
|
|
|
DISPATCHER_HEADER DispatcherHeader; /* 00 */
|
|
|
|
|
|
|
|
/* List of mutants owned by the thread */
|
|
|
|
LIST_ENTRY MutantListHead; /* 10 */
|
|
|
|
PVOID InitialStack; /* 18 */
|
2004-10-30 23:48:57 +00:00
|
|
|
ULONG_PTR StackLimit; /* 1C */
|
2002-09-08 10:23:54 +00:00
|
|
|
|
|
|
|
/* Pointer to the thread's environment block in user memory */
|
|
|
|
PTEB Teb; /* 20 */
|
|
|
|
|
|
|
|
/* Pointer to the thread's TLS array */
|
|
|
|
PVOID TlsArray; /* 24 */
|
|
|
|
PVOID KernelStack; /* 28 */
|
|
|
|
UCHAR DebugActive; /* 2C */
|
|
|
|
|
|
|
|
/* Thread state (one of THREAD_STATE_xxx constants below) */
|
|
|
|
UCHAR State; /* 2D */
|
2005-02-15 13:40:10 +00:00
|
|
|
BOOLEAN Alerted[2]; /* 2E */
|
2002-09-08 10:23:54 +00:00
|
|
|
UCHAR Iopl; /* 30 */
|
|
|
|
UCHAR NpxState; /* 31 */
|
2004-09-28 15:02:31 +00:00
|
|
|
CHAR Saturation; /* 32 */
|
2002-09-08 10:23:54 +00:00
|
|
|
CHAR Priority; /* 33 */
|
|
|
|
KAPC_STATE ApcState; /* 34 */
|
|
|
|
ULONG ContextSwitches; /* 4C */
|
2004-09-28 15:02:31 +00:00
|
|
|
LONG WaitStatus; /* 50 */
|
2002-09-08 10:23:54 +00:00
|
|
|
KIRQL WaitIrql; /* 54 */
|
2004-09-28 15:02:31 +00:00
|
|
|
CHAR WaitMode; /* 55 */
|
2002-09-08 10:23:54 +00:00
|
|
|
UCHAR WaitNext; /* 56 */
|
|
|
|
UCHAR WaitReason; /* 57 */
|
|
|
|
PKWAIT_BLOCK WaitBlockList; /* 58 */
|
|
|
|
LIST_ENTRY WaitListEntry; /* 5C */
|
|
|
|
ULONG WaitTime; /* 64 */
|
|
|
|
CHAR BasePriority; /* 68 */
|
|
|
|
UCHAR DecrementCount; /* 69 */
|
|
|
|
UCHAR PriorityDecrement; /* 6A */
|
2004-10-30 23:48:57 +00:00
|
|
|
CHAR Quantum; /* 6B */
|
2002-09-08 10:23:54 +00:00
|
|
|
KWAIT_BLOCK WaitBlock[4]; /* 6C */
|
|
|
|
PVOID LegoData; /* CC */
|
2004-09-28 15:02:31 +00:00
|
|
|
ULONG KernelApcDisable; /* D0 */
|
2002-09-08 10:23:54 +00:00
|
|
|
KAFFINITY UserAffinity; /* D4 */
|
|
|
|
UCHAR SystemAffinityActive;/* D8 */
|
2003-06-16 16:45:52 +00:00
|
|
|
UCHAR PowerState; /* D9 */
|
|
|
|
UCHAR NpxIrql; /* DA */
|
2004-09-28 15:02:31 +00:00
|
|
|
UCHAR Pad[1]; /* DB */
|
2003-06-16 16:45:52 +00:00
|
|
|
SSDT_ENTRY *ServiceTable; /* DC */
|
2002-09-08 10:23:54 +00:00
|
|
|
PKQUEUE Queue; /* E0 */
|
|
|
|
KSPIN_LOCK ApcQueueLock; /* E4 */
|
|
|
|
KTIMER Timer; /* E8 */
|
|
|
|
LIST_ENTRY QueueListEntry; /* 110 */
|
|
|
|
KAFFINITY Affinity; /* 118 */
|
|
|
|
UCHAR Preempted; /* 11C */
|
|
|
|
UCHAR ProcessReadyQueue; /* 11D */
|
|
|
|
UCHAR KernelStackResident; /* 11E */
|
|
|
|
UCHAR NextProcessor; /* 11F */
|
|
|
|
PVOID CallbackStack; /* 120 */
|
2004-09-28 15:02:31 +00:00
|
|
|
struct _W32THREAD *Win32Thread; /* 124 */
|
|
|
|
struct _KTRAP_FRAME *TrapFrame; /* 128 */
|
2003-11-27 01:13:05 +00:00
|
|
|
PKAPC_STATE ApcStatePointer[2]; /* 12C */
|
2002-09-08 10:23:54 +00:00
|
|
|
UCHAR EnableStackSwap; /* 134 */
|
|
|
|
UCHAR LargeStack; /* 135 */
|
|
|
|
UCHAR ResourceIndex; /* 136 */
|
|
|
|
UCHAR PreviousMode; /* 137 */
|
|
|
|
ULONG KernelTime; /* 138 */
|
|
|
|
ULONG UserTime; /* 13C */
|
|
|
|
KAPC_STATE SavedApcState; /* 140 */
|
|
|
|
UCHAR Alertable; /* 158 */
|
|
|
|
UCHAR ApcStateIndex; /* 159 */
|
|
|
|
UCHAR ApcQueueable; /* 15A */
|
|
|
|
UCHAR AutoAlignment; /* 15B */
|
|
|
|
PVOID StackBase; /* 15C */
|
|
|
|
KAPC SuspendApc; /* 160 */
|
|
|
|
KSEMAPHORE SuspendSemaphore; /* 190 */
|
|
|
|
LIST_ENTRY ThreadListEntry; /* 1A4 */
|
|
|
|
CHAR FreezeCount; /* 1AC */
|
|
|
|
UCHAR SuspendCount; /* 1AD */
|
|
|
|
UCHAR IdealProcessor; /* 1AE */
|
|
|
|
UCHAR DisableBoost; /* 1AF */
|
2004-01-05 14:28:21 +00:00
|
|
|
} KTHREAD;
|
|
|
|
|
|
|
|
#include <poppack.h>
|
2002-09-08 10:23:54 +00:00
|
|
|
|
|
|
|
/* Top level irp definitions. */
|
2004-03-14 18:13:19 +00:00
|
|
|
#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)
|
2002-09-08 10:23:54 +00:00
|
|
|
|
2004-09-28 15:02:31 +00:00
|
|
|
#ifndef __USE_W32API
|
2002-09-08 10:23:54 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2005-01-03 01:13:10 +00:00
|
|
|
PACCESS_TOKEN Token;
|
|
|
|
BOOLEAN CopyOnOpen;
|
|
|
|
BOOLEAN EffectiveOnly;
|
|
|
|
SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
|
2004-09-28 15:02:31 +00:00
|
|
|
} PS_IMPERSONATION_INFORMATION, *PPS_IMPERSONATION_INFORMATION;
|
|
|
|
#endif
|
2002-09-08 10:23:54 +00:00
|
|
|
|
2004-01-05 14:28:21 +00:00
|
|
|
#include <pshpack1.h>
|
|
|
|
|
2002-09-08 10:23:54 +00:00
|
|
|
typedef struct _ETHREAD
|
|
|
|
{
|
2004-09-28 15:02:31 +00:00
|
|
|
KTHREAD Tcb;
|
2004-11-10 02:51:00 +00:00
|
|
|
union {
|
2005-01-03 05:17:16 +00:00
|
|
|
LARGE_INTEGER CreateTime;
|
2004-11-10 02:51:00 +00:00
|
|
|
UCHAR NestedFaultCount:2;
|
|
|
|
UCHAR ApcNeeded:1;
|
|
|
|
};
|
2005-01-03 05:17:16 +00:00
|
|
|
LARGE_INTEGER ExitTime;
|
2004-09-28 15:02:31 +00:00
|
|
|
LIST_ENTRY LpcReplyChain;
|
|
|
|
NTSTATUS ExitStatus;
|
|
|
|
PVOID OfsChain;
|
|
|
|
LIST_ENTRY PostBlockList;
|
|
|
|
LIST_ENTRY TerminationPortList;
|
|
|
|
KSPIN_LOCK ActiveTimerListLock;
|
|
|
|
LIST_ENTRY ActiveTimerListHead;
|
|
|
|
CLIENT_ID Cid;
|
|
|
|
KSEMAPHORE LpcReplySemaphore;
|
|
|
|
PVOID LpcReplyMessage;
|
|
|
|
ULONG LpcReplyMessageId;
|
|
|
|
ULONG PerformanceCountLow;
|
|
|
|
PPS_IMPERSONATION_INFORMATION ImpersonationInfo;
|
|
|
|
LIST_ENTRY IrpList;
|
|
|
|
PIRP TopLevelIrp;
|
|
|
|
PDEVICE_OBJECT DeviceToVerify;
|
|
|
|
ULONG ReadClusterSize;
|
|
|
|
UCHAR ForwardClusterOnly;
|
|
|
|
UCHAR DisablePageFaultClustering;
|
|
|
|
UCHAR DeadThread;
|
|
|
|
UCHAR HideFromDebugger;
|
|
|
|
ULONG HasTerminated;
|
|
|
|
#ifdef _ENABLE_THRDEVTPAIR
|
|
|
|
PVOID EventPair;
|
|
|
|
#endif /* _ENABLE_THRDEVTPAIR */
|
|
|
|
ACCESS_MASK GrantedAccess;
|
|
|
|
struct _EPROCESS *ThreadsProcess;
|
|
|
|
PKSTART_ROUTINE StartAddress;
|
|
|
|
LPTHREAD_START_ROUTINE Win32StartAddress;
|
|
|
|
ULONG LpcReceivedMessageId;
|
|
|
|
UCHAR LpcExitThreadCalled;
|
|
|
|
UCHAR HardErrorsAreDisabled;
|
|
|
|
UCHAR LpcReceivedMsgIdValid;
|
|
|
|
UCHAR ActiveImpersonationInfo;
|
|
|
|
ULONG PerformanceCountHigh;
|
|
|
|
LIST_ENTRY ThreadListEntry;
|
2004-01-05 14:28:21 +00:00
|
|
|
} ETHREAD;
|
|
|
|
|
|
|
|
#include <poppack.h>
|
|
|
|
|
2003-06-07 Casper S. Hornstrup <chorns@users.sourceforge.net>
Changes for compiling with w32api
* include/ddk/service.h: Move ...
* include/ntos/service.h: ... here.
* include/ddk/kdfuncs.h: Move ...
* include/ntos/kdfuncs.h: ... here.
* include/ntos/halfuncs.h: New file.
* ntoskrnl/include/internal/hal/hal.h,
ntoskrnl/include/internal/hal/bus.h,
ntoskrnl/include/internal/hal/mps.h: Remove.
* hal/halx86/include/hal.h: Remove disabled code.
* include/ntos.h: Include ntos/service.h, ntos/halfuncs.h, and
ntos/kdfuncs.h.
* include/ddk/fstypes.h (FILE_LOCK_TOC): Move ...
* include/ntos/file.h: ... here.
* include/ddk/halfuncs.h (HalAllProcessorsStarted,
HalBeginSystemInterrupt, HalDisableSystemInterrupt,
HalEnableSystemInterrupt, HalEndSystemInterrupt,
HalInitializeProcessor, HalInitSystem, HalReportResourceUsage): Move to
include/ntos/halfuncs.h.
* include/ddk/iofuncs.h (IoAssignDriveLetters): Ditto.
* include/ddk/kefuncs.h (KeInitializeApc): Match w32api prototype.
(KeRaiseIrqlToSynchLevel): Move to include/ntos/halfuncs.h.
* include/ddk/ketypes.h (KAPC_ENVIRONMENT): Move to include/ntos/types.h.
(KDEVICE_QUEUE, KDEVICE_QUEUE_ENTRY): Match w32api prototype.
(KINTERRUPT): Move to include/ntos/zwtypes.h.
* include/ddk/mmtypes.h (PAGE_ROUND_UP, PAGE_ROUND_DOWN): Move ...
* include/ntos/mm.h: ... here.
* include/ddk/ntddk.h: Don't include ddk/kdfuncs.h.
* include/ddk/pstypes.h (PKTHREAD, PRKTHREAD): Add.
(PsInitialSystemProcess, PsProcessType, PsThreadType): Move ...
include/ntos/ps.h: ... here.
* lib/ntdll/rtl/i386/exception.c (SehpContinue): New.
* ntoskrnl/rtl/i386/exception.c (SehpContinue): Ditto.
* ntoskrnl/include/internal/ke.h: Include <ddk/ntifs.h>.
* ntoskrnl/include/internal/ntoskrnl.h: Include internal/ke.h.
* ntoskrnl/ex/napi.c: Use new structure SSDT_ENTRY.
* ntoskrnl/ke/apc.c (KeInitializeApc): Match w32api prototype.
* ntoskrnl/ke/kqueue.c: Use fields of new structures KDEVICE_QUEUE
and KDEVICE_QUEUE_ENTRY.
svn path=/trunk/; revision=4861
2003-06-07 10:14:40 +00:00
|
|
|
|
|
|
|
#ifndef __USE_W32API
|
|
|
|
|
|
|
|
typedef struct _ETHREAD *PETHREAD;
|
|
|
|
|
|
|
|
#endif /* __USE_W32API */
|
2002-09-08 10:23:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
typedef struct _KPROCESS
|
|
|
|
{
|
|
|
|
/* So it's possible to wait for the process to terminate */
|
|
|
|
DISPATCHER_HEADER DispatcherHeader; /* 000 */
|
|
|
|
/*
|
|
|
|
* Presumably a list of profile objects associated with this process,
|
|
|
|
* currently unused.
|
|
|
|
*/
|
|
|
|
LIST_ENTRY ProfileListHead; /* 010 */
|
|
|
|
/*
|
|
|
|
* We use the first member of this array to hold the physical address of
|
|
|
|
* the page directory for this process.
|
|
|
|
*/
|
|
|
|
PHYSICAL_ADDRESS DirectoryTableBase; /* 018 */
|
|
|
|
/*
|
|
|
|
* Presumably a descriptor for the process's LDT, currently unused.
|
|
|
|
*/
|
|
|
|
ULONG LdtDescriptor[2]; /* 020 */
|
|
|
|
/*
|
2003-08-19 23:59:08 +00:00
|
|
|
* Virtual Dos Machine flag.
|
2002-09-08 10:23:54 +00:00
|
|
|
*/
|
2003-08-19 23:59:08 +00:00
|
|
|
ULONG NtVdmFlag; /* 028 */
|
|
|
|
ULONG VdmUnused; /* 02C */
|
|
|
|
/* Is the i/o permission map enabled for the process. */
|
2002-09-08 10:23:54 +00:00
|
|
|
USHORT IopmOffset; /* 030 */
|
|
|
|
/*
|
|
|
|
* Presumably I/O privilege level to be used for this process, currently
|
|
|
|
* unused.
|
|
|
|
*/
|
|
|
|
UCHAR Iopl; /* 032 */
|
|
|
|
/* Set if this process is a virtual dos machine? */
|
|
|
|
UCHAR VdmFlag; /* 033 */
|
|
|
|
/* Bitmask of the processors being used by this process's threads? */
|
|
|
|
ULONG ActiveProcessors; /* 034 */
|
|
|
|
/* Aggregate of the time this process's threads have spent in kernel mode? */
|
|
|
|
ULONG KernelTime; /* 038 */
|
|
|
|
/* Aggregate of the time this process's threads have spent in user mode? */
|
|
|
|
ULONG UserTime; /* 03C */
|
|
|
|
/* List of this process's threads that are ready for execution? */
|
|
|
|
LIST_ENTRY ReadyListHead; /* 040 */
|
|
|
|
/* List of this process's threads that have their stacks swapped out? */
|
|
|
|
LIST_ENTRY SwapListEntry; /* 048 */
|
|
|
|
/* List of this process's threads? */
|
|
|
|
LIST_ENTRY ThreadListHead; /* 050 */
|
|
|
|
/* Maybe a lock for this data structure, the type is assumed. */
|
|
|
|
KSPIN_LOCK ProcessLock; /* 058 */
|
|
|
|
/* Default affinity mask for this process's threads? */
|
|
|
|
ULONG Affinity; /* 05C */
|
|
|
|
/* Count of the stacks allocated for this process's threads? */
|
|
|
|
USHORT StackCount; /* 060 */
|
|
|
|
/* Base priority for this process's threads? */
|
|
|
|
KPRIORITY BasePriority; /* 062 */
|
|
|
|
/* Default quantum for this process's threads */
|
|
|
|
UCHAR ThreadQuantum; /* 063 */
|
|
|
|
/* Unknown. */
|
|
|
|
UCHAR AutoAlignment; /* 064 */
|
|
|
|
/* Process execution state, currently either active or terminated. */
|
|
|
|
UCHAR State; /* 065 */
|
|
|
|
/* Seed for generating thread ids for this process's threads? */
|
|
|
|
UCHAR ThreadSeed; /* 066 */
|
|
|
|
/* Disable priority boosts? */
|
|
|
|
UCHAR DisableBoost; /* 067 */
|
2003-06-07 Casper S. Hornstrup <chorns@users.sourceforge.net>
Changes for compiling with w32api
* include/ddk/service.h: Move ...
* include/ntos/service.h: ... here.
* include/ddk/kdfuncs.h: Move ...
* include/ntos/kdfuncs.h: ... here.
* include/ntos/halfuncs.h: New file.
* ntoskrnl/include/internal/hal/hal.h,
ntoskrnl/include/internal/hal/bus.h,
ntoskrnl/include/internal/hal/mps.h: Remove.
* hal/halx86/include/hal.h: Remove disabled code.
* include/ntos.h: Include ntos/service.h, ntos/halfuncs.h, and
ntos/kdfuncs.h.
* include/ddk/fstypes.h (FILE_LOCK_TOC): Move ...
* include/ntos/file.h: ... here.
* include/ddk/halfuncs.h (HalAllProcessorsStarted,
HalBeginSystemInterrupt, HalDisableSystemInterrupt,
HalEnableSystemInterrupt, HalEndSystemInterrupt,
HalInitializeProcessor, HalInitSystem, HalReportResourceUsage): Move to
include/ntos/halfuncs.h.
* include/ddk/iofuncs.h (IoAssignDriveLetters): Ditto.
* include/ddk/kefuncs.h (KeInitializeApc): Match w32api prototype.
(KeRaiseIrqlToSynchLevel): Move to include/ntos/halfuncs.h.
* include/ddk/ketypes.h (KAPC_ENVIRONMENT): Move to include/ntos/types.h.
(KDEVICE_QUEUE, KDEVICE_QUEUE_ENTRY): Match w32api prototype.
(KINTERRUPT): Move to include/ntos/zwtypes.h.
* include/ddk/mmtypes.h (PAGE_ROUND_UP, PAGE_ROUND_DOWN): Move ...
* include/ntos/mm.h: ... here.
* include/ddk/ntddk.h: Don't include ddk/kdfuncs.h.
* include/ddk/pstypes.h (PKTHREAD, PRKTHREAD): Add.
(PsInitialSystemProcess, PsProcessType, PsThreadType): Move ...
include/ntos/ps.h: ... here.
* lib/ntdll/rtl/i386/exception.c (SehpContinue): New.
* ntoskrnl/rtl/i386/exception.c (SehpContinue): Ditto.
* ntoskrnl/include/internal/ke.h: Include <ddk/ntifs.h>.
* ntoskrnl/include/internal/ntoskrnl.h: Include internal/ke.h.
* ntoskrnl/ex/napi.c: Use new structure SSDT_ENTRY.
* ntoskrnl/ke/apc.c (KeInitializeApc): Match w32api prototype.
* ntoskrnl/ke/kqueue.c: Use fields of new structures KDEVICE_QUEUE
and KDEVICE_QUEUE_ENTRY.
svn path=/trunk/; revision=4861
2003-06-07 10:14:40 +00:00
|
|
|
} KPROCESS;
|
|
|
|
|
|
|
|
#ifndef __USE_W32API
|
|
|
|
|
|
|
|
typedef struct _KPROCESS *PKPROCESS;
|
|
|
|
|
2004-11-20 16:46:06 +00:00
|
|
|
typedef struct _HARDWARE_PTE_X86 {
|
|
|
|
ULONG Valid : 1;
|
|
|
|
ULONG Write : 1;
|
|
|
|
ULONG Owner : 1;
|
|
|
|
ULONG WriteThrough : 1;
|
|
|
|
ULONG CacheDisable : 1;
|
|
|
|
ULONG Accessed : 1;
|
|
|
|
ULONG Dirty : 1;
|
|
|
|
ULONG LargePage : 1;
|
|
|
|
ULONG Global : 1;
|
|
|
|
ULONG CopyOnWrite : 1;
|
|
|
|
ULONG Prototype : 1;
|
|
|
|
ULONG reserved : 1;
|
|
|
|
ULONG PageFrameNumber : 20;
|
|
|
|
} HARDWARE_PTE_X86, *PHARDWARE_PTE_X86;
|
|
|
|
|
|
|
|
typedef struct _WOW64_PROCESS
|
|
|
|
{
|
|
|
|
PVOID Wow64;
|
|
|
|
} WOW64_PROCESS, *PWOW64_PROCESS;
|
|
|
|
|
2003-06-07 Casper S. Hornstrup <chorns@users.sourceforge.net>
Changes for compiling with w32api
* include/ddk/service.h: Move ...
* include/ntos/service.h: ... here.
* include/ddk/kdfuncs.h: Move ...
* include/ntos/kdfuncs.h: ... here.
* include/ntos/halfuncs.h: New file.
* ntoskrnl/include/internal/hal/hal.h,
ntoskrnl/include/internal/hal/bus.h,
ntoskrnl/include/internal/hal/mps.h: Remove.
* hal/halx86/include/hal.h: Remove disabled code.
* include/ntos.h: Include ntos/service.h, ntos/halfuncs.h, and
ntos/kdfuncs.h.
* include/ddk/fstypes.h (FILE_LOCK_TOC): Move ...
* include/ntos/file.h: ... here.
* include/ddk/halfuncs.h (HalAllProcessorsStarted,
HalBeginSystemInterrupt, HalDisableSystemInterrupt,
HalEnableSystemInterrupt, HalEndSystemInterrupt,
HalInitializeProcessor, HalInitSystem, HalReportResourceUsage): Move to
include/ntos/halfuncs.h.
* include/ddk/iofuncs.h (IoAssignDriveLetters): Ditto.
* include/ddk/kefuncs.h (KeInitializeApc): Match w32api prototype.
(KeRaiseIrqlToSynchLevel): Move to include/ntos/halfuncs.h.
* include/ddk/ketypes.h (KAPC_ENVIRONMENT): Move to include/ntos/types.h.
(KDEVICE_QUEUE, KDEVICE_QUEUE_ENTRY): Match w32api prototype.
(KINTERRUPT): Move to include/ntos/zwtypes.h.
* include/ddk/mmtypes.h (PAGE_ROUND_UP, PAGE_ROUND_DOWN): Move ...
* include/ntos/mm.h: ... here.
* include/ddk/ntddk.h: Don't include ddk/kdfuncs.h.
* include/ddk/pstypes.h (PKTHREAD, PRKTHREAD): Add.
(PsInitialSystemProcess, PsProcessType, PsThreadType): Move ...
include/ntos/ps.h: ... here.
* lib/ntdll/rtl/i386/exception.c (SehpContinue): New.
* ntoskrnl/rtl/i386/exception.c (SehpContinue): Ditto.
* ntoskrnl/include/internal/ke.h: Include <ddk/ntifs.h>.
* ntoskrnl/include/internal/ntoskrnl.h: Include internal/ke.h.
* ntoskrnl/ex/napi.c: Use new structure SSDT_ENTRY.
* ntoskrnl/ke/apc.c (KeInitializeApc): Match w32api prototype.
* ntoskrnl/ke/kqueue.c: Use fields of new structures KDEVICE_QUEUE
and KDEVICE_QUEUE_ENTRY.
svn path=/trunk/; revision=4861
2003-06-07 10:14:40 +00:00
|
|
|
#endif /* __USE_W32API */
|
2002-09-08 10:23:54 +00:00
|
|
|
|
|
|
|
struct _EPROCESS
|
|
|
|
{
|
|
|
|
/* Microkernel specific process state. */
|
|
|
|
KPROCESS Pcb; /* 000 */
|
|
|
|
/* Exit status of the process. */
|
|
|
|
NTSTATUS ExitStatus; /* 068 */
|
|
|
|
/* Unknown. */
|
|
|
|
KEVENT LockEvent; /* 06C */
|
|
|
|
/* Unknown. */
|
|
|
|
ULONG LockCount; /* 07C */
|
2003-07-17 16:57:39 +00:00
|
|
|
|
2002-09-08 10:23:54 +00:00
|
|
|
/* Time of process creation. */
|
2005-01-03 05:17:16 +00:00
|
|
|
LARGE_INTEGER CreateTime; /* 080 */
|
2003-07-17 16:57:39 +00:00
|
|
|
|
2002-09-08 10:23:54 +00:00
|
|
|
/* Time of process exit. */
|
2005-01-03 05:17:16 +00:00
|
|
|
LARGE_INTEGER ExitTime; /* 088 */
|
2002-09-08 10:23:54 +00:00
|
|
|
/* Unknown. */
|
2004-11-20 16:46:06 +00:00
|
|
|
PKTHREAD LockOwner; /* 090 */
|
2002-09-08 10:23:54 +00:00
|
|
|
/* Process id. */
|
2005-01-26 00:03:05 +00:00
|
|
|
HANDLE UniqueProcessId; /* 094 */
|
2002-09-08 10:23:54 +00:00
|
|
|
/* Unknown. */
|
|
|
|
LIST_ENTRY ActiveProcessLinks; /* 098 */
|
|
|
|
/* Unknown. */
|
|
|
|
ULONG QuotaPeakPoolUsage[2]; /* 0A0 */
|
|
|
|
/* Unknown. */
|
|
|
|
ULONG QuotaPoolUsage[2]; /* 0A8 */
|
|
|
|
/* Unknown. */
|
|
|
|
ULONG PagefileUsage; /* 0B0 */
|
|
|
|
/* Unknown. */
|
|
|
|
ULONG CommitCharge; /* 0B4 */
|
|
|
|
/* Unknown. */
|
|
|
|
ULONG PeakPagefileUsage; /* 0B8 */
|
|
|
|
/* Unknown. */
|
|
|
|
ULONG PeakVirtualSize; /* 0BC */
|
|
|
|
/* Unknown. */
|
|
|
|
LARGE_INTEGER VirtualSize; /* 0C0 */
|
2004-11-20 16:46:06 +00:00
|
|
|
|
|
|
|
MMSUPPORT Vm;
|
|
|
|
LIST_ENTRY SessionProcessLinks;
|
|
|
|
struct _EPORT *DebugPort;
|
|
|
|
struct _EPORT *ExceptionPort;
|
2005-03-13 14:21:47 +00:00
|
|
|
PHANDLE_TABLE ObjectTable;
|
2002-09-08 10:23:54 +00:00
|
|
|
PVOID Token;
|
2004-11-20 16:46:06 +00:00
|
|
|
FAST_MUTEX WorkingSetLock;
|
|
|
|
ULONG WorkingSetPage;
|
2002-09-08 10:23:54 +00:00
|
|
|
UCHAR ProcessOutswapEnabled;
|
|
|
|
UCHAR ProcessOutswapped;
|
|
|
|
UCHAR AddressSpaceInitialized;
|
|
|
|
UCHAR AddressSpaceDeleted;
|
|
|
|
FAST_MUTEX AddressCreationLock;
|
|
|
|
KSPIN_LOCK HyperSpaceLock;
|
|
|
|
PETHREAD ForkInProgress;
|
|
|
|
USHORT VmOperation;
|
|
|
|
UCHAR ForkWasSuccessful;
|
|
|
|
UCHAR MmAgressiveWsTrimMask;
|
|
|
|
PKEVENT VmOperationEvent;
|
2004-11-20 16:46:06 +00:00
|
|
|
PVOID PaeTop;
|
2002-09-08 10:23:54 +00:00
|
|
|
ULONG LastFaultCount;
|
2004-11-20 16:46:06 +00:00
|
|
|
ULONG ModifiedPageCount;
|
2002-09-08 10:23:54 +00:00
|
|
|
PVOID VadRoot;
|
|
|
|
PVOID VadHint;
|
|
|
|
PVOID CloneRoot;
|
|
|
|
ULONG NumberOfPrivatePages;
|
|
|
|
ULONG NumberOfLockedPages;
|
2004-11-20 16:46:06 +00:00
|
|
|
USHORT NextPageColor;
|
2002-09-08 10:23:54 +00:00
|
|
|
UCHAR ExitProcessCalled;
|
|
|
|
UCHAR CreateProcessReported;
|
|
|
|
HANDLE SectionHandle;
|
|
|
|
PPEB Peb;
|
|
|
|
PVOID SectionBaseAddress;
|
2004-08-08 20:33:17 +00:00
|
|
|
PEPROCESS_QUOTA_BLOCK QuotaBlock;
|
2002-09-08 10:23:54 +00:00
|
|
|
NTSTATUS LastThreadExitStatus;
|
2004-11-20 16:46:06 +00:00
|
|
|
PPAGEFAULT_HISTORY WorkingSetWatch;
|
|
|
|
HANDLE Win32WindowStation;
|
2002-09-08 10:23:54 +00:00
|
|
|
HANDLE InheritedFromUniqueProcessId;
|
2004-11-20 16:46:06 +00:00
|
|
|
ULONG GrantedAccess;
|
2002-09-08 10:23:54 +00:00
|
|
|
ULONG DefaultHardErrorProcessing;
|
|
|
|
PVOID LdtInformation;
|
2004-11-20 16:46:06 +00:00
|
|
|
PVOID VadFreeHint;
|
2002-09-08 10:23:54 +00:00
|
|
|
PVOID VdmObjects;
|
2004-11-20 16:46:06 +00:00
|
|
|
PVOID DeviceObjects;
|
|
|
|
ULONG SessionId;
|
|
|
|
LIST_ENTRY PhysicalVadList;
|
|
|
|
HARDWARE_PTE_X86 PageDirectoryPte;
|
|
|
|
ULONGLONG Filler;
|
|
|
|
ULONG PaePageDirectoryPage;
|
2002-09-08 10:23:54 +00:00
|
|
|
CHAR ImageFileName[16];
|
|
|
|
ULONG VmTrimFaultValue;
|
|
|
|
UCHAR SetTimerResolution;
|
|
|
|
UCHAR PriorityClass;
|
|
|
|
UCHAR SubSystemMinorVersion;
|
|
|
|
UCHAR SubSystemMajorVersion;
|
|
|
|
USHORT SubSystemVersion;
|
2004-11-20 16:46:06 +00:00
|
|
|
struct _W32PROCESS *Win32Process;
|
|
|
|
struct _EJOB *Job;
|
|
|
|
ULONG JobStatus;
|
|
|
|
LIST_ENTRY JobLinks;
|
|
|
|
PVOID LockedPagesList;
|
|
|
|
struct _EPORT *SecurityPort;
|
|
|
|
PWOW64_PROCESS Wow64;
|
|
|
|
LARGE_INTEGER ReadOperationCount;
|
|
|
|
LARGE_INTEGER WriteOperationCount;
|
|
|
|
LARGE_INTEGER OtherOperationCount;
|
|
|
|
LARGE_INTEGER ReadTransferCount;
|
|
|
|
LARGE_INTEGER WriteTransferCount;
|
|
|
|
LARGE_INTEGER OtherTransferCount;
|
|
|
|
ULONG CommitChargeLimit;
|
|
|
|
ULONG CommitChargePeak;
|
|
|
|
LIST_ENTRY ThreadListHead;
|
|
|
|
PRTL_BITMAP VadPhysicalPagesBitMap;
|
|
|
|
ULONG VadPhysicalPages;
|
|
|
|
KSPIN_LOCK AweLock;
|
2005-03-12 08:54:41 +00:00
|
|
|
ULONG Cookie;
|
2004-11-20 16:46:06 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* FIXME - ReactOS specified - remove the following fields ASAP!!!
|
|
|
|
*/
|
2002-09-08 10:23:54 +00:00
|
|
|
MADDRESS_SPACE AddressSpace;
|
|
|
|
LIST_ENTRY ProcessListEntry;
|
2004-10-01 20:26:05 +00:00
|
|
|
FAST_MUTEX TebLock;
|
|
|
|
PVOID TebBlock;
|
|
|
|
PVOID TebLastAllocated;
|
2002-09-08 10:23:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#define PROCESS_STATE_TERMINATED (1)
|
|
|
|
#define PROCESS_STATE_ACTIVE (2)
|
|
|
|
|
2001-07-12 17:23:42 +00:00
|
|
|
VOID PiInitDefaultLocale(VOID);
|
1999-11-24 11:51:55 +00:00
|
|
|
VOID PiInitProcessManager(VOID);
|
|
|
|
VOID PiShutdownProcessManager(VOID);
|
1999-11-02 08:55:45 +00:00
|
|
|
VOID PsInitThreadManagment(VOID);
|
1999-01-16 21:03:00 +00:00
|
|
|
VOID PsInitProcessManagment(VOID);
|
|
|
|
VOID PsInitIdleThread(VOID);
|
1999-12-13 22:04:41 +00:00
|
|
|
VOID PsDispatchThreadNoLock(ULONG NewThreadStatus);
|
1999-01-16 21:03:00 +00:00
|
|
|
VOID PiTerminateProcessThreads(PEPROCESS Process, NTSTATUS ExitStatus);
|
Implemented KeAreApcsDisabled, KeFlushEntireTb, KeIsExecutingDpc, KeSetKernelStackSwapEnable, KeQueryPriorityThread, KeRevertToUserAffinityThread, KeSetIdealProcessorThread, KeSetSystemAffinityThread, KeTerminateThread, KeStackAttachProcess, KeUnstackDetachProcess
svn path=/trunk/; revision=11284
2004-10-13 01:42:14 +00:00
|
|
|
VOID PsTerminateCurrentThread(NTSTATUS ExitStatus);
|
1999-03-25 00:37:06 +00:00
|
|
|
VOID PsTerminateOtherThread(PETHREAD Thread, NTSTATUS ExitStatus);
|
|
|
|
VOID PsReleaseThread(PETHREAD Thread);
|
1999-04-05 15:04:46 +00:00
|
|
|
VOID PsBeginThread(PKSTART_ROUTINE StartRoutine, PVOID StartContext);
|
|
|
|
VOID PsBeginThreadWithContextInternal(VOID);
|
1999-11-24 11:51:55 +00:00
|
|
|
VOID PiKillMostProcesses(VOID);
|
|
|
|
NTSTATUS STDCALL PiTerminateProcess(PEPROCESS Process, NTSTATUS ExitStatus);
|
1999-12-13 22:04:41 +00:00
|
|
|
VOID PiInitApcManagement(VOID);
|
2001-08-26 17:30:21 +00:00
|
|
|
VOID STDCALL PiDeleteThread(PVOID ObjectBody);
|
1999-12-18 17:48:23 +00:00
|
|
|
VOID PsReapThreads(VOID);
|
2004-09-28 15:02:31 +00:00
|
|
|
VOID PsInitializeThreadReaper(VOID);
|
|
|
|
VOID PsQueueThreadReap(PETHREAD Thread);
|
2000-12-23 02:37:41 +00:00
|
|
|
NTSTATUS
|
2004-09-28 15:02:31 +00:00
|
|
|
PsInitializeThread(PEPROCESS Process,
|
2000-12-23 02:37:41 +00:00
|
|
|
PETHREAD* ThreadPtr,
|
|
|
|
POBJECT_ATTRIBUTES ObjectAttributes,
|
2005-03-14 01:47:18 +00:00
|
|
|
KPROCESSOR_MODE AccessMode,
|
2000-12-23 02:37:41 +00:00
|
|
|
BOOLEAN First);
|
1999-01-16 21:03:00 +00:00
|
|
|
|
2002-09-08 10:23:54 +00:00
|
|
|
PACCESS_TOKEN PsReferenceEffectiveToken(PETHREAD Thread,
|
2000-07-01 22:38:15 +00:00
|
|
|
PTOKEN_TYPE TokenType,
|
|
|
|
PUCHAR b,
|
|
|
|
PSECURITY_IMPERSONATION_LEVEL Level);
|
|
|
|
|
|
|
|
NTSTATUS PsOpenTokenOfProcess(HANDLE ProcessHandle,
|
2002-09-08 10:23:54 +00:00
|
|
|
PACCESS_TOKEN* Token);
|
2000-07-01 22:38:15 +00:00
|
|
|
|
2001-01-21 14:54:30 +00:00
|
|
|
NTSTATUS PsSuspendThread(PETHREAD Thread, PULONG PreviousCount);
|
|
|
|
NTSTATUS PsResumeThread(PETHREAD Thread, PULONG PreviousCount);
|
2000-07-01 22:38:15 +00:00
|
|
|
|
2004-11-10 02:51:00 +00:00
|
|
|
VOID STDCALL PsExitSpecialApc(PKAPC Apc,
|
|
|
|
PKNORMAL_ROUTINE *NormalRoutine,
|
|
|
|
PVOID *NormalContext,
|
|
|
|
PVOID *SystemArgument1,
|
|
|
|
PVOID *SystemArgument2);
|
2000-07-01 22:38:15 +00:00
|
|
|
|
2002-07-10 15:15:00 +00:00
|
|
|
#define THREAD_STATE_INITIALIZED (0)
|
|
|
|
#define THREAD_STATE_READY (1)
|
1999-12-02 20:53:55 +00:00
|
|
|
#define THREAD_STATE_RUNNING (2)
|
|
|
|
#define THREAD_STATE_SUSPENDED (3)
|
1999-12-13 22:04:41 +00:00
|
|
|
#define THREAD_STATE_FROZEN (4)
|
|
|
|
#define THREAD_STATE_TERMINATED_1 (5)
|
|
|
|
#define THREAD_STATE_TERMINATED_2 (6)
|
2001-01-19 15:09:01 +00:00
|
|
|
#define THREAD_STATE_BLOCKED (7)
|
|
|
|
#define THREAD_STATE_MAX (8)
|
1999-12-10 22:07:23 +00:00
|
|
|
|
|
|
|
|
2000-10-07 13:41:58 +00:00
|
|
|
/*
|
|
|
|
* Internal thread priorities, added by Phillip Susi
|
2002-08-14 20:58:39 +00:00
|
|
|
* TODO: rebalence these to make use of all priorities... the ones above 16
|
|
|
|
* can not all be used right now
|
2000-10-07 13:41:58 +00:00
|
|
|
*/
|
1999-12-10 22:07:23 +00:00
|
|
|
#define PROCESS_PRIO_IDLE 3
|
|
|
|
#define PROCESS_PRIO_NORMAL 8
|
|
|
|
#define PROCESS_PRIO_HIGH 13
|
|
|
|
#define PROCESS_PRIO_RT 18
|
2000-04-25 23:22:57 +00:00
|
|
|
|
1999-01-16 21:03:00 +00:00
|
|
|
|
2005-03-12 19:23:04 +00:00
|
|
|
VOID STDCALL
|
2000-12-23 02:37:41 +00:00
|
|
|
KeInitializeThread(PKPROCESS Process, PKTHREAD Thread, BOOLEAN First);
|
2004-09-28 15:02:31 +00:00
|
|
|
NTSTATUS KeReleaseThread(PKTHREAD Thread);
|
2004-06-23 21:02:35 +00:00
|
|
|
|
|
|
|
VOID
|
2004-08-21 12:34:58 +00:00
|
|
|
STDCALL
|
2004-06-23 21:02:35 +00:00
|
|
|
KeStackAttachProcess (
|
|
|
|
IN PKPROCESS Process,
|
2004-06-24 21:03:56 +00:00
|
|
|
OUT PKAPC_STATE ApcState
|
2004-06-23 21:02:35 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
VOID
|
2004-08-21 12:34:58 +00:00
|
|
|
STDCALL
|
2004-06-23 21:02:35 +00:00
|
|
|
KeUnstackDetachProcess (
|
2004-06-24 21:03:56 +00:00
|
|
|
IN PKAPC_STATE ApcState
|
2004-06-23 21:02:35 +00:00
|
|
|
);
|
|
|
|
|
2001-08-26 17:30:21 +00:00
|
|
|
VOID STDCALL PiDeleteProcess(PVOID ObjectBody);
|
1999-12-02 20:53:55 +00:00
|
|
|
VOID PsReapThreads(VOID);
|
2004-09-28 15:02:31 +00:00
|
|
|
VOID PsInitializeThreadReaper(VOID);
|
|
|
|
VOID PsQueueThreadReap(PETHREAD Thread);
|
2000-04-07 02:24:03 +00:00
|
|
|
VOID PsUnfreezeOtherThread(PETHREAD Thread);
|
|
|
|
VOID PsFreezeOtherThread(PETHREAD Thread);
|
|
|
|
VOID PsFreezeProcessThreads(PEPROCESS Process);
|
|
|
|
VOID PsUnfreezeProcessThreads(PEPROCESS Process);
|
2004-07-23 07:44:26 +00:00
|
|
|
ULONG PsEnumThreadsByProcess(PEPROCESS Process);
|
2000-06-25 03:59:17 +00:00
|
|
|
PEPROCESS PsGetNextProcess(PEPROCESS OldProcess);
|
2000-12-23 02:37:41 +00:00
|
|
|
VOID
|
Dispatching & Queue Rewrite II:
- Rewrote wait code. It is now cleaner, more optimized and faster. All waiting
functions are now clearly differentiated instead of sharing code. These functions
are called up to a dozen times a second, so having dedicated code for each of
them is a real boost in speed.
- Fixed several queue issues, made a dedicated queue wait/wake function (you are not
supposed to use KeWaitFor on a queue, and this is also a speed boost), and make it
compatible with new wait code.
- Optimized Work Queue code to be much smaller and better organized, by using an
array instead of hard-coded multiple static variables. Also, add support for the
real NT structures and implementation, paving the road for Dynamic Work Items, which
also have timeouts, and deadlock dection + debug info.
- Simplified PsBlockThread and made it compatible with wait code.
- Added support for priority boosting when unwaiting a thread; will use later, as well
as put proper boosting for dispatch objects.
- Inlined all dispatcher lock functions and header initialization for speed.
- Moved executive wait code into ob.
svn path=/trunk/; revision=14047
2005-03-14 05:54:32 +00:00
|
|
|
STDCALL
|
|
|
|
PsBlockThread(PNTSTATUS Status,
|
|
|
|
UCHAR Alertable,
|
|
|
|
ULONG WaitMode,
|
|
|
|
UCHAR WaitReason);
|
2001-01-19 15:09:01 +00:00
|
|
|
VOID
|
2005-01-12 13:43:05 +00:00
|
|
|
PsUnblockThread(PETHREAD Thread, PNTSTATUS WaitStatus, KPRIORITY Increment);
|
2001-04-17 04:11:01 +00:00
|
|
|
VOID
|
|
|
|
PsApplicationProcessorInit(VOID);
|
|
|
|
VOID
|
|
|
|
PsPrepareForApplicationProcessorInit(ULONG Id);
|
2005-03-14 01:47:18 +00:00
|
|
|
VOID
|
|
|
|
PsInitReaperThread(VOID);
|
2003-12-14 18:02:34 +00:00
|
|
|
VOID STDCALL
|
2001-04-17 04:11:01 +00:00
|
|
|
PsIdleThreadMain(PVOID Context);
|
1999-01-16 21:03:00 +00:00
|
|
|
|
2001-08-27 01:29:07 +00:00
|
|
|
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);
|
2002-01-27 01:11:24 +00:00
|
|
|
VOID STDCALL
|
|
|
|
PsDispatchThread(ULONG NewThreadStatus);
|
2002-08-09 17:23:57 +00:00
|
|
|
VOID
|
|
|
|
PsInitialiseSuspendImplementation(VOID);
|
2002-01-27 01:11:24 +00:00
|
|
|
|
2004-09-28 15:02:31 +00:00
|
|
|
extern LONG PiNrThreadsAwaitingReaping;
|
2003-06-20 16:26:53 +00:00
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
PsInitWin32Thread (PETHREAD Thread);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
PsTerminateWin32Process (PEPROCESS Process);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
PsTerminateWin32Thread (PETHREAD Thread);
|
|
|
|
|
2003-07-23 19:13:37 +00:00
|
|
|
VOID
|
|
|
|
PsInitialiseW32Call(VOID);
|
|
|
|
|
2003-12-30 00:12:47 +00:00
|
|
|
VOID
|
|
|
|
STDCALL
|
|
|
|
PspRunCreateThreadNotifyRoutines(PETHREAD, BOOLEAN);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
STDCALL
|
|
|
|
PspRunCreateProcessNotifyRoutines(PEPROCESS, BOOLEAN);
|
|
|
|
|
2004-09-22 14:53:26 +00:00
|
|
|
#include <pshpack1.h>
|
|
|
|
typedef struct _PS_JOB_TOKEN_FILTER
|
|
|
|
{
|
|
|
|
UINT CapturedSidCount;
|
|
|
|
PSID_AND_ATTRIBUTES CapturedSids;
|
|
|
|
UINT CapturedSidsLength;
|
|
|
|
UINT CapturedGroupCount;
|
|
|
|
PSID_AND_ATTRIBUTES CapturedGroups;
|
|
|
|
UINT CapturedGroupsLength;
|
|
|
|
UINT CapturedPrivilegeCount;
|
|
|
|
PLUID_AND_ATTRIBUTES CapturedPrivileges;
|
|
|
|
UINT CapturedPrivilegesLength;
|
|
|
|
} PS_JOB_TOKEN_FILTER, *PPS_JOB_TOKEN_FILTER;
|
|
|
|
#include <poppack.h>
|
|
|
|
|
|
|
|
#include <pshpack1.h>
|
|
|
|
typedef struct _EJOB
|
|
|
|
{
|
|
|
|
KEVENT Event;
|
|
|
|
LIST_ENTRY JobLinks;
|
|
|
|
LIST_ENTRY ProcessListHead;
|
|
|
|
ERESOURCE JobLock;
|
|
|
|
LARGE_INTEGER TotalUserTime;
|
|
|
|
LARGE_INTEGER TotalKernelTime;
|
|
|
|
LARGE_INTEGER ThisPeriodTotalUserTime;
|
|
|
|
LARGE_INTEGER ThisPeriodTotalKernelTime;
|
|
|
|
UINT TotalPageFaultCount;
|
|
|
|
UINT TotalProcesses;
|
|
|
|
UINT ActiveProcesses;
|
|
|
|
UINT TotalTerminatedProcesses;
|
|
|
|
LARGE_INTEGER PerProcessUserTimeLimit;
|
|
|
|
LARGE_INTEGER PerJobUserTimeLimit;
|
|
|
|
UINT LimitFlags;
|
|
|
|
UINT MinimumWorkingSetSize;
|
|
|
|
UINT MaximumWorkingSetSize;
|
|
|
|
UINT ActiveProcessLimit;
|
|
|
|
UINT Affinity;
|
|
|
|
BYTE PriorityClass;
|
|
|
|
UINT UIRestrictionsClass;
|
|
|
|
UINT SecurityLimitFlags;
|
|
|
|
PVOID Token;
|
|
|
|
PPS_JOB_TOKEN_FILTER Filter;
|
|
|
|
UINT EndOfJobTimeAction;
|
|
|
|
PVOID CompletionPort;
|
|
|
|
PVOID CompletionKey;
|
|
|
|
UINT SessionId;
|
|
|
|
UINT SchedulingClass;
|
|
|
|
ULONGLONG ReadOperationCount;
|
|
|
|
ULONGLONG WriteOperationCount;
|
|
|
|
ULONGLONG OtherOperationCount;
|
|
|
|
ULONGLONG ReadTransferCount;
|
|
|
|
ULONGLONG WriteTransferCount;
|
|
|
|
ULONGLONG OtherTransferCount;
|
|
|
|
IO_COUNTERS IoInfo;
|
|
|
|
UINT ProcessMemoryLimit;
|
|
|
|
UINT JobMemoryLimit;
|
|
|
|
UINT PeakProcessMemoryUsed;
|
|
|
|
UINT PeakJobMemoryUsed;
|
|
|
|
UINT CurrentJobMemoryUsed;
|
|
|
|
FAST_MUTEX MemoryLimitsLock;
|
|
|
|
} EJOB;
|
|
|
|
#include <poppack.h>
|
|
|
|
|
2004-09-22 22:31:46 +00:00
|
|
|
VOID INIT_FUNCTION PsInitJobManagment(VOID);
|
|
|
|
|
2005-03-13 14:21:47 +00:00
|
|
|
/* CLIENT ID */
|
2004-09-28 15:02:31 +00:00
|
|
|
|
|
|
|
NTSTATUS PsCreateCidHandle(PVOID Object, POBJECT_TYPE ObjectType, PHANDLE Handle);
|
|
|
|
NTSTATUS PsDeleteCidHandle(HANDLE CidHandle, POBJECT_TYPE ObjectType);
|
2005-03-13 14:21:47 +00:00
|
|
|
PHANDLE_TABLE_ENTRY PsLookupCidHandle(HANDLE CidHandle, POBJECT_TYPE ObjectType, PVOID *Object);
|
|
|
|
VOID PsUnlockCidHandle(PHANDLE_TABLE_ENTRY CidEntry);
|
2004-11-20 16:46:06 +00:00
|
|
|
NTSTATUS PsLockProcess(PEPROCESS Process, BOOL Timeout);
|
|
|
|
VOID PsUnlockProcess(PEPROCESS Process);
|
2004-09-28 15:02:31 +00:00
|
|
|
|
|
|
|
#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))
|
|
|
|
|
2002-09-08 10:23:54 +00:00
|
|
|
#endif /* ASSEMBLER */
|
2000-10-07 13:41:58 +00:00
|
|
|
|
2000-06-29 23:35:53 +00:00
|
|
|
#endif /* __INCLUDE_INTERNAL_PS_H */
|