- NDK Fix: DirectoryTableBase member of KPROCESS is ULONG[2] and not LARGE_INTEGER since Windows 2000 ("Inside Windows 2000", Chapter 6), and till Windows 2003.

svn path=/trunk/; revision=35269
This commit is contained in:
Aleksey Bragin 2008-08-11 08:40:52 +00:00
parent 30b9ab966f
commit 87e74cda21
8 changed files with 35 additions and 36 deletions

View file

@ -955,7 +955,7 @@ typedef struct _KPROCESS
ULONG DirectoryTableBase; ULONG DirectoryTableBase;
ULONG Unused0; ULONG Unused0;
#else #else
LARGE_INTEGER DirectoryTableBase; ULONG DirectoryTableBase[2];
#endif #endif
#if defined(_M_IX86) #if defined(_M_IX86)
KGDTENTRY LdtDescriptor; KGDTENTRY LdtDescriptor;

View file

@ -537,7 +537,7 @@ KeInitializeProcess(
struct _KPROCESS *Process, struct _KPROCESS *Process,
KPRIORITY Priority, KPRIORITY Priority,
KAFFINITY Affinity, KAFFINITY Affinity,
PLARGE_INTEGER DirectoryTableBase, PULONG DirectoryTableBase,
IN BOOLEAN Enable IN BOOLEAN Enable
); );

View file

@ -1275,14 +1275,14 @@ NTAPI
MmCreateProcessAddressSpace( MmCreateProcessAddressSpace(
IN ULONG MinWs, IN ULONG MinWs,
IN PEPROCESS Dest, IN PEPROCESS Dest,
IN PLARGE_INTEGER DirectoryTableBase IN PULONG DirectoryTableBase
); );
NTSTATUS NTSTATUS
NTAPI NTAPI
MmInitializeHandBuiltProcess( MmInitializeHandBuiltProcess(
IN PEPROCESS Process, IN PEPROCESS Process,
IN PLARGE_INTEGER DirectoryTableBase IN PULONG DirectoryTableBase
); );

View file

