Modified: trunk/reactos/include/ddk/extypes.h
Modified: trunk/reactos/include/ddk/setypes.h
Modified: trunk/reactos/ntoskrnl/ex/sysinfo.c
Modified: trunk/reactos/ntoskrnl/include/internal/mm.h
Modified: trunk/reactos/ntoskrnl/include/internal/ob.h
Modified: trunk/reactos/ntoskrnl/include/internal/ps.h
Modified: trunk/reactos/ntoskrnl/include/internal/se.h
Modified: trunk/reactos/ntoskrnl/io/irp.c
Modified: trunk/reactos/ntoskrnl/kd/wrappers/gdbstub.c
Modified: trunk/reactos/ntoskrnl/kdbg/kdb_cli.c
Modified: trunk/reactos/ntoskrnl/ob/object.c
Modified: trunk/reactos/ntoskrnl/ps/debug.c
Modified: trunk/reactos/ntoskrnl/ps/job.c
Modified: trunk/reactos/ntoskrnl/ps/kill.c
Modified: trunk/reactos/ntoskrnl/ps/process.c
Modified: trunk/reactos/ntoskrnl/ps/psmgr.c
Modified: trunk/reactos/ntoskrnl/ps/query.c
Modified: trunk/reactos/ntoskrnl/ps/security.c
Modified: trunk/reactos/ntoskrnl/ps/thread.c
Modified: trunk/reactos/ntoskrnl/ps/win32.c
Modified: trunk/reactos/ntoskrnl/se/token.c
Modified: trunk/reactos/w32api/include/ddk/winddk.h
--- trunk/reactos/include/ddk/extypes.h 2005-05-06 22:38:00 UTC (rev 15064)
+++ trunk/reactos/include/ddk/extypes.h 2005-05-06 22:54:40 UTC (rev 15065)
@@ -94,6 +94,28 @@
};
} EX_RUNDOWN_REF, *PEX_RUNDOWN_REF;
+typedef struct _EX_FAST_REF {
+ union {
+ PVOID Object;
+ ULONG RefCnt:3;
+ ULONG Value;
+ };
+} EX_FAST_REF, *PEX_FAST_REF;
+
+typedef struct _EX_PUSH_LOCK {
+ union {
+ struct {
+ ULONG Locked:1;
+ ULONG Waiting:1;
+ ULONG Waking:1;
+ ULONG MultipleShared:1;
+ ULONG Shared:28;
+ };
+ ULONG Value;
+ PVOID Ptr;
+ };
+} EX_PUSH_LOCK, *PEX_PUSH_LOCK;
+
typedef struct
{
LONG Count;
--- trunk/reactos/include/ddk/setypes.h 2005-05-06 22:38:00 UTC (rev 15064)
+++ trunk/reactos/include/ddk/setypes.h 2005-05-06 22:54:40 UTC (rev 15065)
@@ -151,6 +151,12 @@
TOKEN_CONTROL ClientTokenControl;
} SECURITY_CLIENT_CONTEXT, *PSECURITY_CLIENT_CONTEXT;
+#ifndef __USE_W32API
+typedef struct _SE_AUDIT_PROCESS_CREATION_INFO
+{
+ struct _OBJECT_NAME_INFORMATION *ImageFileName;
+} SE_AUDIT_PROCESS_CREATION_INFO, *PSE_AUDIT_PROCESS_CREATION_INFO;
+#endif
typedef struct _SE_EXPORTS
{
--- trunk/reactos/ntoskrnl/ex/sysinfo.c 2005-05-06 22:38:00 UTC (rev 15064)
+++ trunk/reactos/ntoskrnl/ex/sysinfo.c 2005-05-06 22:54:40 UTC (rev 15065)
@@ -633,23 +633,17 @@
SpiCur->InheritedFromUniqueProcessId = pr->InheritedFromUniqueProcessId;
SpiCur->HandleCount = (pr->ObjectTable ? ObpGetHandleCountByHandleTable(pr->ObjectTable) : 0);
SpiCur->PeakVirtualSize = pr->PeakVirtualSize;
- SpiCur->VirtualSize = pr->VirtualSize.QuadPart;
- SpiCur->PageFaultCount = pr->LastFaultCount;
+ SpiCur->VirtualSize = pr->VirtualSize;
+ SpiCur->PageFaultCount = pr->Vm.PageFaultCount;
SpiCur->PeakWorkingSetSize = pr->Vm.PeakWorkingSetSize; // Is this right using ->Vm. here ?
SpiCur->WorkingSetSize = pr->Vm.WorkingSetSize; // Is this right using ->Vm. here ?
- SpiCur->QuotaPeakPagedPoolUsage =
- pr->QuotaPeakPoolUsage[0];
- SpiCur->QuotaPagedPoolUsage =
- pr->QuotaPoolUsage[0];
- SpiCur->QuotaPeakNonPagedPoolUsage =
- pr->QuotaPeakPoolUsage[1];
- SpiCur->QuotaNonPagedPoolUsage =
- pr->QuotaPoolUsage[1];
- SpiCur->PagefileUsage = pr->PagefileUsage; // FIXME
- SpiCur->PeakPagefileUsage = pr->PeakPagefileUsage;
- // KJK::Hyperion: I don't know what does this mean. VM_COUNTERS
- // doesn't seem to contain any equivalent field
- //SpiCur->TotalPrivateBytes = pr->NumberOfPrivatePages; //FIXME: bytes != pages
+ SpiCur->QuotaPeakPagedPoolUsage = pr->QuotaPeak[0];
+ SpiCur->QuotaPagedPoolUsage = pr->QuotaUsage[0];
+ SpiCur->QuotaPeakNonPagedPoolUsage = pr->QuotaPeak[1];
+ SpiCur->QuotaNonPagedPoolUsage = pr->QuotaUsage[1];
+ SpiCur->PagefileUsage = pr->QuotaUsage[3];
+ SpiCur->PeakPagefileUsage = pr->QuotaPeak[3];
+ SpiCur->PrivateUsage = pr->CommitCharge;
current_entry = pr->ThreadListHead.Flink;
while (current_entry != &pr->ThreadListHead)
--- trunk/reactos/ntoskrnl/include/internal/mm.h 2005-05-06 22:38:00 UTC (rev 15064)
+++ trunk/reactos/ntoskrnl/include/internal/mm.h 2005-05-06 22:54:40 UTC (rev 15065)
@@ -188,6 +188,28 @@
#endif /* __USE_W32API */
+typedef struct _MMADDRESS_NODE
+{
+ union {
+ ULONG Balance:2;
+ struct _MMADDRESS_NODE *Parent;
+ } u1;
+ struct _MMADDRESS_NODE *LeftChild;
+ struct _MMADDRESS_NODE *RightChild;
+ ULONG StartingVpn;
+ ULONG EndingVpn;
+} MMADDRESS_NODE, *PMMADDRESS_NODE;
+
+typedef struct _MM_AVL_TABLE
+{
+ MMADDRESS_NODE BalancedRoot;
+ ULONG DepthOfTree:5;
+ ULONG Unused:3;
+ ULONG NumberGenericTableElements:24;
+ PVOID NodeHint;
+ PVOID NodeFreeHint;
+} MM_AVL_TABLE, *PMM_AVL_TABLE;
+
typedef struct _MEMORY_AREA
{
PVOID StartingAddress;
--- trunk/reactos/ntoskrnl/include/internal/ob.h 2005-05-06 22:38:00 UTC (rev 15064)
+++ trunk/reactos/ntoskrnl/include/internal/ob.h 2005-05-06 22:54:40 UTC (rev 15065)
@@ -209,7 +209,6 @@
POBJECT_TYPE ObjectType;
} TYPE_OBJECT, *PTYPE_OBJECT;
-
/*
* Enumeration of object types
*/
@@ -326,6 +325,25 @@
VOID
ObpDereferenceCachedSecurityDescriptor(IN PSECURITY_DESCRIPTOR SecurityDescriptor);
+VOID
+FASTCALL
+ObInitializeFastReference(IN PEX_FAST_REF FastRef,
+ PVOID Object);
+
+PVOID
+FASTCALL
+ObFastReplaceObject(IN PEX_FAST_REF FastRef,
+ PVOID Object);
+
+PVOID
+FASTCALL
+ObFastReferenceObject(IN PEX_FAST_REF FastRef);
+
+VOID
+FASTCALL
+ObFastDereferenceObject(IN PEX_FAST_REF FastRef,
+ PVOID Object);
+
/* Secure object information functions */
typedef struct _CAPTURED_OBJECT_ATTRIBUTES
--- trunk/reactos/ntoskrnl/include/internal/ps.h 2005-05-06 22:38:00 UTC (rev 15064)
+++ trunk/reactos/ntoskrnl/include/internal/ps.h 2005-05-06 22:54:40 UTC (rev 15065)
@@ -126,127 +126,140 @@
typedef struct _ETHREAD *PETHREAD;
#endif /* __USE_W32API */
-
+
+#include <pshpack4.h>
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 */
+ KPROCESS Pcb; /* 000 */
+ EX_PUSH_LOCK ProcessLock; /* 078 */
+ LARGE_INTEGER CreateTime; /* 080 */
+ LARGE_INTEGER ExitTime; /* 088 */
+ EX_RUNDOWN_REF RundownProtect; /* 090 */
+ HANDLE UniqueProcessId; /* 094 */
+ LIST_ENTRY ActiveProcessLinks; /* 098 */
+ ULONG QuotaUsage[3]; /* 0A0 */
+ ULONG QuotaPeak[3]; /* 0AC */
+ ULONG CommitCharge; /* 0B8 */
+ ULONG PeakVirtualSize; /* 0BC */
+ ULONG VirtualSize; /* 0C0 */
+ LIST_ENTRY SessionProcessLinks; /* 0C4 */
+ PVOID DebugPort; /* 0CC */
+ PVOID ExceptionPort; /* 0D0 */
+ PHANDLE_TABLE ObjectTable; /* 0D4 */
+ EX_FAST_REF Token; /* 0D8 */
+ ULONG WorkingSetPage; /* 0DC */
+ KGUARDED_MUTEX AddressCreationLock; /* 0E0 */
+ KSPIN_LOCK HyperSpaceLock; /* 100 */
+ PETHREAD ForkInProgress; /* 104 */
+ ULONG HardwareTrigger; /* 108 */
+ MM_AVL_TABLE PhysicalVadroot; /* 10C */
+ PVOID CloneRoot; /* 110 */
+ ULONG NumberOfPrivatePages; /* 114 */
+ ULONG NumberOfLockedPages; /* 118 */
+ PVOID *Win32Process; /* 11C */
+ struct _EJOB *Job; /* 120 */
+ PVOID SectionObject; /* 124 */
+ PVOID SectionBaseAddress; /* 128 */
+ PEPROCESS_QUOTA_BLOCK QuotaBlock; /* 12C */
+ PPAGEFAULT_HISTORY WorkingSetWatch; /* 130 */
+ PVOID Win32WindowStation; /* 134 */
+ HANDLE InheritedFromUniqueProcessId; /* 138 */
+ PVOID LdtInformation; /* 13C */
+ PVOID VadFreeHint; /* 140 */
+ PVOID VdmObjects; /* 144 */
+ PVOID DeviceMap; /* 148 */
+ PVOID Spare0[3]; /* 14C */
+ union {
+ HARDWARE_PTE_X86 PagedirectoryPte; /* 158 */
+ ULONGLONG Filler; /* 158 */
+ };
+ ULONG Session; /* 160 */
+ UCHAR ImageFileName[16]; /* 164 */
+ LIST_ENTRY JobLinks; /* 174 */
+ PVOID LockedPagesList; /* 17C */
+ LIST_ENTRY ThreadListHead; /* 184 */
+ PVOID SecurityPort; /* 188 */
+ PVOID PaeTop; /* 18C */
+ ULONG ActiveThreds; /* 190 */
+ ACCESS_MASK GrantedAccess; /* 194 */
+ ULONG DefaultHardErrorProcessing; /* 198 */
+ NTSTATUS LastThreadExitStatus; /* 19C */
+ PPEB Peb; /* 1A0 */
+ EX_FAST_REF PrefetchTrace; /* 1A4 */
+ LARGE_INTEGER ReadOperationCount; /* 1A8 */
+ LARGE_INTEGER WriteOperationCount; /* 1B0 */
+ LARGE_INTEGER OtherOperationCount; /* 1B8 */
+ LARGE_INTEGER ReadTransferCount; /* 1C0 */
+ LARGE_INTEGER WriteTransferCount; /* 1C8 */
+ LARGE_INTEGER OtherTransferCount; /* 1D0 */
+ ULONG CommitChargeLimit; /* 1D8 */
+ ULONG CommitChargePeak; /* 1DC */
+ PVOID AweInfo; /* 1E0 */
+ SE_AUDIT_PROCESS_CREATION_INFO SeAuditProcessCreationInfo; /* 1E4 */
+ MMSUPPORT Vm; /* 1E8 */
+ LIST_ENTRY MmProcessLinks; /* 230 */
+ ULONG ModifiedPageCount; /* 238 */
+ ULONG JobStatus; /* 23C */
+ union {
+ struct {
+ ULONG CreateReported:1;
+ ULONG NoDebugInherit:1;
+ ULONG ProcessExiting:1;
+ ULONG ProcessDelete:1;
+ ULONG Wow64SplitPages:1;
+ ULONG VmDeleted:1;
+ ULONG OutswapEnabled:1;
+ ULONG Outswapped:1;
+ ULONG ForkFailed:1;
+ ULONG Wow64VaSpace4Gb:1;
+ ULONG AddressSpaceInitialized:2;
+ ULONG SetTimerResolution:1;
+ ULONG BreakOnTermination:1;
+ ULONG SessionCreationUnderway:1;
+ ULONG WriteWatch:1;
+ ULONG ProcessInSession:1;
+ ULONG OverrideAddressSpace:1;
+ ULONG HasAddressSpace:1;
+ ULONG LaunchPrefetched:1;
+ ULONG InjectInpageErrors:1;
+ ULONG VmTopDown:1;
+ ULONG ImageNotifyDone:1;
+ ULONG PdeUpdateNeeded:1;
+ ULONG VdmAllowed:1;
+ ULONG SmapAllowed:1;
+ ULONG CreateFailed:1;
+ ULONG DefaultIoPriority:3;
+ ULONG Spare1:1;
+ ULONG Spare2:1;
+ };
+ ULONG Flags; /* 240 */
+ };
+
+ NTSTATUS ExitStatus; /* 244 */
+ USHORT NextPageColor; /* 248 */
+ union {
+ struct {
+ UCHAR SubSystemMinorVersion; /* 24A */
+ UCHAR SubSystemMajorVersion; /* 24B */
+ };
+ USHORT SubSystemVersion; /* 24A */
+ };
+ UCHAR PriorityClass; /* 24C */
+ MM_AVL_TABLE VadRoot; /* 250 */
+ ULONG Cookie; /* 270 */
- /* Time of process creation. */
- LARGE_INTEGER CreateTime; /* 080 */
-
- /* Time of process exit. */
- LARGE_INTEGER ExitTime; /* 088 */
- /* Unknown. */
- PKTHREAD LockOwner; /* 090 */
- /* Process id. */
- HANDLE UniqueProcessId; /* 094 */
- /* 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 */
-
- MMSUPPORT Vm;
- LIST_ENTRY SessionProcessLinks;
- struct _EPORT *DebugPort;
- struct _EPORT *ExceptionPort;
- PHANDLE_TABLE ObjectTable;
- PVOID Token;
- FAST_MUTEX WorkingSetLock;
- ULONG WorkingSetPage;
- UCHAR ProcessOutswapEnabled;
- UCHAR ProcessOutswapped;
- UCHAR AddressSpaceInitialized;
- UCHAR AddressSpaceDeleted;
- FAST_MUTEX AddressCreationLock;
- KSPIN_LOCK HyperSpaceLock;
- PETHREAD ForkInProgress;
- USHORT VmOperation;
- UCHAR ForkWasSuccessful;
- UCHAR MmAgressiveWsTrimMask;
- PKEVENT VmOperationEvent;
- PVOID PaeTop;
- ULONG LastFaultCount;
- ULONG ModifiedPageCount;
- PVOID VadRoot;
- PVOID VadHint;
- PVOID CloneRoot;
- ULONG NumberOfPrivatePages;
- ULONG NumberOfLockedPages;
- USHORT NextPageColor;
- UCHAR ExitProcessCalled;
- UCHAR CreateProcessReported;
- HANDLE SectionHandle;
- PPEB Peb;
- PVOID SectionBaseAddress;
- PEPROCESS_QUOTA_BLOCK QuotaBlock;
- NTSTATUS LastThreadExitStatus;
- PPAGEFAULT_HISTORY WorkingSetWatch;
- HANDLE Win32WindowStation;
- HANDLE InheritedFromUniqueProcessId;
- ULONG GrantedAccess;
- ULONG DefaultHardErrorProcessing;
- PVOID LdtInformation;
- PVOID VadFreeHint;
- PVOID VdmObjects;
- PVOID DeviceObjects;
- ULONG SessionId;
- LIST_ENTRY PhysicalVadList;
- HARDWARE_PTE_X86 PageDirectoryPte;
- ULONGLONG Filler;
- ULONG PaePageDirectoryPage;
- CHAR ImageFileName[16];
- ULONG VmTrimFaultValue;
- UCHAR SetTimerResolution;
- UCHAR PriorityClass;
- UCHAR SubSystemMinorVersion;
- UCHAR SubSystemMajorVersion;
- USHORT SubSystemVersion;
- 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;
- ULONG Cookie;
-
- /*
- * FIXME - ReactOS specified - remove the following fields ASAP!!!
- */
- MADDRESS_SPACE AddressSpace;
- LIST_ENTRY ProcessListEntry;
+/***************************************************************
+ * REACTOS SPECIFIC START
+ ***************************************************************/
+ /* FIXME WILL BE DEPRECATED WITH PUSHLOCK SUPPORT IN 0.3.0 */
+ KEVENT LockEvent; /* 274 */
+ ULONG LockCount; /* 284 */
+ struct _KTHREAD *LockOwner; /* 288 */
+
+ /* FIXME MOVE TO AVL TREES */
+ MADDRESS_SPACE AddressSpace; /* 28C */
};
+#include <poppack.h>
#define PROCESS_STATE_TERMINATED (1)
#define PROCESS_STATE_ACTIVE (2)
--- trunk/reactos/ntoskrnl/include/internal/se.h 2005-05-06 22:38:00 UTC (rev 15064)
+++ trunk/reactos/ntoskrnl/include/internal/se.h 2005-05-06 22:54:40 UTC (rev 15065)
@@ -20,7 +20,6 @@
#ifndef __NTOSKRNL_INCLUDE_INTERNAL_SE_H
#define __NTOSKRNL_INCLUDE_INTERNAL_SE_H
-
extern POBJECT_TYPE SepTokenObjectType;
/* SID Authorities */
@@ -110,6 +109,8 @@
BOOLEAN SepInitDACLs(VOID);
BOOLEAN SepInitSDs(VOID);
+VOID SeDeassignPrimaryToken(struct _EPROCESS *Process);
+
NTSTATUS STDCALL
SepCreateImpersonationTokenDacl(PTOKEN Token,
PTOKEN PrimaryToken,
--- trunk/reactos/ntoskrnl/io/irp.c 2005-05-06 22:38:00 UTC (rev 15064)
+++ trunk/reactos/ntoskrnl/io/irp.c 2005-05-06 22:54:40 UTC (rev 15065)
@@ -901,7 +901,7 @@
IoGetRequestorSessionId(IN PIRP Irp,
OUT PULONG pSessionId)
{
- *pSessionId = IoGetRequestorProcess(Irp)->SessionId;
+ *pSessionId = IoGetRequestorProcess(Irp)->Session;
return STATUS_SUCCESS;
}
--- trunk/reactos/ntoskrnl/kd/wrappers/gdbstub.c 2005-05-06 22:38:00 UTC (rev 15064)
+++ trunk/reactos/ntoskrnl/kd/wrappers/gdbstub.c 2005-05-06 22:54:40 UTC (rev 15065)
@@ -789,7 +789,7 @@
AProcess = PsActiveProcessHead.Flink;
while(AProcess != &PsActiveProcessHead)
{
- Process = CONTAINING_RECORD(AProcess, EPROCESS, ProcessListEntry);
+ Process = CONTAINING_RECORD(AProcess, EPROCESS, ActiveProcessLinks);
AThread = Process->ThreadListHead.Flink;
if(AThread != &Process->ThreadListHead)
{
@@ -831,10 +831,10 @@
else
{
PETHREAD Thread = NULL;
- AProcess = Process->ProcessListEntry.Flink;
+ AProcess = Process->ActiveProcessLinks.Flink;
while(AProcess != &PsActiveProcessHead)
{
- Process = CONTAINING_RECORD(AProcess, EPROCESS, ProcessListEntry);
+ Process = CONTAINING_RECORD(AProcess, EPROCESS, ActiveProcessLinks);
AThread = Process->ThreadListHead.Flink;
if(AThread != &Process->ThreadListHead)
{
--- trunk/reactos/ntoskrnl/kdbg/kdb_cli.c 2005-05-06 22:38:00 UTC (rev 15064)
+++ trunk/reactos/ntoskrnl/kdbg/kdb_cli.c 2005-05-06 22:54:40 UTC (rev 15065)
@@ -1078,7 +1078,7 @@
KdbpPrint(" PID State Filename\n");
do
{
- Process = CONTAINING_RECORD(Entry, EPROCESS, ProcessListEntry);
+ Process = CONTAINING_RECORD(Entry, EPROCESS, ActiveProcessLinks);
if (Process == KdbCurrentProcess)
{
--- trunk/reactos/ntoskrnl/ob/object.c 2005-05-06 22:38:00 UTC (rev 15064)
+++ trunk/reactos/ntoskrnl/ob/object.c 2005-05-06 22:54:40 UTC (rev 15065)
@@ -507,7 +507,7 @@
if (current)
RtlpCreateUnicodeString (RemainingPath, current, NonPagedPool);
- ExFreePool(PathString.Buffer);
+ RtlFreeUnicodeString (&PathString);
*ReturnedObject = CurrentObject;
return STATUS_SUCCESS;
@@ -806,7 +806,7 @@
}
RtlFreeUnicodeString(&Header->Name);
RtlFreeUnicodeString(&RemainingPath);
- ExFreePoolWithTag(Header, Header->ObjectType->Tag);
+ ExFreePool(Header);
DPRINT("Create Failed\n");
return Status;
}
@@ -1000,7 +1000,7 @@
}
DPRINT("ObPerformRetentionChecks() = Freeing object\n");
- ExFreePoolWithTag(Header, Header->ObjectType->Tag);
+ ExFreePool(Header);
return(STATUS_SUCCESS);
}
@@ -1010,14 +1010,16 @@
ObpDeleteObjectWorkRoutine (IN PVOID Parameter)
{
PRETENTION_CHECK_PARAMS Params = (PRETENTION_CHECK_PARAMS)Parameter;
- ULONG Tag;
+ /* ULONG Tag; */ /* See below */
ASSERT(Params);
ASSERT(KeGetCurrentIrql() == PASSIVE_LEVEL); /* We need PAGED_CODE somewhere... */
- Tag = Params->ObjectHeader->ObjectType->Tag;
+ /* Turn this on when we have ExFreePoolWithTag
+ Tag = Params->ObjectHeader->ObjectType->Tag; */
ObpDeleteObject(Params->ObjectHeader);
- ExFreePoolWithTag(Params, Tag);
+ ExFreePool(Params);
+ /* ExFreePoolWithTag(Params, Tag); */
}
@@ -1115,7 +1117,6 @@
}
-
/**********************************************************************
* NAME EXPORTED
* ObfDereferenceObject@4
@@ -1161,7 +1162,57 @@
}
}
+VOID
+FASTCALL
+ObInitializeFastReference(IN PEX_FAST_REF FastRef,
+ PVOID Object)
+{
+ /* FIXME: Fast Referencing is Unimplemented */
+ FastRef->Object = Object;
+}
+
+PVOID
+FASTCALL
+ObFastReferenceObject(IN PEX_FAST_REF FastRef)
+{
+ /* FIXME: Fast Referencing is Unimplemented */
+
+ /* Do a normal Reference */
+ ObReferenceObject(FastRef->Object);
+
+ /* Return the Object */
+ return FastRef->Object;
+}
+
+VOID
+FASTCALL
+ObFastDereferenceObject(IN PEX_FAST_REF FastRef,
+ PVOID Object)
+{
+ /* FIXME: Fast Referencing is Unimplemented */
+
+ /* Do a normal Dereference */
+ ObDereferenceObject(FastRef->Object);
+}
+
+PVOID
+FASTCALL
+ObFastReplaceObject(IN PEX_FAST_REF FastRef,
+ PVOID Object)
+{
+ PVOID OldObject = FastRef->Object;
+
+ /* FIXME: Fast Referencing is Unimplemented */
+ FastRef->Object = Object;
+
+ /* Do a normal Dereference */
+ ObDereferenceObject(OldObject);
+
+ /* Return old Object*/
+ return OldObject;
+}
+
/**********************************************************************
* NAME EXPORTED
* ObGetObjectPointerCount@4
--- trunk/reactos/ntoskrnl/ps/debug.c 2005-05-06 22:38:00 UTC (rev 15064)
+++ trunk/reactos/ntoskrnl/ps/debug.c 2005-05-06 22:54:40 UTC (rev 15065)
@@ -280,9 +280,8 @@
CurrentProcess = PsActiveProcessHead.Flink;
while(CurrentProcess != &PsActiveProcessHead)
{
-
/* Get the process */
- Process = CONTAINING_RECORD(CurrentProcess, EPROCESS, ProcessListEntry);
+ Process = CONTAINING_RECORD(CurrentProcess, EPROCESS, ActiveProcessLinks);
/* Skip the Initial Process if requested */
if((Process != PsInitialSystemProcess) ||
--- trunk/reactos/ntoskrnl/ps/job.c 2005-05-06 22:38:00 UTC (rev 15064)
+++ trunk/reactos/ntoskrnl/ps/job.c 2005-05-06 22:54:40 UTC (rev 15065)
@@ -160,7 +160,7 @@
Status = PsLockProcess(Process, FALSE);
if(NT_SUCCESS(Status))
{
- if(Process->Job == NULL && Process->SessionId == Job->SessionId)
+ if(Process->Job == NULL && Process->Session == Job->SessionId)
{
/* Just store the pointer to the job object in the process, we'll
assign it later. The reason we can't do this here is that locking
@@ -263,7 +263,7 @@
/* setup the job object */
InitializeListHead(&Job->ProcessListHead);
- Job->SessionId = CurrentProcess->SessionId; /* inherit the session id from the caller */
+ Job->SessionId = CurrentProcess->Session; /* inherit the session id from the caller */
Status = ExInitializeResource(&Job->JobLock);
if(!NT_SUCCESS(Status))
--- trunk/reactos/ntoskrnl/ps/kill.c 2005-05-06 22:38:00 UTC (rev 15064)
+++ trunk/reactos/ntoskrnl/ps/kill.c 2005-05-06 22:54:40 UTC (rev 15065)
@@ -93,7 +93,7 @@
current_entry = PsActiveProcessHead.Flink;
while (current_entry != &PsActiveProcessHead)
{
- current = CONTAINING_RECORD(current_entry, EPROCESS, ProcessListEntry);
+ current = CONTAINING_RECORD(current_entry, EPROCESS, ActiveProcessLinks);
current_entry = current_entry->Flink;
if (current->UniqueProcessId != PsInitialSystemProcess->UniqueProcessId &&
@@ -150,7 +150,7 @@
/* Remove it from the Active List */
ExAcquireFastMutex(&PspActiveProcessMutex);
- RemoveEntryList(&Process->ProcessListEntry);
+ RemoveEntryList(&Process->ActiveProcessLinks);
ExReleaseFastMutex(&PspActiveProcessMutex);
/* Delete the CID Handle */
@@ -162,8 +162,10 @@
/* KDB hook */
KDB_DELETEPROCESS_HOOK(Process);
- /* Dereference the Token and release Memory Information */
- ObDereferenceObject(Process->Token);
+ /* Dereference the Token */
+ SeDeassignPrimaryToken(Process);
+
+ /* Release Memory Information */
MmReleaseMmInfo(Process);
/* Delete the W32PROCESS structure if there's one associated */
--- trunk/reactos/ntoskrnl/ps/process.c 2005-05-06 22:38:00 UTC (rev 15064)
+++ trunk/reactos/ntoskrnl/ps/process.c 2005-05-06 22:54:40 UTC (rev 15065)
@@ -135,12 +135,12 @@
{
/* Get the Process Link */
PLIST_ENTRY Flink = (NextProcess == PsIdleProcess ? PsActiveProcessHead.Flink :
- NextProcess->ProcessListEntry.Flink);
+ NextProcess->ActiveProcessLinks.Flink);
/* Move to the next Process if we're not back at the beginning */
if (Flink != &PsActiveProcessHead)
{
- NextProcess = CONTAINING_RECORD(Flink, EPROCESS, ProcessListEntry);
+ NextProcess = CONTAINING_RECORD(Flink, EPROCESS, ActiveProcessLinks);
}
else
{
@@ -292,7 +292,7 @@
if (pParentProcess)
{
Process->InheritedFromUniqueProcessId = pParentProcess->UniqueProcessId;
- Process->SessionId = pParentProcess->SessionId;
+ Process->Session = pParentProcess->Session;
}
/* FIXME: Set up the Quota Block from the Parent
@@ -393,7 +393,7 @@
/* W00T! The process can now be activated */
DPRINT("Inserting into Active Process List\n");
ExAcquireFastMutex(&PspActiveProcessMutex);
- InsertTailList(&PsActiveProcessHead, &Process->ProcessListEntry);
+ InsertTailList(&PsActiveProcessHead, &Process->ActiveProcessLinks);
ExReleaseFastMutex(&PspActiveProcessMutex);
/* FIXME: SeCreateAccessStateEx */
@@ -547,7 +547,7 @@
STDCALL
PsGetProcessExitProcessCalled(PEPROCESS Process)
{
- return Process->ExitProcessCalled;
+ return Process->ProcessExiting;
}
/*
@@ -636,7 +636,7 @@
STDCALL
PsGetCurrentProcessSessionId(VOID)
{
- return PsGetCurrentProcess()->SessionId;
+ return PsGetCurrentProcess()->Session;
}
/*
@@ -666,7 +666,7 @@
STDCALL
PsGetProcessSessionId(PEPROCESS Process)
{
- return (HANDLE)Process->SessionId;
+ return (HANDLE)Process->Session;
}
/*
--- trunk/reactos/ntoskrnl/ps/psmgr.c 2005-05-06 22:38:00 UTC (rev 15064)
+++ trunk/reactos/ntoskrnl/ps/psmgr.c 2005-05-06 22:54:40 UTC (rev 15065)
@@ -186,7 +186,7 @@
PsIdleProcess->Pcb.QuantumReset = 6;
InitializeListHead(&PsIdleProcess->Pcb.ThreadListHead);
InitializeListHead(&PsIdleProcess->ThreadListHead);
- InitializeListHead(&PsIdleProcess->ProcessListEntry);
+ InitializeListHead(&PsIdleProcess->ActiveProcessLinks);
KeInitializeDispatcherHeader(&PsIdleProcess->Pcb.Header,
ProcessObject,
sizeof(EPROCESS),
@@ -248,7 +248,7 @@
PsInitialSystemProcess->Win32WindowStation = (HANDLE)0;
InsertHeadList(&PsActiveProcessHead,
- &PsInitialSystemProcess->ProcessListEntry);
+ &PsInitialSystemProcess->ActiveProcessLinks);
InitializeListHead(&PsInitialSystemProcess->ThreadListHead);
#ifndef SCHED_REWRITE
@@ -257,7 +257,7 @@
/* No parent, this is the Initial System Process. Assign Boot Token */
BootToken = SepCreateSystemProcessToken();
BootToken->TokenInUse = TRUE;
- PsInitialSystemProcess->Token = BootToken;
+ PsInitialSystemProcess->Token.Object = BootToken; /* FIXME */
ObReferenceObject(BootToken);
#endif
}
--- trunk/reactos/ntoskrnl/ps/query.c 2005-05-06 22:38:00 UTC (rev 15064)
+++ trunk/reactos/ntoskrnl/ps/query.c 2005-05-06 22:54:40 UTC (rev 15065)
@@ -287,7 +287,7 @@
_SEH_TRY
{
- SessionInfo->SessionId = Process->SessionId;
+ SessionInfo->SessionId = Process->Session;
if (ReturnLength)
{
*ReturnLength = sizeof(PROCESS_SESSION_INFORMATION);
@@ -318,16 +318,16 @@
* incompatibilities in current headers (no unnamed union),
* I opted for cast.
*/
- pOut->VirtualSize = (ULONG)Process->VirtualSize.QuadPart;
+ pOut->VirtualSize = (ULONG)Process->VirtualSize;
pOut->PageFaultCount = Process->Vm.PageFaultCount;
pOut->PeakWorkingSetSize = Process->Vm.PeakWorkingSetSize;
pOut->WorkingSetSize = Process->Vm.WorkingSetSize;
- pOut->QuotaPeakPagedPoolUsage = Process->QuotaPeakPoolUsage[0]; // TODO: Verify!
- pOut->QuotaPagedPoolUsage = Process->QuotaPoolUsage[0]; // TODO: Verify!
- pOut->QuotaPeakNonPagedPoolUsage = Process->QuotaPeakPoolUsage[1]; // TODO: Verify!
- pOut->QuotaNonPagedPoolUsage = Process->QuotaPoolUsage[1]; // TODO: Verify!
- pOut->PagefileUsage = Process->PagefileUsage;
- pOut->PeakPagefileUsage = Process->PeakPagefileUsage;
+ pOut->QuotaPeakPagedPoolUsage = Process->QuotaPeak[0]; // TODO: Verify!
+ pOut->QuotaPagedPoolUsage = Process->QuotaUsage[0]; // TODO: Verify!
+ pOut->QuotaPeakNonPagedPoolUsage = Process->QuotaPeak[1]; // TODO: Verify!
+ pOut->QuotaNonPagedPoolUsage = Process->QuotaUsage[1]; // TODO: Verify!
+ pOut->PagefileUsage = Process->QuotaUsage[2];
+ pOut->PeakPagefileUsage = Process->QuotaPeak[2];
if (ReturnLength)
{
@@ -841,7 +841,7 @@
Status = PsLockProcess(Process, FALSE);
if(NT_SUCCESS(Status))
{
- Process->SessionId = SessionInfo.SessionId;
+ Process->Session = SessionInfo.SessionId;
/* Update the session id in the PEB structure */
if(Process->Peb != NULL)
--- trunk/reactos/ntoskrnl/ps/security.c 2005-05-06 22:38:00 UTC (rev 15064)
+++ trunk/reactos/ntoskrnl/ps/security.c 2005-05-06 22:54:40 UTC (rev 15065)
@@ -13,6 +13,32 @@
#define NDEBUG
#include <internal/debug.h>
+/* INTERNAL ******************************************************************/
+
+/* FIXME: Turn into Macro */
+VOID
+STDCALL
+PspLockProcessSecurityShared(PEPROCESS Process)
+{
+ /* Enter a Guarded Region */
+ KeEnterGuardedRegion();
+
+ /* Lock the Process */
+ //ExAcquirePushLockShared(&Process->ProcessLock);
+}
+
+/* FIXME: Turn into Macro */
+VOID
+STDCALL
+PspUnlockProcessSecurityShared(PEPROCESS Process)
+{
+ /* Unlock the Process */
+ //ExReleasePushLockShared(&Process->ProcessLock);
+
+ /* Leave Guarded Region */
+ KeLeaveGuardedRegion();
+}
+
/* FUNCTIONS *****************************************************************/
/*
@@ -104,12 +130,26 @@
STDCALL
PsReferencePrimaryToken(PEPROCESS Process)
{
- /* Reference and return the Token */
- ObReferenceObjectByPointer(Process->Token,
- TOKEN_ALL_ACCESS,
- SepTokenObjectType,
- KernelMode);
- return(Process->Token);
+ PACCESS_TOKEN Token;
+
+ /* Fast Reference the Token */
+ Token = ObFastReferenceObject(&Process->Token);
+
+ /* Check if we got the Token or if we got locked */
+ if (!Token)
+ {
+ /* Lock the Process */
+ PspLockProcessSecurityShared(Process);
+
+ /* Do a Locked Fast Reference */
+ //Token = ObFastReferenceObjectLocked(&Process->Token);
+
+ /* Unlock the Process */
+ PspUnlockProcessSecurityShared(Process);
+ }
+
+ /* Return the Token */
+ return Token;
}
/*
@@ -156,7 +196,8 @@
PTOKEN pParentToken;
OBJECT_ATTRIBUTES ObjectAttributes;
- pParentToken = (PACCESS_TOKEN)Parent->Token;
+ /* Get the Parent Token */
+ pParentToken = PsReferencePrimaryToken(Parent);
/* Initialize the Object Attributes */
InitializeObjectAttributes(&ObjectAttributes,
@@ -180,7 +221,11 @@
return Status;
}
- Process->Token = pNewToken;
+ /* Dereference the Token */
+ ObFastDereferenceObject(&Parent->Token, pParentToken);
+
+ /* Set the new Token */
+ ObInitializeFastReference(&Process->Token, pNewToken);
} else {
@@ -227,7 +272,6 @@
Status = SeExchangePrimaryToken(Process, Token, &OldToken);
/* Derefernece Tokens and Return */
- if (NT_SUCCESS(Status)) ObDereferenceObject(OldToken);
ObDereferenceObject(Token);
return(Status);
}
@@ -356,22 +400,37 @@
PEPROCESS Process;
PACCESS_TOKEN Token;
- if (Thread->ActiveImpersonationInfo == FALSE) {
-
+ if (Thread->ActiveImpersonationInfo == FALSE)
+ {
Process = Thread->ThreadsProcess;
*TokenType = TokenPrimary;
*EffectiveOnly = FALSE;
- Token = Process->Token;
- } else {
-
+ /* Fast Reference the Token */
+ Token = ObFastReferenceObject(&Process->Token);
+
+ /* Check if we got the Token or if we got locked */
+ if (!Token)
+ {
+ /* Lock the Process */
+ PspLockProcessSecurityShared(Process);
+
+ /* Do a Locked Fast Reference */
+ //Token = ObFastReferenceObjectLocked(&Process->Token);
+
+ /* Unlock the Process */
+ PspUnlockProcessSecurityShared(Process);
+ }
+ }
+ else
+ {
Token = Thread->ImpersonationInfo->Token;
*TokenType = TokenImpersonation;
*EffectiveOnly = Thread->ImpersonationInfo->EffectiveOnly;
*Level = Thread->ImpersonationInfo->ImpersonationLevel;
}
- return(Token);
+ return Token;
}
NTSTATUS
--- trunk/reactos/ntoskrnl/ps/thread.c 2005-05-06 22:38:00 UTC (rev 15064)
+++ trunk/reactos/ntoskrnl/ps/thread.c 2005-05-06 22:54:40 UTC (rev 15065)
@@ -423,7 +423,7 @@
STDCALL
PsGetThreadSessionId(PETHREAD Thread)
{
- return (HANDLE)Thread->ThreadsProcess->SessionId;
+ return (HANDLE)Thread->ThreadsProcess->Session;
}
/*
--- trunk/reactos/ntoskrnl/ps/win32.c 2005-05-06 22:38:00 UTC (rev 15064)
+++ trunk/reactos/ntoskrnl/ps/win32.c 2005-05-06 22:54:40 UTC (rev 15065)
@@ -54,7 +54,7 @@
PW32PROCESS STDCALL
PsGetWin32Process(VOID)
{
- return(PsGetCurrentProcess()->Win32Process);
+ return (PW32PROCESS)PsGetCurrentProcess()->Win32Process;
}
NTSTATUS STDCALL
--- trunk/reactos/ntoskrnl/se/token.c 2005-05-06 22:38:00 UTC (rev 15064)
+++ trunk/reactos/ntoskrnl/se/token.c 2005-05-06 22:54:40 UTC (rev 15065)
@@ -79,35 +79,47 @@
return(STATUS_NOT_IMPLEMENTED);
[truncated at 1000 lines; 105 more skipped]