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