mirror of
https://github.com/reactos/reactos.git
synced 2025-06-26 17:09:44 +00:00
- Get rid of ROS_EPROCESS and all the ugly type-casting that was being done, now that the last two hacks make us able to compatibly use EPROCESS.
svn path=/trunk/; revision=21935
This commit is contained in:
parent
7b3c313c1c
commit
19e2ef808c
21 changed files with 157 additions and 352 deletions
|
@ -1074,7 +1074,7 @@ typedef struct _EPROCESS
|
||||||
EX_PUSH_LOCK AddressCreationLock;
|
EX_PUSH_LOCK AddressCreationLock;
|
||||||
PETHREAD RotateInProgress;
|
PETHREAD RotateInProgress;
|
||||||
#else
|
#else
|
||||||
KGUARDED_MUTEX AddressCreationLock;
|
FAST_MUTEX AddressCreationLock; // FIXME: FAST_MUTEX for XP, KGUARDED_MUTEX for 2K3
|
||||||
KSPIN_LOCK HyperSpaceLock;
|
KSPIN_LOCK HyperSpaceLock;
|
||||||
#endif
|
#endif
|
||||||
PETHREAD ForkInProgress;
|
PETHREAD ForkInProgress;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
/* TYPES *********************************************************************/
|
/* TYPES *********************************************************************/
|
||||||
|
|
||||||
struct _ROS_EPROCESS;
|
struct _EPROCESS;
|
||||||
|
|
||||||
extern ULONG MiFreeSwapPages;
|
extern ULONG MiFreeSwapPages;
|
||||||
extern ULONG MiUsedSwapPages;
|
extern ULONG MiUsedSwapPages;
|
||||||
|
@ -242,7 +242,7 @@ typedef struct _MADDRESS_SPACE
|
||||||
{
|
{
|
||||||
PMEMORY_AREA MemoryAreaRoot;
|
PMEMORY_AREA MemoryAreaRoot;
|
||||||
PVOID LowestAddress;
|
PVOID LowestAddress;
|
||||||
struct _ROS_EPROCESS* Process;
|
struct _EPROCESS* Process;
|
||||||
PUSHORT PageTableRefCountTable;
|
PUSHORT PageTableRefCountTable;
|
||||||
ULONG PageTableRefCountTableSize;
|
ULONG PageTableRefCountTableSize;
|
||||||
} MADDRESS_SPACE, *PMADDRESS_SPACE;
|
} MADDRESS_SPACE, *PMADDRESS_SPACE;
|
||||||
|
@ -360,7 +360,7 @@ MmGetKernelAddressSpace(VOID);
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
MmInitializeAddressSpace(
|
MmInitializeAddressSpace(
|
||||||
struct _ROS_EPROCESS* Process,
|
struct _EPROCESS* Process,
|
||||||
PMADDRESS_SPACE AddressSpace);
|
PMADDRESS_SPACE AddressSpace);
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
@ -443,7 +443,7 @@ MmFindGap(
|
||||||
VOID
|
VOID
|
||||||
STDCALL
|
STDCALL
|
||||||
MmReleaseMemoryAreaIfDecommitted(
|
MmReleaseMemoryAreaIfDecommitted(
|
||||||
struct _ROS_EPROCESS *Process,
|
struct _EPROCESS *Process,
|
||||||
PMADDRESS_SPACE AddressSpace,
|
PMADDRESS_SPACE AddressSpace,
|
||||||
PVOID BaseAddress
|
PVOID BaseAddress
|
||||||
);
|
);
|
||||||
|
@ -619,18 +619,18 @@ MmShowOutOfSpaceMessagePagingFile(VOID);
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
STDCALL
|
STDCALL
|
||||||
MmCreateProcessAddressSpace(
|
MmCreateProcessAddressSpace(
|
||||||
IN struct _ROS_EPROCESS* Process,
|
IN struct _EPROCESS* Process,
|
||||||
IN PROS_SECTION_OBJECT Section OPTIONAL
|
IN PROS_SECTION_OBJECT Section OPTIONAL
|
||||||
);
|
);
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
STDCALL
|
STDCALL
|
||||||
MmCreatePeb(struct _ROS_EPROCESS *Process);
|
MmCreatePeb(struct _EPROCESS *Process);
|
||||||
|
|
||||||
struct _TEB*
|
struct _TEB*
|
||||||
STDCALL
|
STDCALL
|
||||||
MmCreateTeb(
|
MmCreateTeb(
|
||||||
struct _ROS_EPROCESS *Process,
|
struct _EPROCESS *Process,
|
||||||
PCLIENT_ID ClientId,
|
PCLIENT_ID ClientId,
|
||||||
PINITIAL_TEB InitialTeb
|
PINITIAL_TEB InitialTeb
|
||||||
);
|
);
|
||||||
|
@ -638,7 +638,7 @@ MmCreateTeb(
|
||||||
VOID
|
VOID
|
||||||
STDCALL
|
STDCALL
|
||||||
MmDeleteTeb(
|
MmDeleteTeb(
|
||||||
struct _ROS_EPROCESS *Process,
|
struct _EPROCESS *Process,
|
||||||
struct _TEB* Teb
|
struct _TEB* Teb
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -704,7 +704,7 @@ MmQueryAnonMem(
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
MmFreeVirtualMemory(
|
MmFreeVirtualMemory(
|
||||||
struct _ROS_EPROCESS* Process,
|
struct _EPROCESS* Process,
|
||||||
PMEMORY_AREA MemoryArea
|
PMEMORY_AREA MemoryArea
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -858,7 +858,7 @@ VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
MmInsertRmap(
|
MmInsertRmap(
|
||||||
PFN_TYPE Page,
|
PFN_TYPE Page,
|
||||||
struct _ROS_EPROCESS *Process,
|
struct _EPROCESS *Process,
|
||||||
PVOID Address
|
PVOID Address
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -867,14 +867,14 @@ NTAPI
|
||||||
MmDeleteAllRmaps(
|
MmDeleteAllRmaps(
|
||||||
PFN_TYPE Page,
|
PFN_TYPE Page,
|
||||||
PVOID Context,
|
PVOID Context,
|
||||||
VOID (*DeleteMapping)(PVOID Context, struct _ROS_EPROCESS *Process, PVOID Address)
|
VOID (*DeleteMapping)(PVOID Context, struct _EPROCESS *Process, PVOID Address)
|
||||||
);
|
);
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
MmDeleteRmap(
|
MmDeleteRmap(
|
||||||
PFN_TYPE Page,
|
PFN_TYPE Page,
|
||||||
struct _ROS_EPROCESS *Process,
|
struct _EPROCESS *Process,
|
||||||
PVOID Address
|
PVOID Address
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -992,7 +992,7 @@ MmCommitPagedPoolAddress(
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
MmCreateVirtualMapping(
|
MmCreateVirtualMapping(
|
||||||
struct _ROS_EPROCESS* Process,
|
struct _EPROCESS* Process,
|
||||||
PVOID Address,
|
PVOID Address,
|
||||||
ULONG flProtect,
|
ULONG flProtect,
|
||||||
PPFN_TYPE Pages,
|
PPFN_TYPE Pages,
|
||||||
|
@ -1002,7 +1002,7 @@ MmCreateVirtualMapping(
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
MmCreateVirtualMappingUnsafe(
|
MmCreateVirtualMappingUnsafe(
|
||||||
struct _ROS_EPROCESS* Process,
|
struct _EPROCESS* Process,
|
||||||
PVOID Address,
|
PVOID Address,
|
||||||
ULONG flProtect,
|
ULONG flProtect,
|
||||||
PPFN_TYPE Pages,
|
PPFN_TYPE Pages,
|
||||||
|
@ -1012,13 +1012,13 @@ MmCreateVirtualMappingUnsafe(
|
||||||
ULONG
|
ULONG
|
||||||
NTAPI
|
NTAPI
|
||||||
MmGetPageProtect(
|
MmGetPageProtect(
|
||||||
struct _ROS_EPROCESS* Process,
|
struct _EPROCESS* Process,
|
||||||
PVOID Address);
|
PVOID Address);
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
MmSetPageProtect(
|
MmSetPageProtect(
|
||||||
struct _ROS_EPROCESS* Process,
|
struct _EPROCESS* Process,
|
||||||
PVOID Address,
|
PVOID Address,
|
||||||
ULONG flProtect
|
ULONG flProtect
|
||||||
);
|
);
|
||||||
|
@ -1026,7 +1026,7 @@ MmSetPageProtect(
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
NTAPI
|
NTAPI
|
||||||
MmIsPagePresent(
|
MmIsPagePresent(
|
||||||
struct _ROS_EPROCESS* Process,
|
struct _EPROCESS* Process,
|
||||||
PVOID Address
|
PVOID Address
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1037,7 +1037,7 @@ MmInitGlobalKernelPageDirectory(VOID);
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
MmDisableVirtualMapping(
|
MmDisableVirtualMapping(
|
||||||
struct _ROS_EPROCESS *Process,
|
struct _EPROCESS *Process,
|
||||||
PVOID Address,
|
PVOID Address,
|
||||||
BOOLEAN* WasDirty,
|
BOOLEAN* WasDirty,
|
||||||
PPFN_TYPE Page
|
PPFN_TYPE Page
|
||||||
|
@ -1046,7 +1046,7 @@ MmDisableVirtualMapping(
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
MmEnableVirtualMapping(
|
MmEnableVirtualMapping(
|
||||||
struct _ROS_EPROCESS *Process,
|
struct _EPROCESS *Process,
|
||||||
PVOID Address
|
PVOID Address
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1057,7 +1057,7 @@ MmRawDeleteVirtualMapping(PVOID Address);
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
MmDeletePageFileMapping(
|
MmDeletePageFileMapping(
|
||||||
struct _ROS_EPROCESS *Process,
|
struct _EPROCESS *Process,
|
||||||
PVOID Address,
|
PVOID Address,
|
||||||
SWAPENTRY* SwapEntry
|
SWAPENTRY* SwapEntry
|
||||||
);
|
);
|
||||||
|
@ -1065,7 +1065,7 @@ MmDeletePageFileMapping(
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
MmCreatePageFileMapping(
|
MmCreatePageFileMapping(
|
||||||
struct _ROS_EPROCESS *Process,
|
struct _EPROCESS *Process,
|
||||||
PVOID Address,
|
PVOID Address,
|
||||||
SWAPENTRY SwapEntry
|
SWAPENTRY SwapEntry
|
||||||
);
|
);
|
||||||
|
@ -1073,7 +1073,7 @@ MmCreatePageFileMapping(
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
NTAPI
|
NTAPI
|
||||||
MmIsPageSwapEntry(
|
MmIsPageSwapEntry(
|
||||||
struct _ROS_EPROCESS *Process,
|
struct _EPROCESS *Process,
|
||||||
PVOID Address
|
PVOID Address
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1087,7 +1087,7 @@ MmTransferOwnershipPage(
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
MmSetDirtyPage(
|
MmSetDirtyPage(
|
||||||
struct _ROS_EPROCESS *Process,
|
struct _EPROCESS *Process,
|
||||||
PVOID Address
|
PVOID Address
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1123,7 +1123,7 @@ MmReferencePageUnsafe(PFN_TYPE Page);
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
NTAPI
|
NTAPI
|
||||||
MmIsAccessedAndResetAccessPage(
|
MmIsAccessedAndResetAccessPage(
|
||||||
struct _ROS_EPROCESS *Process,
|
struct _EPROCESS *Process,
|
||||||
PVOID Address
|
PVOID Address
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1158,7 +1158,7 @@ MmGetSavedSwapEntryPage(PFN_TYPE Page);
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
MmSetCleanPage(
|
MmSetCleanPage(
|
||||||
struct _ROS_EPROCESS *Process,
|
struct _EPROCESS *Process,
|
||||||
PVOID Address
|
PVOID Address
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1169,37 +1169,37 @@ MmCreatePageTable(PVOID PAddress);
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
MmDeletePageTable(
|
MmDeletePageTable(
|
||||||
struct _ROS_EPROCESS *Process,
|
struct _EPROCESS *Process,
|
||||||
PVOID Address
|
PVOID Address
|
||||||
);
|
);
|
||||||
|
|
||||||
PFN_TYPE
|
PFN_TYPE
|
||||||
NTAPI
|
NTAPI
|
||||||
MmGetPfnForProcess(
|
MmGetPfnForProcess(
|
||||||
struct _ROS_EPROCESS *Process,
|
struct _EPROCESS *Process,
|
||||||
PVOID Address
|
PVOID Address
|
||||||
);
|
);
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
STDCALL
|
STDCALL
|
||||||
MmCopyMmInfo(
|
MmCopyMmInfo(
|
||||||
struct _ROS_EPROCESS *Src,
|
struct _EPROCESS *Src,
|
||||||
struct _ROS_EPROCESS *Dest,
|
struct _EPROCESS *Dest,
|
||||||
PPHYSICAL_ADDRESS DirectoryTableBase
|
PPHYSICAL_ADDRESS DirectoryTableBase
|
||||||
);
|
);
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
MmReleaseMmInfo(struct _ROS_EPROCESS *Process);
|
MmReleaseMmInfo(struct _EPROCESS *Process);
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
Mmi386ReleaseMmInfo(struct _ROS_EPROCESS *Process);
|
Mmi386ReleaseMmInfo(struct _EPROCESS *Process);
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
MmDeleteVirtualMapping(
|
MmDeleteVirtualMapping(
|
||||||
struct _ROS_EPROCESS *Process,
|
struct _EPROCESS *Process,
|
||||||
PVOID Address,
|
PVOID Address,
|
||||||
BOOLEAN FreePage,
|
BOOLEAN FreePage,
|
||||||
BOOLEAN* WasDirty,
|
BOOLEAN* WasDirty,
|
||||||
|
@ -1209,7 +1209,7 @@ MmDeleteVirtualMapping(
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
NTAPI
|
NTAPI
|
||||||
MmIsDirtyPage(
|
MmIsDirtyPage(
|
||||||
struct _ROS_EPROCESS *Process,
|
struct _EPROCESS *Process,
|
||||||
PVOID Address
|
PVOID Address
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1224,7 +1224,7 @@ MmMarkPageUnmapped(PFN_TYPE Page);
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
MmUpdatePageDir(
|
MmUpdatePageDir(
|
||||||
struct _ROS_EPROCESS *Process,
|
struct _EPROCESS *Process,
|
||||||
PVOID Address,
|
PVOID Address,
|
||||||
ULONG Size
|
ULONG Size
|
||||||
);
|
);
|
||||||
|
|
|
@ -8,201 +8,6 @@ struct _EJOB;
|
||||||
|
|
||||||
#include <internal/arch/ps.h>
|
#include <internal/arch/ps.h>
|
||||||
|
|
||||||
//
|
|
||||||
// ROS Process
|
|
||||||
//
|
|
||||||
#include <pshpack4.h>
|
|
||||||
typedef struct _ROS_EPROCESS
|
|
||||||
{
|
|
||||||
KPROCESS Pcb;
|
|
||||||
EX_PUSH_LOCK ProcessLock;
|
|
||||||
LARGE_INTEGER CreateTime;
|
|
||||||
LARGE_INTEGER ExitTime;
|
|
||||||
EX_RUNDOWN_REF RundownProtect;
|
|
||||||
HANDLE UniqueProcessId;
|
|
||||||
LIST_ENTRY ActiveProcessLinks;
|
|
||||||
ULONG QuotaUsage[3];
|
|
||||||
ULONG QuotaPeak[3];
|
|
||||||
ULONG CommitCharge;
|
|
||||||
ULONG PeakVirtualSize;
|
|
||||||
ULONG VirtualSize;
|
|
||||||
LIST_ENTRY SessionProcessLinks;
|
|
||||||
PVOID DebugPort;
|
|
||||||
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
|
|
||||||
union
|
|
||||||
{
|
|
||||||
PVOID ExceptionPortData;
|
|
||||||
ULONG ExceptionPortValue;
|
|
||||||
UCHAR ExceptionPortState:3;
|
|
||||||
};
|
|
||||||
#else
|
|
||||||
PVOID ExceptionPort;
|
|
||||||
#endif
|
|
||||||
PHANDLE_TABLE ObjectTable;
|
|
||||||
EX_FAST_REF Token;
|
|
||||||
ULONG WorkingSetPage;
|
|
||||||
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
|
|
||||||
EX_PUSH_LOCK AddressCreationLock;
|
|
||||||
PETHREAD RotateInProgress;
|
|
||||||
#else
|
|
||||||
FAST_MUTEX AddressCreationLock; // FIXME: FAST_MUTEX for XP, KGUARDED_MUTEX for 2K3
|
|
||||||
KSPIN_LOCK HyperSpaceLock;
|
|
||||||
#endif
|
|
||||||
PETHREAD ForkInProgress;
|
|
||||||
ULONG HardwareTrigger;
|
|
||||||
MM_AVL_TABLE PhysicalVadroot;
|
|
||||||
PVOID CloneRoot;
|
|
||||||
ULONG NumberOfPrivatePages;
|
|
||||||
ULONG NumberOfLockedPages;
|
|
||||||
PVOID *Win32Process;
|
|
||||||
struct _EJOB *Job;
|
|
||||||
PVOID SectionObject;
|
|
||||||
PVOID SectionBaseAddress;
|
|
||||||
PEPROCESS_QUOTA_BLOCK QuotaBlock;
|
|
||||||
PPAGEFAULT_HISTORY WorkingSetWatch;
|
|
||||||
PVOID Win32WindowStation;
|
|
||||||
HANDLE InheritedFromUniqueProcessId;
|
|
||||||
PVOID LdtInformation;
|
|
||||||
PVOID VadFreeHint;
|
|
||||||
PVOID VdmObjects;
|
|
||||||
PVOID DeviceMap;
|
|
||||||
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
|
|
||||||
ULONG AlpcPagedPoolQuotaCache;
|
|
||||||
PVOID EtwDataSource;
|
|
||||||
PVOID FreeTebHint;
|
|
||||||
#else
|
|
||||||
PVOID Spare0[3];
|
|
||||||
#endif
|
|
||||||
union
|
|
||||||
{
|
|
||||||
HARDWARE_PTE_X86 PagedirectoryPte;
|
|
||||||
ULONGLONG Filler;
|
|
||||||
};
|
|
||||||
ULONG Session;
|
|
||||||
CHAR ImageFileName[16];
|
|
||||||
LIST_ENTRY JobLinks;
|
|
||||||
PVOID LockedPagesList;
|
|
||||||
LIST_ENTRY ThreadListHead;
|
|
||||||
PVOID SecurityPort;
|
|
||||||
PVOID PaeTop;
|
|
||||||
ULONG ActiveThreads;
|
|
||||||
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
|
|
||||||
ULONG ImagePathHash;
|
|
||||||
#else
|
|
||||||
ACCESS_MASK GrantedAccess;
|
|
||||||
#endif
|
|
||||||
ULONG DefaultHardErrorProcessing;
|
|
||||||
NTSTATUS LastThreadExitStatus;
|
|
||||||
struct _PEB* Peb;
|
|
||||||
EX_FAST_REF PrefetchTrace;
|
|
||||||
LARGE_INTEGER ReadOperationCount;
|
|
||||||
LARGE_INTEGER WriteOperationCount;
|
|
||||||
LARGE_INTEGER OtherOperationCount;
|
|
||||||
LARGE_INTEGER ReadTransferCount;
|
|
||||||
LARGE_INTEGER WriteTransferCount;
|
|
||||||
LARGE_INTEGER OtherTransferCount;
|
|
||||||
ULONG CommitChargeLimit;
|
|
||||||
ULONG CommitChargePeak;
|
|
||||||
PVOID AweInfo;
|
|
||||||
SE_AUDIT_PROCESS_CREATION_INFO SeAuditProcessCreationInfo;
|
|
||||||
MMSUPPORT Vm;
|
|
||||||
LIST_ENTRY MmProcessLinks;
|
|
||||||
ULONG ModifiedPageCount;
|
|
||||||
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
|
|
||||||
union
|
|
||||||
{
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
ULONG JobNotReallyActive:1;
|
|
||||||
ULONG AccountingFolded:1;
|
|
||||||
ULONG NewProcessReported:1;
|
|
||||||
ULONG ExitProcessReported:1;
|
|
||||||
ULONG ReportCommitChanges:1;
|
|
||||||
ULONG LastReportMemory:1;
|
|
||||||
ULONG ReportPhysicalPageChanges:1;
|
|
||||||
ULONG HandleTableRundown:1;
|
|
||||||
ULONG NeedsHandleRundown:1;
|
|
||||||
ULONG RefTraceEnabled:1;
|
|
||||||
ULONG NumaAware:1;
|
|
||||||
ULONG ProtectedProcess:1;
|
|
||||||
ULONG DefaultPagePriority:3;
|
|
||||||
ULONG ProcessDeleteSelf:1;
|
|
||||||
ULONG ProcessVerifierTarget:1;
|
|
||||||
};
|
|
||||||
ULONG Flags2;
|
|
||||||
};
|
|
||||||
#else
|
|
||||||
ULONG JobStatus;
|
|
||||||
#endif
|
|
||||||
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;
|
|
||||||
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
|
|
||||||
ULONG DeprioritizeViews:1;
|
|
||||||
#else
|
|
||||||
ULONG SessionCreationUnderway:1;
|
|
||||||
#endif
|
|
||||||
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;
|
|
||||||
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
|
|
||||||
ULONG ProcessInserted:1;
|
|
||||||
#else
|
|
||||||
ULONG CreateFailed:1;
|
|
||||||
#endif
|
|
||||||
ULONG DefaultIoPriority:3;
|
|
||||||
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
|
|
||||||
ULONG SparePsFlags1:2;
|
|
||||||
#else
|
|
||||||
ULONG Spare1:1;
|
|
||||||
ULONG Spare2:1;
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
ULONG Flags;
|
|
||||||
};
|
|
||||||
NTSTATUS ExitStatus;
|
|
||||||
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
|
|
||||||
USHORT Spare7;
|
|
||||||
#else
|
|
||||||
USHORT NextPageColor;
|
|
||||||
#endif
|
|
||||||
union
|
|
||||||
{
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
UCHAR SubSystemMinorVersion;
|
|
||||||
UCHAR SubSystemMajorVersion;
|
|
||||||
};
|
|
||||||
USHORT SubSystemVersion;
|
|
||||||
};
|
|
||||||
UCHAR PriorityClass;
|
|
||||||
MM_AVL_TABLE VadRoot;
|
|
||||||
ULONG Cookie;
|
|
||||||
} ROS_EPROCESS, *PROS_EPROCESS;
|
|
||||||
#include <poppack.h>
|
|
||||||
|
|
||||||
extern LCID PsDefaultThreadLocaleId;
|
extern LCID PsDefaultThreadLocaleId;
|
||||||
extern LCID PsDefaultSystemLocaleId;
|
extern LCID PsDefaultSystemLocaleId;
|
||||||
extern LIST_ENTRY PspReaperListHead;
|
extern LIST_ENTRY PspReaperListHead;
|
||||||
|
@ -563,12 +368,12 @@ PspGetSystemDllEntryPoints(VOID);
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
PsLockProcess(
|
PsLockProcess(
|
||||||
PROS_EPROCESS Process,
|
PEPROCESS Process,
|
||||||
BOOLEAN Timeout
|
BOOLEAN Timeout
|
||||||
);
|
);
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
PsUnlockProcess(PROS_EPROCESS Process);
|
PsUnlockProcess(PEPROCESS Process);
|
||||||
|
|
||||||
#endif /* __INCLUDE_INTERNAL_PS_H */
|
#endif /* __INCLUDE_INTERNAL_PS_H */
|
||||||
|
|
|
@ -154,7 +154,7 @@ KiDispatchThreadNoLock(ULONG NewThreadStatus)
|
||||||
IdleProcessorMask |= Affinity;
|
IdleProcessorMask |= Affinity;
|
||||||
}
|
}
|
||||||
|
|
||||||
MmUpdatePageDir((PROS_EPROCESS)PsGetCurrentProcess(),((PETHREAD)CurrentThread)->ThreadsProcess, sizeof(ROS_EPROCESS));
|
MmUpdatePageDir((PEPROCESS)PsGetCurrentProcess(),((PETHREAD)CurrentThread)->ThreadsProcess, sizeof(EPROCESS));
|
||||||
|
|
||||||
/* Special note for Filip: This will release the Dispatcher DB Lock ;-) -- Alex */
|
/* Special note for Filip: This will release the Dispatcher DB Lock ;-) -- Alex */
|
||||||
DPRINT("You are : %x, swapping to: %x\n", OldThread, CurrentThread);
|
DPRINT("You are : %x, swapping to: %x\n", OldThread, CurrentThread);
|
||||||
|
@ -864,8 +864,8 @@ KeInitializeThread(PKPROCESS Process,
|
||||||
* while handling page faults. At this point it isn't possible to call the
|
* while handling page faults. At this point it isn't possible to call the
|
||||||
* page fault handler for the missing pde's.
|
* page fault handler for the missing pde's.
|
||||||
*/
|
*/
|
||||||
MmUpdatePageDir((PROS_EPROCESS)Process, (PVOID)Thread->StackLimit, KERNEL_STACK_SIZE);
|
MmUpdatePageDir((PEPROCESS)Process, (PVOID)Thread->StackLimit, KERNEL_STACK_SIZE);
|
||||||
MmUpdatePageDir((PROS_EPROCESS)Process, (PVOID)Thread, sizeof(ETHREAD));
|
MmUpdatePageDir((PEPROCESS)Process, (PVOID)Thread, sizeof(ETHREAD));
|
||||||
|
|
||||||
/* Initalize the Thread Context */
|
/* Initalize the Thread Context */
|
||||||
DPRINT("Initializing the Context for the thread: %x\n", Thread);
|
DPRINT("Initializing the Context for the thread: %x\n", Thread);
|
||||||
|
|
|
@ -56,8 +56,8 @@ UpdatePageDirs(IN PKTHREAD Thread,
|
||||||
* To prevent this, make sure the page directory of the process we're
|
* To prevent this, make sure the page directory of the process we're
|
||||||
* attaching to is up-to-date.
|
* attaching to is up-to-date.
|
||||||
*/
|
*/
|
||||||
MmUpdatePageDir((PROS_EPROCESS)Process, (PVOID)Thread->StackLimit, KERNEL_STACK_SIZE);
|
MmUpdatePageDir((PEPROCESS)Process, (PVOID)Thread->StackLimit, KERNEL_STACK_SIZE);
|
||||||
MmUpdatePageDir((PROS_EPROCESS)Process, (PVOID)Thread, sizeof(ETHREAD));
|
MmUpdatePageDir((PEPROCESS)Process, (PVOID)Thread, sizeof(ETHREAD));
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
|
|
@ -544,7 +544,7 @@ NtAllocateVirtualMemory(IN HANDLE ProcessHandle,
|
||||||
* RETURNS: Status
|
* RETURNS: Status
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
PROS_EPROCESS Process;
|
PEPROCESS Process;
|
||||||
MEMORY_AREA* MemoryArea;
|
MEMORY_AREA* MemoryArea;
|
||||||
ULONG_PTR MemoryAreaLength;
|
ULONG_PTR MemoryAreaLength;
|
||||||
ULONG Type;
|
ULONG Type;
|
||||||
|
@ -784,7 +784,7 @@ MmFreeVirtualMemoryPage(PVOID Context,
|
||||||
MmFreeSwapPage(SavedSwapEntry);
|
MmFreeSwapPage(SavedSwapEntry);
|
||||||
MmSetSavedSwapEntryPage(Page, 0);
|
MmSetSavedSwapEntryPage(Page, 0);
|
||||||
}
|
}
|
||||||
MmDeleteRmap(Page, (PROS_EPROCESS)Process, Address);
|
MmDeleteRmap(Page, Process, Address);
|
||||||
MmReleasePageMemoryConsumer(MC_USER, Page);
|
MmReleasePageMemoryConsumer(MC_USER, Page);
|
||||||
}
|
}
|
||||||
else if (SwapEntry != 0)
|
else if (SwapEntry != 0)
|
||||||
|
@ -795,7 +795,7 @@ MmFreeVirtualMemoryPage(PVOID Context,
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
MmFreeVirtualMemory(PROS_EPROCESS Process,
|
MmFreeVirtualMemory(PEPROCESS Process,
|
||||||
PMEMORY_AREA MemoryArea)
|
PMEMORY_AREA MemoryArea)
|
||||||
{
|
{
|
||||||
PLIST_ENTRY current_entry;
|
PLIST_ENTRY current_entry;
|
||||||
|
@ -889,7 +889,7 @@ NtFreeVirtualMemory(IN HANDLE ProcessHandle,
|
||||||
{
|
{
|
||||||
MEMORY_AREA* MemoryArea;
|
MEMORY_AREA* MemoryArea;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PROS_EPROCESS Process;
|
PEPROCESS Process;
|
||||||
PMADDRESS_SPACE AddressSpace;
|
PMADDRESS_SPACE AddressSpace;
|
||||||
PVOID BaseAddress;
|
PVOID BaseAddress;
|
||||||
ULONG RegionSize;
|
ULONG RegionSize;
|
||||||
|
|
|
@ -80,7 +80,7 @@ PMADDRESS_SPACE
|
||||||
NTAPI
|
NTAPI
|
||||||
MmGetCurrentAddressSpace(VOID)
|
MmGetCurrentAddressSpace(VOID)
|
||||||
{
|
{
|
||||||
return((PMADDRESS_SPACE)&((PROS_EPROCESS)PsGetCurrentProcess())->VadRoot);
|
return((PMADDRESS_SPACE)&(PsGetCurrentProcess())->VadRoot);
|
||||||
}
|
}
|
||||||
|
|
||||||
PMADDRESS_SPACE
|
PMADDRESS_SPACE
|
||||||
|
@ -92,7 +92,7 @@ MmGetKernelAddressSpace(VOID)
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
MmInitializeAddressSpace(PROS_EPROCESS Process,
|
MmInitializeAddressSpace(PEPROCESS Process,
|
||||||
PMADDRESS_SPACE AddressSpace)
|
PMADDRESS_SPACE AddressSpace)
|
||||||
{
|
{
|
||||||
AddressSpace->MemoryAreaRoot = NULL;
|
AddressSpace->MemoryAreaRoot = NULL;
|
||||||
|
|
|
@ -203,7 +203,7 @@ ProtectToPTE(ULONG flProtect)
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
Mmi386ReleaseMmInfo(PROS_EPROCESS Process)
|
Mmi386ReleaseMmInfo(PEPROCESS Process)
|
||||||
{
|
{
|
||||||
PUSHORT LdtDescriptor;
|
PUSHORT LdtDescriptor;
|
||||||
ULONG LdtBase;
|
ULONG LdtBase;
|
||||||
|
@ -329,8 +329,8 @@ Mmi386ReleaseMmInfo(PROS_EPROCESS Process)
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
STDCALL
|
STDCALL
|
||||||
MmCopyMmInfo(PROS_EPROCESS Src,
|
MmCopyMmInfo(PEPROCESS Src,
|
||||||
PROS_EPROCESS Dest,
|
PEPROCESS Dest,
|
||||||
PPHYSICAL_ADDRESS DirectoryTableBase)
|
PPHYSICAL_ADDRESS DirectoryTableBase)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
@ -408,9 +408,9 @@ MmCopyMmInfo(PROS_EPROCESS Src,
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
MmDeletePageTable(PROS_EPROCESS Process, PVOID Address)
|
MmDeletePageTable(PEPROCESS Process, PVOID Address)
|
||||||
{
|
{
|
||||||
PROS_EPROCESS CurrentProcess = (PROS_EPROCESS)PsGetCurrentProcess();
|
PEPROCESS CurrentProcess = PsGetCurrentProcess();
|
||||||
|
|
||||||
if (Process != NULL && Process != CurrentProcess)
|
if (Process != NULL && Process != CurrentProcess)
|
||||||
{
|
{
|
||||||
|
@ -441,9 +441,9 @@ MmDeletePageTable(PROS_EPROCESS Process, PVOID Address)
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
MmFreePageTable(PROS_EPROCESS Process, PVOID Address)
|
MmFreePageTable(PEPROCESS Process, PVOID Address)
|
||||||
{
|
{
|
||||||
PROS_EPROCESS CurrentProcess = (PROS_EPROCESS)PsGetCurrentProcess();
|
PEPROCESS CurrentProcess = PsGetCurrentProcess();
|
||||||
ULONG i;
|
ULONG i;
|
||||||
PFN_TYPE Pfn;
|
PFN_TYPE Pfn;
|
||||||
|
|
||||||
|
@ -504,7 +504,7 @@ MmFreePageTable(PROS_EPROCESS Process, PVOID Address)
|
||||||
}
|
}
|
||||||
|
|
||||||
static PULONGLONG
|
static PULONGLONG
|
||||||
MmGetPageTableForProcessForPAE(PROS_EPROCESS Process, PVOID Address, BOOLEAN Create)
|
MmGetPageTableForProcessForPAE(PEPROCESS Process, PVOID Address, BOOLEAN Create)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PFN_TYPE Pfn;
|
PFN_TYPE Pfn;
|
||||||
|
@ -520,7 +520,7 @@ MmGetPageTableForProcessForPAE(PROS_EPROCESS Process, PVOID Address, BOOLEAN Cre
|
||||||
{
|
{
|
||||||
KEBUGCHECK(0);
|
KEBUGCHECK(0);
|
||||||
}
|
}
|
||||||
if (Address < MmSystemRangeStart && Process && Process != (PROS_EPROCESS)PsGetCurrentProcess())
|
if (Address < MmSystemRangeStart && Process && Process != PsGetCurrentProcess())
|
||||||
{
|
{
|
||||||
PageDirTable = MmCreateHyperspaceMapping(PAE_PTE_TO_PFN(Process->Pcb.DirectoryTableBase.QuadPart));
|
PageDirTable = MmCreateHyperspaceMapping(PAE_PTE_TO_PFN(Process->Pcb.DirectoryTableBase.QuadPart));
|
||||||
if (PageDirTable == NULL)
|
if (PageDirTable == NULL)
|
||||||
|
@ -618,7 +618,7 @@ MmGetPageTableForProcessForPAE(PROS_EPROCESS Process, PVOID Address, BOOLEAN Cre
|
||||||
}
|
}
|
||||||
|
|
||||||
static PULONG
|
static PULONG
|
||||||
MmGetPageTableForProcess(PROS_EPROCESS Process, PVOID Address, BOOLEAN Create)
|
MmGetPageTableForProcess(PEPROCESS Process, PVOID Address, BOOLEAN Create)
|
||||||
{
|
{
|
||||||
ULONG PdeOffset = ADDR_TO_PDE_OFFSET(Address);
|
ULONG PdeOffset = ADDR_TO_PDE_OFFSET(Address);
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
@ -626,7 +626,7 @@ MmGetPageTableForProcess(PROS_EPROCESS Process, PVOID Address, BOOLEAN Create)
|
||||||
ULONG Entry;
|
ULONG Entry;
|
||||||
PULONG Pt, PageDir;
|
PULONG Pt, PageDir;
|
||||||
|
|
||||||
if (Address < MmSystemRangeStart && Process && Process != (PROS_EPROCESS)PsGetCurrentProcess())
|
if (Address < MmSystemRangeStart && Process && Process != PsGetCurrentProcess())
|
||||||
{
|
{
|
||||||
PageDir = MmCreateHyperspaceMapping(PTE_TO_PFN(Process->Pcb.DirectoryTableBase.QuadPart));
|
PageDir = MmCreateHyperspaceMapping(PTE_TO_PFN(Process->Pcb.DirectoryTableBase.QuadPart));
|
||||||
if (PageDir == NULL)
|
if (PageDir == NULL)
|
||||||
|
@ -736,7 +736,7 @@ BOOLEAN MmUnmapPageTable(PULONG Pt)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONGLONG MmGetPageEntryForProcessForPAE(PROS_EPROCESS Process, PVOID Address)
|
static ULONGLONG MmGetPageEntryForProcessForPAE(PEPROCESS Process, PVOID Address)
|
||||||
{
|
{
|
||||||
ULONGLONG Pte;
|
ULONGLONG Pte;
|
||||||
PULONGLONG Pt;
|
PULONGLONG Pt;
|
||||||
|
@ -751,7 +751,7 @@ static ULONGLONG MmGetPageEntryForProcessForPAE(PROS_EPROCESS Process, PVOID Add
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG MmGetPageEntryForProcess(PROS_EPROCESS Process, PVOID Address)
|
static ULONG MmGetPageEntryForProcess(PEPROCESS Process, PVOID Address)
|
||||||
{
|
{
|
||||||
ULONG Pte;
|
ULONG Pte;
|
||||||
PULONG Pt;
|
PULONG Pt;
|
||||||
|
@ -768,7 +768,7 @@ static ULONG MmGetPageEntryForProcess(PROS_EPROCESS Process, PVOID Address)
|
||||||
|
|
||||||
PFN_TYPE
|
PFN_TYPE
|
||||||
NTAPI
|
NTAPI
|
||||||
MmGetPfnForProcess(PROS_EPROCESS Process,
|
MmGetPfnForProcess(PEPROCESS Process,
|
||||||
PVOID Address)
|
PVOID Address)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -796,7 +796,7 @@ MmGetPfnForProcess(PROS_EPROCESS Process,
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
MmDisableVirtualMapping(PROS_EPROCESS Process, PVOID Address, BOOLEAN* WasDirty, PPFN_TYPE Page)
|
MmDisableVirtualMapping(PEPROCESS Process, PVOID Address, BOOLEAN* WasDirty, PPFN_TYPE Page)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Delete a virtual mapping
|
* FUNCTION: Delete a virtual mapping
|
||||||
*/
|
*/
|
||||||
|
@ -916,7 +916,7 @@ MmRawDeleteVirtualMapping(PVOID Address)
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
MmDeleteVirtualMapping(PROS_EPROCESS Process, PVOID Address, BOOLEAN FreePage,
|
MmDeleteVirtualMapping(PEPROCESS Process, PVOID Address, BOOLEAN FreePage,
|
||||||
BOOLEAN* WasDirty, PPFN_TYPE Page)
|
BOOLEAN* WasDirty, PPFN_TYPE Page)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Delete a virtual mapping
|
* FUNCTION: Delete a virtual mapping
|
||||||
|
@ -1060,7 +1060,7 @@ MmDeleteVirtualMapping(PROS_EPROCESS Process, PVOID Address, BOOLEAN FreePage,
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
MmDeletePageFileMapping(PROS_EPROCESS Process, PVOID Address,
|
MmDeletePageFileMapping(PEPROCESS Process, PVOID Address,
|
||||||
SWAPENTRY* SwapEntry)
|
SWAPENTRY* SwapEntry)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Delete a virtual mapping
|
* FUNCTION: Delete a virtual mapping
|
||||||
|
@ -1199,7 +1199,7 @@ Mmi386MakeKernelPageTableGlobal(PVOID PAddress)
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
NTAPI
|
NTAPI
|
||||||
MmIsDirtyPage(PROS_EPROCESS Process, PVOID Address)
|
MmIsDirtyPage(PEPROCESS Process, PVOID Address)
|
||||||
{
|
{
|
||||||
if (Ke386Pae)
|
if (Ke386Pae)
|
||||||
{
|
{
|
||||||
|
@ -1213,7 +1213,7 @@ MmIsDirtyPage(PROS_EPROCESS Process, PVOID Address)
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
NTAPI
|
NTAPI
|
||||||
MmIsAccessedAndResetAccessPage(PROS_EPROCESS Process, PVOID Address)
|
MmIsAccessedAndResetAccessPage(PEPROCESS Process, PVOID Address)
|
||||||
{
|
{
|
||||||
if (Address < MmSystemRangeStart && Process == NULL)
|
if (Address < MmSystemRangeStart && Process == NULL)
|
||||||
{
|
{
|
||||||
|
@ -1280,7 +1280,7 @@ MmIsAccessedAndResetAccessPage(PROS_EPROCESS Process, PVOID Address)
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
MmSetCleanPage(PROS_EPROCESS Process, PVOID Address)
|
MmSetCleanPage(PEPROCESS Process, PVOID Address)
|
||||||
{
|
{
|
||||||
if (Address < MmSystemRangeStart && Process == NULL)
|
if (Address < MmSystemRangeStart && Process == NULL)
|
||||||
{
|
{
|
||||||
|
@ -1345,7 +1345,7 @@ MmSetCleanPage(PROS_EPROCESS Process, PVOID Address)
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
MmSetDirtyPage(PROS_EPROCESS Process, PVOID Address)
|
MmSetDirtyPage(PEPROCESS Process, PVOID Address)
|
||||||
{
|
{
|
||||||
if (Address < MmSystemRangeStart && Process == NULL)
|
if (Address < MmSystemRangeStart && Process == NULL)
|
||||||
{
|
{
|
||||||
|
@ -1406,7 +1406,7 @@ MmSetDirtyPage(PROS_EPROCESS Process, PVOID Address)
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
MmEnableVirtualMapping(PROS_EPROCESS Process, PVOID Address)
|
MmEnableVirtualMapping(PEPROCESS Process, PVOID Address)
|
||||||
{
|
{
|
||||||
if (Ke386Pae)
|
if (Ke386Pae)
|
||||||
{
|
{
|
||||||
|
@ -1462,7 +1462,7 @@ MmEnableVirtualMapping(PROS_EPROCESS Process, PVOID Address)
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
NTAPI
|
NTAPI
|
||||||
MmIsPagePresent(PROS_EPROCESS Process, PVOID Address)
|
MmIsPagePresent(PEPROCESS Process, PVOID Address)
|
||||||
{
|
{
|
||||||
if (Ke386Pae)
|
if (Ke386Pae)
|
||||||
{
|
{
|
||||||
|
@ -1476,7 +1476,7 @@ MmIsPagePresent(PROS_EPROCESS Process, PVOID Address)
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
NTAPI
|
NTAPI
|
||||||
MmIsPageSwapEntry(PROS_EPROCESS Process, PVOID Address)
|
MmIsPageSwapEntry(PEPROCESS Process, PVOID Address)
|
||||||
{
|
{
|
||||||
if (Ke386Pae)
|
if (Ke386Pae)
|
||||||
{
|
{
|
||||||
|
@ -1622,7 +1622,7 @@ MmCreateVirtualMappingForKernel(PVOID Address,
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
MmCreatePageFileMapping(PROS_EPROCESS Process,
|
MmCreatePageFileMapping(PEPROCESS Process,
|
||||||
PVOID Address,
|
PVOID Address,
|
||||||
SWAPENTRY SwapEntry)
|
SWAPENTRY SwapEntry)
|
||||||
{
|
{
|
||||||
|
@ -1710,7 +1710,7 @@ MmCreatePageFileMapping(PROS_EPROCESS Process,
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
MmCreateVirtualMappingUnsafe(PROS_EPROCESS Process,
|
MmCreateVirtualMappingUnsafe(PEPROCESS Process,
|
||||||
PVOID Address,
|
PVOID Address,
|
||||||
ULONG flProtect,
|
ULONG flProtect,
|
||||||
PPFN_TYPE Pages,
|
PPFN_TYPE Pages,
|
||||||
|
@ -1916,7 +1916,7 @@ MmCreateVirtualMappingUnsafe(PROS_EPROCESS Process,
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
MmCreateVirtualMapping(PROS_EPROCESS Process,
|
MmCreateVirtualMapping(PEPROCESS Process,
|
||||||
PVOID Address,
|
PVOID Address,
|
||||||
ULONG flProtect,
|
ULONG flProtect,
|
||||||
PPFN_TYPE Pages,
|
PPFN_TYPE Pages,
|
||||||
|
@ -1942,7 +1942,7 @@ MmCreateVirtualMapping(PROS_EPROCESS Process,
|
||||||
|
|
||||||
ULONG
|
ULONG
|
||||||
NTAPI
|
NTAPI
|
||||||
MmGetPageProtect(PROS_EPROCESS Process, PVOID Address)
|
MmGetPageProtect(PEPROCESS Process, PVOID Address)
|
||||||
{
|
{
|
||||||
ULONG Entry;
|
ULONG Entry;
|
||||||
ULONG Protect;
|
ULONG Protect;
|
||||||
|
@ -1988,7 +1988,7 @@ MmGetPageProtect(PROS_EPROCESS Process, PVOID Address)
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
MmSetPageProtect(PROS_EPROCESS Process, PVOID Address, ULONG flProtect)
|
MmSetPageProtect(PEPROCESS Process, PVOID Address, ULONG flProtect)
|
||||||
{
|
{
|
||||||
ULONG Attributes = 0;
|
ULONG Attributes = 0;
|
||||||
BOOLEAN NoExecute = FALSE;
|
BOOLEAN NoExecute = FALSE;
|
||||||
|
@ -2273,7 +2273,7 @@ MmDeleteHyperspaceMapping(PVOID Address)
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
MmUpdatePageDir(PROS_EPROCESS Process, PVOID Address, ULONG Size)
|
MmUpdatePageDir(PEPROCESS Process, PVOID Address, ULONG Size)
|
||||||
{
|
{
|
||||||
ULONG StartOffset, EndOffset, Offset;
|
ULONG StartOffset, EndOffset, Offset;
|
||||||
|
|
||||||
|
@ -2307,7 +2307,7 @@ MmUpdatePageDir(PROS_EPROCESS Process, PVOID Address, ULONG Size)
|
||||||
EndOffset = 511;
|
EndOffset = 511;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Process != NULL && Process != (PROS_EPROCESS)PsGetCurrentProcess())
|
if (Process != NULL && Process != PsGetCurrentProcess())
|
||||||
{
|
{
|
||||||
PageDirTable = MmCreateHyperspaceMapping(PAE_PTE_TO_PFN(Process->Pcb.DirectoryTableBase.QuadPart));
|
PageDirTable = MmCreateHyperspaceMapping(PAE_PTE_TO_PFN(Process->Pcb.DirectoryTableBase.QuadPart));
|
||||||
Pde = (PULONGLONG)MmCreateHyperspaceMapping(PTE_TO_PFN(PageDirTable[i]));
|
Pde = (PULONGLONG)MmCreateHyperspaceMapping(PTE_TO_PFN(PageDirTable[i]));
|
||||||
|
@ -2334,7 +2334,7 @@ MmUpdatePageDir(PROS_EPROCESS Process, PVOID Address, ULONG Size)
|
||||||
StartOffset = ADDR_TO_PDE_OFFSET(Address);
|
StartOffset = ADDR_TO_PDE_OFFSET(Address);
|
||||||
EndOffset = ADDR_TO_PDE_OFFSET((PVOID)((ULONG_PTR)Address + Size));
|
EndOffset = ADDR_TO_PDE_OFFSET((PVOID)((ULONG_PTR)Address + Size));
|
||||||
|
|
||||||
if (Process != NULL && Process != (PROS_EPROCESS)PsGetCurrentProcess())
|
if (Process != NULL && Process != PsGetCurrentProcess())
|
||||||
{
|
{
|
||||||
Pde = MmCreateHyperspaceMapping(PTE_TO_PFN(Process->Pcb.DirectoryTableBase.u.LowPart));
|
Pde = MmCreateHyperspaceMapping(PTE_TO_PFN(Process->Pcb.DirectoryTableBase.u.LowPart));
|
||||||
}
|
}
|
||||||
|
|
|
@ -747,7 +747,7 @@ MmFreeMemoryArea(
|
||||||
PMEMORY_AREA *ParentReplace;
|
PMEMORY_AREA *ParentReplace;
|
||||||
ULONG_PTR Address;
|
ULONG_PTR Address;
|
||||||
PVOID EndAddress;
|
PVOID EndAddress;
|
||||||
PROS_EPROCESS CurrentProcess = (PROS_EPROCESS)PsGetCurrentProcess();
|
PEPROCESS CurrentProcess = PsGetCurrentProcess();
|
||||||
|
|
||||||
if (AddressSpace->Process != NULL &&
|
if (AddressSpace->Process != NULL &&
|
||||||
AddressSpace->Process != CurrentProcess)
|
AddressSpace->Process != CurrentProcess)
|
||||||
|
@ -1025,7 +1025,7 @@ MmCreateMemoryArea(PMADDRESS_SPACE AddressSpace,
|
||||||
|
|
||||||
|
|
||||||
VOID STDCALL
|
VOID STDCALL
|
||||||
MmReleaseMemoryAreaIfDecommitted(PROS_EPROCESS Process,
|
MmReleaseMemoryAreaIfDecommitted(PEPROCESS Process,
|
||||||
PMADDRESS_SPACE AddressSpace,
|
PMADDRESS_SPACE AddressSpace,
|
||||||
PVOID BaseAddress)
|
PVOID BaseAddress)
|
||||||
{
|
{
|
||||||
|
|
|
@ -241,7 +241,7 @@ MmUnmapLockedPages(PVOID BaseAddress, PMDL Mdl)
|
||||||
/* Unmap all the pages. */
|
/* Unmap all the pages. */
|
||||||
for (i = 0; i < PageCount; i++)
|
for (i = 0; i < PageCount; i++)
|
||||||
{
|
{
|
||||||
MmDeleteVirtualMapping((PROS_EPROCESS)Mdl->Process,
|
MmDeleteVirtualMapping(Mdl->Process,
|
||||||
(char*)BaseAddress + (i * PAGE_SIZE),
|
(char*)BaseAddress + (i * PAGE_SIZE),
|
||||||
FALSE,
|
FALSE,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -273,14 +273,14 @@ MmUnmapLockedPages(PVOID BaseAddress, PMDL Mdl)
|
||||||
|
|
||||||
ASSERT(Mdl->Process == PsGetCurrentProcess());
|
ASSERT(Mdl->Process == PsGetCurrentProcess());
|
||||||
|
|
||||||
Marea = MmLocateMemoryAreaByAddress( (PMADDRESS_SPACE)&((PROS_EPROCESS)Mdl->Process)->VadRoot, BaseAddress );
|
Marea = MmLocateMemoryAreaByAddress( (PMADDRESS_SPACE)&(Mdl->Process)->VadRoot, BaseAddress );
|
||||||
if (Marea == NULL)
|
if (Marea == NULL)
|
||||||
{
|
{
|
||||||
DPRINT1( "Couldn't open memory area when unmapping user-space pages!\n" );
|
DPRINT1( "Couldn't open memory area when unmapping user-space pages!\n" );
|
||||||
KEBUGCHECK(0);
|
KEBUGCHECK(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
MmFreeMemoryArea( (PMADDRESS_SPACE)&((PROS_EPROCESS)Mdl->Process)->VadRoot, Marea, NULL, NULL );
|
MmFreeMemoryArea( (PMADDRESS_SPACE)&(Mdl->Process)->VadRoot, Marea, NULL, NULL );
|
||||||
|
|
||||||
Mdl->Process = NULL;
|
Mdl->Process = NULL;
|
||||||
}
|
}
|
||||||
|
@ -411,7 +411,7 @@ VOID STDCALL MmProbeAndLockPages (PMDL Mdl,
|
||||||
/* FIXME: why isn't AccessMode used? */
|
/* FIXME: why isn't AccessMode used? */
|
||||||
Mode = UserMode;
|
Mode = UserMode;
|
||||||
Mdl->Process = CurrentProcess;
|
Mdl->Process = CurrentProcess;
|
||||||
AddressSpace = (PMADDRESS_SPACE)&((PROS_EPROCESS)CurrentProcess)->VadRoot;
|
AddressSpace = (PMADDRESS_SPACE)&(CurrentProcess)->VadRoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -771,7 +771,7 @@ MmMapLockedPagesSpecifyCache ( IN PMDL Mdl,
|
||||||
KIRQL oldIrql;
|
KIRQL oldIrql;
|
||||||
ULONG PageCount;
|
ULONG PageCount;
|
||||||
ULONG StartingOffset;
|
ULONG StartingOffset;
|
||||||
PROS_EPROCESS CurrentProcess;
|
PEPROCESS CurrentProcess;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
ULONG Protect;
|
ULONG Protect;
|
||||||
|
|
||||||
|
@ -803,7 +803,7 @@ MmMapLockedPagesSpecifyCache ( IN PMDL Mdl,
|
||||||
BoundaryAddressMultiple.QuadPart = 0;
|
BoundaryAddressMultiple.QuadPart = 0;
|
||||||
Base = BaseAddress;
|
Base = BaseAddress;
|
||||||
|
|
||||||
CurrentProcess = (PROS_EPROCESS)PsGetCurrentProcess();
|
CurrentProcess = PsGetCurrentProcess();
|
||||||
|
|
||||||
MmLockAddressSpace((PMADDRESS_SPACE)&CurrentProcess->VadRoot);
|
MmLockAddressSpace((PMADDRESS_SPACE)&CurrentProcess->VadRoot);
|
||||||
Status = MmCreateMemoryArea((PMADDRESS_SPACE)&CurrentProcess->VadRoot,
|
Status = MmCreateMemoryArea((PMADDRESS_SPACE)&CurrentProcess->VadRoot,
|
||||||
|
|
|
@ -30,7 +30,7 @@ MM_STATS MmStats;
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
MmReleaseMmInfo(PROS_EPROCESS Process)
|
MmReleaseMmInfo(PEPROCESS Process)
|
||||||
{
|
{
|
||||||
PVOID Address;
|
PVOID Address;
|
||||||
PMEMORY_AREA MemoryArea;
|
PMEMORY_AREA MemoryArea;
|
||||||
|
@ -114,7 +114,7 @@ BOOLEAN STDCALL MmIsAddressValid(PVOID VirtualAddress)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AddressSpace = (PMADDRESS_SPACE)&((PROS_EPROCESS)PsGetCurrentProcess())->VadRoot;
|
AddressSpace = (PMADDRESS_SPACE)&(PsGetCurrentProcess())->VadRoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
MmLockAddressSpace(AddressSpace);
|
MmLockAddressSpace(AddressSpace);
|
||||||
|
@ -171,7 +171,7 @@ MmAccessFault(KPROCESSOR_MODE Mode,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AddressSpace = (PMADDRESS_SPACE)&((PROS_EPROCESS)PsGetCurrentProcess())->VadRoot;
|
AddressSpace = (PMADDRESS_SPACE)&(PsGetCurrentProcess())->VadRoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!FromMdl)
|
if (!FromMdl)
|
||||||
|
@ -304,7 +304,7 @@ MmNotPresentFault(KPROCESSOR_MODE Mode,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AddressSpace = (PMADDRESS_SPACE)&((PROS_EPROCESS)PsGetCurrentProcess())->VadRoot;
|
AddressSpace = (PMADDRESS_SPACE)&(PsGetCurrentProcess())->VadRoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!FromMdl)
|
if (!FromMdl)
|
||||||
|
@ -357,7 +357,7 @@ MmNotPresentFault(KPROCESSOR_MODE Mode,
|
||||||
case MEMORY_AREA_SHARED_DATA:
|
case MEMORY_AREA_SHARED_DATA:
|
||||||
Pfn = MmSharedDataPagePhysicalAddress.QuadPart >> PAGE_SHIFT;
|
Pfn = MmSharedDataPagePhysicalAddress.QuadPart >> PAGE_SHIFT;
|
||||||
Status =
|
Status =
|
||||||
MmCreateVirtualMapping((PROS_EPROCESS)PsGetCurrentProcess(),
|
MmCreateVirtualMapping(PsGetCurrentProcess(),
|
||||||
(PVOID)PAGE_ROUND_DOWN(Address),
|
(PVOID)PAGE_ROUND_DOWN(Address),
|
||||||
PAGE_READONLY,
|
PAGE_READONLY,
|
||||||
&Pfn,
|
&Pfn,
|
||||||
|
|
|
@ -25,7 +25,7 @@ extern ULONG NtGlobalFlag;
|
||||||
|
|
||||||
PVOID
|
PVOID
|
||||||
STDCALL
|
STDCALL
|
||||||
MiCreatePebOrTeb(PROS_EPROCESS Process,
|
MiCreatePebOrTeb(PEPROCESS Process,
|
||||||
PVOID BaseAddress)
|
PVOID BaseAddress)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
@ -107,7 +107,7 @@ MmDeleteKernelStack(PVOID Stack,
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
STDCALL
|
STDCALL
|
||||||
MmDeleteTeb(PROS_EPROCESS Process,
|
MmDeleteTeb(PEPROCESS Process,
|
||||||
PTEB Teb)
|
PTEB Teb)
|
||||||
{
|
{
|
||||||
PMADDRESS_SPACE ProcessAddressSpace = (PMADDRESS_SPACE)&Process->VadRoot;
|
PMADDRESS_SPACE ProcessAddressSpace = (PMADDRESS_SPACE)&Process->VadRoot;
|
||||||
|
@ -220,7 +220,7 @@ MmGrowKernelStack(PVOID StackPointer)
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
STDCALL
|
STDCALL
|
||||||
MmCreatePeb(PROS_EPROCESS Process)
|
MmCreatePeb(PEPROCESS Process)
|
||||||
{
|
{
|
||||||
PPEB Peb = NULL;
|
PPEB Peb = NULL;
|
||||||
LARGE_INTEGER SectionOffset;
|
LARGE_INTEGER SectionOffset;
|
||||||
|
@ -370,7 +370,7 @@ MmCreatePeb(PROS_EPROCESS Process)
|
||||||
|
|
||||||
PTEB
|
PTEB
|
||||||
STDCALL
|
STDCALL
|
||||||
MmCreateTeb(PROS_EPROCESS Process,
|
MmCreateTeb(PEPROCESS Process,
|
||||||
PCLIENT_ID ClientId,
|
PCLIENT_ID ClientId,
|
||||||
PINITIAL_TEB InitialTeb)
|
PINITIAL_TEB InitialTeb)
|
||||||
{
|
{
|
||||||
|
@ -379,7 +379,7 @@ MmCreateTeb(PROS_EPROCESS Process,
|
||||||
|
|
||||||
/* Attach to the process */
|
/* Attach to the process */
|
||||||
DPRINT("MmCreateTeb\n");
|
DPRINT("MmCreateTeb\n");
|
||||||
if (Process != (PROS_EPROCESS)PsGetCurrentProcess())
|
if (Process != PsGetCurrentProcess())
|
||||||
{
|
{
|
||||||
/* Attach to Target */
|
/* Attach to Target */
|
||||||
KeAttachProcess(&Process->Pcb);
|
KeAttachProcess(&Process->Pcb);
|
||||||
|
@ -420,7 +420,7 @@ MmCreateTeb(PROS_EPROCESS Process,
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
STDCALL
|
STDCALL
|
||||||
MmCreateProcessAddressSpace(IN PROS_EPROCESS Process,
|
MmCreateProcessAddressSpace(IN PEPROCESS Process,
|
||||||
IN PROS_SECTION_OBJECT Section OPTIONAL)
|
IN PROS_SECTION_OBJECT Section OPTIONAL)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
|
@ -62,7 +62,7 @@ MmWritePagePhysicalAddress(PFN_TYPE Page)
|
||||||
PMADDRESS_SPACE AddressSpace;
|
PMADDRESS_SPACE AddressSpace;
|
||||||
ULONG Type;
|
ULONG Type;
|
||||||
PVOID Address;
|
PVOID Address;
|
||||||
PROS_EPROCESS Process;
|
PEPROCESS Process;
|
||||||
PMM_PAGEOP PageOp;
|
PMM_PAGEOP PageOp;
|
||||||
ULONG Offset;
|
ULONG Offset;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
@ -78,7 +78,7 @@ MmWritePagePhysicalAddress(PFN_TYPE Page)
|
||||||
ExReleaseFastMutex(&RmapListLock);
|
ExReleaseFastMutex(&RmapListLock);
|
||||||
return(STATUS_UNSUCCESSFUL);
|
return(STATUS_UNSUCCESSFUL);
|
||||||
}
|
}
|
||||||
Process = (PROS_EPROCESS)entry->Process;
|
Process = entry->Process;
|
||||||
Address = entry->Address;
|
Address = entry->Address;
|
||||||
if ((((ULONG_PTR)Address) & 0xFFF) != 0)
|
if ((((ULONG_PTR)Address) & 0xFFF) != 0)
|
||||||
{
|
{
|
||||||
|
@ -196,7 +196,7 @@ MmPageOutPhysicalAddress(PFN_TYPE Page)
|
||||||
PMADDRESS_SPACE AddressSpace;
|
PMADDRESS_SPACE AddressSpace;
|
||||||
ULONG Type;
|
ULONG Type;
|
||||||
PVOID Address;
|
PVOID Address;
|
||||||
PROS_EPROCESS Process;
|
PEPROCESS Process;
|
||||||
PMM_PAGEOP PageOp;
|
PMM_PAGEOP PageOp;
|
||||||
ULONG Offset;
|
ULONG Offset;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
@ -208,7 +208,7 @@ MmPageOutPhysicalAddress(PFN_TYPE Page)
|
||||||
ExReleaseFastMutex(&RmapListLock);
|
ExReleaseFastMutex(&RmapListLock);
|
||||||
return(STATUS_UNSUCCESSFUL);
|
return(STATUS_UNSUCCESSFUL);
|
||||||
}
|
}
|
||||||
Process = (PROS_EPROCESS)entry->Process;
|
Process = entry->Process;
|
||||||
Address = entry->Address;
|
Address = entry->Address;
|
||||||
if ((((ULONG_PTR)Address) & 0xFFF) != 0)
|
if ((((ULONG_PTR)Address) & 0xFFF) != 0)
|
||||||
{
|
{
|
||||||
|
@ -326,7 +326,7 @@ MmSetCleanAllRmaps(PFN_TYPE Page)
|
||||||
}
|
}
|
||||||
while (current_entry != NULL)
|
while (current_entry != NULL)
|
||||||
{
|
{
|
||||||
MmSetCleanPage((PROS_EPROCESS)current_entry->Process, current_entry->Address);
|
MmSetCleanPage(current_entry->Process, current_entry->Address);
|
||||||
current_entry = current_entry->Next;
|
current_entry = current_entry->Next;
|
||||||
}
|
}
|
||||||
ExReleaseFastMutex(&RmapListLock);
|
ExReleaseFastMutex(&RmapListLock);
|
||||||
|
@ -347,7 +347,7 @@ MmSetDirtyAllRmaps(PFN_TYPE Page)
|
||||||
}
|
}
|
||||||
while (current_entry != NULL)
|
while (current_entry != NULL)
|
||||||
{
|
{
|
||||||
MmSetDirtyPage((PROS_EPROCESS)current_entry->Process, current_entry->Address);
|
MmSetDirtyPage(current_entry->Process, current_entry->Address);
|
||||||
current_entry = current_entry->Next;
|
current_entry = current_entry->Next;
|
||||||
}
|
}
|
||||||
ExReleaseFastMutex(&RmapListLock);
|
ExReleaseFastMutex(&RmapListLock);
|
||||||
|
@ -368,7 +368,7 @@ MmIsDirtyPageRmap(PFN_TYPE Page)
|
||||||
}
|
}
|
||||||
while (current_entry != NULL)
|
while (current_entry != NULL)
|
||||||
{
|
{
|
||||||
if (MmIsDirtyPage((PROS_EPROCESS)current_entry->Process, current_entry->Address))
|
if (MmIsDirtyPage(current_entry->Process, current_entry->Address))
|
||||||
{
|
{
|
||||||
ExReleaseFastMutex(&RmapListLock);
|
ExReleaseFastMutex(&RmapListLock);
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
|
@ -381,7 +381,7 @@ MmIsDirtyPageRmap(PFN_TYPE Page)
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
MmInsertRmap(PFN_TYPE Page, PROS_EPROCESS Process,
|
MmInsertRmap(PFN_TYPE Page, PEPROCESS Process,
|
||||||
PVOID Address)
|
PVOID Address)
|
||||||
{
|
{
|
||||||
PMM_RMAP_ENTRY current_entry;
|
PMM_RMAP_ENTRY current_entry;
|
||||||
|
@ -433,7 +433,7 @@ MmInsertRmap(PFN_TYPE Page, PROS_EPROCESS Process,
|
||||||
ExReleaseFastMutex(&RmapListLock);
|
ExReleaseFastMutex(&RmapListLock);
|
||||||
if (Process == NULL)
|
if (Process == NULL)
|
||||||
{
|
{
|
||||||
Process = (PROS_EPROCESS)PsInitialSystemProcess;
|
Process = PsInitialSystemProcess;
|
||||||
}
|
}
|
||||||
if (Process)
|
if (Process)
|
||||||
{
|
{
|
||||||
|
@ -448,7 +448,7 @@ MmInsertRmap(PFN_TYPE Page, PROS_EPROCESS Process,
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
MmDeleteAllRmaps(PFN_TYPE Page, PVOID Context,
|
MmDeleteAllRmaps(PFN_TYPE Page, PVOID Context,
|
||||||
VOID (*DeleteMapping)(PVOID Context, PROS_EPROCESS Process,
|
VOID (*DeleteMapping)(PVOID Context, PEPROCESS Process,
|
||||||
PVOID Address))
|
PVOID Address))
|
||||||
{
|
{
|
||||||
PMM_RMAP_ENTRY current_entry;
|
PMM_RMAP_ENTRY current_entry;
|
||||||
|
@ -470,7 +470,7 @@ MmDeleteAllRmaps(PFN_TYPE Page, PVOID Context,
|
||||||
current_entry = current_entry->Next;
|
current_entry = current_entry->Next;
|
||||||
if (DeleteMapping)
|
if (DeleteMapping)
|
||||||
{
|
{
|
||||||
DeleteMapping(Context, (PROS_EPROCESS)previous_entry->Process,
|
DeleteMapping(Context, previous_entry->Process,
|
||||||
previous_entry->Address);
|
previous_entry->Address);
|
||||||
}
|
}
|
||||||
Process = previous_entry->Process;
|
Process = previous_entry->Process;
|
||||||
|
@ -488,7 +488,7 @@ MmDeleteAllRmaps(PFN_TYPE Page, PVOID Context,
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
MmDeleteRmap(PFN_TYPE Page, PROS_EPROCESS Process,
|
MmDeleteRmap(PFN_TYPE Page, PEPROCESS Process,
|
||||||
PVOID Address)
|
PVOID Address)
|
||||||
{
|
{
|
||||||
PMM_RMAP_ENTRY current_entry, previous_entry;
|
PMM_RMAP_ENTRY current_entry, previous_entry;
|
||||||
|
@ -513,7 +513,7 @@ MmDeleteRmap(PFN_TYPE Page, PROS_EPROCESS Process,
|
||||||
ExFreeToNPagedLookasideList(&RmapLookasideList, current_entry);
|
ExFreeToNPagedLookasideList(&RmapLookasideList, current_entry);
|
||||||
if (Process == NULL)
|
if (Process == NULL)
|
||||||
{
|
{
|
||||||
Process = (PROS_EPROCESS)PsInitialSystemProcess;
|
Process = PsInitialSystemProcess;
|
||||||
}
|
}
|
||||||
if (Process)
|
if (Process)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1329,7 +1329,7 @@ MmAccessFaultSectionView(PMADDRESS_SPACE AddressSpace,
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
MmPageOutDeleteMapping(PVOID Context, PROS_EPROCESS Process, PVOID Address)
|
MmPageOutDeleteMapping(PVOID Context, PEPROCESS Process, PVOID Address)
|
||||||
{
|
{
|
||||||
MM_SECTION_PAGEOUT_CONTEXT* PageOutContext;
|
MM_SECTION_PAGEOUT_CONTEXT* PageOutContext;
|
||||||
BOOLEAN WasDirty;
|
BOOLEAN WasDirty;
|
||||||
|
@ -3595,7 +3595,7 @@ NtMapViewOfSection(IN HANDLE SectionHandle,
|
||||||
LARGE_INTEGER SafeSectionOffset;
|
LARGE_INTEGER SafeSectionOffset;
|
||||||
SIZE_T SafeViewSize;
|
SIZE_T SafeViewSize;
|
||||||
PROS_SECTION_OBJECT Section;
|
PROS_SECTION_OBJECT Section;
|
||||||
PROS_EPROCESS Process;
|
PEPROCESS Process;
|
||||||
KPROCESSOR_MODE PreviousMode;
|
KPROCESSOR_MODE PreviousMode;
|
||||||
PMADDRESS_SPACE AddressSpace;
|
PMADDRESS_SPACE AddressSpace;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
@ -3911,7 +3911,7 @@ MmUnmapViewOfSection(PEPROCESS Process,
|
||||||
|
|
||||||
ASSERT(Process);
|
ASSERT(Process);
|
||||||
|
|
||||||
AddressSpace = (PMADDRESS_SPACE)&((PROS_EPROCESS)Process)->VadRoot;
|
AddressSpace = (PMADDRESS_SPACE)&(Process)->VadRoot;
|
||||||
|
|
||||||
MmLockAddressSpace(AddressSpace);
|
MmLockAddressSpace(AddressSpace);
|
||||||
MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace,
|
MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace,
|
||||||
|
@ -4432,7 +4432,7 @@ MmMapViewOfSection(IN PVOID SectionObject,
|
||||||
|
|
||||||
|
|
||||||
Section = (PROS_SECTION_OBJECT)SectionObject;
|
Section = (PROS_SECTION_OBJECT)SectionObject;
|
||||||
AddressSpace = (PMADDRESS_SPACE)&((PROS_EPROCESS)Process)->VadRoot;
|
AddressSpace = (PMADDRESS_SPACE)&(Process)->VadRoot;
|
||||||
|
|
||||||
AllocationType |= (Section->AllocationAttributes & SEC_NO_CHANGE);
|
AllocationType |= (Section->AllocationAttributes & SEC_NO_CHANGE);
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,7 @@ MiQueryVirtualMemory (IN HANDLE ProcessHandle,
|
||||||
OUT PULONG ResultLength)
|
OUT PULONG ResultLength)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PROS_EPROCESS Process;
|
PEPROCESS Process;
|
||||||
MEMORY_AREA* MemoryArea;
|
MEMORY_AREA* MemoryArea;
|
||||||
PMADDRESS_SPACE AddressSpace;
|
PMADDRESS_SPACE AddressSpace;
|
||||||
|
|
||||||
|
@ -393,7 +393,7 @@ MiProtectVirtualMemory(IN PEPROCESS Process,
|
||||||
PAGE_ROUND_DOWN(*BaseAddress);
|
PAGE_ROUND_DOWN(*BaseAddress);
|
||||||
*BaseAddress = (PVOID)PAGE_ROUND_DOWN(*BaseAddress);
|
*BaseAddress = (PVOID)PAGE_ROUND_DOWN(*BaseAddress);
|
||||||
|
|
||||||
AddressSpace = (PMADDRESS_SPACE)&((PROS_EPROCESS)Process)->VadRoot;
|
AddressSpace = (PMADDRESS_SPACE)&(Process)->VadRoot;
|
||||||
|
|
||||||
MmLockAddressSpace(AddressSpace);
|
MmLockAddressSpace(AddressSpace);
|
||||||
MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace, *BaseAddress);
|
MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace, *BaseAddress);
|
||||||
|
|
|
@ -157,7 +157,7 @@ NtAssignProcessToJobObject (
|
||||||
/* lock the process so we can safely assign the process. Note that in the
|
/* lock the process so we can safely assign the process. Note that in the
|
||||||
meanwhile another thread could have assigned this process to a job! */
|
meanwhile another thread could have assigned this process to a job! */
|
||||||
|
|
||||||
Status = PsLockProcess((PROS_EPROCESS)Process, FALSE);
|
Status = PsLockProcess(Process, FALSE);
|
||||||
if(NT_SUCCESS(Status))
|
if(NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
if(Process->Job == NULL && Process->Session == Job->SessionId)
|
if(Process->Job == NULL && Process->Session == Job->SessionId)
|
||||||
|
@ -173,7 +173,7 @@ NtAssignProcessToJobObject (
|
||||||
/* process is already assigned to a job or session id differs! */
|
/* process is already assigned to a job or session id differs! */
|
||||||
Status = STATUS_ACCESS_DENIED;
|
Status = STATUS_ACCESS_DENIED;
|
||||||
}
|
}
|
||||||
PsUnlockProcess((PROS_EPROCESS)Process);
|
PsUnlockProcess(Process);
|
||||||
|
|
||||||
if(NT_SUCCESS(Status))
|
if(NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
|
|
@ -165,7 +165,7 @@ PspDeleteProcess(PVOID ObjectBody)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Delete the process lock */
|
/* Delete the process lock */
|
||||||
ExFreePool(((PROS_EPROCESS)Process)->LockEvent);
|
ExFreePool(Process->LockEvent);
|
||||||
|
|
||||||
/* KDB hook */
|
/* KDB hook */
|
||||||
KDB_DELETEPROCESS_HOOK(Process);
|
KDB_DELETEPROCESS_HOOK(Process);
|
||||||
|
@ -174,7 +174,7 @@ PspDeleteProcess(PVOID ObjectBody)
|
||||||
SeDeassignPrimaryToken(Process);
|
SeDeassignPrimaryToken(Process);
|
||||||
|
|
||||||
/* Release Memory Information */
|
/* Release Memory Information */
|
||||||
MmReleaseMmInfo((PROS_EPROCESS)Process);
|
MmReleaseMmInfo(Process);
|
||||||
|
|
||||||
/* Delete the W32PROCESS structure if there's one associated */
|
/* Delete the W32PROCESS structure if there's one associated */
|
||||||
if(Process->Win32Process != NULL) ExFreePool(Process->Win32Process);
|
if(Process->Win32Process != NULL) ExFreePool(Process->Win32Process);
|
||||||
|
@ -248,7 +248,7 @@ PspExitThread(NTSTATUS ExitStatus)
|
||||||
KeLowerIrql(PASSIVE_LEVEL);
|
KeLowerIrql(PASSIVE_LEVEL);
|
||||||
|
|
||||||
/* Lock the Process before we modify its thread entries */
|
/* Lock the Process before we modify its thread entries */
|
||||||
PsLockProcess((PROS_EPROCESS)CurrentProcess, FALSE);
|
PsLockProcess(CurrentProcess, FALSE);
|
||||||
|
|
||||||
/* wake up the thread so we don't deadlock on PsLockProcess */
|
/* wake up the thread so we don't deadlock on PsLockProcess */
|
||||||
KeForceResumeThread(&CurrentThread->Tcb);
|
KeForceResumeThread(&CurrentThread->Tcb);
|
||||||
|
@ -316,7 +316,7 @@ PspExitThread(NTSTATUS ExitStatus)
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT("Decommit teb at %p\n", Teb);
|
DPRINT("Decommit teb at %p\n", Teb);
|
||||||
MmDeleteTeb((PROS_EPROCESS)CurrentProcess, Teb);
|
MmDeleteTeb(CurrentProcess, Teb);
|
||||||
CurrentThread->Tcb.Teb = NULL;
|
CurrentThread->Tcb.Teb = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,7 +324,7 @@ PspExitThread(NTSTATUS ExitStatus)
|
||||||
if (Last) PspExitProcess(CurrentProcess);
|
if (Last) PspExitProcess(CurrentProcess);
|
||||||
|
|
||||||
/* Unlock the Process */
|
/* Unlock the Process */
|
||||||
PsUnlockProcess((PROS_EPROCESS)CurrentProcess);
|
PsUnlockProcess(CurrentProcess);
|
||||||
|
|
||||||
/* Cancel I/O for the thread. */
|
/* Cancel I/O for the thread. */
|
||||||
IoCancelThreadIo(CurrentThread);
|
IoCancelThreadIo(CurrentThread);
|
||||||
|
@ -571,11 +571,11 @@ NtTerminateProcess(IN HANDLE ProcessHandle OPTIONAL,
|
||||||
|
|
||||||
CurrentThread = PsGetCurrentThread();
|
CurrentThread = PsGetCurrentThread();
|
||||||
|
|
||||||
PsLockProcess((PROS_EPROCESS)Process, FALSE);
|
PsLockProcess(Process, FALSE);
|
||||||
|
|
||||||
if(Process->ExitTime.QuadPart != 0)
|
if(Process->ExitTime.QuadPart != 0)
|
||||||
{
|
{
|
||||||
PsUnlockProcess((PROS_EPROCESS)Process);
|
PsUnlockProcess(Process);
|
||||||
ObDereferenceObject(Process);
|
ObDereferenceObject(Process);
|
||||||
return STATUS_PROCESS_IS_TERMINATING;
|
return STATUS_PROCESS_IS_TERMINATING;
|
||||||
}
|
}
|
||||||
|
@ -600,7 +600,7 @@ NtTerminateProcess(IN HANDLE ProcessHandle OPTIONAL,
|
||||||
unlocking the process, fail */
|
unlocking the process, fail */
|
||||||
CurrentThread->Terminated = TRUE;
|
CurrentThread->Terminated = TRUE;
|
||||||
|
|
||||||
PsUnlockProcess((PROS_EPROCESS)Process);
|
PsUnlockProcess(Process);
|
||||||
|
|
||||||
/* we can safely dereference the process because the current thread
|
/* we can safely dereference the process because the current thread
|
||||||
holds a reference to it until it gets reaped */
|
holds a reference to it until it gets reaped */
|
||||||
|
@ -618,7 +618,7 @@ NtTerminateProcess(IN HANDLE ProcessHandle OPTIONAL,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* unlock and dereference the process so the threads can kill themselves */
|
/* unlock and dereference the process so the threads can kill themselves */
|
||||||
PsUnlockProcess((PROS_EPROCESS)Process);
|
PsUnlockProcess(Process);
|
||||||
ObDereferenceObject(Process);
|
ObDereferenceObject(Process);
|
||||||
|
|
||||||
return(STATUS_SUCCESS);
|
return(STATUS_SUCCESS);
|
||||||
|
@ -676,7 +676,7 @@ NtTerminateThread(IN HANDLE ThreadHandle,
|
||||||
if (Thread != PsGetCurrentThread()) {
|
if (Thread != PsGetCurrentThread()) {
|
||||||
|
|
||||||
/* we need to lock the process to make sure it's not already terminating */
|
/* we need to lock the process to make sure it's not already terminating */
|
||||||
PsLockProcess((PROS_EPROCESS)Thread->ThreadsProcess, FALSE);
|
PsLockProcess(Thread->ThreadsProcess, FALSE);
|
||||||
|
|
||||||
/* This isn't our thread, terminate it if not already done */
|
/* This isn't our thread, terminate it if not already done */
|
||||||
if (!Thread->Terminated) {
|
if (!Thread->Terminated) {
|
||||||
|
@ -687,7 +687,7 @@ NtTerminateThread(IN HANDLE ThreadHandle,
|
||||||
PspTerminateThreadByPointer(Thread, ExitStatus);
|
PspTerminateThreadByPointer(Thread, ExitStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
PsUnlockProcess((PROS_EPROCESS)Thread->ThreadsProcess);
|
PsUnlockProcess(Thread->ThreadsProcess);
|
||||||
|
|
||||||
/* Dereference the Thread and return */
|
/* Dereference the Thread and return */
|
||||||
ObDereferenceObject(Thread);
|
ObDereferenceObject(Thread);
|
||||||
|
|
|
@ -35,7 +35,7 @@ LARGE_INTEGER ShortPsLockDelay, PsLockTimeout;
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
PsLockProcess(PROS_EPROCESS Process, BOOLEAN Timeout)
|
PsLockProcess(PEPROCESS Process, BOOLEAN Timeout)
|
||||||
{
|
{
|
||||||
ULONG Attempts = 0;
|
ULONG Attempts = 0;
|
||||||
PKTHREAD PrevLockOwner;
|
PKTHREAD PrevLockOwner;
|
||||||
|
@ -94,7 +94,7 @@ PsLockProcess(PROS_EPROCESS Process, BOOLEAN Timeout)
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
PsUnlockProcess(PROS_EPROCESS Process)
|
PsUnlockProcess(PEPROCESS Process)
|
||||||
{
|
{
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
@ -292,7 +292,7 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
|
||||||
ObjectAttributes,
|
ObjectAttributes,
|
||||||
PreviousMode,
|
PreviousMode,
|
||||||
NULL,
|
NULL,
|
||||||
sizeof(ROS_EPROCESS),
|
sizeof(EPROCESS),
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
(PVOID*)&Process);
|
(PVOID*)&Process);
|
||||||
|
@ -305,7 +305,7 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
|
||||||
|
|
||||||
/* Clean up the Object */
|
/* Clean up the Object */
|
||||||
DPRINT("Cleaning Process Object\n");
|
DPRINT("Cleaning Process Object\n");
|
||||||
RtlZeroMemory(Process, sizeof(ROS_EPROCESS));
|
RtlZeroMemory(Process, sizeof(EPROCESS));
|
||||||
|
|
||||||
/* Inherit stuff from the Parent since we now have the object created */
|
/* Inherit stuff from the Parent since we now have the object created */
|
||||||
if (pParentProcess)
|
if (pParentProcess)
|
||||||
|
@ -329,10 +329,10 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
|
||||||
|
|
||||||
/* Setup the Lock Event */
|
/* Setup the Lock Event */
|
||||||
DPRINT("Initialzing Process Lock\n");
|
DPRINT("Initialzing Process Lock\n");
|
||||||
((PROS_EPROCESS)Process)->LockEvent = ExAllocatePoolWithTag(PagedPool,
|
Process->LockEvent = ExAllocatePoolWithTag(PagedPool,
|
||||||
sizeof(KEVENT),
|
sizeof(KEVENT),
|
||||||
TAG('P', 's', 'L', 'k'));
|
TAG('P', 's', 'L', 'k'));
|
||||||
KeInitializeEvent(((PROS_EPROCESS)Process)->LockEvent, SynchronizationEvent, FALSE);
|
KeInitializeEvent(Process->LockEvent, SynchronizationEvent, FALSE);
|
||||||
|
|
||||||
/* Setup the Thread List Head */
|
/* Setup the Thread List Head */
|
||||||
DPRINT("Initialzing Process ThreadListHead\n");
|
DPRINT("Initialzing Process ThreadListHead\n");
|
||||||
|
@ -345,8 +345,8 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
|
||||||
|
|
||||||
/* Set Process's Directory Base */
|
/* Set Process's Directory Base */
|
||||||
DPRINT("Initialzing Process Directory Base\n");
|
DPRINT("Initialzing Process Directory Base\n");
|
||||||
MmCopyMmInfo((PROS_EPROCESS)(pParentProcess ? pParentProcess : PsInitialSystemProcess),
|
MmCopyMmInfo((pParentProcess ? pParentProcess : PsInitialSystemProcess),
|
||||||
(PROS_EPROCESS)Process,
|
Process,
|
||||||
&DirectoryTableBase);
|
&DirectoryTableBase);
|
||||||
|
|
||||||
/* Now initialize the Kernel Process */
|
/* Now initialize the Kernel Process */
|
||||||
|
@ -367,7 +367,7 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
|
||||||
|
|
||||||
/* Create the Process' Address Space */
|
/* Create the Process' Address Space */
|
||||||
DPRINT("Initialzing Process Address Space\n");
|
DPRINT("Initialzing Process Address Space\n");
|
||||||
Status = MmCreateProcessAddressSpace((PROS_EPROCESS)Process, (PROS_SECTION_OBJECT)SectionObject);
|
Status = MmCreateProcessAddressSpace(Process, (PROS_SECTION_OBJECT)SectionObject);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("Failed to create Address Space\n");
|
DPRINT1("Failed to create Address Space\n");
|
||||||
|
@ -400,7 +400,7 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
|
||||||
if (pParentProcess)
|
if (pParentProcess)
|
||||||
{
|
{
|
||||||
DPRINT("Creating PEB\n");
|
DPRINT("Creating PEB\n");
|
||||||
Status = MmCreatePeb((PROS_EPROCESS)Process);
|
Status = MmCreatePeb(Process);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DbgPrint("NtCreateProcess() Peb creation failed: Status %x\n",Status);
|
DbgPrint("NtCreateProcess() Peb creation failed: Status %x\n",Status);
|
||||||
|
|
|
@ -158,7 +158,7 @@ PsInitProcessManagment(VOID)
|
||||||
RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
|
RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
|
||||||
RtlInitUnicodeString(&Name, L"Process");
|
RtlInitUnicodeString(&Name, L"Process");
|
||||||
ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
|
ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
|
||||||
ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(ROS_EPROCESS);
|
ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(EPROCESS);
|
||||||
ObjectTypeInitializer.GenericMapping = PiProcessMapping;
|
ObjectTypeInitializer.GenericMapping = PiProcessMapping;
|
||||||
ObjectTypeInitializer.PoolType = NonPagedPool;
|
ObjectTypeInitializer.PoolType = NonPagedPool;
|
||||||
ObjectTypeInitializer.ValidAccessMask = PROCESS_ALL_ACCESS;
|
ObjectTypeInitializer.ValidAccessMask = PROCESS_ALL_ACCESS;
|
||||||
|
@ -185,7 +185,7 @@ PsInitProcessManagment(VOID)
|
||||||
NULL,
|
NULL,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
NULL,
|
NULL,
|
||||||
sizeof(ROS_EPROCESS),
|
sizeof(EPROCESS),
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
(PVOID*)&PsIdleProcess);
|
(PVOID*)&PsIdleProcess);
|
||||||
|
@ -196,7 +196,7 @@ PsInitProcessManagment(VOID)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlZeroMemory(PsIdleProcess, sizeof(ROS_EPROCESS));
|
RtlZeroMemory(PsIdleProcess, sizeof(EPROCESS));
|
||||||
|
|
||||||
PsIdleProcess->Pcb.Affinity = 0xFFFFFFFF;
|
PsIdleProcess->Pcb.Affinity = 0xFFFFFFFF;
|
||||||
PsIdleProcess->Pcb.IopmOffset = 0xffff;
|
PsIdleProcess->Pcb.IopmOffset = 0xffff;
|
||||||
|
@ -207,7 +207,7 @@ PsInitProcessManagment(VOID)
|
||||||
InitializeListHead(&PsIdleProcess->ActiveProcessLinks);
|
InitializeListHead(&PsIdleProcess->ActiveProcessLinks);
|
||||||
KeInitializeDispatcherHeader(&PsIdleProcess->Pcb.Header,
|
KeInitializeDispatcherHeader(&PsIdleProcess->Pcb.Header,
|
||||||
ProcessObject,
|
ProcessObject,
|
||||||
sizeof(ROS_EPROCESS) / sizeof(LONG),
|
sizeof(EPROCESS) / sizeof(LONG),
|
||||||
FALSE);
|
FALSE);
|
||||||
PsIdleProcess->Pcb.DirectoryTableBase.QuadPart = (ULONG_PTR)MmGetPageDirectory();
|
PsIdleProcess->Pcb.DirectoryTableBase.QuadPart = (ULONG_PTR)MmGetPageDirectory();
|
||||||
strcpy(PsIdleProcess->ImageFileName, "Idle");
|
strcpy(PsIdleProcess->ImageFileName, "Idle");
|
||||||
|
@ -221,7 +221,7 @@ PsInitProcessManagment(VOID)
|
||||||
NULL,
|
NULL,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
NULL,
|
NULL,
|
||||||
sizeof(ROS_EPROCESS),
|
sizeof(EPROCESS),
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
(PVOID*)&PsInitialSystemProcess);
|
(PVOID*)&PsInitialSystemProcess);
|
||||||
|
@ -233,7 +233,7 @@ PsInitProcessManagment(VOID)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* System threads may run on any processor. */
|
/* System threads may run on any processor. */
|
||||||
RtlZeroMemory(PsInitialSystemProcess, sizeof(ROS_EPROCESS));
|
RtlZeroMemory(PsInitialSystemProcess, sizeof(EPROCESS));
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
/* FIXME:
|
/* FIXME:
|
||||||
* Only the boot cpu is initialized. Threads of the
|
* Only the boot cpu is initialized. Threads of the
|
||||||
|
@ -249,17 +249,17 @@ PsInitProcessManagment(VOID)
|
||||||
InitializeListHead(&PsInitialSystemProcess->Pcb.ThreadListHead);
|
InitializeListHead(&PsInitialSystemProcess->Pcb.ThreadListHead);
|
||||||
KeInitializeDispatcherHeader(&PsInitialSystemProcess->Pcb.Header,
|
KeInitializeDispatcherHeader(&PsInitialSystemProcess->Pcb.Header,
|
||||||
ProcessObject,
|
ProcessObject,
|
||||||
sizeof(ROS_EPROCESS) / sizeof(LONG),
|
sizeof(EPROCESS) / sizeof(LONG),
|
||||||
FALSE);
|
FALSE);
|
||||||
KProcess = &PsInitialSystemProcess->Pcb;
|
KProcess = &PsInitialSystemProcess->Pcb;
|
||||||
PspInheritQuota(PsInitialSystemProcess, NULL);
|
PspInheritQuota(PsInitialSystemProcess, NULL);
|
||||||
|
|
||||||
MmInitializeAddressSpace((PROS_EPROCESS)PsInitialSystemProcess,
|
MmInitializeAddressSpace(PsInitialSystemProcess,
|
||||||
(PMADDRESS_SPACE)&((PROS_EPROCESS)PsInitialSystemProcess)->VadRoot);
|
(PMADDRESS_SPACE)&(PsInitialSystemProcess)->VadRoot);
|
||||||
|
|
||||||
((PROS_EPROCESS)PsInitialSystemProcess)->LockEvent =
|
(PsInitialSystemProcess)->LockEvent =
|
||||||
ExAllocatePoolWithTag(PagedPool, sizeof(KEVENT), TAG('P', 's', 'L', 'k'));
|
ExAllocatePoolWithTag(PagedPool, sizeof(KEVENT), TAG('P', 's', 'L', 'k'));
|
||||||
KeInitializeEvent(((PROS_EPROCESS)PsInitialSystemProcess)->LockEvent, SynchronizationEvent, FALSE);
|
KeInitializeEvent((PsInitialSystemProcess)->LockEvent, SynchronizationEvent, FALSE);
|
||||||
|
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
KProcess->DirectoryTableBase =
|
KProcess->DirectoryTableBase =
|
||||||
|
|
|
@ -653,7 +653,7 @@ NtSetInformationProcess(IN HANDLE ProcessHandle,
|
||||||
{
|
{
|
||||||
/* lock the process to be thread-safe! */
|
/* lock the process to be thread-safe! */
|
||||||
|
|
||||||
Status = PsLockProcess((PROS_EPROCESS)Process, FALSE);
|
Status = PsLockProcess(Process, FALSE);
|
||||||
if(NT_SUCCESS(Status))
|
if(NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -671,7 +671,7 @@ NtSetInformationProcess(IN HANDLE ProcessHandle,
|
||||||
ObDereferenceObject(ExceptionPort);
|
ObDereferenceObject(ExceptionPort);
|
||||||
Status = STATUS_PORT_ALREADY_SET;
|
Status = STATUS_PORT_ALREADY_SET;
|
||||||
}
|
}
|
||||||
PsUnlockProcess((PROS_EPROCESS)Process);
|
PsUnlockProcess(Process);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -758,7 +758,7 @@ NtSetInformationProcess(IN HANDLE ProcessHandle,
|
||||||
|
|
||||||
/* FIXME - update the session id for the process token */
|
/* FIXME - update the session id for the process token */
|
||||||
|
|
||||||
Status = PsLockProcess((PROS_EPROCESS)Process, FALSE);
|
Status = PsLockProcess(Process, FALSE);
|
||||||
if(NT_SUCCESS(Status))
|
if(NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
Process->Session = SessionInfo.SessionId;
|
Process->Session = SessionInfo.SessionId;
|
||||||
|
@ -785,7 +785,7 @@ NtSetInformationProcess(IN HANDLE ProcessHandle,
|
||||||
KeDetachProcess();
|
KeDetachProcess();
|
||||||
}
|
}
|
||||||
|
|
||||||
PsUnlockProcess((PROS_EPROCESS)Process);
|
PsUnlockProcess(Process);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -220,7 +220,7 @@ PspCreateThread(OUT PHANDLE ThreadHandle,
|
||||||
|
|
||||||
/* Create Teb */
|
/* Create Teb */
|
||||||
DPRINT("Initialliazing Thread PEB\n");
|
DPRINT("Initialliazing Thread PEB\n");
|
||||||
TebBase = MmCreateTeb((PROS_EPROCESS)Process, &Thread->Cid, InitialTeb);
|
TebBase = MmCreateTeb(Process, &Thread->Cid, InitialTeb);
|
||||||
|
|
||||||
/* Set the Start Addresses */
|
/* Set the Start Addresses */
|
||||||
DPRINT("Initialliazing Thread Start Addresses :%x, %x\n", ThreadContext->Eip, ThreadContext->Eax);
|
DPRINT("Initialliazing Thread Start Addresses :%x, %x\n", ThreadContext->Eip, ThreadContext->Eax);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue