ReactOS 0.4.17-dev-798-g86f1b42
process.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Kernel
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: ntoskrnl/ps/process.c
5 * PURPOSE: Process Manager: Process Management
6 * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
7 * Thomas Weidenmueller (w3seek@reactos.org
8 */
9
10/* INCLUDES ******************************************************************/
11
12#include <ntoskrnl.h>
13#define NDEBUG
14#include <debug.h>
15
16/* GLOBALS *******************************************************************/
17
19
21
24
26
30
31/* Fixed quantum table */
33{
34 /* Short quantums */
35 3 * 6, /* Level 1 */
36 3 * 6, /* Level 2 */
37 3 * 6, /* Level 3 */
38
39 /* Long quantums */
40 6 * 6, /* Level 1 */
41 6 * 6, /* Level 2 */
42 6 * 6 /* Level 3 */
43};
44
45/* Variable quantum table */
47{
48 /* Short quantums */
49 1 * 6, /* Level 1 */
50 2 * 6, /* Level 2 */
51 3 * 6, /* Level 3 */
52
53 /* Long quantums */
54 2 * 6, /* Level 1 */
55 4 * 6, /* Level 2 */
56 6 * 6 /* Level 3 */
57};
58
59/* Priority table */
61{
62 8,
63 4,
64 8,
65 13,
66 24,
67 6,
68 10
69};
70
71/* PRIVATE FUNCTIONS *********************************************************/
72
77{
78 PETHREAD FoundThread = NULL;
79 PLIST_ENTRY ListHead, Entry;
80 PAGED_CODE();
82 "Process: %p Thread: %p\n", Process, Thread);
83
84 /* Lock the process */
86 ExAcquirePushLockShared(&Process->ProcessLock);
87
88 /* Check if we're already starting somewhere */
89 if (Thread)
90 {
91 /* Start where we left off */
93 }
94 else
95 {
96 /* Start at the beginning */
97 Entry = Process->ThreadListHead.Flink;
98 }
99
100 /* Set the list head and start looping */
101 ListHead = &Process->ThreadListHead;
102 while (ListHead != Entry)
103 {
104 /* Get the Thread */
105 FoundThread = CONTAINING_RECORD(Entry, ETHREAD, ThreadListEntry);
106
107 /* Safe reference the thread */
108 if (ObReferenceObjectSafe(FoundThread)) break;
109
110 /* Nothing found, keep looping */
111 FoundThread = NULL;
112 Entry = Entry->Flink;
113 }
114
115 /* Unlock the process */
116 ExReleasePushLockShared(&Process->ProcessLock);
118
119 /* Check if we had a starting thread, and dereference it */
121
122 /* Return what we found */
123 return FoundThread;
124}
125
127NTAPI
129{
131 PEPROCESS FoundProcess = NULL;
132 PAGED_CODE();
133 PSTRACE(PS_PROCESS_DEBUG, "Process: %p\n", OldProcess);
134
135 /* Acquire the Active Process Lock */
137
138 /* Check if we're already starting somewhere */
139 if (OldProcess)
140 {
141 /* Start where we left off */
142 Entry = OldProcess->ActiveProcessLinks.Flink;
143 }
144 else
145 {
146 /* Start at the beginning */
148 }
149
150 /* Loop the process list */
151 while (Entry != &PsActiveProcessHead)
152 {
153 /* Get the process */
154 FoundProcess = CONTAINING_RECORD(Entry, EPROCESS, ActiveProcessLinks);
155
156 /* Reference the process */
157 if (ObReferenceObjectSafe(FoundProcess)) break;
158
159 /* Nothing found, keep trying */
160 FoundProcess = NULL;
161 Entry = Entry->Flink;
162 }
163
164 /* Release the lock */
166
167 /* Dereference the Process we had referenced earlier */
168 if (OldProcess) ObDereferenceObject(OldProcess);
169 return FoundProcess;
170}
171
173NTAPI
176 OUT PUCHAR Quantum)
177{
178 ULONG i;
179 UCHAR LocalQuantum, MemoryPriority;
180 PAGED_CODE();
181 PSTRACE(PS_PROCESS_DEBUG, "Process: %p Mode: %lx\n", Process, Mode);
182
183 /* Check if this is a foreground process */
185 {
186 /* Set the memory priority and use priority separation */
187 MemoryPriority = MEMORY_PRIORITY_FOREGROUND;
189 }
190 else
191 {
192 /* Set the background memory priority and no separation */
193 MemoryPriority = MEMORY_PRIORITY_BACKGROUND;
194 i = 0;
195 }
196
197 /* Make sure that the process mode isn't spinning */
199 {
200 /* Set the priority */
201 MmSetMemoryPriorityProcess(Process, MemoryPriority);
202 }
203
204 /* Make sure that the process isn't idle */
205 if (Process->PriorityClass != PROCESS_PRIORITY_CLASS_IDLE)
206 {
207 /* Does the process have a job? */
208 if ((Process->Job) && (PspUseJobSchedulingClasses))
209 {
210 /* Use job quantum */
211 LocalQuantum = PspJobSchedulingClasses[Process->Job->
212 SchedulingClass];
213 }
214 else
215 {
216 /* Use calculated quantum */
217 LocalQuantum = PspForegroundQuantum[i];
218 }
219 }
220 else
221 {
222 /* Process is idle, use default quantum */
223 LocalQuantum = 6;
224 }
225
226 /* Return quantum to caller */
227 *Quantum = LocalQuantum;
228
229 /* Return priority */
230 return PspPriorityTable[Process->PriorityClass];
231}
232
233VOID
234NTAPI
236 IN ULONG PrioritySeparation)
237{
239 ULONG i;
240 UCHAR Quantum;
241 PCHAR QuantumTable;
242 PAGED_CODE();
244 "%lx PrioritySeparation: %lx\n", Immediate, PrioritySeparation);
245
246 /* Write the current priority separation */
248
249 /* Normalize it if it was too high */
251
252 /* Get the quantum table to use */
253 if (PspQuantumTypeFromMask(PrioritySeparation) == PSP_VARIABLE_QUANTUMS)
254 {
255 /* Use a variable table */
256 QuantumTable = PspVariableQuantums;
257 }
258 else if (PspQuantumTypeFromMask(PrioritySeparation) == PSP_FIXED_QUANTUMS)
259 {
260 /* Use fixed table */
261 QuantumTable = PspFixedQuantums;
262 }
263 else
264 {
265 /* Use default for the type of system we're on */
267 }
268
269 /* Now check if we should use long or short */
270 if (PspQuantumLengthFromMask(PrioritySeparation) == PSP_LONG_QUANTUMS)
271 {
272 /* Use long quantums */
273 QuantumTable += 3;
274 }
275 else if (PspQuantumLengthFromMask(PrioritySeparation) == PSP_SHORT_QUANTUMS)
276 {
277 /* Keep existing table */
278 NOTHING;
279 }
280 else
281 {
282 /* Use default for the type of system we're on */
283 QuantumTable += MmIsThisAnNtAsSystem() ? 3 : 0;
284 }
285
286 /* Check if we're using long fixed quantums */
287 if (QuantumTable == &PspFixedQuantums[3])
288 {
289 /* Use Job scheduling classes */
291 }
292 else
293 {
294 /* Otherwise, we don't */
296 }
297
298 /* Copy the selected table into the Foreground Quantum table */
300 QuantumTable,
301 sizeof(PspForegroundQuantum));
302
303 /* Check if we should apply these changes real-time */
304 if (Immediate)
305 {
306 /* We are...loop every process */
308 while (Process)
309 {
310 /* Use the priority separation if this is a foreground process */
311 i = (Process->Vm.Flags.MemoryPriority ==
314
315 /* Make sure that the process isn't idle */
316 if (Process->PriorityClass != PROCESS_PRIORITY_CLASS_IDLE)
317 {
318 /* Does the process have a job? */
319 if ((Process->Job) && (PspUseJobSchedulingClasses))
320 {
321 /* Use job quantum */
322 Quantum = PspJobSchedulingClasses[Process->Job->SchedulingClass];
323 }
324 else
325 {
326 /* Use calculated quantum */
327 Quantum = PspForegroundQuantum[i];
328 }
329 }
330 else
331 {
332 /* Process is idle, use default quantum */
333 Quantum = 6;
334 }
335
336 /* Now set the quantum */
337 KeSetQuantumProcess(&Process->Pcb, Quantum);
338
339 /* Get the next process */
341 }
342 }
343}
344
346NTAPI
350 IN HANDLE ParentProcess OPTIONAL,
351 IN ULONG Flags,
352 IN HANDLE SectionHandle OPTIONAL,
353 IN HANDLE DebugPort OPTIONAL,
354 IN HANDLE ExceptionPort OPTIONAL,
355 IN BOOLEAN InJob)
356{
359 PVOID ExceptionPortObject;
360 PDEBUG_OBJECT DebugObject;
363 ULONG_PTR DirectoryTableBase[2] = {0,0};
365 HANDLE_TABLE_ENTRY CidEntry;
366 PETHREAD CurrentThread = PsGetCurrentThread();
368 PEPROCESS CurrentProcess = PsGetCurrentProcess();
369 ULONG MinWs, MaxWs;
370 ACCESS_STATE LocalAccessState;
371 PACCESS_STATE AccessState = &LocalAccessState;
372 AUX_ACCESS_DATA AuxData;
373 UCHAR Quantum;
374 BOOLEAN Result, SdAllocated;
377 BOOLEAN NeedsPeb = FALSE;
378 INITIAL_PEB InitialPeb;
379
380 PAGED_CODE();
381
383 "ProcessHandle: %p Parent: %p\n", ProcessHandle, ParentProcess);
384
385 /* Validate flags */
387
388 /* Check for parent */
389 if (ParentProcess)
390 {
391 /* Reference it */
392 Status = ObReferenceObjectByHandle(ParentProcess,
396 (PVOID*)&Parent,
397 NULL);
398 if (!NT_SUCCESS(Status)) return Status;
399
400 /* If this process should be in a job but the parent isn't */
401 if ((InJob) && (!Parent->Job))
402 {
403 /* This is illegal. Dereference the parent and fail */
406 }
407
408 /* Inherit Parent process's Affinity. */
409 Affinity = Parent->Pcb.Affinity;
410 }
411 else
412 {
413 /* We have no parent */
414 Parent = NULL;
416 }
417
418 /* Save working set data */
419 MinWs = PsMinimumWorkingSet;
420 MaxWs = PsMaximumWorkingSet;
421
422 /* Create the Object */
427 NULL,
428 sizeof(EPROCESS),
429 0,
430 0,
431 (PVOID*)&Process);
432 if (!NT_SUCCESS(Status)) goto Cleanup;
433
434 /* Clean up the Object */
436
437 /* Initialize pushlock and rundown protection */
438 ExInitializeRundownProtection(&Process->RundownProtect);
439 Process->ProcessLock.Value = 0;
440
441 /* Setup the Thread List Head */
442 InitializeListHead(&Process->ThreadListHead);
443
444 /* Initialize the job process list entry */
445 InitializeListHead(&Process->JobLinks);
446
447 /* Set up the Quota Block from the Parent */
449
450 /* Set up Dos Device Map from the Parent */
452
453 /* Check if we have a parent */
454 if (Parent)
455 {
456 /* Inherit PID and hard-error processing */
457 Process->InheritedFromUniqueProcessId = Parent->UniqueProcessId;
458 Process->DefaultHardErrorProcessing = Parent->DefaultHardErrorProcessing;
459 }
460 else
461 {
462 /* Use default hard-error processing */
463 Process->DefaultHardErrorProcessing = SEM_FAILCRITICALERRORS;
464 }
465
466 /* Check for a section handle */
467 if (SectionHandle)
468 {
469 /* Get a pointer to it */
470 Status = ObReferenceObjectByHandle(SectionHandle,
475 NULL);
476 if (!NT_SUCCESS(Status)) goto CleanupWithRef;
477 }
478 else
479 {
480 /* Assume no section object */
482
483 /* Is the parent the initial process?
484 * Check for NULL also, as at initialization PsInitialSystemProcess is NULL */
486 {
487 /* It's not, so acquire the process rundown */
488 if (ExAcquireRundownProtection(&Parent->RundownProtect))
489 {
490 /* If the parent has a section, use it */
491 SectionObject = Parent->SectionObject;
493
494 /* Release process rundown */
495 ExReleaseRundownProtection(&Parent->RundownProtect);
496 }
497
498 /* If we don't have a section object */
499 if (!SectionObject)
500 {
501 /* Then the process is in termination, so fail */
503 goto CleanupWithRef;
504 }
505 }
506 }
507
508 /* Save the pointer to the section object */
509 Process->SectionObject = SectionObject;
510
511 /* Check for the debug port */
512 if (DebugPort)
513 {
514 /* Reference it */
519 (PVOID*)&DebugObject,
520 NULL);
521 if (!NT_SUCCESS(Status)) goto CleanupWithRef;
522
523 /* Save the debug object */
524 Process->DebugPort = DebugObject;
525
526 /* Check if the caller doesn't want the debug stuff inherited */
528 {
529 /* Set the process flag */
531 }
532 }
533 else
534 {
535 /* Do we have a parent? Copy his debug port */
537 }
538
539 /* Now check for an exception port */
540 if (ExceptionPort)
541 {
542 /* Reference it */
543 Status = ObReferenceObjectByHandle(ExceptionPort,
547 (PVOID*)&ExceptionPortObject,
548 NULL);
549 if (!NT_SUCCESS(Status)) goto CleanupWithRef;
550
551 /* Save the exception port */
552 Process->ExceptionPort = ExceptionPortObject;
553 }
554
555 /* Save the pointer to the section object */
556 Process->SectionObject = SectionObject;
557
558 /* Set default exit code */
559 Process->ExitStatus = STATUS_PENDING;
560
561 /* Check if this is the initial process being built */
562 if (Parent)
563 {
564 /* Create the address space for the child */
566 Process,
567 DirectoryTableBase))
568 {
569 /* Failed */
571 goto CleanupWithRef;
572 }
573 }
574 else
575 {
576 /* Otherwise, we are the boot process, we're already semi-initialized */
577 Process->ObjectTable = CurrentProcess->ObjectTable;
578 Status = MmInitializeHandBuiltProcess(Process, DirectoryTableBase);
579 if (!NT_SUCCESS(Status)) goto CleanupWithRef;
580 }
581
582 /* We now have an address space */
584
585 /* Set the maximum WS */
586 Process->Vm.MaximumWorkingSetSize = MaxWs;
587
588 /* Now initialize the Kernel Process */
591 Affinity,
592 DirectoryTableBase,
593 BooleanFlagOn(Process->DefaultHardErrorProcessing,
595
596 /* Duplicate Parent Token */
598 if (!NT_SUCCESS(Status)) goto CleanupWithRef;
599
600 /* Set default priority class */
601 Process->PriorityClass = PROCESS_PRIORITY_CLASS_NORMAL;
602
603 /* Check if we have a parent */
604 if (Parent)
605 {
606 /* Check our priority class */
607 if (Parent->PriorityClass == PROCESS_PRIORITY_CLASS_IDLE ||
609 {
610 /* Normalize it */
611 Process->PriorityClass = Parent->PriorityClass;
612 }
613
614 /* Initialize object manager for the process */
616 Parent : NULL,
617 Process);
618 if (!NT_SUCCESS(Status)) goto CleanupWithRef;
619 }
620 else
621 {
622 /* Do the second part of the boot process memory setup */
624 if (!NT_SUCCESS(Status)) goto CleanupWithRef;
625 }
626
627 /* Set success for now */
629
630 /* Check if this is a real user-mode process */
631 if (SectionHandle)
632 {
633 /* Initialize the address space */
635 NULL,
637 &Flags,
638 &Process->
639 SeAuditProcessCreationInfo.
640 ImageFileName);
641 if (!NT_SUCCESS(Status)) goto CleanupWithRef;
642
643 //
644 // We need a PEB
645 //
646 NeedsPeb = TRUE;
647 }
648 else if (Parent)
649 {
650 /* Check if this is a child of the system process */
652 {
653 //
654 // We need a PEB
655 //
656 NeedsPeb = TRUE;
657
658 /* This is a clone! */
659 ASSERTMSG("No support for cloning yet\n", FALSE);
660 }
661 else
662 {
663 /* This is the initial system process */
664 Flags &= ~PROCESS_CREATE_FLAGS_LARGE_PAGES;
666 NULL,
667 NULL,
668 &Flags,
669 NULL);
670 if (!NT_SUCCESS(Status)) goto CleanupWithRef;
671
672 /* Create a dummy image file name */
673 Process->SeAuditProcessCreationInfo.ImageFileName =
676 TAG_SEPA);
677 if (!Process->SeAuditProcessCreationInfo.ImageFileName)
678 {
679 /* Fail */
681 goto CleanupWithRef;
682 }
683
684 /* Zero it out */
685 RtlZeroMemory(Process->SeAuditProcessCreationInfo.ImageFileName,
687 }
688 }
689
690#if MI_TRACE_PFNS
691 /* Copy the process name now that we have it */
692 memcpy(MiGetPfnEntry(Process->Pcb.DirectoryTableBase[0] >> PAGE_SHIFT)->ProcessName, Process->ImageFileName, 16);
693 if (Process->Pcb.DirectoryTableBase[1]) memcpy(MiGetPfnEntry(Process->Pcb.DirectoryTableBase[1] >> PAGE_SHIFT)->ProcessName, Process->ImageFileName, 16);
694 if (Process->WorkingSetPage) memcpy(MiGetPfnEntry(Process->WorkingSetPage)->ProcessName, Process->ImageFileName, 16);
695#endif
696
697 /* Check if we have a section object and map the system DLL */
699
700 /* Create a handle for the Process */
701 CidEntry.Object = Process;
702 CidEntry.GrantedAccess = 0;
703 Process->UniqueProcessId = ExCreateHandle(PspCidTable, &CidEntry);
704 if (!Process->UniqueProcessId)
705 {
706 /* Fail */
708 goto CleanupWithRef;
709 }
710
711 /* Set the handle table PID */
712 Process->ObjectTable->UniqueProcessId = Process->UniqueProcessId;
713
714 /* Check if we need to audit */
716
717 /*
718 * Attach the process to parent's job if:
719 * a) parent exists,
720 * b) parent has a job,
721 * c) parent's job does NOT allow silent breakaway.
722 */
723 if (Parent && Parent->Job &&
725 {
726 PEJOB ParentJob = Parent->Job;
727
728 /* If caller explicitly requested breakaway from the job */
730 {
731 /* Deny if the job forbids breakaway */
733 {
735 goto CleanupWithRef;
736 }
737 }
738 else
739 {
740 /* Under normal conditions, child should join a parent's job */
742 if (!NT_SUCCESS(Status))
743 {
744 goto CleanupWithRef;
745 }
746 }
747 }
748
749 /* Create PEB only for User-Mode Processes */
750 if ((Parent) && (NeedsPeb))
751 {
752 //
753 // Set up the initial PEB
754 //
755 RtlZeroMemory(&InitialPeb, sizeof(INITIAL_PEB));
756 InitialPeb.Mutant = (HANDLE)-1;
757 InitialPeb.ImageUsesLargePages = 0; // FIXME: Not yet supported
758
759 //
760 // Create it only if we have an image section
761 //
762 if (SectionHandle)
763 {
764 //
765 // Create it
766 //
767 Status = MmCreatePeb(Process, &InitialPeb, &Process->Peb);
768 if (!NT_SUCCESS(Status)) goto CleanupWithRef;
769 }
770 else
771 {
772 //
773 // We have to clone it
774 //
775 ASSERTMSG("No support for cloning yet\n", FALSE);
776 }
777
778 }
779
780 /* The process can now be activated */
782 InsertTailList(&PsActiveProcessHead, &Process->ActiveProcessLinks);
784
785 /* Create an access state */
786 Status = SeCreateAccessStateEx(CurrentThread,
787 ((Parent) &&
789 Parent : CurrentProcess,
790 &LocalAccessState,
791 &AuxData,
794 if (!NT_SUCCESS(Status)) goto CleanupWithRef;
795
796 /* Insert the Process into the Object Directory */
800 1,
801 NULL,
802 &hProcess);
803
804 /* Free the access state */
806
807 /* Cleanup on failure */
808 if (!NT_SUCCESS(Status)) goto Cleanup;
809
810 /* Compute Quantum and Priority */
811 ASSERT(IsListEmpty(&Process->ThreadListHead) == TRUE);
812 Process->Pcb.BasePriority =
815 &Quantum);
816 Process->Pcb.QuantumReset = Quantum;
817
818 /* Check if we have a parent other then the initial system process */
819 Process->GrantedAccess = PROCESS_TERMINATE;
821 {
822 /* Get the process's SD */
825 &SdAllocated);
826 if (!NT_SUCCESS(Status))
827 {
828 /* We failed, close the handle and clean up */
830 goto CleanupWithRef;
831 }
832
833 /* Create the subject context */
834 SubjectContext.ProcessAuditId = Process;
836 SubjectContext.ClientToken = NULL;
837
838 /* Do the access check */
841 FALSE,
843 0,
844 NULL,
847 &Process->GrantedAccess,
848 &AccessStatus);
849
850 /* Dereference the token and let go the SD */
852 SubjectContext.PrimaryToken);
854
855 /* Remove access if it failed */
856 if (!Result) Process->GrantedAccess = 0;
857
858 /* Give the process some basic access */
859 Process->GrantedAccess |= (PROCESS_VM_OPERATION |
870 }
871 else
872 {
873 /* Set full granted access */
874 Process->GrantedAccess = PROCESS_ALL_ACCESS;
875 }
876
877 /* Set the Creation Time */
878 KeQuerySystemTime(&Process->CreateTime);
879
880 /* Protect against bad user-mode pointer */
882 {
883 /* Hacky way of returning the PEB to the user-mode creator */
884 if ((Process->Peb) && (CurrentThread->Tcb.Teb))
885 {
886 CurrentThread->Tcb.Teb->NtTib.ArbitraryUserPointer = Process->Peb;
887 }
888
889 /* Save the process handle */
891 }
893 {
894 /* Get the exception code */
896 }
897 _SEH2_END;
898
899 /* Run the Notification Routines */
901
902 /* If 12 processes have been created, enough of user-mode is ready */
903 if (++ProcessCount == 12) Ki386PerfEnd();
904
905CleanupWithRef:
906 /*
907 * Dereference the process. For failures, kills the process and does
908 * cleanup present in PspDeleteProcess. For success, kills the extra
909 * reference added by ObInsertObject.
910 */
912
913Cleanup:
914 /* Dereference the parent */
916
917 /* Return status to caller */
918 return Status;
919}
920
921/* PUBLIC FUNCTIONS **********************************************************/
922
923/*
924 * @implemented
925 */
927NTAPI
931{
932 /* Call the internal API */
936 NULL,
937 0,
938 NULL,
939 NULL,
940 NULL,
941 FALSE);
942}
943
944/*
945 * @implemented
946 */
948NTAPI
951{
952 PHANDLE_TABLE_ENTRY CidEntry;
953 PEPROCESS FoundProcess;
955 PAGED_CODE();
956 PSTRACE(PS_PROCESS_DEBUG, "ProcessId: %p\n", ProcessId);
958
959 /* Get the CID Handle Entry */
961 if (CidEntry)
962 {
963 /* Get the Process */
964 FoundProcess = CidEntry->Object;
965
966 /* Make sure it's really a process */
967 if (FoundProcess->Pcb.Header.Type == ProcessObject)
968 {
969 /* Safe Reference and return it */
970 if (ObReferenceObjectSafe(FoundProcess))
971 {
972 *Process = FoundProcess;
974 }
975 }
976
977 /* Unlock the Entry */
979 }
980
981 /* Return to caller */
983 return Status;
984}
985
986/*
987 * @implemented
988 */
990NTAPI
994{
995 PHANDLE_TABLE_ENTRY CidEntry;
996 PETHREAD FoundThread;
998 PAGED_CODE();
999 PSTRACE(PS_PROCESS_DEBUG, "Cid: %p\n", Cid);
1001
1002 /* Get the CID Handle Entry */
1003 CidEntry = ExMapHandleToPointer(PspCidTable, Cid->UniqueThread);
1004 if (CidEntry)
1005 {
1006 /* Get the Process */
1007 FoundThread = CidEntry->Object;
1008
1009 /* Make sure it's really a thread and this process' */
1010 if ((FoundThread->Tcb.Header.Type == ThreadObject) &&
1011 (FoundThread->Cid.UniqueProcess == Cid->UniqueProcess))
1012 {
1013 /* Safe Reference and return it */
1014 if (ObReferenceObjectSafe(FoundThread))
1015 {
1016 *Thread = FoundThread;
1018
1019 /* Check if we should return the Process too */
1020 if (Process)
1021 {
1022 /* Return it and reference it */
1023 *Process = FoundThread->ThreadsProcess;
1025 }
1026 }
1027 }
1028
1029 /* Unlock the Entry */
1031 }
1032
1033 /* Return to caller */
1035 return Status;
1036}
1037
1038/*
1039 * @implemented
1040 */
1042NTAPI
1044{
1045 return PsGetCurrentProcess()->ExitTime;
1046}
1047
1048/*
1049 * @implemented
1050 */
1052NTAPI
1054{
1055 return Process->CreateTime.QuadPart;
1056}
1057
1058/*
1059 * @implemented
1060 */
1061PVOID
1062NTAPI
1064{
1065 return Process->DebugPort;
1066}
1067
1068/*
1069 * @implemented
1070 */
1071BOOLEAN
1072NTAPI
1074{
1075 return (BOOLEAN)Process->ProcessExiting;
1076}
1077
1078/*
1079 * @implemented
1080 */
1082NTAPI
1084{
1085 return Process->ExitStatus;
1086}
1087
1088/*
1089 * @implemented
1090 */
1091HANDLE
1092NTAPI
1094{
1095 return (HANDLE)Process->UniqueProcessId;
1096}
1097
1098/*
1099 * @implemented
1100 */
1101LPSTR
1102NTAPI
1104{
1105 return (LPSTR)Process->ImageFileName;
1106}
1107
1108/*
1109 * @implemented
1110 */
1111HANDLE
1112NTAPI
1114{
1115 return Process->InheritedFromUniqueProcessId;
1116}
1117
1118/*
1119 * @implemented
1120 */
1121PEJOB
1122NTAPI
1124{
1125 return Process->Job;
1126}
1127
1128/*
1129 * @implemented
1130 */
1131PPEB
1132NTAPI
1134{
1135 return Process->Peb;
1136}
1137
1138/*
1139 * @implemented
1140 */
1141ULONG
1142NTAPI
1144{
1145 return Process->PriorityClass;
1146}
1147
1148/*
1149 * @implemented
1150 */
1151HANDLE
1152NTAPI
1154{
1155 return (HANDLE)PsGetCurrentProcess()->UniqueProcessId;
1156}
1157
1158/*
1159 * @implemented
1160 */
1161ULONG
1162NTAPI
1164{
1166}
1167
1168/*
1169 * @implemented
1170 */
1171PVOID
1172NTAPI
1174{
1175 return Process->SectionBaseAddress;
1176}
1177
1178/*
1179 * @implemented
1180 */
1181PVOID
1182NTAPI
1184{
1185 return Process->SecurityPort;
1186}
1187
1188/*
1189 * @implemented
1190 */
1191ULONG
1192NTAPI
1194{
1195 return MmGetSessionId(Process);
1196}
1197
1198/*
1199 * @implemented
1200 */
1201ULONG
1202NTAPI
1204{
1205 return MmGetSessionIdEx(Process);
1206}
1207
1208/*
1209 * @implemented
1210 */
1211PVOID
1212NTAPI
1214{
1215 return PsGetCurrentProcess()->Win32Process;
1216}
1217
1218/*
1219 * @implemented
1220 */
1221PVOID
1222NTAPI
1224{
1225 return Process->Win32Process;
1226}
1227
1228/*
1229 * @implemented
1230 */
1231PVOID
1232NTAPI
1234{
1235 return Process->Win32WindowStation;
1236}
1237
1238/*
1239 * @implemented
1240 */
1241BOOLEAN
1242NTAPI
1244{
1245 return Process->DebugPort != NULL;
1246}
1247
1248/*
1249 * @implemented
1250 */
1251BOOLEAN
1252NTAPI
1254{
1255 /* Return if this is the System Process */
1257}
1258
1259/*
1260 * @implemented
1261 */
1262VOID
1263NTAPI
1265 ULONG PriorityClass)
1266{
1267 Process->PriorityClass = (UCHAR)PriorityClass;
1268}
1269
1270/*
1271 * @implemented
1272 */
1274NTAPI
1276 PVOID SecurityPort)
1277{
1278 Process->SecurityPort = SecurityPort;
1279 return STATUS_SUCCESS;
1280}
1281
1282/*
1283 * @implemented
1284 */
1286NTAPI
1289 _In_opt_ PVOID Win32Process,
1290 _In_opt_ PVOID OldWin32Process)
1291{
1293
1294 /* Assume success */
1296
1297 /* Lock the process */
1299 ExAcquirePushLockExclusive(&Process->ProcessLock);
1300
1301 /* Check if we set a new win32 process */
1302 if (Win32Process != NULL)
1303 {
1304 /* Check if the process is in the right state */
1305 if (((Process->Flags & PSF_PROCESS_DELETE_BIT) == 0) &&
1306 (Process->Win32Process == NULL))
1307 {
1308 /* Set the new win32 process */
1309 Process->Win32Process = Win32Process;
1310 }
1311 else
1312 {
1313 /* Otherwise fail */
1315 }
1316 }
1317 else
1318 {
1319 /* Reset the win32 process, did the caller specify the correct old value? */
1320 if (Process->Win32Process == OldWin32Process)
1321 {
1322 /* Yes, so reset the win32 process to NULL */
1323 Process->Win32Process = NULL;
1324 }
1325 else
1326 {
1327 /* Otherwise fail */
1329 }
1330 }
1331
1332 /* Unlock the process */
1333 ExReleasePushLockExclusive(&Process->ProcessLock);
1335
1336 return Status;
1337}
1338
1339/*
1340 * @implemented
1341 */
1342VOID
1343NTAPI
1345 PVOID WindowStation)
1346{
1347 Process->Win32WindowStation = WindowStation;
1348}
1349
1350/*
1351 * @implemented
1352 */
1353VOID
1354NTAPI
1357{
1358 UCHAR Quantum;
1360 PSTRACE(PS_PROCESS_DEBUG, "Process: %p Type: %lx\n", Process, Type);
1361
1362 /* Compute quantum and priority */
1364
1365 /* Set them */
1367}
1368
1369/*
1370 * @implemented
1371 */
1373NTAPI
1377 IN HANDLE ParentProcess,
1378 IN ULONG Flags,
1379 IN HANDLE SectionHandle OPTIONAL,
1380 IN HANDLE DebugPort OPTIONAL,
1381 IN HANDLE ExceptionPort OPTIONAL,
1382 IN BOOLEAN InJob)
1383{
1386 PAGED_CODE();
1388 "ParentProcess: %p Flags: %lx\n", ParentProcess, Flags);
1389
1390 /* Check if we came from user mode */
1391 if (PreviousMode != KernelMode)
1392 {
1393 _SEH2_TRY
1394 {
1395 /* Probe process handle */
1397 }
1399 {
1400 /* Return the exception code */
1402 }
1403 _SEH2_END;
1404 }
1405
1406 /* Make sure there's a parent process */
1407 if (!ParentProcess)
1408 {
1409 /* Can't create System Processes like this */
1411 }
1412 else
1413 {
1414 /* Create a user Process */
1418 ParentProcess,
1419 Flags,
1420 SectionHandle,
1421 DebugPort,
1422 ExceptionPort,
1423 InJob);
1424 }
1425
1426 /* Return Status */
1427 return Status;
1428}
1429
1430/*
1431 * @implemented
1432 */
1434NTAPI
1438 IN HANDLE ParentProcess,
1439 IN BOOLEAN InheritObjectTable,
1440 IN HANDLE SectionHandle OPTIONAL,
1441 IN HANDLE DebugPort OPTIONAL,
1442 IN HANDLE ExceptionPort OPTIONAL)
1443{
1444 ULONG Flags = 0;
1446 "Parent: %p Attributes: %p\n", ParentProcess, ObjectAttributes);
1447
1448 /* Set new-style flags */
1449 if ((ULONG_PTR)SectionHandle & 1) Flags |= PROCESS_CREATE_FLAGS_BREAKAWAY;
1451 if (InheritObjectTable) Flags |= PROCESS_CREATE_FLAGS_INHERIT_HANDLES;
1452
1453 /* Call the new API */
1457 ParentProcess,
1458 Flags,
1459 SectionHandle,
1460 DebugPort,
1461 ExceptionPort,
1462 FALSE);
1463}
1464
1465/*
1466 * @implemented
1467 */
1469NTAPI
1474{
1476 CLIENT_ID SafeClientId;
1477 ULONG Attributes = 0;
1479 BOOLEAN HasObjectName = FALSE;
1484 AUX_ACCESS_DATA AuxData;
1485 PAGED_CODE();
1487 "ClientId: %p Attributes: %p\n", ClientId, ObjectAttributes);
1488
1489 /* Check if we were called from user mode */
1490 if (PreviousMode != KernelMode)
1491 {
1492 /* Enter SEH for probing */
1493 _SEH2_TRY
1494 {
1495 /* Probe the thread handle */
1497
1498 /* Check for a CID structure */
1499 if (ClientId)
1500 {
1501 /* Probe and capture it */
1502 ProbeForRead(ClientId, sizeof(CLIENT_ID), sizeof(ULONG));
1503 SafeClientId = *ClientId;
1504 ClientId = &SafeClientId;
1505 }
1506
1507 /*
1508 * Just probe the object attributes structure, don't capture it
1509 * completely. This is done later if necessary
1510 */
1512 sizeof(OBJECT_ATTRIBUTES),
1513 sizeof(ULONG));
1514 HasObjectName = (ObjectAttributes->ObjectName != NULL);
1515
1516 /* Validate user attributes */
1518 }
1520 {
1521 /* Return the exception code */
1523 }
1524 _SEH2_END;
1525 }
1526 else
1527 {
1528 /* Otherwise just get the data directly */
1529 HasObjectName = (ObjectAttributes->ObjectName != NULL);
1530
1531 /* Still have to sanitize attributes */
1533 }
1534
1535 /* Can't pass both, fail */
1536 if ((HasObjectName) && (ClientId)) return STATUS_INVALID_PARAMETER_MIX;
1537
1538 /* Create an access state */
1540 &AuxData,
1543 if (!NT_SUCCESS(Status)) return Status;
1544
1545 /* Check if this is a debugger */
1547 {
1548 /* Did he want full access? */
1549 if (AccessState.RemainingDesiredAccess & MAXIMUM_ALLOWED)
1550 {
1551 /* Give it to him */
1552 AccessState.PreviouslyGrantedAccess |= PROCESS_ALL_ACCESS;
1553 }
1554 else
1555 {
1556 /* Otherwise just give every other access he could want */
1557 AccessState.PreviouslyGrantedAccess |=
1558 AccessState.RemainingDesiredAccess;
1559 }
1560
1561 /* The caller desires nothing else now */
1562 AccessState.RemainingDesiredAccess = 0;
1563 }
1564
1565 /* Open by name if one was given */
1566 if (HasObjectName)
1567 {
1568 /* Open it */
1572 &AccessState,
1573 0,
1574 NULL,
1575 &hProcess);
1576
1577 /* Get rid of the access state */
1579 }
1580 else if (ClientId)
1581 {
1582 /* Open by Thread ID */
1584 {
1585 /* Get the Process */
1587 }
1588 else
1589 {
1590 /* Get the Process */
1592 &Process);
1593 }
1594
1595 /* Check if we didn't find anything */
1596 if (!NT_SUCCESS(Status))
1597 {
1598 /* Get rid of the access state and return */
1600 return Status;
1601 }
1602
1603 /* Open the Process Object */
1605 Attributes,
1606 &AccessState,
1607 0,
1610 &hProcess);
1611
1612 /* Delete the access state */
1614
1615 /* Dereference the thread if we used it */
1617
1618 /* Dereference the Process */
1620 }
1621 else
1622 {
1623 /* neither an object name nor a client id was passed */
1625 }
1626
1627 /* Check for success */
1628 if (NT_SUCCESS(Status))
1629 {
1630 /* Use SEH for write back */
1631 _SEH2_TRY
1632 {
1633 /* Write back the handle */
1635 }
1637 {
1638 /* Get the exception code */
1640 }
1641 _SEH2_END;
1642 }
1643
1644 /* Return status */
1645 return Status;
1646}
1647
1649ULONG64
1650PsQueryTotalCycleTimeProcess(
1653{
1654 ULONG64 CurrentCycleTime, TotalCycleTime;
1655 KIRQL OldIrql;
1656
1657 /* Raise IRQL, so we stay on the same processor */
1659
1660#ifdef CONFIG_SMP
1661 // FIXME should send an IPI to all processors running this process to update
1662 // their cycle times.
1663#endif
1664
1665 /* Get the current cycle time */
1666 CurrentCycleTime = KxQueryProcessorCycleTime();
1667
1668 /* Get the process' cycle time */
1669 TotalCycleTime = Process->CycleTime;
1670
1671 /* Check if this is the current process */
1673 {
1674 /* Add the additional cycle time from the current thread */
1675 TotalCycleTime += CurrentCycleTime - KeGetCurrentPrcb()->StartCycles;
1676 }
1677
1678 /* Lower IRQL */
1680
1681 /* Return the current cycle time as the time stamp */
1682 if (CycleTimeStamp)
1683 {
1684 *CycleTimeStamp = CurrentCycleTime;
1685 }
1686
1687 /* Return the total cycle time */
1688 return TotalCycleTime;
1689}
1690
1691/* EOF */
#define PAGED_CODE()
_In_ PVOID _In_ ULONG _Out_ PVOID _In_ ULONG _Inout_ PULONG _In_ KPROCESSOR_MODE PreviousMode
#define DbgkDebugObjectType
Definition: ObTypes.cpp:172
Type
Definition: Type.h:7
BOOLEAN NTAPI SeAccessCheck(_In_ PSECURITY_DESCRIPTOR SecurityDescriptor, _In_ PSECURITY_SUBJECT_CONTEXT SubjectSecurityContext, _In_ BOOLEAN SubjectContextLocked, _In_ ACCESS_MASK DesiredAccess, _In_ ACCESS_MASK PreviouslyGrantedAccess, _Out_ PPRIVILEGE_SET *Privileges, _In_ PGENERIC_MAPPING GenericMapping, _In_ KPROCESSOR_MODE AccessMode, _Out_ PACCESS_MASK GrantedAccess, _Out_ PNTSTATUS AccessStatus)
Determines whether security access rights can be given to an object depending on the security descrip...
Definition: accesschk.c:1994
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE Parent
Definition: acpixf.h:732
unsigned char BOOLEAN
Definition: actypes.h:127
LONG NTSTATUS
Definition: precomp.h:26
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
VOID NTAPI DbgkCopyProcessDebugPort(IN PEPROCESS Process, IN PEPROCESS Parent)
Definition: dbgkobj.c:276
#define DEBUG_OBJECT_ADD_REMOVE_PROCESS
Definition: dbgktypes.h:32
_In_ ULONG Attributes
Definition: dispmprt.h:1077
_In_ D3DDDI_VIDEO_PRESENT_TARGET_ID _In_ ULONG _In_ ULONG Flags
Definition: dispmprt.h:245
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
ULONG_PTR KAFFINITY
Definition: compat.h:85
LONG KPRIORITY
Definition: compat.h:803
static const WCHAR Cleanup[]
Definition: register.c:80
#define _IRQL_requires_max_(irql)
Definition: driverspecs.h:230
#define InsertTailList(ListHead, Entry)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define PsGetCurrentThread()
Definition: env_spec_w32.h:81
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
#define PAGE_SHIFT
Definition: env_spec_w32.h:45
#define KeQuerySystemTime(t)
Definition: env_spec_w32.h:570
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define PagedPool
Definition: env_spec_w32.h:308
#define ExReleaseRundownProtection
Definition: ex.h:139
#define ExGetPreviousMode
Definition: ex.h:143
#define ExInitializeRundownProtection
Definition: ex.h:140
FORCEINLINE VOID ExAcquirePushLockExclusive(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1039
FORCEINLINE VOID ExAcquirePushLockShared(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1108
FORCEINLINE VOID ExReleasePushLockShared(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1216
FORCEINLINE VOID ExReleasePushLockExclusive(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1255
#define ExAcquireRundownProtection
Definition: ex.h:138
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ProcessId
Definition: fatprocs.h:2712
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG IN OUT PLONG IN LONG Increment KeRaiseIrqlToDpcLevel
Definition: CrNtStubs.h:68
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
_Inout_ PLIST_ENTRY _In_ PVOID _In_ PSTRING _In_ BOOLEAN _In_ BOOLEAN _In_ ULONG _In_ PFLT_CALLBACK_DATA _In_opt_ PCHECK_FOR_TRAVERSE_ACCESS _In_opt_ PSECURITY_SUBJECT_CONTEXT SubjectContext
Definition: fltkernel.h:2246
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:223
_Must_inspect_result_ _Outptr_ PVOID * SectionObject
Definition: fsrtlfuncs.h:860
Status
Definition: gdiplustypes.h:24
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
VOID FASTCALL KeReleaseGuardedMutex(IN OUT PKGUARDED_MUTEX GuardedMutex)
Definition: gmutex.c:53
VOID FASTCALL KeAcquireGuardedMutex(IN PKGUARDED_MUTEX GuardedMutex)
Definition: gmutex.c:42
_In_ ULONG Mode
Definition: hubbusif.h:303
#define PROCESS_TERMINATE
Definition: pstypes.h:153
#define PROCESS_VM_READ
Definition: pstypes.h:157
#define PSF_PROCESS_DELETE_BIT
Definition: pstypes.h:302
#define PROCESS_CREATE_FLAGS_BREAKAWAY
Definition: pstypes.h:87
#define PROCESS_QUERY_INFORMATION
Definition: pstypes.h:162
#define PROCESS_PRIORITY_CLASS_IDLE
Definition: pstypes.h:103
#define PROCESS_VM_WRITE
Definition: pstypes.h:158
#define PROCESS_CREATE_FLAGS_INHERIT_HANDLES
Definition: pstypes.h:89
#define JOB_OBJECT_LIMIT_BREAKAWAY_OK
Definition: pstypes.h:219
#define PROCESS_CREATE_THREAD
Definition: pstypes.h:154
#define PSP_VARIABLE_QUANTUMS
Definition: pstypes.h:128
#define PROCESS_PRIORITY_CLASS_NORMAL
Definition: pstypes.h:104
#define PROCESS_PRIORITY_CLASS_ABOVE_NORMAL
Definition: pstypes.h:108
#define PSP_LONG_QUANTUMS
Definition: pstypes.h:130
#define PSF_NO_DEBUG_INHERIT_BIT
Definition: pstypes.h:300
enum _PSPROCESSPRIORITYMODE PSPROCESSPRIORITYMODE
#define PROCESS_VM_OPERATION
Definition: pstypes.h:156
#define PSP_FIXED_QUANTUMS
Definition: pstypes.h:129
@ PsProcessPrioritySpinning
Definition: pstypes.h:487
@ PsProcessPriorityForeground
Definition: pstypes.h:485
@ PsProcessPriorityBackground
Definition: pstypes.h:486
#define PROCESS_PRIORITY_CLASS_BELOW_NORMAL
Definition: pstypes.h:107
#define PROCESS_SET_INFORMATION
Definition: pstypes.h:161
#define PROCESS_PRIORITY_NORMAL
Definition: pstypes.h:114
#define PROCESS_CREATE_PROCESS
Definition: pstypes.h:159
#define PSF_HAS_ADDRESS_SPACE_BIT
Definition: pstypes.h:316
#define PROCESS_CREATE_FLAGS_LEGAL_MASK
Definition: pstypes.h:93
#define PROCESS_CREATE_FLAGS_NO_DEBUG_INHERIT
Definition: pstypes.h:88
#define JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK
Definition: pstypes.h:220
#define MEMORY_PRIORITY_BACKGROUND
Definition: pstypes.h:120
#define PSP_SHORT_QUANTUMS
Definition: pstypes.h:131
#define PROCESS_SET_QUOTA
Definition: pstypes.h:160
#define MEMORY_PRIORITY_FOREGROUND
Definition: pstypes.h:122
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
#define PROCESS_DUP_HANDLE
#define NOTHING
Definition: input_list.c:10
#define InterlockedOr
Definition: interlocked.h:239
#define KeLeaveCriticalRegion()
Definition: ke_x.h:119
#define KeEnterCriticalRegion()
Definition: ke_x.h:88
POBJECT_TYPE LpcPortObjectType
Definition: port.c:17
#define PORT_ALL_ACCESS
Definition: lpctypes.h:51
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:71
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
BOOLEAN NTAPI MmIsThisAnNtAsSystem(VOID)
Definition: mmsup.c:246
#define ASSERT(a)
Definition: mode.c:44
unsigned __int64 ULONG64
Definition: imports.h:198
unsigned __int64 * PULONG64
Definition: imports.h:198
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1197
#define KeGetPreviousMode()
Definition: ketypes.h:1115
#define KernelMode
Definition: asm.h:38
@ ProcessObject
Definition: ketypes.h:428
@ ThreadObject
Definition: ketypes.h:431
_In_ HANDLE ProcessHandle
Definition: mmfuncs.h:407
#define SEM_NOALIGNMENTFAULTEXCEPT
Definition: rtltypes.h:71
#define SEM_FAILCRITICALERRORS
Definition: rtltypes.h:69
#define _Inout_
Definition: no_sal2.h:162
#define _Out_
Definition: no_sal2.h:160
#define _In_opt_
Definition: no_sal2.h:212
#define SECTION_MAP_EXECUTE
Definition: nt_native.h:1293
#define ASSERTMSG(msg, exp)
Definition: nt_native.h:431
#define PROCESS_ALL_ACCESS
Definition: nt_native.h:1327
ULONG ACCESS_MASK
Definition: nt_native.h:40
#define STANDARD_RIGHTS_ALL
Definition: nt_native.h:69
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
HANDLE NTAPI ExCreateHandle(IN PHANDLE_TABLE HandleTable, IN PHANDLE_TABLE_ENTRY HandleTableEntry)
Definition: handle.c:827
PHANDLE_TABLE_ENTRY NTAPI ExMapHandleToPointer(IN PHANDLE_TABLE HandleTable, IN HANDLE Handle)
Definition: handle.c:1046
VOID NTAPI ExUnlockHandleTableEntry(IN PHANDLE_TABLE HandleTable, IN PHANDLE_TABLE_ENTRY HandleTableEntry)
Definition: handle.c:923
FORCEINLINE ULONG64 KxQueryProcessorCycleTime(VOID)
Definition: ke.h:209
#define Ki386PerfEnd()
Definition: ke.h:174
_Out_ PULONG64 CycleTimeStamp
Definition: ke.h:1091
KAFFINITY KeActiveProcessors
Definition: processor.c:16
VOID NTAPI KeSetQuantumProcess(IN PKPROCESS Process, IN UCHAR Quantum)
Definition: procobj.c:229
VOID NTAPI KeInitializeProcess(struct _KPROCESS *Process, KPRIORITY Priority, KAFFINITY Affinity, PULONG_PTR DirectoryTableBase, IN BOOLEAN Enable)
KPRIORITY NTAPI KeSetPriorityAndQuantumProcess(IN PKPROCESS Process, IN KPRIORITY Priority, IN UCHAR Quantum OPTIONAL)
Definition: procobj.c:349
NTSTATUS NTAPI MmInitializeHandBuiltProcess2(IN PEPROCESS Process)
Definition: procsup.c:1209
FORCEINLINE PMMPFN MiGetPfnEntry(IN PFN_NUMBER Pfn)
Definition: mm.h:1046
NTSTATUS NTAPI MmInitializeProcessAddressSpace(IN PEPROCESS Process, IN PEPROCESS Clone OPTIONAL, IN PVOID Section OPTIONAL, IN OUT PULONG Flags, IN POBJECT_NAME_INFORMATION *AuditName OPTIONAL)
ULONG NTAPI MmGetSessionId(IN PEPROCESS Process)
Definition: session.c:179
ULONG NTAPI MmGetSessionIdEx(IN PEPROCESS Process)
Definition: session.c:194
NTSTATUS NTAPI MmCreatePeb(IN PEPROCESS Process, IN PINITIAL_PEB InitialPeb, OUT PPEB *BasePeb)
Definition: procsup.c:574
NTSTATUS NTAPI MmInitializeHandBuiltProcess(IN PEPROCESS Process, IN PULONG_PTR DirectoryTableBase)
Definition: procsup.c:1183
NTSTATUS NTAPI MmSetMemoryPriorityProcess(IN PEPROCESS Process, IN UCHAR MemoryPriority)
Definition: procsup.c:543
BOOLEAN NTAPI MmCreateProcessAddressSpace(IN ULONG MinWs, IN PEPROCESS Dest, IN PULONG_PTR DirectoryTableBase)
Definition: page.c:136
const LUID SeDebugPrivilege
Definition: priv.c:39
NTSTATUS NTAPI SeCreateAccessStateEx(_In_ PETHREAD Thread, _In_ PEPROCESS Process, _In_ OUT PACCESS_STATE AccessState, _In_ PAUX_ACCESS_DATA AuxData, _In_ ACCESS_MASK Access, _In_ PGENERIC_MAPPING GenericMapping)
BOOLEAN NTAPI SeDetailedAuditingWithToken(_In_ PTOKEN Token)
Peforms a detailed security auditing with an access token.
Definition: audit.c:34
VOID NTAPI SeAuditProcessCreate(_In_ PEPROCESS Process)
Peforms a security auditing against a process that is about to be created.
Definition: audit.c:56
NTSTATUS NTAPI PsCreateSystemProcess(OUT PHANDLE ProcessHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: process.c:928
VOID NTAPI PsSetProcessPriorityClass(PEPROCESS Process, ULONG PriorityClass)
Definition: process.c:1264
HANDLE NTAPI PsGetProcessInheritedFromUniqueProcessId(PEPROCESS Process)
Definition: process.c:1113
BOOLEAN NTAPI PsIsSystemProcess(IN PEPROCESS Process)
Definition: process.c:1253
PVOID NTAPI PsGetProcessWin32Process(PEPROCESS Process)
Definition: process.c:1223
PPEB NTAPI PsGetProcessPeb(PEPROCESS Process)
Definition: process.c:1133
PEPROCESS NTAPI PsGetNextProcess(IN PEPROCESS OldProcess)
Definition: process.c:128
CHAR PspForegroundQuantum[3]
Definition: process.c:29
LPSTR NTAPI PsGetProcessImageFileName(PEPROCESS Process)
Definition: process.c:1103
NTSTATUS NTAPI PsSetProcessWin32Process(_Inout_ PEPROCESS Process, _In_opt_ PVOID Win32Process, _In_opt_ PVOID OldWin32Process)
Definition: process.c:1287
PVOID NTAPI PsGetProcessSecurityPort(PEPROCESS Process)
Definition: process.c:1183
ULONG NTAPI PsGetProcessPriorityClass(PEPROCESS Process)
Definition: process.c:1143
NTSTATUS NTAPI NtCreateProcess(OUT PHANDLE ProcessHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN HANDLE ParentProcess, IN BOOLEAN InheritObjectTable, IN HANDLE SectionHandle OPTIONAL, IN HANDLE DebugPort OPTIONAL, IN HANDLE ExceptionPort OPTIONAL)
Definition: process.c:1435
BOOLEAN NTAPI PsGetProcessExitProcessCalled(PEPROCESS Process)
Definition: process.c:1073
NTSTATUS NTAPI NtCreateProcessEx(OUT PHANDLE ProcessHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN HANDLE ParentProcess, IN ULONG Flags, IN HANDLE SectionHandle OPTIONAL, IN HANDLE DebugPort OPTIONAL, IN HANDLE ExceptionPort OPTIONAL, IN BOOLEAN InJob)
Definition: process.c:1374
POBJECT_TYPE PsProcessType
Definition: process.c:20
KPRIORITY NTAPI PspComputeQuantumAndPriority(IN PEPROCESS Process, IN PSPROCESSPRIORITYMODE Mode, OUT PUCHAR Quantum)
Definition: process.c:174
NTSTATUS NTAPI PsLookupProcessThreadByCid(IN PCLIENT_ID Cid, OUT PEPROCESS *Process OPTIONAL, OUT PETHREAD *Thread)
Definition: process.c:991
ULONG PsMaximumWorkingSet
Definition: process.c:18
BOOLEAN NTAPI PsIsProcessBeingDebugged(PEPROCESS Process)
Definition: process.c:1243
ULONG NTAPI PsGetProcessSessionId(IN PEPROCESS Process)
Definition: process.c:1193
ULONG NTAPI PsGetProcessSessionIdEx(IN PEPROCESS Process)
Definition: process.c:1203
NTSTATUS NTAPI PsLookupProcessByProcessId(IN HANDLE ProcessId, OUT PEPROCESS *Process)
Definition: process.c:949
NTSTATUS NTAPI PspCreateProcess(OUT PHANDLE ProcessHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN HANDLE ParentProcess OPTIONAL, IN ULONG Flags, IN HANDLE SectionHandle OPTIONAL, IN HANDLE DebugPort OPTIONAL, IN HANDLE ExceptionPort OPTIONAL, IN BOOLEAN InJob)
Definition: process.c:347
ULONG PsMinimumWorkingSet
Definition: psmgr.c:54
PETHREAD NTAPI PsGetNextProcessThread(IN PEPROCESS Process, IN PETHREAD Thread OPTIONAL)
Definition: process.c:75
NTSTATUS NTAPI PsSetProcessSecurityPort(PEPROCESS Process, PVOID SecurityPort)
Definition: process.c:1275
LIST_ENTRY PsActiveProcessHead
Definition: process.c:22
PEJOB NTAPI PsGetProcessJob(PEPROCESS Process)
Definition: process.c:1123
VOID NTAPI PsSetProcessWindowStation(PEPROCESS Process, PVOID WindowStation)
Definition: process.c:1344
ULONG PsPrioritySeparation
Definition: process.c:28
VOID NTAPI PsChangeQuantumTable(IN BOOLEAN Immediate, IN ULONG PrioritySeparation)
Definition: process.c:235
NTSTATUS NTAPI PsGetProcessExitStatus(PEPROCESS Process)
Definition: process.c:1083
CHAR PspFixedQuantums[6]
Definition: process.c:32
LONGLONG NTAPI PsGetProcessCreateTimeQuadPart(PEPROCESS Process)
Definition: process.c:1053
CHAR PspVariableQuantums[6]
Definition: process.c:46
PVOID NTAPI PsGetCurrentProcessWin32Process(VOID)
Definition: process.c:1213
HANDLE NTAPI PsGetCurrentProcessId(VOID)
Definition: process.c:1153
ULONG PsRawPrioritySeparation
Definition: process.c:27
LARGE_INTEGER ShortPsLockDelay
Definition: process.c:25
VOID NTAPI PsSetProcessPriorityByClass(IN PEPROCESS Process, IN PSPROCESSPRIORITYMODE Type)
Definition: process.c:1355
HANDLE NTAPI PsGetProcessId(PEPROCESS Process)
Definition: process.c:1093
PVOID NTAPI PsGetProcessDebugPort(PEPROCESS Process)
Definition: process.c:1063
PVOID NTAPI PsGetProcessSectionBaseAddress(PEPROCESS Process)
Definition: process.c:1173
KPRIORITY PspPriorityTable[PROCESS_PRIORITY_CLASS_ABOVE_NORMAL+1]
Definition: process.c:60
PVOID NTAPI PsGetProcessWin32WindowStation(PEPROCESS Process)
Definition: process.c:1233
KGUARDED_MUTEX PspActiveProcessMutex
Definition: process.c:23
ULONG NTAPI PsGetCurrentProcessSessionId(VOID)
Definition: process.c:1163
NTSTATUS NTAPI NtOpenProcess(OUT PHANDLE ProcessHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN PCLIENT_ID ClientId)
Definition: process.c:1470
LARGE_INTEGER NTAPI PsGetProcessExitTime(VOID)
Definition: process.c:1043
PACCESS_TOKEN NTAPI PsReferencePrimaryToken(PEPROCESS Process)
Definition: security.c:440
VOID NTAPI SeDeleteAccessState(_In_ PACCESS_STATE AccessState)
Deletes an allocated access state from the memory.
Definition: access.c:150
NTSTATUS NTAPI SeCreateAccessState(_Out_ PACCESS_STATE AccessState, _Out_ __drv_aliasesMem PAUX_ACCESS_DATA AuxData, _In_ ACCESS_MASK Access, _In_ PGENERIC_MAPPING GenericMapping)
Creates an access state.
Definition: access.c:121
BOOLEAN NTAPI SeSinglePrivilegeCheck(_In_ LUID PrivilegeValue, _In_ KPROCESSOR_MODE PreviousMode)
Checks if a single privilege is present in the context of the calling thread.
Definition: priv.c:744
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:455
#define STATUS_INVALID_CID
Definition: ntstatus.h:341
#define STATUS_INVALID_PARAMETER_MIX
Definition: ntstatus.h:378
#define STATUS_PROCESS_IS_TERMINATING
Definition: ntstatus.h:596
VOID NTAPI ObInheritDeviceMap(IN PEPROCESS Parent, IN PEPROCESS Process)
Definition: devicemap.c:511
BOOLEAN FASTCALL ObReferenceObjectSafe(IN PVOID Object)
Definition: obref.c:22
VOID FASTCALL ObFastDereferenceObject(IN PEX_FAST_REF FastRef, IN PVOID Object)
Definition: obref.c:167
NTSTATUS NTAPI ObInitProcess(IN PEPROCESS Parent OPTIONAL, IN PEPROCESS Process)
Definition: obhandle.c:2112
FORCEINLINE ULONG ObpValidateAttributes(IN ULONG Attributes, IN KPROCESSOR_MODE PreviousMode)
Definition: ob_x.h:22
NTSTATUS NTAPI ObCloseHandle(IN HANDLE Handle, IN KPROCESSOR_MODE AccessMode)
Definition: obhandle.c:3406
NTSTATUS NTAPI ObInsertObject(IN PVOID Object, IN PACCESS_STATE AccessState OPTIONAL, IN ACCESS_MASK DesiredAccess, IN ULONG ObjectPointerBias, OUT PVOID *NewObject OPTIONAL, OUT PHANDLE Handle)
Definition: obhandle.c:2957
NTSTATUS NTAPI ObOpenObjectByPointer(IN PVOID Object, IN ULONG HandleAttributes, IN PACCESS_STATE PassedAccessState, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PHANDLE Handle)
Definition: obhandle.c:2764
NTSTATUS NTAPI ObOpenObjectByName(IN POBJECT_ATTRIBUTES ObjectAttributes, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, IN PACCESS_STATE PassedAccessState, IN ACCESS_MASK DesiredAccess, IN OUT PVOID ParseContext, OUT PHANDLE Handle)
Definition: obhandle.c:2554
NTSTATUS NTAPI ObCreateObject(IN KPROCESSOR_MODE ProbeMode OPTIONAL, IN POBJECT_TYPE Type, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN KPROCESSOR_MODE AccessMode, IN OUT PVOID ParseContext OPTIONAL, IN ULONG ObjectSize, IN ULONG PagedPoolCharge OPTIONAL, IN ULONG NonPagedPoolCharge OPTIONAL, OUT PVOID *Object)
Definition: oblife.c:1040
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
Definition: obref.c:493
NTSTATUS NTAPI ObGetObjectSecurity(IN PVOID Object, OUT PSECURITY_DESCRIPTOR *SecurityDescriptor, OUT PBOOLEAN MemoryAllocated)
Definition: obsecure.c:612
VOID NTAPI ObReleaseObjectSecurity(IN PSECURITY_DESCRIPTOR SecurityDescriptor, IN BOOLEAN MemoryAllocated)
Definition: obsecure.c:712
char CHAR
Definition: pedump.c:57
ULONG ProcessCount
Definition: perfdata.c:22
NTSTATUS NTAPI PspAssignProcessToJob(_In_ PEPROCESS Process, _In_ PEJOB Job)
Definition: job.c:432
#define PSTRACE(x, fmt,...)
Definition: ps.h:57
NTSTATUS NTAPI PspInitializeProcessSecurity(IN PEPROCESS Process, IN PEPROCESS Parent OPTIONAL)
Definition: security.c:71
PHANDLE_TABLE PspCidTable
Definition: psmgr.c:48
#define PS_PROCESS_DEBUG
Definition: ps.h:18
BOOLEAN PspUseJobSchedulingClasses
Definition: job.c:28
CHAR PspJobSchedulingClasses[PSP_JOB_SCHEDULING_CLASSES]
Definition: job.c:30
NTSTATUS NTAPI PspMapSystemDll(IN PEPROCESS Process, OUT PVOID *DllBase, IN BOOLEAN UseLargePages)
VOID NTAPI PspInheritQuota(_In_ PEPROCESS Process, _In_ PEPROCESS ParentProcess)
#define PspPrioritySeparationFromMask(Mask)
Definition: ps_x.h:13
FORCEINLINE VOID PspRunCreateProcessNotifyRoutines(IN PEPROCESS CurrentProcess, IN BOOLEAN Create)
Definition: ps_x.h:62
#define PspQuantumTypeFromMask(Mask)
Definition: ps_x.h:16
#define PspQuantumLengthFromMask(Mask)
Definition: ps_x.h:19
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:204
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:104
#define _SEH2_END
Definition: pseh2_64.h:194
#define _SEH2_TRY
Definition: pseh2_64.h:93
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:207
PEPROCESS PsInitialSystemProcess
Definition: psmgr.c:50
#define ProbeForWriteHandle(Ptr)
Definition: probe.h:43
POBJECT_TYPE MmSectionObjectType
Definition: section.c:196
Entry
Definition: section.c:5216
#define STATUS_SUCCESS
Definition: shellext.h:65
signed char SCHAR
Definition: sqltypes.h:14
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
HANDLE UniqueThread
Definition: compat.h:826
HANDLE UniqueProcess
Definition: compat.h:825
ULONG LimitFlags
Definition: pstypes.h:1633
KPROCESS Pcb
Definition: pstypes.h:1399
PHANDLE_TABLE ObjectTable
Definition: pstypes.h:1423
KTHREAD Tcb
Definition: pstypes.h:1228
CLIENT_ID Cid
Definition: pstypes.h:1253
LIST_ENTRY ThreadListEntry
Definition: pstypes.h:1283
Definition: extypes.h:767
PVOID Object
Definition: extypes.h:770
ULONG GrantedAccess
Definition: extypes.h:777
BOOLEAN ImageUsesLargePages
Definition: pstypes.h:734
HANDLE Mutant
Definition: pstypes.h:747
DISPATCHER_HEADER Header
Definition: ketypes.h:2231
PVOID Teb
Definition: ketypes.h:1954
DISPATCHER_HEADER Header
Definition: ketypes.h:1808
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
GENERIC_MAPPING GenericMapping
Definition: obtypes.h:379
OBJECT_TYPE_INITIALIZER TypeInfo
Definition: obtypes.h:411
#define TAG_SEPA
Definition: tag.h:158
#define STATUS_PENDING
Definition: telnetd.h:14
unsigned char UCHAR
Definition: typedefs.h:53
int64_t LONGLONG
Definition: typedefs.h:68
#define NTAPI
Definition: typedefs.h:36
PVOID HANDLE
Definition: typedefs.h:73
char * LPSTR
Definition: typedefs.h:51
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
int32_t * PLONG
Definition: typedefs.h:58
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
char * PCHAR
Definition: typedefs.h:51
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
LONGLONG QuadPart
Definition: typedefs.h:114
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK DesiredAccess
Definition: wdfdevice.h:2664
_In_ WDFINTERRUPT _In_ WDF_INTERRUPT_POLICY _In_ WDF_INTERRUPT_PRIORITY Priority
Definition: wdfinterrupt.h:655
_In_ USHORT _In_ ULONG _In_ PSOCKADDR _In_ PSOCKADDR _Reserved_ ULONG _In_opt_ PVOID _In_opt_ const WSK_CLIENT_CONNECTION_DISPATCH _In_opt_ PEPROCESS _In_opt_ PETHREAD _In_opt_ PSECURITY_DESCRIPTOR SecurityDescriptor
Definition: wsk.h:191
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409
_In_ ULONG _In_ ULONG _In_ ULONG _Out_ PKIRQL _Out_ PKAFFINITY Affinity
Definition: halfuncs.h:174
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:778
_Out_ PCLIENT_ID ClientId
Definition: kefuncs.h:1151
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
#define ObDereferenceObject
Definition: obfuncs.h:203
#define ObReferenceObject
Definition: obfuncs.h:204
#define PsGetCurrentProcess
Definition: psfuncs.h:17
_In_ PSECURITY_SUBJECT_CONTEXT _In_ BOOLEAN _In_ ACCESS_MASK _In_ ACCESS_MASK _Outptr_opt_ PPRIVILEGE_SET _In_ PGENERIC_MAPPING _In_ KPROCESSOR_MODE _Out_ PACCESS_MASK _Out_ PNTSTATUS AccessStatus
Definition: sefuncs.h:21
_In_opt_ PVOID _In_opt_ PUNICODE_STRING _In_ PSECURITY_DESCRIPTOR _In_ PACCESS_STATE AccessState
Definition: sefuncs.h:417