ReactOS  r73918
procsup.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Kernel
3  * LICENSE: BSD - See COPYING.ARM in the top level directory
4  * FILE: ntoskrnl/mm/ARM3/procsup.c
5  * PURPOSE: ARM Memory Manager Process Related Management
6  * PROGRAMMERS: ReactOS Portable Systems Group
7  */
8 
9 /* INCLUDES *******************************************************************/
10 
11 #include <ntoskrnl.h>
12 #define NDEBUG
13 #include <debug.h>
14 
15 #define MODULE_INVOLVED_IN_ARM3
16 #include <mm/ARM3/miarm.h>
17 
18 /* GLOBALS ********************************************************************/
19 
24 
25 /* PRIVATE FUNCTIONS **********************************************************/
26 
28 NTAPI
30  IN ULONG Size,
32 {
33  PMMVAD_LONG Vad;
35  ULONG_PTR HighestAddress, RandomBase;
36  ULONG AlignedSize;
37  LARGE_INTEGER CurrentTime;
38 
39  /* Allocate a VAD */
40  Vad = ExAllocatePoolWithTag(NonPagedPool, sizeof(MMVAD_LONG), 'ldaV');
41  if (!Vad) return STATUS_NO_MEMORY;
42 
43  /* Setup the primary flags with the size, and make it commited, private, RW */
44  Vad->u.LongFlags = 0;
46  Vad->u.VadFlags.MemCommit = TRUE;
49  Vad->u.VadFlags.NoChange = TRUE;
50  Vad->u1.Parent = NULL;
51 
52  /* Setup the secondary flags to make it a secured, writable, long VAD */
53  Vad->u2.LongFlags2 = 0;
54  Vad->u2.VadFlags2.OneSecured = TRUE;
55  Vad->u2.VadFlags2.LongVad = TRUE;
56  Vad->u2.VadFlags2.ReadOnly = FALSE;
57 
58  Vad->ControlArea = NULL; // For Memory-Area hack
59  Vad->FirstPrototypePte = NULL;
60 
61  /* Check if this is a PEB creation */
62  ASSERT(sizeof(TEB) != sizeof(PEB));
63  if (Size == sizeof(PEB))
64  {
65  /* Create a random value to select one page in a 64k region */
66  KeQueryTickCount(&CurrentTime);
67  CurrentTime.LowPart &= (_64K / PAGE_SIZE) - 1;
68 
69  /* Calculate a random base address */
70  RandomBase = (ULONG_PTR)MM_HIGHEST_VAD_ADDRESS + 1;
71  RandomBase -= CurrentTime.LowPart << PAGE_SHIFT;
72 
73  /* Make sure the base address is not too high */
74  AlignedSize = ROUND_TO_PAGES(Size);
75  if ((RandomBase + AlignedSize) > (ULONG_PTR)MM_HIGHEST_VAD_ADDRESS + 1)
76  {
77  RandomBase = (ULONG_PTR)MM_HIGHEST_VAD_ADDRESS + 1 - AlignedSize;
78  }
79 
80  /* Calculate the highest allowed address */
81  HighestAddress = RandomBase + AlignedSize - 1;
82  }
83  else
84  {
85  HighestAddress = (ULONG_PTR)MM_HIGHEST_VAD_ADDRESS;
86  }
87 
88  *BaseAddress = 0;
89  Status = MiInsertVadEx((PMMVAD)Vad,
90  BaseAddress,
91  BYTES_TO_PAGES(Size),
92  HighestAddress,
93  PAGE_SIZE,
94  MEM_TOP_DOWN);
95  if (!NT_SUCCESS(Status))
96  {
97  ExFreePoolWithTag(Vad, 'ldaV');
98  return STATUS_NO_MEMORY;
99  }
100 
101  /* Success */
102  return STATUS_SUCCESS;
103 }
104 
105 VOID
106 NTAPI
108  IN PTEB Teb)
109 {
110  ULONG_PTR TebEnd;
112  PMMVAD Vad;
113  PMM_AVL_TABLE VadTree = &Process->VadRoot;
114  DPRINT("Deleting TEB: %p in %16s\n", Teb, Process->ImageFileName);
115 
116  /* TEB is one page */
117  TebEnd = (ULONG_PTR)Teb + ROUND_TO_PAGES(sizeof(TEB)) - 1;
118 
119  /* Attach to the process */
120  KeAttachProcess(&Process->Pcb);
121 
122  /* Lock the process address space */
123  KeAcquireGuardedMutex(&Process->AddressCreationLock);
124 
125  /* Find the VAD, make sure it's a TEB VAD */
126  Vad = MiLocateAddress(Teb);
127  DPRINT("Removing node for VAD: %lx %lx\n", Vad->StartingVpn, Vad->EndingVpn);
128  ASSERT(Vad != NULL);
129  if (Vad->StartingVpn != ((ULONG_PTR)Teb >> PAGE_SHIFT))
130  {
131  /* Bug in the AVL code? */
132  DPRINT1("Corrupted VAD!\n");
133  }
134  else
135  {
136  /* Sanity checks for a valid TEB VAD */
137  ASSERT((Vad->StartingVpn == ((ULONG_PTR)Teb >> PAGE_SHIFT) &&
138  (Vad->EndingVpn == (TebEnd >> PAGE_SHIFT))));
139  ASSERT(Vad->u.VadFlags.NoChange == TRUE);
140  ASSERT(Vad->u2.VadFlags2.OneSecured == TRUE);
142 
143  /* Lock the working set */
144  MiLockProcessWorkingSetUnsafe(Process, Thread);
145 
146  /* Remove this VAD from the tree */
147  ASSERT(VadTree->NumberGenericTableElements >= 1);
148  MiRemoveNode((PMMADDRESS_NODE)Vad, VadTree);
149 
150  /* Delete the pages */
151  MiDeleteVirtualAddresses((ULONG_PTR)Teb, TebEnd, NULL);
152 
153  /* Release the working set */
154  MiUnlockProcessWorkingSetUnsafe(Process, Thread);
155 
156  /* Remove the VAD */
157  ExFreePool(Vad);
158  }
159 
160  /* Release the address space lock */
161  KeReleaseGuardedMutex(&Process->AddressCreationLock);
162 
163  /* Detach */
164  KeDetachProcess();
165 }
166 
167 VOID
168 NTAPI
170  IN BOOLEAN GuiStack)
171 {
172  PMMPTE PointerPte;
173  PFN_NUMBER PageFrameNumber, PageTableFrameNumber;
174  PFN_COUNT StackPages;
175  PMMPFN Pfn1, Pfn2;
176  ULONG i;
177  KIRQL OldIrql;
178 
179  //
180  // This should be the guard page, so decrement by one
181  //
182  PointerPte = MiAddressToPte(StackBase);
183  PointerPte--;
184 
185  //
186  // If this is a small stack, just push the stack onto the dead stack S-LIST
187  //
188  if (!GuiStack)
189  {
190  if (ExQueryDepthSList(&MmDeadStackSListHead) < MmMaximumDeadKernelStacks)
191  {
192  Pfn1 = MiGetPfnEntry(PointerPte->u.Hard.PageFrameNumber);
193  InterlockedPushEntrySList(&MmDeadStackSListHead,
194  (PSLIST_ENTRY)&Pfn1->u1.NextStackPfn);
195  return;
196  }
197  }
198 
199  //
200  // Calculate pages used
201  //
202  StackPages = BYTES_TO_PAGES(GuiStack ?
204 
205  /* Acquire the PFN lock */
207 
208  //
209  // Loop them
210  //
211  for (i = 0; i < StackPages; i++)
212  {
213  //
214  // Check if this is a valid PTE
215  //
216  if (PointerPte->u.Hard.Valid == 1)
217  {
218  /* Get the PTE's page */
219  PageFrameNumber = PFN_FROM_PTE(PointerPte);
220  Pfn1 = MiGetPfnEntry(PageFrameNumber);
221 
222  /* Now get the page of the page table mapping it */
223  PageTableFrameNumber = Pfn1->u4.PteFrame;
224  Pfn2 = MiGetPfnEntry(PageTableFrameNumber);
225 
226  /* Remove a shared reference, since the page is going away */
227  MiDecrementShareCount(Pfn2, PageTableFrameNumber);
228 
229  /* Set the special pending delete marker */
230  MI_SET_PFN_DELETED(Pfn1);
231 
232  /* And now delete the actual stack page */
233  MiDecrementShareCount(Pfn1, PageFrameNumber);
234  }
235 
236  //
237  // Next one
238  //
239  PointerPte--;
240  }
241 
242  //
243  // We should be at the guard page now
244  //
245  ASSERT(PointerPte->u.Hard.Valid == 0);
246 
247  /* Release the PFN lock */
249 
250  //
251  // Release the PTEs
252  //
253  MiReleaseSystemPtes(PointerPte, StackPages + 1, SystemPteSpace);
254 }
255 
256 PVOID
257 NTAPI
259  IN UCHAR Node)
260 {
261  PFN_COUNT StackPtes, StackPages;
262  PMMPTE PointerPte, StackPte;
264  MMPTE TempPte, InvalidPte;
265  KIRQL OldIrql;
266  PFN_NUMBER PageFrameIndex;
267  ULONG i;
268  PMMPFN Pfn1;
269 
270  //
271  // Calculate pages needed
272  //
273  if (GuiStack)
274  {
275  //
276  // We'll allocate 64KB stack, but only commit 12K
277  //
278  StackPtes = BYTES_TO_PAGES(MmLargeStackSize);
280  }
281  else
282  {
283  //
284  // If the dead stack S-LIST has a stack on it, use it instead of allocating
285  // new system PTEs for this stack
286  //
287  if (ExQueryDepthSList(&MmDeadStackSListHead))
288  {
289  Pfn1 = (PMMPFN)InterlockedPopEntrySList(&MmDeadStackSListHead);
290  if (Pfn1)
291  {
292  PointerPte = Pfn1->PteAddress;
293  BaseAddress = MiPteToAddress(++PointerPte);
294  return BaseAddress;
295  }
296  }
297 
298  //
299  // We'll allocate 12K and that's it
300  //
301  StackPtes = BYTES_TO_PAGES(KERNEL_STACK_SIZE);
302  StackPages = StackPtes;
303  }
304 
305  //
306  // Reserve stack pages, plus a guard page
307  //
308  StackPte = MiReserveSystemPtes(StackPtes + 1, SystemPteSpace);
309  if (!StackPte) return NULL;
310 
311  //
312  // Get the stack address
313  //
314  BaseAddress = MiPteToAddress(StackPte + StackPtes + 1);
315 
316  //
317  // Select the right PTE address where we actually start committing pages
318  //
319  PointerPte = StackPte;
320  if (GuiStack) PointerPte += BYTES_TO_PAGES(MmLargeStackSize -
322 
323 
324  /* Setup the temporary invalid PTE */
325  MI_MAKE_SOFTWARE_PTE(&InvalidPte, MM_NOACCESS);
326 
327  /* Setup the template stack PTE */
328  MI_MAKE_HARDWARE_PTE_KERNEL(&TempPte, PointerPte + 1, MM_READWRITE, 0);
329 
330  //
331  // Acquire the PFN DB lock
332  //
334 
335  //
336  // Loop each stack page
337  //
338  for (i = 0; i < StackPages; i++)
339  {
340  //
341  // Next PTE
342  //
343  PointerPte++;
344 
345  /* Get a page and write the current invalid PTE */
347  MI_SET_PROCESS2(PsGetCurrentProcess()->ImageFileName);
348  PageFrameIndex = MiRemoveAnyPage(MI_GET_NEXT_COLOR());
349  MI_WRITE_INVALID_PTE(PointerPte, InvalidPte);
350 
351  /* Initialize the PFN entry for this page */
352  MiInitializePfn(PageFrameIndex, PointerPte, 1);
353 
354  /* Write the valid PTE */
355  TempPte.u.Hard.PageFrameNumber = PageFrameIndex;
356  MI_WRITE_VALID_PTE(PointerPte, TempPte);
357  }
358 
359  //
360  // Release the PFN lock
361  //
363 
364  //
365  // Return the stack address
366  //
367  return BaseAddress;
368 }
369 
370 NTSTATUS
371 NTAPI
373  IN ULONG GrowSize)
374 {
376  PMMPTE LimitPte, NewLimitPte, LastPte;
377  KIRQL OldIrql;
378  MMPTE TempPte, InvalidPte;
379  PFN_NUMBER PageFrameIndex;
380 
381  //
382  // Make sure the stack did not overflow
383  //
384  ASSERT(((ULONG_PTR)Thread->StackBase - (ULONG_PTR)Thread->StackLimit) <=
386 
387  //
388  // Get the current stack limit
389  //
390  LimitPte = MiAddressToPte(Thread->StackLimit);
391  ASSERT(LimitPte->u.Hard.Valid == 1);
392 
393  //
394  // Get the new one and make sure this isn't a retarded request
395  //
396  NewLimitPte = MiAddressToPte((PVOID)((ULONG_PTR)StackPointer - GrowSize));
397  if (NewLimitPte == LimitPte) return STATUS_SUCCESS;
398 
399  //
400  // Now make sure you're not going past the reserved space
401  //
402  LastPte = MiAddressToPte((PVOID)((ULONG_PTR)Thread->StackBase -
404  if (NewLimitPte < LastPte)
405  {
406  //
407  // Sorry!
408  //
409  DPRINT1("Thread wants too much stack\n");
410  return STATUS_STACK_OVERFLOW;
411  }
412 
413  //
414  // Calculate the number of new pages
415  //
416  LimitPte--;
417 
418  /* Setup the temporary invalid PTE */
419  MI_MAKE_SOFTWARE_PTE(&InvalidPte, MM_NOACCESS);
420 
421  //
422  // Acquire the PFN DB lock
423  //
425 
426  //
427  // Loop each stack page
428  //
429  while (LimitPte >= NewLimitPte)
430  {
431  /* Get a page and write the current invalid PTE */
433  MI_SET_PROCESS2(PsGetCurrentProcess()->ImageFileName);
434  PageFrameIndex = MiRemoveAnyPage(MI_GET_NEXT_COLOR());
435  MI_WRITE_INVALID_PTE(LimitPte, InvalidPte);
436 
437  /* Initialize the PFN entry for this page */
438  MiInitializePfn(PageFrameIndex, LimitPte, 1);
439 
440  /* Setup the template stack PTE */
441  MI_MAKE_HARDWARE_PTE_KERNEL(&TempPte, LimitPte, MM_READWRITE, PageFrameIndex);
442 
443  /* Write the valid PTE */
444  MI_WRITE_VALID_PTE(LimitPte--, TempPte);
445  }
446 
447  //
448  // Release the PFN lock
449  //
451 
452  //
453  // Set the new limit
454  //
455  Thread->StackLimit = (ULONG_PTR)MiPteToAddress(NewLimitPte);
456  return STATUS_SUCCESS;
457 }
458 
459 NTSTATUS
460 NTAPI
462 {
463  //
464  // Call the extended version
465  //
466  return MmGrowKernelStackEx(StackPointer, KERNEL_LARGE_STACK_COMMIT);
467 }
468 
469 NTSTATUS
470 NTAPI
472  IN UCHAR MemoryPriority)
473 {
474  UCHAR OldPriority;
475 
476  //
477  // Check if we have less then 16MB of Physical Memory
478  //
479  if ((MmSystemSize == MmSmallSystem) &&
480  (MmNumberOfPhysicalPages < ((15 * 1024 * 1024) / PAGE_SIZE)))
481  {
482  //
483  // Always use background priority
484  //
485  MemoryPriority = MEMORY_PRIORITY_BACKGROUND;
486  }
487 
488  //
489  // Save the old priority and update it
490  //
491  OldPriority = (UCHAR)Process->Vm.Flags.MemoryPriority;
492  Process->Vm.Flags.MemoryPriority = MemoryPriority;
493 
494  //
495  // Return the old priority
496  //
497  return OldPriority;
498 }
499 
500 NTSTATUS
501 NTAPI
503  IN PINITIAL_PEB InitialPeb,
504  OUT PPEB *BasePeb)
505 {
506  PPEB Peb = NULL;
508  SIZE_T ViewSize = 0;
509  PVOID TableBase = NULL;
510  PIMAGE_NT_HEADERS NtHeaders;
511  PIMAGE_LOAD_CONFIG_DIRECTORY ImageConfigData;
513  USHORT Characteristics;
515  SectionOffset.QuadPart = (ULONGLONG)0;
516  *BasePeb = NULL;
517 
518  //
519  // Attach to Process
520  //
521  KeAttachProcess(&Process->Pcb);
522 
523  //
524  // Map NLS Tables
525  //
527  (PEPROCESS)Process,
528  &TableBase,
529  0,
530  0,
531  &SectionOffset,
532  &ViewSize,
533  ViewShare,
534  MEM_TOP_DOWN,
535  PAGE_READONLY);
536  DPRINT("NLS Tables at: %p\n", TableBase);
537  if (!NT_SUCCESS(Status))
538  {
539  /* Cleanup and exit */
540  KeDetachProcess();
541  return Status;
542  }
543 
544  //
545  // Allocate the PEB
546  //
547  Status = MiCreatePebOrTeb(Process, sizeof(PEB), (PULONG_PTR)&Peb);
548  DPRINT("PEB at: %p\n", Peb);
549  if (!NT_SUCCESS(Status))
550  {
551  /* Cleanup and exit */
552  KeDetachProcess();
553  return Status;
554  }
555 
556  //
557  // Use SEH in case we can't load the PEB
558  //
559  _SEH2_TRY
560  {
561  //
562  // Initialize the PEB
563  //
564  RtlZeroMemory(Peb, sizeof(PEB));
565 
566  //
567  // Set up data
568  //
569  Peb->ImageBaseAddress = Process->SectionBaseAddress;
570  Peb->InheritedAddressSpace = InitialPeb->InheritedAddressSpace;
571  Peb->Mutant = InitialPeb->Mutant;
572  Peb->ImageUsesLargePages = InitialPeb->ImageUsesLargePages;
573 
574  //
575  // NLS
576  //
577  Peb->AnsiCodePageData = (PCHAR)TableBase + ExpAnsiCodePageDataOffset;
578  Peb->OemCodePageData = (PCHAR)TableBase + ExpOemCodePageDataOffset;
579  Peb->UnicodeCaseTableData = (PCHAR)TableBase + ExpUnicodeCaseTableDataOffset;
580 
581  //
582  // Default Version Data (could get changed below)
583  //
584  Peb->OSMajorVersion = NtMajorVersion;
585  Peb->OSMinorVersion = NtMinorVersion;
586  Peb->OSBuildNumber = (USHORT)(NtBuildNumber & 0x3FFF);
587  Peb->OSPlatformId = VER_PLATFORM_WIN32_NT;
588  Peb->OSCSDVersion = (USHORT)CmNtCSDVersion;
589 
590  //
591  // Heap and Debug Data
592  //
593  Peb->NumberOfProcessors = KeNumberProcessors;
594  Peb->BeingDebugged = (BOOLEAN)(Process->DebugPort != NULL);
595  Peb->NtGlobalFlag = NtGlobalFlag;
596  Peb->HeapSegmentReserve = MmHeapSegmentReserve;
597  Peb->HeapSegmentCommit = MmHeapSegmentCommit;
598  Peb->HeapDeCommitTotalFreeThreshold = MmHeapDeCommitTotalFreeThreshold;
599  Peb->HeapDeCommitFreeBlockThreshold = MmHeapDeCommitFreeBlockThreshold;
600  Peb->CriticalSectionTimeout = MmCriticalSectionTimeout;
601  Peb->MinimumStackCommit = MmMinimumStackCommitInBytes;
602  Peb->MaximumNumberOfHeaps = (PAGE_SIZE - sizeof(PEB)) / sizeof(PVOID);
603  Peb->ProcessHeaps = (PVOID*)(Peb + 1);
604 
605  //
606  // Session ID
607  //
608  if (Process->Session) Peb->SessionId = MmGetSessionId(Process);
609  }
611  {
612  //
613  // Fail
614  //
615  KeDetachProcess();
617  }
618  _SEH2_END;
619 
620  //
621  // Use SEH in case we can't load the image
622  //
623  _SEH2_TRY
624  {
625  //
626  // Get NT Headers
627  //
628  NtHeaders = RtlImageNtHeader(Peb->ImageBaseAddress);
629  Characteristics = NtHeaders->FileHeader.Characteristics;
630  }
632  {
633  //
634  // Fail
635  //
636  KeDetachProcess();
638  }
639  _SEH2_END;
640 
641  //
642  // Parse the headers
643  //
644  if (NtHeaders)
645  {
646  //
647  // Use SEH in case we can't load the headers
648  //
649  _SEH2_TRY
650  {
651  //
652  // Get the Image Config Data too
653  //
654  ImageConfigData = RtlImageDirectoryEntryToData(Peb->ImageBaseAddress,
655  TRUE,
657  (PULONG)&ViewSize);
658  if (ImageConfigData)
659  {
660  //
661  // Probe it
662  //
663  ProbeForRead(ImageConfigData,
665  sizeof(ULONG));
666  }
667 
668  //
669  // Write subsystem data
670  //
671  Peb->ImageSubsystem = NtHeaders->OptionalHeader.Subsystem;
672  Peb->ImageSubsystemMajorVersion = NtHeaders->OptionalHeader.MajorSubsystemVersion;
673  Peb->ImageSubsystemMinorVersion = NtHeaders->OptionalHeader.MinorSubsystemVersion;
674 
675  //
676  // Check for version data
677  //
678  if (NtHeaders->OptionalHeader.Win32VersionValue)
679  {
680  //
681  // Extract values and write them
682  //
683  Peb->OSMajorVersion = NtHeaders->OptionalHeader.Win32VersionValue & 0xFF;
684  Peb->OSMinorVersion = (NtHeaders->OptionalHeader.Win32VersionValue >> 8) & 0xFF;
685  Peb->OSBuildNumber = (NtHeaders->OptionalHeader.Win32VersionValue >> 16) & 0x3FFF;
686  Peb->OSPlatformId = (NtHeaders->OptionalHeader.Win32VersionValue >> 30) ^ 2;
687 
688  /* Process CSD version override */
689  if ((ImageConfigData) && (ImageConfigData->CSDVersion))
690  {
691  /* Take the value from the image configuration directory */
692  Peb->OSCSDVersion = ImageConfigData->CSDVersion;
693  }
694  }
695 
696  /* Process optional process affinity mask override */
697  if ((ImageConfigData) && (ImageConfigData->ProcessAffinityMask))
698  {
699  /* Take the value from the image configuration directory */
700  ProcessAffinityMask = ImageConfigData->ProcessAffinityMask;
701  }
702 
703  //
704  // Check if this is a UP image
705  if (Characteristics & IMAGE_FILE_UP_SYSTEM_ONLY)
706  {
707  //
708  // Force it to use CPU 0
709  //
710  /* FIXME: this should use the MmRotatingUniprocessorNumber */
711  Peb->ImageProcessAffinityMask = 0;
712  }
713  else
714  {
715  //
716  // Whatever was configured
717  //
718  Peb->ImageProcessAffinityMask = ProcessAffinityMask;
719  }
720  }
722  {
723  //
724  // Fail
725  //
726  KeDetachProcess();
728  }
729  _SEH2_END;
730  }
731 
732  //
733  // Detach from the Process
734  //
735  KeDetachProcess();
736  *BasePeb = Peb;
737  return STATUS_SUCCESS;
738 }
739 
740 NTSTATUS
741 NTAPI
744  IN PINITIAL_TEB InitialTeb,
745  OUT PTEB *BaseTeb)
746 {
747  PTEB Teb;
749  *BaseTeb = NULL;
750 
751  //
752  // Attach to Target
753  //
754  KeAttachProcess(&Process->Pcb);
755 
756  //
757  // Allocate the TEB
758  //
759  Status = MiCreatePebOrTeb(Process, sizeof(TEB), (PULONG_PTR)&Teb);
760  if (!NT_SUCCESS(Status))
761  {
762  /* Cleanup and exit */
763  KeDetachProcess();
764  return Status;
765  }
766 
767  //
768  // Use SEH in case we can't load the TEB
769  //
770  _SEH2_TRY
771  {
772  //
773  // Initialize the PEB
774  //
775  RtlZeroMemory(Teb, sizeof(TEB));
776 
777  //
778  // Set TIB Data
779  //
780 #ifdef _M_AMD64
781  Teb->NtTib.ExceptionList = NULL;
782 #else
783  Teb->NtTib.ExceptionList = EXCEPTION_CHAIN_END;
784 #endif
785  Teb->NtTib.Self = (PNT_TIB)Teb;
786 
787  //
788  // Identify this as an OS/2 V3.0 ("Cruiser") TIB
789  //
790  Teb->NtTib.Version = 30 << 8;
791 
792  //
793  // Set TEB Data
794  //
795  Teb->ClientId = *ClientId;
796  Teb->RealClientId = *ClientId;
797  Teb->ProcessEnvironmentBlock = Process->Peb;
798  Teb->CurrentLocale = PsDefaultThreadLocaleId;
799 
800  //
801  // Check if we have a grandparent TEB
802  //
803  if ((InitialTeb->PreviousStackBase == NULL) &&
804  (InitialTeb->PreviousStackLimit == NULL))
805  {
806  //
807  // Use initial TEB values
808  //
809  Teb->NtTib.StackBase = InitialTeb->StackBase;
810  Teb->NtTib.StackLimit = InitialTeb->StackLimit;
811  Teb->DeallocationStack = InitialTeb->AllocatedStackBase;
812  }
813  else
814  {
815  //
816  // Use grandparent TEB values
817  //
818  Teb->NtTib.StackBase = InitialTeb->PreviousStackBase;
819  Teb->NtTib.StackLimit = InitialTeb->PreviousStackLimit;
820  }
821 
822  //
823  // Initialize the static unicode string
824  //
825  Teb->StaticUnicodeString.MaximumLength = sizeof(Teb->StaticUnicodeBuffer);
826  Teb->StaticUnicodeString.Buffer = Teb->StaticUnicodeBuffer;
827  }
829  {
830  //
831  // Get error code
832  //
833  Status = _SEH2_GetExceptionCode();
834  }
835  _SEH2_END;
836 
837  //
838  // Return
839  //
840  KeDetachProcess();
841  *BaseTeb = Teb;
842  return Status;
843 }
844 
845 VOID
846 NTAPI
848 {
849  PMMPFN Pfn1;
850  PMMPTE sysPte;
851  MMPTE tempPte;
852 
853  /* Setup some bogus list data */
854  MmWorkingSetList->LastEntry = CurrentProcess->Vm.MinimumWorkingSetSize;
855  MmWorkingSetList->HashTable = NULL;
856  MmWorkingSetList->HashTableSize = 0;
857  MmWorkingSetList->NumberOfImageWaiters = 0;
858  MmWorkingSetList->Wsle = (PVOID)0xDEADBABE;
859  MmWorkingSetList->VadBitMapHint = 1;
860  MmWorkingSetList->HashTableStart = (PVOID)0xBADAB00B;
861  MmWorkingSetList->HighestPermittedHashAddress = (PVOID)0xCAFEBABE;
862  MmWorkingSetList->FirstFree = 1;
863  MmWorkingSetList->FirstDynamic = 2;
864  MmWorkingSetList->NextSlot = 3;
865  MmWorkingSetList->LastInitializedWsle = 4;
866 
867  /* The rule is that the owner process is always in the FLINK of the PDE's PFN entry */
868  Pfn1 = MiGetPfnEntry(CurrentProcess->Pcb.DirectoryTableBase[0] >> PAGE_SHIFT);
869  ASSERT(Pfn1->u4.PteFrame == MiGetPfnEntryIndex(Pfn1));
870  Pfn1->u1.Event = (PKEVENT)CurrentProcess;
871 
872  /* Map the process working set in kernel space */
873  sysPte = MiReserveSystemPtes(1, SystemPteSpace);
874  MI_MAKE_HARDWARE_PTE_KERNEL(&tempPte, sysPte, MM_READWRITE, CurrentProcess->WorkingSetPage);
875  MI_WRITE_VALID_PTE(sysPte, tempPte);
876  CurrentProcess->Vm.VmWorkingSetList = MiPteToAddress(sysPte);
877 }
878 
879 NTSTATUS
880 NTAPI
882  IN PEPROCESS ProcessClone OPTIONAL,
883  IN PVOID Section OPTIONAL,
884  IN OUT PULONG Flags,
885  IN POBJECT_NAME_INFORMATION *AuditName OPTIONAL)
886 {
888  SIZE_T ViewSize = 0;
889  PVOID ImageBase = 0;
891  PMMPTE PointerPte;
892  KIRQL OldIrql;
893  PMMPDE PointerPde;
894  PFN_NUMBER PageFrameNumber;
896  PWCHAR Source;
898  USHORT Length = 0;
899  MMPTE TempPte;
900 
901  /* We should have a PDE */
902  ASSERT(Process->Pcb.DirectoryTableBase[0] != 0);
903  ASSERT(Process->PdeUpdateNeeded == FALSE);
904 
905  /* Attach to the process */
906  KeAttachProcess(&Process->Pcb);
907 
908  /* The address space should now been in phase 1 or 0 */
909  ASSERT(Process->AddressSpaceInitialized <= 1);
910  Process->AddressSpaceInitialized = 2;
911 
912  /* Initialize the Addresss Space lock */
913  KeInitializeGuardedMutex(&Process->AddressCreationLock);
914  Process->Vm.WorkingSetExpansionLinks.Flink = NULL;
915 
916  /* Initialize AVL tree */
917  ASSERT(Process->VadRoot.NumberGenericTableElements == 0);
918  Process->VadRoot.BalancedRoot.u1.Parent = &Process->VadRoot.BalancedRoot;
919 
920  /* Lock PFN database */
922 
923  /* Setup the PFN for the PDE base of this process */
924 #ifdef _M_AMD64
925  PointerPte = MiAddressToPte(PXE_BASE);
926 #else
927  PointerPte = MiAddressToPte(PDE_BASE);
928 #endif
929  PageFrameNumber = PFN_FROM_PTE(PointerPte);
930  ASSERT(Process->Pcb.DirectoryTableBase[0] == PageFrameNumber * PAGE_SIZE);
931  MiInitializePfn(PageFrameNumber, PointerPte, TRUE);
932 
933  /* Do the same for hyperspace */
934 #ifdef _M_AMD64
935  PointerPde = MiAddressToPxe((PVOID)HYPER_SPACE);
936 #else
937  PointerPde = MiAddressToPde(HYPER_SPACE);
938 #endif
939  PageFrameNumber = PFN_FROM_PTE(PointerPde);
940  //ASSERT(Process->Pcb.DirectoryTableBase[0] == PageFrameNumber * PAGE_SIZE); // we're not lucky
941  MiInitializePfn(PageFrameNumber, (PMMPTE)PointerPde, TRUE);
942 
943  /* Setup the PFN for the PTE for the working set */
944  PointerPte = MiAddressToPte(MI_WORKING_SET_LIST);
945  MI_MAKE_HARDWARE_PTE(&TempPte, PointerPte, MM_READWRITE, 0);
946  ASSERT(PointerPte->u.Long != 0);
947  PageFrameNumber = PFN_FROM_PTE(PointerPte);
948  MI_WRITE_INVALID_PTE(PointerPte, DemandZeroPte);
949  MiInitializePfn(PageFrameNumber, PointerPte, TRUE);
950  TempPte.u.Hard.PageFrameNumber = PageFrameNumber;
951  MI_WRITE_VALID_PTE(PointerPte, TempPte);
952 
953  /* Now initialize the working set list */
955 
956  /* Sanity check */
957  ASSERT(Process->PhysicalVadRoot == NULL);
958 
959  /* Release PFN lock */
961 
962  /* Check if there's a Section Object */
963  if (SectionObject)
964  {
965  /* Determine the image file name and save it to EPROCESS */
966  FileName = SectionObject->FileObject->FileName;
967  Source = (PWCHAR)((PCHAR)FileName.Buffer + FileName.Length);
968  if (FileName.Buffer)
969  {
970  /* Loop the file name*/
971  while (Source > FileName.Buffer)
972  {
973  /* Make sure this isn't a backslash */
974  if (*--Source == OBJ_NAME_PATH_SEPARATOR)
975  {
976  /* If so, stop it here */
977  Source++;
978  break;
979  }
980  else
981  {
982  /* Otherwise, keep going */
983  Length++;
984  }
985  }
986  }
987 
988  /* Copy the to the process and truncate it to 15 characters if necessary */
989  Destination = Process->ImageFileName;
990  Length = min(Length, sizeof(Process->ImageFileName) - 1);
991  while (Length--) *Destination++ = (UCHAR)*Source++;
992  *Destination = ANSI_NULL;
993 
994  /* Check if caller wants an audit name */
995  if (AuditName)
996  {
997  /* Setup the audit name */
998  Status = SeInitializeProcessAuditName(SectionObject->FileObject,
999  FALSE,
1000  AuditName);
1001  if (!NT_SUCCESS(Status))
1002  {
1003  /* Fail */
1004  KeDetachProcess();
1005  return Status;
1006  }
1007  }
1008 
1009  /* Map the section */
1010  Status = MmMapViewOfSection(Section,
1011  Process,
1012  (PVOID*)&ImageBase,
1013  0,
1014  0,
1015  NULL,
1016  &ViewSize,
1017  0,
1018  MEM_COMMIT,
1019  PAGE_READWRITE);
1020 
1021  /* Save the pointer */
1022  Process->SectionBaseAddress = ImageBase;
1023  }
1024 
1025  /* Be nice and detach */
1026  KeDetachProcess();
1027 
1028  /* Return status to caller */
1029  return Status;
1030 }
1031 
1032 NTSTATUS
1033 NTAPI
1036  IN PULONG_PTR DirectoryTableBase)
1037 {
1038  /* Share the directory base with the idle process */
1039  DirectoryTableBase[0] = PsGetCurrentProcess()->Pcb.DirectoryTableBase[0];
1040  DirectoryTableBase[1] = PsGetCurrentProcess()->Pcb.DirectoryTableBase[1];
1041 
1042  /* Initialize the Addresss Space */
1043  KeInitializeGuardedMutex(&Process->AddressCreationLock);
1044  KeInitializeSpinLock(&Process->HyperSpaceLock);
1045  Process->Vm.WorkingSetExpansionLinks.Flink = NULL;
1046  ASSERT(Process->VadRoot.NumberGenericTableElements == 0);
1047  Process->VadRoot.BalancedRoot.u1.Parent = &Process->VadRoot.BalancedRoot;
1048 
1049  /* Use idle process Working set */
1050  Process->Vm.VmWorkingSetList = PsGetCurrentProcess()->Vm.VmWorkingSetList;
1051 
1052  /* Done */
1053  Process->HasAddressSpace = TRUE;//??
1054  return STATUS_SUCCESS;
1055 }
1056 
1057 NTSTATUS
1058 NTAPI
1061 {
1062  /* Lock the VAD, ARM3-owned ranges away */
1063  return STATUS_SUCCESS;
1064 }
1065 
1066 #ifdef _M_IX86
1067 /* FIXME: Evaluate ways to make this portable yet arch-specific */
1068 BOOLEAN
1069 NTAPI
1072  OUT PULONG_PTR DirectoryTableBase)
1073 {
1074  KIRQL OldIrql;
1075  PFN_NUMBER PdeIndex, HyperIndex, WsListIndex;
1076  PMMPTE PointerPte;
1077  MMPTE TempPte, PdePte;
1078  ULONG PdeOffset;
1079  PMMPTE SystemTable, HyperTable;
1080  ULONG Color;
1081  PMMPFN Pfn1;
1082 
1083  /* Choose a process color */
1084  Process->NextPageColor = (USHORT)RtlRandom(&MmProcessColorSeed);
1085 
1086  /* Setup the hyperspace lock */
1087  KeInitializeSpinLock(&Process->HyperSpaceLock);
1088 
1089  /* Lock PFN database */
1091 
1092  /* Get a zero page for the PDE, if possible */
1093  Color = MI_GET_NEXT_PROCESS_COLOR(Process);
1095  PdeIndex = MiRemoveZeroPageSafe(Color);
1096  if (!PdeIndex)
1097  {
1098  /* No zero pages, grab a free one */
1099  PdeIndex = MiRemoveAnyPage(Color);
1100 
1101  /* Zero it outside the PFN lock */
1103  MiZeroPhysicalPage(PdeIndex);
1105  }
1106 
1107  /* Get a zero page for hyperspace, if possible */
1109  Color = MI_GET_NEXT_PROCESS_COLOR(Process);
1110  HyperIndex = MiRemoveZeroPageSafe(Color);
1111  if (!HyperIndex)
1112  {
1113  /* No zero pages, grab a free one */
1114  HyperIndex = MiRemoveAnyPage(Color);
1115 
1116  /* Zero it outside the PFN lock */
1118  MiZeroPhysicalPage(HyperIndex);
1120  }
1121 
1122  /* Get a zero page for the woring set list, if possible */
1124  Color = MI_GET_NEXT_PROCESS_COLOR(Process);
1125  WsListIndex = MiRemoveZeroPageSafe(Color);
1126  if (!WsListIndex)
1127  {
1128  /* No zero pages, grab a free one */
1129  WsListIndex = MiRemoveAnyPage(Color);
1130 
1131  /* Zero it outside the PFN lock */
1133  MiZeroPhysicalPage(WsListIndex);
1134  }
1135  else
1136  {
1137  /* Release the PFN lock */
1139  }
1140 
1141  /* Switch to phase 1 initialization */
1142  ASSERT(Process->AddressSpaceInitialized == 0);
1143  Process->AddressSpaceInitialized = 1;
1144 
1145  /* Set the base directory pointers */
1146  Process->WorkingSetPage = WsListIndex;
1147  DirectoryTableBase[0] = PdeIndex << PAGE_SHIFT;
1148  DirectoryTableBase[1] = HyperIndex << PAGE_SHIFT;
1149 
1150  /* Make sure we don't already have a page directory setup */
1151  ASSERT(Process->Pcb.DirectoryTableBase[0] == 0);
1152 
1153  /* Get a PTE to map hyperspace */
1154  PointerPte = MiReserveSystemPtes(1, SystemPteSpace);
1155  ASSERT(PointerPte != NULL);
1156 
1157  /* Build it */
1159  PointerPte,
1160  MM_READWRITE,
1161  HyperIndex);
1162 
1163  /* Set it dirty and map it */
1164  MI_MAKE_DIRTY_PAGE(&PdePte);
1165  MI_WRITE_VALID_PTE(PointerPte, PdePte);
1166 
1167  /* Now get hyperspace's page table */
1168  HyperTable = MiPteToAddress(PointerPte);
1169 
1170  /* Now write the PTE/PDE entry for the working set list index itself */
1171  TempPte = ValidKernelPteLocal;
1172  TempPte.u.Hard.PageFrameNumber = WsListIndex;
1173  PdeOffset = MiAddressToPteOffset(MmWorkingSetList);
1174  HyperTable[PdeOffset] = TempPte;
1175 
1176  /* Let go of the system PTE */
1177  MiReleaseSystemPtes(PointerPte, 1, SystemPteSpace);
1178 
1179  /* Save the PTE address of the page directory itself */
1180  Pfn1 = MiGetPfnEntry(PdeIndex);
1181  Pfn1->PteAddress = (PMMPTE)PDE_BASE;
1182 
1183  /* Insert us into the Mm process list */
1184  OldIrql = MiAcquireExpansionLock();
1185  InsertTailList(&MmProcessList, &Process->MmProcessLinks);
1186  MiReleaseExpansionLock(OldIrql);
1187 
1188  /* Get a PTE to map the page directory */
1189  PointerPte = MiReserveSystemPtes(1, SystemPteSpace);
1190  ASSERT(PointerPte != NULL);
1191 
1192  /* Build it */
1194  PointerPte,
1195  MM_READWRITE,
1196  PdeIndex);
1197 
1198  /* Set it dirty and map it */
1199  MI_MAKE_DIRTY_PAGE(&PdePte);
1200  MI_WRITE_VALID_PTE(PointerPte, PdePte);
1201 
1202  /* Now get the page directory (which we'll double map, so call it a page table */
1203  SystemTable = MiPteToAddress(PointerPte);
1204 
1205  /* Copy all the kernel mappings */
1206  PdeOffset = MiGetPdeOffset(MmSystemRangeStart);
1207  RtlCopyMemory(&SystemTable[PdeOffset],
1209  PAGE_SIZE - PdeOffset * sizeof(MMPTE));
1210 
1211  /* Now write the PTE/PDE entry for hyperspace itself */
1212  TempPte = ValidKernelPteLocal;
1213  TempPte.u.Hard.PageFrameNumber = HyperIndex;
1214  PdeOffset = MiGetPdeOffset(HYPER_SPACE);
1215  SystemTable[PdeOffset] = TempPte;
1216 
1217  /* Sanity check */
1218  PdeOffset++;
1219  ASSERT(MiGetPdeOffset(MmHyperSpaceEnd) >= PdeOffset);
1220 
1221  /* Now do the x86 trick of making the PDE a page table itself */
1222  PdeOffset = MiGetPdeOffset(PTE_BASE);
1223  TempPte.u.Hard.PageFrameNumber = PdeIndex;
1224  SystemTable[PdeOffset] = TempPte;
1225 
1226  /* Let go of the system PTE */
1227  MiReleaseSystemPtes(PointerPte, 1, SystemPteSpace);
1228 
1229  /* Add the process to the session */
1230  MiSessionAddProcess(Process);
1231  return TRUE;
1232 }
1233 #endif
1234 
1235 VOID
1236 NTAPI
1238 {
1239  PMMVAD Vad;
1240  PMM_AVL_TABLE VadTree;
1242 
1243  /* Only support this */
1244  ASSERT(Process->AddressSpaceInitialized == 2);
1245 
1246  /* Remove from the session */
1248 
1249  /* Lock the process address space from changes */
1250  MmLockAddressSpace(&Process->Vm);
1251  MiLockProcessWorkingSetUnsafe(Process, Thread);
1252 
1253  /* VM is deleted now */
1254  Process->VmDeleted = TRUE;
1255  MiUnlockProcessWorkingSetUnsafe(Process, Thread);
1256 
1257  /* Enumerate the VADs */
1258  VadTree = &Process->VadRoot;
1259  while (VadTree->NumberGenericTableElements)
1260  {
1261  /* Grab the current VAD */
1262  Vad = (PMMVAD)VadTree->BalancedRoot.RightChild;
1263 
1264  /* Check for old-style memory areas */
1265  if (Vad->u.VadFlags.Spare == 1)
1266  {
1267  /* Let RosMm handle this */
1268  MiRosCleanupMemoryArea(Process, Vad);
1269  continue;
1270  }
1271 
1272  /* Lock the working set */
1273  MiLockProcessWorkingSetUnsafe(Process, Thread);
1274 
1275  /* Remove this VAD from the tree */
1276  ASSERT(VadTree->NumberGenericTableElements >= 1);
1277  MiRemoveNode((PMMADDRESS_NODE)Vad, VadTree);
1278 
1279  /* Only regular VADs supported for now */
1280  ASSERT(Vad->u.VadFlags.VadType == VadNone);
1281 
1282  /* Check if this is a section VAD */
1283  if (!(Vad->u.VadFlags.PrivateMemory) && (Vad->ControlArea))
1284  {
1285  /* Remove the view */
1286  MiRemoveMappedView(Process, Vad);
1287  }
1288  else
1289  {
1290  /* Delete the addresses */
1291  MiDeleteVirtualAddresses(Vad->StartingVpn << PAGE_SHIFT,
1292  (Vad->EndingVpn << PAGE_SHIFT) | (PAGE_SIZE - 1),
1293  Vad);
1294 
1295  /* Release the working set */
1296  MiUnlockProcessWorkingSetUnsafe(Process, Thread);
1297  }
1298 
1299  /* Skip ARM3 fake VADs, they'll be freed by MmDeleteProcessAddresSpace */
1300  if (Vad->u.VadFlags.Spare == 1)
1301  {
1302  /* Set a flag so MmDeleteMemoryArea knows to free, but not to remove */
1303  Vad->u.VadFlags.Spare = 2;
1304  continue;
1305  }
1306 
1307  /* Free the VAD memory */
1308  ExFreePool(Vad);
1309  }
1310 
1311  /* Lock the working set */
1312  MiLockProcessWorkingSetUnsafe(Process, Thread);
1313  ASSERT(Process->CloneRoot == NULL);
1314  ASSERT(Process->PhysicalVadRoot == NULL);
1315 
1316  /* Delete the shared user data section */
1318 
1319  /* Release the working set */
1320  MiUnlockProcessWorkingSetUnsafe(Process, Thread);
1321 
1322  /* Release the address space */
1323  MmUnlockAddressSpace(&Process->Vm);
1324 }
1325 
1326 VOID
1327 NTAPI
1329 {
1330  PMMPFN Pfn1, Pfn2;
1331  KIRQL OldIrql;
1332  PFN_NUMBER PageFrameIndex;
1333 
1334  //ASSERT(Process->CommitCharge == 0);
1335 
1336  /* Acquire the PFN lock */
1338 
1339  /* Check for fully initialized process */
1340  if (Process->AddressSpaceInitialized == 2)
1341  {
1342  /* Map the working set page and its page table */
1343  Pfn1 = MiGetPfnEntry(Process->WorkingSetPage);
1344  Pfn2 = MiGetPfnEntry(Pfn1->u4.PteFrame);
1345 
1346  /* Nuke it */
1347  MI_SET_PFN_DELETED(Pfn1);
1348  MiDecrementShareCount(Pfn2, Pfn1->u4.PteFrame);
1349  MiDecrementShareCount(Pfn1, Process->WorkingSetPage);
1350  ASSERT((Pfn1->u3.e2.ReferenceCount == 0) || (Pfn1->u3.e1.WriteInProgress));
1351  MiReleaseSystemPtes(MiAddressToPte(Process->Vm.VmWorkingSetList), 1, SystemPteSpace);
1352 
1353  /* Now map hyperspace and its page table */
1354  PageFrameIndex = Process->Pcb.DirectoryTableBase[1] >> PAGE_SHIFT;
1355  Pfn1 = MiGetPfnEntry(PageFrameIndex);
1356  Pfn2 = MiGetPfnEntry(Pfn1->u4.PteFrame);
1357 
1358  /* Nuke it */
1359  MI_SET_PFN_DELETED(Pfn1);
1360  MiDecrementShareCount(Pfn2, Pfn1->u4.PteFrame);
1361  MiDecrementShareCount(Pfn1, PageFrameIndex);
1362  ASSERT((Pfn1->u3.e2.ReferenceCount == 0) || (Pfn1->u3.e1.WriteInProgress));
1363 
1364  /* Finally, nuke the PDE itself */
1365  PageFrameIndex = Process->Pcb.DirectoryTableBase[0] >> PAGE_SHIFT;
1366  Pfn1 = MiGetPfnEntry(PageFrameIndex);
1367  MI_SET_PFN_DELETED(Pfn1);
1368  MiDecrementShareCount(Pfn1, PageFrameIndex);
1369  MiDecrementShareCount(Pfn1, PageFrameIndex);
1370 
1371  /* Page table is now dead. Bye bye... */
1372  ASSERT((Pfn1->u3.e2.ReferenceCount == 0) || (Pfn1->u3.e1.WriteInProgress));
1373  }
1374  else
1375  {
1376  /* A partly-initialized process should never exit through here */
1377  ASSERT(FALSE);
1378  }
1379 
1380  /* Release the PFN lock */
1382 
1383  /* Drop a reference on the session */
1384  if (Process->Session) MiReleaseProcessReferenceToSessionDataPage(Process->Session);
1385 
1386  /* Clear out the PDE pages */
1387  Process->Pcb.DirectoryTableBase[0] = 0;
1388  Process->Pcb.DirectoryTableBase[1] = 0;
1389 }
1390 
1391 
1392 /* SYSTEM CALLS ***************************************************************/
1393 
1394 NTSTATUS
1395 NTAPI
1397  IN OUT PULONG_PTR NumberOfPages,
1398  IN OUT PULONG_PTR UserPfnArray)
1399 {
1400  UNIMPLEMENTED;
1401  return STATUS_NOT_IMPLEMENTED;
1402 }
1403 
1404 NTSTATUS
1405 NTAPI
1407  IN ULONG_PTR NumberOfPages,
1408  IN OUT PULONG_PTR UserPfnArray)
1409 {
1410  UNIMPLEMENTED;
1411  return STATUS_NOT_IMPLEMENTED;
1412 }
1413 
1414 NTSTATUS
1415 NTAPI
1417  IN ULONG_PTR NumberOfPages,
1418  IN OUT PULONG_PTR UserPfnArray)
1419 {
1420  UNIMPLEMENTED;
1421  return STATUS_NOT_IMPLEMENTED;
1422 }
1423 
1424 NTSTATUS
1425 NTAPI
1427  IN OUT PULONG_PTR NumberOfPages,
1428  IN OUT PULONG_PTR UserPfnArray)
1429 {
1430  UNIMPLEMENTED;
1431  return STATUS_NOT_IMPLEMENTED;
1432 }
1433 
1434 /* EOF */
union _MMVAD_LONG::@2127 u
_Must_inspect_result_ _Outptr_ PVOID * SectionObject
Definition: fsrtlfuncs.h:860
DWORD *typedef PVOID
Definition: winlogon.h:52
#define MI_MAKE_SOFTWARE_PTE(p, x)
Definition: miarm.h:156
NTSYSAPI ULONG NTAPI RtlRandom(_Inout_ PULONG Seed)
#define STATUS_SUCCESS
Definition: contextmenu.cpp:55
VOID NTAPI MiInitializePfn(IN PFN_NUMBER PageFrameIndex, IN PMMPTE PointerPte, IN BOOLEAN Modified)
Definition: pfnlist.c:969
struct _MMPFN::@1488::@1494 e2
#define PAGE_SHIFT
Definition: env_spec_w32.h:45
#define IN
Definition: typedefs.h:39
PVOID NTAPI MmCreateKernelStack(IN BOOLEAN GuiStack, IN UCHAR Node)
Definition: procsup.c:258
#define VER_PLATFORM_WIN32_NT
Definition: rtltypes.h:236
VOID NTAPI MmCleanProcessAddressSpace(IN PEPROCESS Process)
Definition: procsup.c:1237
SIZE_T MmHeapDeCommitTotalFreeThreshold
Definition: mminit.c:367
union _MMVAD_LONG::@2128 u2
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
struct _KEVENT * PKEVENT
VOID NTAPI MiSessionRemoveProcess(VOID)
Definition: session.c:396
PPEB Peb
Definition: dllmain.c:27
ULONG ReadOnly
Definition: mmtypes.h:711
FORCEINLINE VOID MiUnlockProcessWorkingSetUnsafe(IN PEPROCESS Process, IN PETHREAD Thread)
Definition: miarm.h:1177
PVOID HashTableStart
Definition: mmtypes.h:866
#define MiAddressToPde(x)
Definition: mmx86.c:20
FORCEINLINE KIRQL MiAcquireExpansionLock(VOID)
Definition: miarm.h:1348
#define PsGetCurrentThread()
Definition: env_spec_w32.h:81
union _MMPFN::@1491 u4
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
VOID FASTCALL KeAcquireGuardedMutex(IN PKGUARDED_MUTEX GuardedMutex)
Definition: gmutex.c:42
PMMVAD Parent
Definition: mmtypes.h:755
VOID NTAPI MiReleaseProcessReferenceToSessionDataPage(IN PMM_SESSION_SPACE SessionGlobal)
Definition: session.c:210
ULONG PFN_COUNT
Definition: mmtypes.h:102
ULONG OneSecured
Definition: mmtypes.h:709
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel)?(CompletionRoutine!=NULL):TRUE)
PMMPTE NTAPI MiReserveSystemPtes(IN ULONG NumberOfPtes, IN MMSYSTEM_PTE_POOL_TYPE SystemPtePoolType)
Definition: syspte.c:246
ULONG FirstDynamic
Definition: mmtypes.h:857
FORCEINLINE VOID MmUnlockAddressSpace(PMMSUPPORT AddressSpace)
Definition: mm.h:1354
MMVAD_FLAGS VadFlags
Definition: mmtypes.h:764
ULONG_PTR CommitCharge
Definition: mmtypes.h:692
#define TRUE
Definition: numbers.c:17
#define MM_READWRITE
Definition: miarm.h:49
PVOID HighestPermittedHashAddress
Definition: mmtypes.h:867
VOID * Source
Definition: acefiex.h:718
ULONG_PTR NumberGenericTableElements
Definition: mmtypes.h:669
#define MI_GET_NEXT_COLOR()
Definition: miarm.h:209
NTSTATUS NTAPI NtMapUserPhysicalPagesScatter(IN PVOID *VirtualAddresses, IN ULONG_PTR NumberOfPages, IN OUT PULONG_PTR UserPfnArray)
Definition: procsup.c:1416
#define MM_NOACCESS
Definition: miarm.h:67
union _MMVAD_LONG::@2126 u1
NTSTATUS NTAPI NtFreeUserPhysicalPages(IN HANDLE ProcessHandle, IN OUT PULONG_PTR NumberOfPages, IN OUT PULONG_PTR UserPfnArray)
Definition: procsup.c:1426
PCONTROL_AREA ControlArea
Definition: mmtypes.h:766
ULONG_PTR Protection
Definition: mmtypes.h:697
ULONG LongVad
Definition: mmtypes.h:712
VOID NTAPI MiZeroPhysicalPage(IN PFN_NUMBER PageFrameIndex)
Definition: pfnlist.c:122
uint16_t * PWCHAR
Definition: typedefs.h:55
#define InsertTailList(ListHead, Entry)
#define KERNEL_LARGE_STACK_COMMIT
LCID PsDefaultThreadLocaleId
Definition: locale.c:25
ULONG_PTR LongFlags
Definition: mmtypes.h:763
SIZE_T MmMinimumStackCommitInBytes
Definition: mminit.c:369
#define MEM_COMMIT
Definition: nt_native.h:1313
VOID NTAPI MiRosCleanupMemoryArea(PEPROCESS Process, PMMVAD Vad)
Definition: marea.c:524
ULONG_PTR NoChange
Definition: mmtypes.h:694
#define MiGetPdeOffset(x)
Definition: mm.h:172
ULONG MmLargeStackSize
Definition: mminit.c:261
MMVAD_FLAGS VadFlags
Definition: mmtypes.h:735
ULONG NtMajorVersion
Definition: init.c:42
SLIST_HEADER MmDeadStackSListHead
Definition: procsup.c:23
IMAGE_OPTIONAL_HEADER32 OptionalHeader
Definition: ntddk_ex.h:184
PSLIST_ENTRY WINAPI InterlockedPopEntrySList(PSLIST_HEADER ListHead)
Definition: interlocked.c:55
struct Color Color
NTSTATUS NTAPI MmCreatePeb(IN PEPROCESS Process, IN PINITIAL_PEB InitialPeb, OUT PPEB *BasePeb)
Definition: procsup.c:502
MMADDRESS_NODE BalancedRoot
Definition: mmtypes.h:663
ULONG_PTR StackLimit
Definition: ketypes.h:938
uint32_t ULONG_PTR
Definition: typedefs.h:64
#define OBJ_NAME_PATH_SEPARATOR
Definition: nt_native.h:1240
UCHAR KIRQL
Definition: env_spec_w32.h:591
MMPFNENTRY e1
Definition: mm.h:329
#define MI_MAKE_DIRTY_PAGE(x)
Definition: mm.h:88
ULONG_PTR EndingVpn
Definition: mmtypes.h:731
NTSTATUS NTAPI MmCreateTeb(IN PEPROCESS Process, IN PCLIENT_ID ClientId, IN PINITIAL_TEB InitialTeb, OUT PTEB *BaseTeb)
Definition: procsup.c:742
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
GLenum GLclampf GLint i
Definition: glfuncs.h:14
#define MiAddressToPte(x)
Definition: mmx86.c:19
NTSTATUS NTAPI INIT_FUNCTION MmInitializeHandBuiltProcess2(IN PEPROCESS Process)
Definition: procsup.c:1060
NTSTATUS NTAPI MmGrowKernelStack(IN PVOID StackPointer)
Definition: procsup.c:461
ULONG PFN_NUMBER
Definition: ke.h:8
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
FORCEINLINE VOID MI_WRITE_VALID_PTE(IN PMMPTE PointerPte, IN MMPTE TempPte)
Definition: miarm.h:914
#define ANSI_NULL
LARGE_INTEGER MmCriticalSectionTimeout
Definition: mminit.c:387
#define PDE_BASE
Definition: winldr.c:20
ULONG MmProcessColorSeed
Definition: procsup.c:20
#define _SEH2_END
Definition: pseh2_64.h:7
PKEVENT Event
Definition: mm.h:311
#define USER_SHARED_DATA
Definition: pstypes.h:51
#define NULL
Definition: mystdio.h:57
#define MI_SET_PROCESS2(x)
Definition: mm.h:254
struct _ACPI_EFI_SYSTEM_TABLE * SystemTable
Definition: acefiex.h:457
ULONG MmMaximumDeadKernelStacks
Definition: procsup.c:22
VOID NTAPI MmDeleteKernelStack(IN PVOID StackBase, IN BOOLEAN GuiStack)
Definition: procsup.c:169
#define PsGetCurrentProcess
Definition: psfuncs.h:17
ULONG LongFlags2
Definition: mmtypes.h:771
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
FORCEINLINE VOID KeInitializeSpinLock(_Out_ PKSPIN_LOCK SpinLock)
Definition: kefuncs.h:251
FORCEINLINE PFN_NUMBER MiRemoveZeroPageSafe(IN ULONG Color)
Definition: miarm.h:2265
PVOID FORCEINLINE MiPteToAddress(PMMPTE PointerPte)
Definition: mm.h:185
PMMVAD NTAPI MiLocateAddress(IN PVOID VirtualAddress)
Definition: vadnode.c:48
void DPRINT(...)
Definition: polytest.cpp:61
VOID NTAPI MiDecrementShareCount(IN PMMPFN Pfn1, IN PFN_NUMBER PageFrameIndex)
Definition: pfnlist.c:1133
ULONG NextSlot
Definition: mmtypes.h:859
struct _FileName FileName
#define MI_SET_USAGE(x)
Definition: mm.h:253
NTSTATUS NTAPI MmMapViewOfSection(IN PVOID SectionObject, IN PEPROCESS Process, IN OUT PVOID *BaseAddress, IN ULONG_PTR ZeroBits, IN SIZE_T CommitSize, IN OUT PLARGE_INTEGER SectionOffset OPTIONAL, IN OUT PSIZE_T ViewSize, IN SECTION_INHERIT InheritDisposition, IN ULONG AllocationType, IN ULONG Protect)
Definition: section.c:4508
VOID NTAPI MiReleaseSystemPtes(IN PMMPTE StartingPte, IN ULONG NumberOfPtes, IN MMSYSTEM_PTE_POOL_TYPE SystemPtePoolType)
Definition: syspte.c:275
ULONG_PTR StartingVpn
Definition: mmtypes.h:730
ULONG_PTR StartingVpn
Definition: mmtypes.h:654
VOID NTAPI MiInitializeWorkingSetList(IN PEPROCESS CurrentProcess)
Definition: procsup.c:847
struct _PEB PEB
NTSTATUS NTAPI NtAllocateUserPhysicalPages(IN HANDLE ProcessHandle, IN OUT PULONG_PTR NumberOfPages, IN OUT PULONG_PTR UserPfnArray)
Definition: procsup.c:1396
IMAGE_FILE_HEADER FileHeader
Definition: ntddk_ex.h:183
VOID NTAPI KeQueryTickCount(IN PLARGE_INTEGER TickCount)
Definition: clock.c:165
NTSTATUS NTAPI INIT_FUNCTION MmInitializeHandBuiltProcess(IN PEPROCESS Process, IN PULONG_PTR DirectoryTableBase)
Definition: procsup.c:1035
union _MMPFN::@1488 u3
MMVAD_FLAGS2 VadFlags2
Definition: mmtypes.h:743
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID _In_ ULONG_PTR _In_ SIZE_T _Inout_opt_ PLARGE_INTEGER SectionOffset
Definition: mmfuncs.h:404
ULONG_PTR MemCommit
Definition: mmtypes.h:696
USHORT WriteInProgress
Definition: mm.h:294
UINTN Size
Definition: acefiex.h:550
ULONG MultipleSecured
Definition: mmtypes.h:710
PVOID Session
Definition: pstypes.h:1202
ULONG_PTR EndingVpn
Definition: mmtypes.h:655
#define STATUS_INVALID_IMAGE_PROTECT
Definition: ntstatus.h:526
FORCEINLINE VOID MiLockProcessWorkingSetUnsafe(IN PEPROCESS Process, IN PETHREAD Thread)
Definition: miarm.h:1107
unsigned char BOOLEAN
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
ULONG CurrentProcess
Definition: shell.c:125
_Out_ PCLIENT_ID ClientId
Definition: kefuncs.h:1176
ULONG_PTR PrivateMemory
Definition: mmtypes.h:699
NTSTATUS NTAPI MiInsertVadEx(_Inout_ PMMVAD Vad, _In_ ULONG_PTR *BaseAddress, _In_ SIZE_T ViewSize, _In_ ULONG_PTR HighestAddress, _In_ ULONG_PTR Alignment, _In_ ULONG AllocationType)
Definition: vadnode.c:204
PFILE_OBJECT FileObject
Definition: mm.h:195
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
NTSTATUS NTAPI SeInitializeProcessAuditName(IN PFILE_OBJECT FileObject, IN BOOLEAN DoAudit, OUT POBJECT_NAME_INFORMATION *AuditInfo)
Definition: audit.c:47
if(!(yy_init))
Definition: macro.lex.yy.c:704
#define MI_WORKING_SET_LIST
Definition: mm.h:41
#define MEMORY_PRIORITY_BACKGROUND
Definition: pstypes.h:125
SIZE_T MmHeapDeCommitFreeBlockThreshold
Definition: mminit.c:368
ULONG LastInitializedWsle
Definition: mmtypes.h:861
uint64_t ULONGLONG
Definition: typedefs.h:66
#define MI_GET_NEXT_PROCESS_COLOR(x)
Definition: miarm.h:210
MMPTE ValidKernelPteLocal
Definition: init.c:35
ULONG64 Valid
Definition: mmtypes.h:150
struct _MMPTE * PMMPTE
NTSTATUS NTAPI MiCreatePebOrTeb(IN PEPROCESS Process, IN ULONG Size, OUT PULONG_PTR BaseAddress)
Definition: procsup.c:29
struct _NT_TIB * PNT_TIB
PVOID ExpNlsSectionPointer
Definition: init.c:86
VOID FASTCALL KeReleaseQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber, IN KIRQL OldIrql)
Definition: spinlock.c:154
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
ULONG NtMinorVersion
Definition: init.c:43
MMVAD_FLAGS2 VadFlags2
Definition: mmtypes.h:772
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
Definition: rtlfuncs.h:2781
HARDWARE_PTE_ARMV6 TempPte
Definition: winldr.c:75
#define PSLIST_ENTRY
Definition: rtltypes.h:130
FORCEINLINE USHORT ExQueryDepthSList(_In_ PSLIST_HEADER SListHead)
Definition: exfuncs.h:153
#define KERNEL_STACK_SIZE
ULONG NtBuildNumber
Definition: init.c:47
struct _MMADDRESS_NODE * RightChild
Definition: mmtypes.h:653
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define BYTES_TO_PAGES(Size)
VOID NTAPI KeDetachProcess(VOID)
Definition: procobj.c:566
unsigned char UCHAR
Definition: xmlstorage.h:181
SIZE_T MmHeapSegmentReserve
Definition: mminit.c:365
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
PMMWSLE Wsle
Definition: mmtypes.h:860
union _MMVAD::@2125 u2
VOID UINTN Length
Definition: acefiex.h:718
PMMWSLE_HASH HashTable
Definition: mmtypes.h:863
#define RtlImageDirectoryEntryToData
Definition: compat.h:460
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
#define IMAGE_FILE_UP_SYSTEM_ONLY
Definition: pedump.c:170
ULONG ExpUnicodeCaseTableDataOffset
Definition: init.c:83
Definition: mm.h:305
union _MMPFN::@1486 u1
ULONG LowPart
Definition: typedefs.h:105
PMMPTE FORCEINLINE MiAddressToPxe(PVOID Address)
Definition: mm.h:148
NTSTATUS NTAPI MmSetMemoryPriorityProcess(IN PEPROCESS Process, IN UCHAR MemoryPriority)
Definition: procsup.c:471
#define PAGE_SIZE
Definition: env_spec_w32.h:49
#define PTE_BASE
Definition: mmx86.c:14
NTKERNELAPI PSLIST_ENTRY FASTCALL InterlockedPushEntrySList(IN PSLIST_HEADER ListHead, IN PSLIST_ENTRY ListEntry)
Definition: interlocked.c:82
KIRQL FASTCALL KeAcquireQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber)
Definition: spinlock.c:108
MM_SYSTEMSIZE MmSystemSize
Definition: mminit.c:325
#define _64K
Definition: miarm.h:17
FORCEINLINE PMMPFN MiGetPfnEntry(IN PFN_NUMBER Pfn)
Definition: mm.h:877
VOID NTAPI MiRemoveNode(IN PMMADDRESS_NODE Node, IN PMM_AVL_TABLE Table)
Definition: vadnode.c:360
BOOLEAN NTAPI MmCreateProcessAddressSpace(IN ULONG MinWs, IN PEPROCESS Dest, IN PULONG_PTR DirectoryTableBase)
CCHAR KeNumberProcessors
Definition: krnlinit.c:35
Status
Definition: gdiplustypes.h:24
ULONG_PTR Long
Definition: mmtypes.h:215
VOID NTAPI MiDeleteVirtualAddresses(IN ULONG_PTR Va, IN ULONG_PTR EndingAddress, IN PMMVAD Vad)
Definition: virtual.c:540
PVOID StackBase
Definition: ketypes.h:1282
PFN_NUMBER NTAPI MiRemoveAnyPage(IN ULONG Color)
Definition: pfnlist.c:475
ULONG ExpOemCodePageDataOffset
Definition: init.c:82
ULONG_PTR SIZE_T
Definition: typedefs.h:79
MMPTE_HARDWARE Hard
Definition: mmtypes.h:217
Definition: compat.h:484
union _MMPTE::@1885 u
#define PXE_BASE
#define MI_SET_PFN_DELETED(x)
Definition: miarm.h:161
#define NT_SUCCESS(StatCode)
Definition: cmd.c:149
FORCEINLINE VOID MI_WRITE_INVALID_PTE(IN PMMPTE PointerPte, IN MMPTE InvalidPte)
Definition: miarm.h:943
#define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG
Definition: pedump.c:269
PFN_COUNT MmNumberOfPhysicalPages
Definition: init.c:48
DWORD *typedef HANDLE
Definition: winlogon.h:52
VOID FASTCALL KeInitializeGuardedMutex(OUT PKGUARDED_MUTEX GuardedMutex)
Definition: gmutex.c:31
LONG NTSTATUS
Definition: DriverTester.h:11
#define EXCEPTION_CHAIN_END
Definition: rtltypes.h:63
Definition: ntddk_ex.h:242
NTSTATUS NTAPI NtMapUserPhysicalPages(IN PVOID VirtualAddresses, IN ULONG_PTR NumberOfPages, IN OUT PULONG_PTR UserPfnArray)
Definition: procsup.c:1406
#define ROUND_TO_PAGES(Size)
ULONG HashTableSize
Definition: mmtypes.h:864
PVOID DebugPort
Definition: pstypes.h:1152
unsigned short USHORT
Definition: pedump.c:61
ULONG_PTR PteFrame
Definition: mm.h:350
ULONG_PTR KAFFINITY
Definition: compat.h:75
ULONG NumberOfImageWaiters
Definition: mmtypes.h:868
VOID NTAPI KeAttachProcess(IN PKPROCESS Process)
Definition: procobj.c:527
struct _MMPFN * PMMPFN
ULONG FirstFree
Definition: mmtypes.h:856
SIZE_T MmHeapSegmentCommit
Definition: mminit.c:366
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
#define _SEH2_TRY
Definition: pseh2_64.h:5
PMMPTE PteAddress
Definition: mm.h:318
unsigned int * PULONG
Definition: retypes.h:1
#define min(a, b)
Definition: monoChain.cc:55
#define PAGE_READONLY
Definition: compat.h:127
#define STATUS_STACK_OVERFLOW
Definition: ntstatus.h:475
FORCEINLINE VOID MiReleaseExpansionLock(KIRQL OldIrql)
Definition: miarm.h:1361
PMMWSL MmWorkingSetList
Definition: procsup.c:21
VOID FASTCALL KeReleaseGuardedMutex(IN OUT PKGUARDED_MUTEX GuardedMutex)
Definition: gmutex.c:53
#define DPRINT1
Definition: precomp.h:8
#define RtlImageNtHeader
Definition: compat.h:457
#define MM_HIGHEST_VAD_ADDRESS
Definition: mm.h:36
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
signed char * PCHAR
Definition: retypes.h:7
VOID NTAPI MmDeleteTeb(IN PEPROCESS Process, IN PTEB Teb)
Definition: procsup.c:107
VOID NTAPI MiSessionAddProcess(IN PEPROCESS NewProcess)
Definition: session.c:427
FORCEINLINE PFN_NUMBER MiGetPfnEntryIndex(IN PMMPFN Pfn1)
Definition: mm.h:897
#define BOOLEAN
Definition: pedump.c:73
#define OUT
Definition: typedefs.h:40
ULONG CmNtCSDVersion
Definition: init.c:56
#define FALSE
Definition: numbers.c:16
ULONG_PTR Spare
Definition: mmtypes.h:698
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID _In_ ULONG_PTR _In_ SIZE_T _Inout_opt_ PLARGE_INTEGER _Inout_ PSIZE_T ViewSize
Definition: mmfuncs.h:404
#define HYPER_SPACE
Definition: mm.h:12
union _MMVAD::@2124 u
PVOID MmHyperSpaceEnd
Definition: init.c:56
unsigned int ULONG
Definition: retypes.h:1
PMMPTE FirstPrototypePte
Definition: mmtypes.h:767
#define UNIMPLEMENTED
Definition: debug.h:114
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define ULONG_PTR
Definition: config.h:101
uint32_t * PULONG_PTR
Definition: typedefs.h:64
ULONG64 PageFrameNumber
Definition: mmtypes.h:171
ULONG NTAPI MmGetSessionId(IN PEPROCESS Process)
Definition: session.c:180
NTSTATUS NTAPI MmInitializeProcessAddressSpace(IN PEPROCESS Process, IN PEPROCESS ProcessClone OPTIONAL, IN PVOID Section OPTIONAL, IN OUT PULONG Flags, IN POBJECT_NAME_INFORMATION *AuditName OPTIONAL)
Definition: procsup.c:881
VOID NTAPI MiRemoveMappedView(IN PEPROCESS CurrentProcess, IN PMMVAD Vad)
Definition: section.c:780
MMPTE DemandZeroPte
Definition: init.c:39
#define MiAddressToPteOffset(x)
Definition: mmx86.c:21
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1097
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
FORCEINLINE VOID MI_MAKE_HARDWARE_PTE_KERNEL(IN PMMPTE NewPte, IN PMMPTE MappingPte, IN ULONG_PTR ProtectionMask, IN PFN_NUMBER PageFrameNumber)
Definition: miarm.h:746
#define KeGetCurrentThread
Definition: hal.h:44
NTSTATUS NTAPI MmGrowKernelStackEx(IN PVOID StackPointer, IN ULONG GrowSize)
Definition: procsup.c:372
LIST_ENTRY MmProcessList
Definition: largepag.c:20
#define MEM_TOP_DOWN
Definition: nt_native.h:1321
PVOID SectionBaseAddress
Definition: pstypes.h:1182
_In_ HANDLE ProcessHandle
Definition: mmfuncs.h:403
ULONG NtGlobalFlag
Definition: init.c:51
SINGLE_LIST_ENTRY NextStackPfn
Definition: mm.h:313
ULONG LastEntry
Definition: mmtypes.h:858
ULONG ExpAnsiCodePageDataOffset
Definition: init.c:82
FORCEINLINE VOID MmLockAddressSpace(PMMSUPPORT AddressSpace)
Definition: mm.h:1347
struct _MMVAD * PMMVAD
#define PFN_FROM_PTE(v)
Definition: mm.h:82
#define MmSystemRangeStart
Definition: mm.h:25
IN HDEVINFO IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL
Definition: devinst.c:44
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
VOID NTAPI MmDeleteProcessAddressSpace2(IN PEPROCESS Process)
Definition: procsup.c:1328
FORCEINLINE VOID MI_MAKE_HARDWARE_PTE(IN PMMPTE NewPte, IN PMMPTE MappingPte, IN ULONG_PTR ProtectionMask, IN PFN_NUMBER PageFrameNumber)
Definition: miarm.h:769
LONGLONG QuadPart
Definition: typedefs.h:113
#define INIT_FUNCTION
Definition: ntoskrnl.h:11
#define PAGE_READWRITE
Definition: nt_native.h:1304
ULONG VadBitMapHint
Definition: mmtypes.h:869