- 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 Unused0;
#else
LARGE_INTEGER DirectoryTableBase;
ULONG DirectoryTableBase[2];
#endif
#if defined(_M_IX86)
KGDTENTRY LdtDescriptor;

View file

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

View file

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

View file

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

View file

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

View file

@ -162,7 +162,7 @@ Mmi386ReleaseMmInfo(PEPROCESS Process)
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++)
{
if (PageDir[i] != 0)
@ -173,16 +173,11 @@ Mmi386ReleaseMmInfo(PEPROCESS Process)
}
MmReleasePageMemoryConsumer(MC_NPPOOL, PTE_TO_PFN(PageDir[ADDR_TO_PDE_OFFSET(HYPERSPACE)]));
MmDeleteHyperspaceMapping(PageDir);
MmReleasePageMemoryConsumer(MC_NPPOOL, PTE_TO_PFN(Process->Pcb.DirectoryTableBase.u.LowPart));
#if defined(__GNUC__)
Process->Pcb.DirectoryTableBase.QuadPart = 0LL;
#else
Process->Pcb.DirectoryTableBase.QuadPart = 0;
#endif
MmReleasePageMemoryConsumer(MC_NPPOOL, PTE_TO_PFN(Process->Pcb.DirectoryTableBase[0]));
Process->Pcb.DirectoryTableBase[0] = 0;
Process->Pcb.DirectoryTableBase[1] = 0;
DPRINT("Finished Mmi386ReleaseMmInfo()\n");
return(STATUS_SUCCESS);
}
@ -190,15 +185,16 @@ Mmi386ReleaseMmInfo(PEPROCESS Process)
NTSTATUS
NTAPI
MmInitializeHandBuiltProcess(IN PEPROCESS Process,
IN PLARGE_INTEGER DirectoryTableBase)
IN PULONG DirectoryTableBase)
{
/* 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 */
KeInitializeGuardedMutex(&Process->AddressCreationLock);
Process->VadRoot.BalancedRoot.u1.Parent = NULL;
/* The process now has an address space */
Process->HasAddressSpace = TRUE;
return STATUS_SUCCESS;
@ -208,7 +204,7 @@ BOOLEAN
STDCALL
MmCreateProcessAddressSpace(IN ULONG MinWs,
IN PEPROCESS Process,
IN PLARGE_INTEGER DirectoryTableBase)
IN PULONG DirectoryTableBase)
{
NTSTATUS Status;
ULONG i, j;
@ -243,8 +239,9 @@ MmCreateProcessAddressSpace(IN ULONG MinWs,
MmDeleteHyperspaceMapping(PageDirectory);
DirectoryTableBase->QuadPart = PFN_TO_PTE(Pfn[0]);
DPRINT("Finished MmCopyMmInfo(): %I64x\n", DirectoryTableBase->QuadPart);
DirectoryTableBase[0] = PFN_TO_PTE(Pfn[0]);
DirectoryTableBase[1] = 0;
DPRINT("Finished MmCopyMmInfo(): 0x%x\n", DirectoryTableBase[0]);
return TRUE;
}
@ -329,7 +326,7 @@ MmGetPageTableForProcess(PEPROCESS Process, PVOID Address, BOOLEAN Create)
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)
{
KEBUGCHECK(0);
@ -1286,7 +1283,7 @@ MmUpdatePageDir(PEPROCESS Process, PVOID Address, ULONG Size)
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
{

View file

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

View file

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