@ -391,7 +391,7 @@ KiInitializeKernel(IN PKPROCESS InitProcess,
{ {
BOOLEAN NpxPresent; BOOLEAN NpxPresent;
ULONG FeatureBits; ULONG FeatureBits;
LARGE_INTEGER PageDirectory; ULONG PageDirectory[2];
PVOID DpcStack; PVOID DpcStack;
ULONG Vendor[3]; ULONG Vendor[3];
@ -503,11 +503,12 @@ KiInitializeKernel(IN PKPROCESS InitProcess,
/* Initialize the Idle Process and the Process Listhead */ /* Initialize the Idle Process and the Process Listhead */
InitializeListHead(&KiProcessListHead); InitializeListHead(&KiProcessListHead);
PageDirectory.QuadPart = 0; PageDirectory[0] = 0;
PageDirectory[1] = 0;
KeInitializeProcess(InitProcess, KeInitializeProcess(InitProcess,
0, 0,
0xFFFFFFFF, 0xFFFFFFFF,
&PageDirectory, PageDirectory,
FALSE); FALSE);
InitProcess->QuantumReset = MAXCHAR; InitProcess->QuantumReset = MAXCHAR;
} }

View file

@ -115,7 +115,7 @@ NTAPI
KeInitializeProcess(IN OUT PKPROCESS Process, KeInitializeProcess(IN OUT PKPROCESS Process,
IN KPRIORITY Priority, IN KPRIORITY Priority,
IN KAFFINITY Affinity, IN KAFFINITY Affinity,
IN PLARGE_INTEGER DirectoryTableBase, IN PULONG DirectoryTableBase,
IN BOOLEAN Enable) IN BOOLEAN Enable)
{ {
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
@ -134,7 +134,8 @@ KeInitializeProcess(IN OUT PKPROCESS Process,
Process->Affinity = Affinity; Process->Affinity = Affinity;
Process->BasePriority = (CHAR)Priority; Process->BasePriority = (CHAR)Priority;
Process->QuantumReset = 6; Process->QuantumReset = 6;
Process->DirectoryTableBase = *DirectoryTableBase; Process->DirectoryTableBase[0] = DirectoryTableBase[0];
Process->DirectoryTableBase[1] = DirectoryTableBase[1];
Process->AutoAlignment = Enable; Process->AutoAlignment = Enable;
#if defined(_M_IX86) #if defined(_M_IX86)
Process->IopmOffset = KiComputeIopmOffset(IO_ACCESS_MAP_NONE); Process->IopmOffset = KiComputeIopmOffset(IO_ACCESS_MAP_NONE);

View file

@ -162,7 +162,7 @@ Mmi386ReleaseMmInfo(PEPROCESS Process)
ExFreePool((PVOID) LdtBase); ExFreePool((PVOID) LdtBase);
} }
PageDir = MmCreateHyperspaceMapping(PTE_TO_PFN(Process->Pcb.DirectoryTableBase.u.LowPart)); PageDir = MmCreateHyperspaceMapping(PTE_TO_PFN(Process->Pcb.DirectoryTableBase[0]));
for (i = 0; i < ADDR_TO_PDE_OFFSET(MmSystemRangeStart); i++) for (i = 0; i < ADDR_TO_PDE_OFFSET(MmSystemRangeStart); i++)
{ {
if (PageDir[i] != 0) if (PageDir[i] != 0)
@ -173,15 +173,10 @@ Mmi386ReleaseMmInfo(PEPROCESS Process)
} }
MmReleasePageMemoryConsumer(MC_NPPOOL, PTE_TO_PFN(PageDir[ADDR_TO_PDE_OFFSET(HYPERSPACE)])); MmReleasePageMemoryConsumer(MC_NPPOOL, PTE_TO_PFN(PageDir[ADDR_TO_PDE_OFFSET(HYPERSPACE)]));
MmDeleteHyperspaceMapping(PageDir); MmDeleteHyperspaceMapping(PageDir);
MmReleasePageMemoryConsumer(MC_NPPOOL, PTE_TO_PFN(Process->Pcb.DirectoryTableBase.u.LowPart)); MmReleasePageMemoryConsumer(MC_NPPOOL, PTE_TO_PFN(Process->Pcb.DirectoryTableBase[0]));
#if defined(__GNUC__) Process->Pcb.DirectoryTableBase[0] = 0;
Process->Pcb.DirectoryTableBase[1] = 0;
Process->Pcb.DirectoryTableBase.QuadPart = 0LL;
#else
Process->Pcb.DirectoryTableBase.QuadPart = 0;
#endif
DPRINT("Finished Mmi386ReleaseMmInfo()\n"); DPRINT("Finished Mmi386ReleaseMmInfo()\n");
return(STATUS_SUCCESS); return(STATUS_SUCCESS);
@ -190,10 +185,11 @@ Mmi386ReleaseMmInfo(PEPROCESS Process)
NTSTATUS NTSTATUS
NTAPI NTAPI
MmInitializeHandBuiltProcess(IN PEPROCESS Process, MmInitializeHandBuiltProcess(IN PEPROCESS Process,
IN PLARGE_INTEGER DirectoryTableBase) IN PULONG DirectoryTableBase)
{ {
/* Share the directory base with the idle process */ /* Share the directory base with the idle process */
*DirectoryTableBase = PsGetCurrentProcess()->Pcb.DirectoryTableBase; DirectoryTableBase[0] = PsGetCurrentProcess()->Pcb.DirectoryTableBase[0];
DirectoryTableBase[1] = PsGetCurrentProcess()->Pcb.DirectoryTableBase[1];
/* Initialize the Addresss Space */ /* Initialize the Addresss Space */
KeInitializeGuardedMutex(&Process->AddressCreationLock); KeInitializeGuardedMutex(&Process->AddressCreationLock);
@ -208,7 +204,7 @@ BOOLEAN
STDCALL STDCALL
MmCreateProcessAddressSpace(IN ULONG MinWs, MmCreateProcessAddressSpace(IN ULONG MinWs,
IN PEPROCESS Process, IN PEPROCESS Process,
IN PLARGE_INTEGER DirectoryTableBase) IN PULONG DirectoryTableBase)
{ {
NTSTATUS Status; NTSTATUS Status;
ULONG i, j; ULONG i, j;
@ -243,8 +239,9 @@ MmCreateProcessAddressSpace(IN ULONG MinWs,
MmDeleteHyperspaceMapping(PageDirectory); MmDeleteHyperspaceMapping(PageDirectory);
DirectoryTableBase->QuadPart = PFN_TO_PTE(Pfn[0]); DirectoryTableBase[0] = PFN_TO_PTE(Pfn[0]);
DPRINT("Finished MmCopyMmInfo(): %I64x\n", DirectoryTableBase->QuadPart); DirectoryTableBase[1] = 0;
DPRINT("Finished MmCopyMmInfo(): 0x%x\n", DirectoryTableBase[0]);
return TRUE; return TRUE;
} }
@ -329,7 +326,7 @@ MmGetPageTableForProcess(PEPROCESS Process, PVOID Address, BOOLEAN Create)
if (Address < MmSystemRangeStart && Process && Process != PsGetCurrentProcess()) if (Address < MmSystemRangeStart && Process && Process != PsGetCurrentProcess())
{ {
PageDir = MmCreateHyperspaceMapping(PTE_TO_PFN(Process->Pcb.DirectoryTableBase.LowPart)); PageDir = MmCreateHyperspaceMapping(PTE_TO_PFN(Process->Pcb.DirectoryTableBase[0]));
if (PageDir == NULL) if (PageDir == NULL)
{ {
KEBUGCHECK(0); KEBUGCHECK(0);
@ -1286,7 +1283,7 @@ MmUpdatePageDir(PEPROCESS Process, PVOID Address, ULONG Size)
if (Process != NULL && Process != PsGetCurrentProcess()) if (Process != NULL && Process != PsGetCurrentProcess())
{ {
Pde = MmCreateHyperspaceMapping(PTE_TO_PFN(Process->Pcb.DirectoryTableBase.u.LowPart)); Pde = MmCreateHyperspaceMapping(PTE_TO_PFN(Process->Pcb.DirectoryTableBase[0]));
} }
else else
{ {

View file

@ -368,13 +368,13 @@ NTAPI
MmInit1(VOID) MmInit1(VOID)
{ {
PLDR_DATA_TABLE_ENTRY LdrEntry; PLDR_DATA_TABLE_ENTRY LdrEntry;
LARGE_INTEGER Dummy; ULONG Dummy[2];
/* Dump memory descriptors */ /* Dump memory descriptors */
if (MiDbgEnableMdDump) MiDbgDumpMemoryDescriptors(); if (MiDbgEnableMdDump) MiDbgDumpMemoryDescriptors();
/* Set the page directory */ /* Set the page directory */
PsGetCurrentProcess()->Pcb.DirectoryTableBase.LowPart = (ULONG)MmGetPageDirectory(); PsGetCurrentProcess()->Pcb.DirectoryTableBase[0] = (ULONG)MmGetPageDirectory();
/* Get the size of FreeLDR's image allocations */ /* Get the size of FreeLDR's image allocations */
MmBootImageSize = KeLoaderBlock->Extension->LoaderPagesSpanned; MmBootImageSize = KeLoaderBlock->Extension->LoaderPagesSpanned;
@ -396,7 +396,7 @@ MmInit1(VOID)
DbgPrint("Used memory %dKb\n", (MmNumberOfPhysicalPages * PAGE_SIZE) / 1024); DbgPrint("Used memory %dKb\n", (MmNumberOfPhysicalPages * PAGE_SIZE) / 1024);
/* Initialize the kernel address space */ /* Initialize the kernel address space */
MmInitializeHandBuiltProcess(PsGetCurrentProcess(), &Dummy); MmInitializeHandBuiltProcess(PsGetCurrentProcess(), Dummy);
MmKernelAddressSpace = MmGetCurrentAddressSpace(); MmKernelAddressSpace = MmGetCurrentAddressSpace();
MmInitGlobalKernelPageDirectory(); MmInitGlobalKernelPageDirectory();

View file

@ -365,7 +365,7 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
PDEBUG_OBJECT DebugObject; PDEBUG_OBJECT DebugObject;
PSECTION_OBJECT SectionObject; PSECTION_OBJECT SectionObject;
NTSTATUS Status, AccessStatus; NTSTATUS Status, AccessStatus;
PHYSICAL_ADDRESS DirectoryTableBase = {{0}}; ULONG DirectoryTableBase[2] = {0,0};
KAFFINITY Affinity; KAFFINITY Affinity;
HANDLE_TABLE_ENTRY CidEntry; HANDLE_TABLE_ENTRY CidEntry;
PETHREAD CurrentThread = PsGetCurrentThread(); PETHREAD CurrentThread = PsGetCurrentThread();
@ -562,7 +562,7 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
/* Create the address space for the child */ /* Create the address space for the child */
if (!MmCreateProcessAddressSpace(MinWs, if (!MmCreateProcessAddressSpace(MinWs,
Process, Process,
&DirectoryTableBase)) DirectoryTableBase))
{ {
/* Failed */ /* Failed */
Status = STATUS_INSUFFICIENT_RESOURCES; Status = STATUS_INSUFFICIENT_RESOURCES;
@ -573,7 +573,7 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
{ {
/* Otherwise, we are the boot process, we're already semi-initialized */ /* Otherwise, we are the boot process, we're already semi-initialized */
Process->ObjectTable = CurrentProcess->ObjectTable; Process->ObjectTable = CurrentProcess->ObjectTable;
Status = MmInitializeHandBuiltProcess(Process, &DirectoryTableBase); Status = MmInitializeHandBuiltProcess(Process, DirectoryTableBase);
if (!NT_SUCCESS(Status)) goto CleanupWithRef; if (!NT_SUCCESS(Status)) goto CleanupWithRef;
} }
@ -587,7 +587,7 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
KeInitializeProcess(&Process->Pcb, KeInitializeProcess(&Process->Pcb,
PROCESS_PRIORITY_NORMAL, PROCESS_PRIORITY_NORMAL,
Affinity, Affinity,
&DirectoryTableBase, DirectoryTableBase,
(BOOLEAN)(Process->DefaultHardErrorProcessing & 4)); (BOOLEAN)(Process->DefaultHardErrorProcessing & 4));
/* Duplicate Parent Token */ /* Duplicate Parent Token */