ReactOS 0.4.17-dev-1190-g4c812f4
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
126static
128NTAPI
130{
132 PEPROCESS FoundProcess = NULL;
133 PAGED_CODE();
134 PSTRACE(PS_PROCESS_DEBUG, "Process: %p\n", OldProcess);
135
136 /* Acquire the Active Process Lock */
138
139 /* Check if we're already starting somewhere */
140 if (OldProcess)
141 {
142 /* Start where we left off and move to the next/previous process */
143 Entry = Reverse ? OldProcess->ActiveProcessLinks.Blink :
144 OldProcess->ActiveProcessLinks.Flink;
145 }
146 else
147 {
148 /* Start at the beginning (or end) */
149 Entry = Reverse ? PsActiveProcessHead.Blink :
151 }
152
153 /* Loop the process list */
154 while (Entry != &PsActiveProcessHead)
155 {
156 /* Get the process */
157 FoundProcess = CONTAINING_RECORD(Entry, EPROCESS, ActiveProcessLinks);
158
159 /* Reference the process */
160 if (ObReferenceObjectSafe(FoundProcess)) break;
161
162 /* Nothing found, keep trying */
163 FoundProcess = NULL;
164 Entry = Reverse ? Entry->Blink : Entry->Flink;
165 }
166
167 /* Release the lock */
169
170 /* Dereference the Process we had referenced earlier */
171 if (OldProcess) ObDereferenceObject(OldProcess);
172 return FoundProcess;
173}
174
176NTAPI
178{
179 return PsGetNextProcessEx(OldProcess, FALSE);
180}
181
183NTAPI
186 OUT PUCHAR Quantum)
187{
188 ULONG i;
189 UCHAR LocalQuantum, MemoryPriority;
190 PAGED_CODE();
191 PSTRACE(PS_PROCESS_DEBUG, "Process: %p Mode: %lx\n", Process, Mode);
192
193 /* Check if this is a foreground process */
195 {
196 /* Set the memory priority and use priority separation */
197 MemoryPriority = MEMORY_PRIORITY_FOREGROUND;
199 }
200 else
201 {
202 /* Set the background memory priority and no separation */
203 MemoryPriority = MEMORY_PRIORITY_BACKGROUND;
204 i = 0;
205 }
206
207 /* Make sure that the process mode isn't spinning */
209 {
210 /* Set the priority */
211 MmSetMemoryPriorityProcess(Process, MemoryPriority);
212 }
213
214 /* Make sure that the process isn't idle */
215 if (Process->PriorityClass != PROCESS_PRIORITY_CLASS_IDLE)
216 {
217 /* Does the process have a job? */
218 if ((Process->Job) && (PspUseJobSchedulingClasses))
219 {
220 /* Use job quantum */
221 LocalQuantum = PspJobSchedulingClasses[Process->Job->
222 SchedulingClass];
223 }
224 else
225 {
226 /* Use calculated quantum */
227 LocalQuantum = PspForegroundQuantum[i];
228 }
229 }
230 else
231 {
232 /* Process is idle, use default quantum */
233 LocalQuantum = 6;
234 }
235
236 /* Return quantum to caller */
237 *Quantum = LocalQuantum;
238
239 /* Return priority */
240 return PspPriorityTable[Process->PriorityClass];
241}
242
243VOID
244NTAPI
246 IN ULONG PrioritySeparation)
247{
249 ULONG i;
250 UCHAR Quantum;
251 PCHAR QuantumTable;
252 PAGED_CODE();
254 "%lx PrioritySeparation: %lx\n", Immediate, PrioritySeparation);
255
256 /* Write the current priority separation */
258
259 /* Normalize it if it was too high */
261
262 /* Get the quantum table to use */
263 if (PspQuantumTypeFromMask(PrioritySeparation) == PSP_VARIABLE_QUANTUMS)
264 {
265 /* Use a variable table */
266 QuantumTable = PspVariableQuantums;
267 }
268 else if (PspQuantumTypeFromMask(PrioritySeparation) == PSP_FIXED_QUANTUMS)
269 {
270 /* Use fixed table */
271 QuantumTable = PspFixedQuantums;
272 }
273 else
274 {
275 /* Use default for the type of system we're on */
277 }
278
279 /* Now check if we should use long or short */
280 if (PspQuantumLengthFromMask(PrioritySeparation) == PSP_LONG_QUANTUMS)
281 {
282 /* Use long quantums */
283 QuantumTable += 3;
284 }
285 else if (PspQuantumLengthFromMask(PrioritySeparation) == PSP_SHORT_QUANTUMS)
286 {
287 /* Keep existing table */
288 NOTHING;
289 }
290 else
291 {
292 /* Use default for the type of system we're on */
293 QuantumTable += MmIsThisAnNtAsSystem() ? 3 : 0;
294 }
295
296 /* Check if we're using long fixed quantums */
297 if (QuantumTable == &PspFixedQuantums[3])
298 {
299 /* Use Job scheduling classes */
301 }
302 else
303 {
304 /* Otherwise, we don't */
306 }
307
308 /* Copy the selected table into the Foreground Quantum table */
310 QuantumTable,
311 sizeof(PspForegroundQuantum));
312
313 /* Check if we should apply these changes real-time */
314 if (Immediate)
315 {
316 /* We are...loop every process */
318 while (Process)
319 {
320 /* Use the priority separation if this is a foreground process */
321 i = (Process->Vm.Flags.MemoryPriority ==
324
325 /* Make sure that the process isn't idle */
326 if (Process->PriorityClass != PROCESS_PRIORITY_CLASS_IDLE)
327 {
328 /* Does the process have a job? */
329 if ((Process->Job) && (PspUseJobSchedulingClasses))
330 {
331 /* Use job quantum */
332 Quantum = PspJobSchedulingClasses[Process->Job->SchedulingClass];
333 }
334 else
335 {
336 /* Use calculated quantum */
337 Quantum = PspForegroundQuantum[i];
338 }
339 }
340 else
341 {
342 /* Process is idle, use default quantum */
343 Quantum = 6;
344 }
345
346 /* Now set the quantum */
347 KeSetQuantumProcess(&Process->Pcb, Quantum);
348
349 /* Get the next process */
351 }
352 }
353}
354
356NTAPI
360 IN HANDLE ParentProcess OPTIONAL,
361 IN ULONG Flags,
362 IN HANDLE SectionHandle OPTIONAL,
363 IN HANDLE DebugPort OPTIONAL,
364 IN HANDLE ExceptionPort OPTIONAL,
365 IN BOOLEAN InJob)
366{
369 PVOID ExceptionPortObject;
370 PDEBUG_OBJECT DebugObject;
373 ULONG_PTR DirectoryTableBase[2] = {0,0};
375 HANDLE_TABLE_ENTRY CidEntry;
376 PETHREAD CurrentThread = PsGetCurrentThread();
378 PEPROCESS CurrentProcess = PsGetCurrentProcess();
379 ULONG MinWs, MaxWs;
380 ACCESS_STATE LocalAccessState;
381 PACCESS_STATE AccessState = &LocalAccessState;
382 AUX_ACCESS_DATA AuxData;
383 UCHAR Quantum;
384 BOOLEAN Result, SdAllocated;
387 BOOLEAN NeedsPeb = FALSE;
388 INITIAL_PEB InitialPeb;
389
390 PAGED_CODE();
391
393 "ProcessHandle: %p Parent: %p\n", ProcessHandle, ParentProcess);
394
395 /* Validate flags */
397
398 /* Check for parent */
399 if (ParentProcess)
400 {
401 /* Reference it */
402 Status = ObReferenceObjectByHandle(ParentProcess,
406 (PVOID*)&Parent,
407 NULL);
408 if (!NT_SUCCESS(Status)) return Status;
409
410 /* If this process should be in a job but the parent isn't */
411 if ((InJob) && (!Parent->Job))
412 {
413 /* This is illegal. Dereference the parent and fail */
416 }
417
418 /* Inherit Parent process's Affinity. */
419 Affinity = Parent->Pcb.Affinity;
420 }
421 else
422 {
423 /* We have no parent */
424 Parent = NULL;
426 }
427
428 /* Save working set data */
429 MinWs = PsMinimumWorkingSet;
430 MaxWs = PsMaximumWorkingSet;
431
432 /* Create the Object */
437 NULL,
438 sizeof(EPROCESS),
439 0,
440 0,
441 (PVOID*)&Process);
442 if (!NT_SUCCESS(Status)) goto Cleanup;
443
444 /* Clean up the Object */
446
447 /* Initialize pushlock and rundown protection */
448 ExInitializeRundownProtection(&Process->RundownProtect);
449 Process->ProcessLock.Value = 0;
450
451 /* Setup the Thread List Head */
452 InitializeListHead(&Process->ThreadListHead);
453
454 /* Initialize the job process list entry */
455 InitializeListHead(&Process->JobLinks);
456
457 /* Set up the Quota Block from the Parent */
459
460 /* Set up Dos Device Map from the Parent */
462
463 /* Check if we have a parent */
464 if (Parent)
465 {
466 /* Inherit PID and hard-error processing */
467 Process->InheritedFromUniqueProcessId = Parent->UniqueProcessId;
468 Process->DefaultHardErrorProcessing = Parent->DefaultHardErrorProcessing;
469 }
470 else
471 {
472 /* Use default hard-error processing */
473 Process->DefaultHardErrorProcessing = SEM_FAILCRITICALERRORS;
474 }
475
476 /* Check for a section handle */
477 if (SectionHandle)
478 {
479 /* Get a pointer to it */
480 Status = ObReferenceObjectByHandle(SectionHandle,
485 NULL);
486 if (!NT_SUCCESS(Status)) goto CleanupWithRef;
487 }
488 else
489 {
490 /* Assume no section object */
492
493 /* Is the parent the initial process?
494 * Check for NULL also, as at initialization PsInitialSystemProcess is NULL */
496 {
497 /* It's not, so acquire the process rundown */
498 if (ExAcquireRundownProtection(&Parent->RundownProtect))
499 {
500 /* If the parent has a section, use it */
501 SectionObject = Parent->SectionObject;
503
504 /* Release process rundown */
505 ExReleaseRundownProtection(&Parent->RundownProtect);
506 }
507
508 /* If we don't have a section object */
509 if (!SectionObject)
510 {
511 /* Then the process is in termination, so fail */
513 goto CleanupWithRef;
514 }
515 }
516 }
517
518 /* Save the pointer to the section object */
519 Process->SectionObject = SectionObject;
520
521 /* Check for the debug port */
522 if (DebugPort)
523 {
524 /* Reference it */
529 (PVOID*)&DebugObject,
530 NULL);
531 if (!NT_SUCCESS(Status)) goto CleanupWithRef;
532
533 /* Save the debug object */
534 Process->DebugPort = DebugObject;
535
536 /* Check if the caller doesn't want the debug stuff inherited */
538 {
539 /* Set the process flag */
541 }
542 }
543 else
544 {
545 /* Do we have a parent? Copy his debug port */
547 }
548
549 /* Now check for an exception port */
550 if (ExceptionPort)
551 {
552 /* Reference it */
553 Status = ObReferenceObjectByHandle(ExceptionPort,
557 (PVOID*)&ExceptionPortObject,
558 NULL);
559 if (!NT_SUCCESS(Status)) goto CleanupWithRef;
560
561 /* Save the exception port */
562 Process->ExceptionPort = ExceptionPortObject;
563 }
564
565 /* Save the pointer to the section object */
566 Process->SectionObject = SectionObject;
567
568 /* Set default exit code */
569 Process->ExitStatus = STATUS_PENDING;
570
571 /* Check if this is the initial process being built */
572 if (Parent)
573 {
574 /* Create the address space for the child */
576 Process,
577 DirectoryTableBase))
578 {
579 /* Failed */
581 goto CleanupWithRef;
582 }
583 }
584 else
585 {
586 /* Otherwise, we are the boot process, we're already semi-initialized */
587 Process->ObjectTable = CurrentProcess->ObjectTable;
588 Status = MmInitializeHandBuiltProcess(Process, DirectoryTableBase);
589 if (!NT_SUCCESS(Status)) goto CleanupWithRef;
590 }
591
592 /* We now have an address space */
594
595 /* Set the maximum WS */
596 Process->Vm.MaximumWorkingSetSize = MaxWs;
597
598 /* Now initialize the Kernel Process */
601 Affinity,
602 DirectoryTableBase,
603 BooleanFlagOn(Process->DefaultHardErrorProcessing,
605
606 /* Duplicate Parent Token */
608 if (!NT_SUCCESS(Status)) goto CleanupWithRef;
609
610 /* Set default priority class */
611 Process->PriorityClass = PROCESS_PRIORITY_CLASS_NORMAL;
612
613 /* Check if we have a parent */
614 if (Parent)
615 {
616 /* Check our priority class */
617 if (Parent->PriorityClass == PROCESS_PRIORITY_CLASS_IDLE ||
619 {
620 /* Normalize it */
621 Process->PriorityClass = Parent->PriorityClass;
622 }
623
624 /* Initialize object manager for the process */
626 Parent : NULL,
627 Process);
628 if (!NT_SUCCESS(Status)) goto CleanupWithRef;
629 }
630 else
631 {
632 /* Do the second part of the boot process memory setup */
634 if (!NT_SUCCESS(Status)) goto CleanupWithRef;
635 }
636
637 /* Set success for now */
639
640 /* Check if this is a real user-mode process */
641 if (SectionHandle)
642 {
643 /* Initialize the address space */
645 NULL,
647 &Flags,
648 &Process->
649 SeAuditProcessCreationInfo.
650 ImageFileName);
651 if (!NT_SUCCESS(Status)) goto CleanupWithRef;
652
653 //
654 // We need a PEB
655 //
656 NeedsPeb = TRUE;
657 }
658 else if (Parent)
659 {
660 /* Check if this is a child of the system process */
662 {
663 //
664 // We need a PEB
665 //
666 NeedsPeb = TRUE;
667
668 /* This is a clone! */
669 ASSERTMSG("No support for cloning yet\n", FALSE);
670 }
671 else
672 {
673 /* This is the initial system process */
674 Flags &= ~PROCESS_CREATE_FLAGS_LARGE_PAGES;
676 NULL,
677 NULL,
678 &Flags,
679 NULL);
680 if (!NT_SUCCESS(Status)) goto CleanupWithRef;
681
682 /* Create a dummy image file name */
683 Process->SeAuditProcessCreationInfo.ImageFileName =
686 TAG_SEPA);
687 if (!Process->SeAuditProcessCreationInfo.ImageFileName)
688 {
689 /* Fail */
691 goto CleanupWithRef;
692 }
693
694 /* Zero it out */
695 RtlZeroMemory(Process->SeAuditProcessCreationInfo.ImageFileName,
697 }
698 }
699
700#if MI_TRACE_PFNS
701 /* Copy the process name now that we have it */
702 memcpy(MiGetPfnEntry(Process->Pcb.DirectoryTableBase[0] >> PAGE_SHIFT)->ProcessName, Process->ImageFileName, 16);
703 if (Process->Pcb.DirectoryTableBase[1]) memcpy(MiGetPfnEntry(Process->Pcb.DirectoryTableBase[1] >> PAGE_SHIFT)->ProcessName, Process->ImageFileName, 16);
704 if (Process->WorkingSetPage) memcpy(MiGetPfnEntry(Process->WorkingSetPage)->ProcessName, Process->ImageFileName, 16);
705#endif
706
707 /* Check if we have a section object and map the system DLL */
709
710 /* Create a handle for the Process */
711 CidEntry.Object = Process;
712 CidEntry.GrantedAccess = 0;
713 Process->UniqueProcessId = ExCreateHandle(PspCidTable, &CidEntry);
714 if (!Process->UniqueProcessId)
715 {
716 /* Fail */
718 goto CleanupWithRef;
719 }
720
721 /* Set the handle table PID */
722 Process->ObjectTable->UniqueProcessId = Process->UniqueProcessId;
723
724 /* Check if we need to audit */
726
727 /*
728 * Attach the process to parent's job if:
729 * a) parent exists,
730 * b) parent has a job,
731 * c) parent's job does NOT allow silent breakaway.
732 */
733 if (Parent && Parent->Job &&
735 {
736 PEJOB ParentJob = Parent->Job;
737
738 /* If caller explicitly requested breakaway from the job */
740 {
741 /* Deny if the job forbids breakaway */
743 {
745 goto CleanupWithRef;
746 }
747 }
748 else
749 {
750 /* Under normal conditions, child should join a parent's job */
752 if (!NT_SUCCESS(Status))
753 {
754 goto CleanupWithRef;
755 }
756 }
757 }
758
759 /* Create PEB only for User-Mode Processes */
760 if ((Parent) && (NeedsPeb))
761 {
762 //
763 // Set up the initial PEB
764 //
765 RtlZeroMemory(&InitialPeb, sizeof(INITIAL_PEB));
766 InitialPeb.Mutant = (HANDLE)-1;
767 InitialPeb.ImageUsesLargePages = 0; // FIXME: Not yet supported
768
769 //
770 // Create it only if we have an image section
771 //
772 if (SectionHandle)
773 {
774 //
775 // Create it
776 //
777 Status = MmCreatePeb(Process, &InitialPeb, &Process->Peb);
778 if (!NT_SUCCESS(Status)) goto CleanupWithRef;
779 }
780 else
781 {
782 //
783 // We have to clone it
784 //
785 ASSERTMSG("No support for cloning yet\n", FALSE);
786 }
787
788 }
789
790 /* The process can now be activated */
792 InsertTailList(&PsActiveProcessHead, &Process->ActiveProcessLinks);
794
795 /* Create an access state */
796 Status = SeCreateAccessStateEx(CurrentThread,
797 ((Parent) &&
799 Parent : CurrentProcess,
800 &LocalAccessState,
801 &AuxData,
804 if (!NT_SUCCESS(Status)) goto CleanupWithRef;
805
806 /* Insert the Process into the Object Directory */
810 1,
811 NULL,
812 &hProcess);
813
814 /* Free the access state */
816
817 /* Cleanup on failure */
818 if (!NT_SUCCESS(Status)) goto Cleanup;
819
820 /* Compute Quantum and Priority */
821 ASSERT(IsListEmpty(&Process->ThreadListHead) == TRUE);
822 Process->Pcb.BasePriority =
825 &Quantum);
826 Process->Pcb.QuantumReset = Quantum;
827
828 /* Check if we have a parent other then the initial system process */
829 Process->GrantedAccess = PROCESS_TERMINATE;
831 {
832 /* Get the process's SD */
835 &SdAllocated);
836 if (!NT_SUCCESS(Status))
837 {
838 /* We failed, close the handle and clean up */
840 goto CleanupWithRef;
841 }
842
843 /* Create the subject context */
844 SubjectContext.ProcessAuditId = Process;
846 SubjectContext.ClientToken = NULL;
847
848 /* Do the access check */
851 FALSE,
853 0,
854 NULL,
857 &Process->GrantedAccess,
858 &AccessStatus);
859
860 /* Dereference the token and let go the SD */
862 SubjectContext.PrimaryToken);
864
865 /* Remove access if it failed */
866 if (!Result) Process->GrantedAccess = 0;
867
868 /* Give the process some basic access */
869 Process->GrantedAccess |= (PROCESS_VM_OPERATION |
880 }
881 else
882 {
883 /* Set full granted access */
884 Process->GrantedAccess = PROCESS_ALL_ACCESS;
885 }
886
887 /* Set the Creation Time */
888 KeQuerySystemTime(&Process->CreateTime);
889
890 /* Protect against bad user-mode pointer */
892 {
893 /* Hacky way of returning the PEB to the user-mode creator */
894 if ((Process->Peb) && (CurrentThread->Tcb.Teb))
895 {
896 CurrentThread->Tcb.Teb->NtTib.ArbitraryUserPointer = Process->Peb;
897 }
898
899 /* Save the process handle */
901 }
903 {
904 /* Get the exception code */
906 }
907 _SEH2_END;
908
909 /* Run the Notification Routines */
911
912 /* If 12 processes have been created, enough of user-mode is ready */
913 if (++ProcessCount == 12) Ki386PerfEnd();
914
915CleanupWithRef:
916 /*
917 * Dereference the process. For failures, kills the process and does
918 * cleanup present in PspDeleteProcess. For success, kills the extra
919 * reference added by ObInsertObject.
920 */
922
923Cleanup:
924 /* Dereference the parent */
926
927 /* Return status to caller */
928 return Status;
929}
930
931/* PUBLIC FUNCTIONS **********************************************************/
932
933/*
934 * @implemented
935 */
937NTAPI
941{
942 /* Call the internal API */
946 NULL,
947 0,
948 NULL,
949 NULL,
950 NULL,
951 FALSE);
952}
953
954/*
955 * @implemented
956 */
958NTAPI
961{
962 PHANDLE_TABLE_ENTRY CidEntry;
963 PEPROCESS FoundProcess;
965 PAGED_CODE();
966 PSTRACE(PS_PROCESS_DEBUG, "ProcessId: %p\n", ProcessId);
968
969 /* Get the CID Handle Entry */
971 if (CidEntry)
972 {
973 /* Get the Process */
974 FoundProcess = CidEntry->Object;
975
976 /* Make sure it's really a process */
977 if (FoundProcess->Pcb.Header.Type == ProcessObject)
978 {
979 /* Safe Reference and return it */
980 if (ObReferenceObjectSafe(FoundProcess))
981 {
982 *Process = FoundProcess;
984 }
985 }
986
987 /* Unlock the Entry */
989 }
990
991 /* Return to caller */
993 return Status;
994}
995
996/*
997 * @implemented
998 */
1000NTAPI
1004{
1005 PHANDLE_TABLE_ENTRY CidEntry;
1006 PETHREAD FoundThread;
1008 PAGED_CODE();
1009 PSTRACE(PS_PROCESS_DEBUG, "Cid: %p\n", Cid);
1011
1012 /* Get the CID Handle Entry */
1013 CidEntry = ExMapHandleToPointer(PspCidTable, Cid->UniqueThread);
1014 if (CidEntry)
1015 {
1016 /* Get the Process */
1017 FoundThread = CidEntry->Object;
1018
1019 /* Make sure it's really a thread and this process' */
1020 if ((FoundThread->Tcb.Header.Type == ThreadObject) &&
1021 (FoundThread->Cid.UniqueProcess == Cid->UniqueProcess))
1022 {
1023 /* Safe Reference and return it */
1024 if (ObReferenceObjectSafe(FoundThread))
1025 {
1026 *Thread = FoundThread;
1028
1029 /* Check if we should return the Process too */
1030 if (Process)
1031 {
1032 /* Return it and reference it */
1033 *Process = FoundThread->ThreadsProcess;
1035 }
1036 }
1037 }
1038
1039 /* Unlock the Entry */
1041 }
1042
1043 /* Return to caller */
1045 return Status;
1046}
1047
1048/*
1049 * @implemented
1050 */
1052NTAPI
1054{
1055 return PsGetCurrentProcess()->ExitTime;
1056}
1057
1058/*
1059 * @implemented
1060 */
1062NTAPI
1064{
1065 return Process->CreateTime.QuadPart;
1066}
1067
1068/*
1069 * @implemented
1070 */
1071PVOID
1072NTAPI
1074{
1075 return Process->DebugPort;
1076}
1077
1078/*
1079 * @implemented
1080 */
1081BOOLEAN
1082NTAPI
1084{
1085 return (BOOLEAN)Process->ProcessExiting;
1086}
1087
1088/*
1089 * @implemented
1090 */
1092NTAPI
1094{
1095 return Process->ExitStatus;
1096}
1097
1098/*
1099 * @implemented
1100 */
1101HANDLE
1102NTAPI
1104{
1105 return (HANDLE)Process->UniqueProcessId;
1106}
1107
1108/*
1109 * @implemented
1110 */
1111LPSTR
1112NTAPI
1114{
1115 return (LPSTR)Process->ImageFileName;
1116}
1117
1118/*
1119 * @implemented
1120 */
1121HANDLE
1122NTAPI
1124{
1125 return Process->InheritedFromUniqueProcessId;
1126}
1127
1128/*
1129 * @implemented
1130 */
1131PEJOB
1132NTAPI
1134{
1135 return Process->Job;
1136}
1137
1138/*
1139 * @implemented
1140 */
1141PPEB
1142NTAPI
1144{
1145 return Process->Peb;
1146}
1147
1148/*
1149 * @implemented
1150 */
1151ULONG
1152NTAPI
1154{
1155 return Process->PriorityClass;
1156}
1157
1158/*
1159 * @implemented
1160 */
1161HANDLE
1162NTAPI
1164{
1165 return (HANDLE)PsGetCurrentProcess()->UniqueProcessId;
1166}
1167
1168/*
1169 * @implemented
1170 */
1171ULONG
1172NTAPI
1174{
1176}
1177
1178/*
1179 * @implemented
1180 */
1181PVOID
1182NTAPI
1184{
1185 return Process->SectionBaseAddress;
1186}
1187
1188/*
1189 * @implemented
1190 */
1191PVOID
1192NTAPI
1194{
1195 return Process->SecurityPort;
1196}
1197
1198/*
1199 * @implemented
1200 */
1201ULONG
1202NTAPI
1204{
1205 return MmGetSessionId(Process);
1206}
1207
1208/*
1209 * @implemented
1210 */
1211ULONG
1212NTAPI
1214{
1215 return MmGetSessionIdEx(Process);
1216}
1217
1218/*
1219 * @implemented
1220 */
1221PVOID
1222NTAPI
1224{
1225 return PsGetCurrentProcess()->Win32Process;
1226}
1227
1228/*
1229 * @implemented
1230 */
1231PVOID
1232NTAPI
1234{
1235 return Process->Win32Process;
1236}
1237
1238/*
1239 * @implemented
1240 */
1241PVOID
1242NTAPI
1244{
1245 return Process->Win32WindowStation;
1246}
1247
1248/*
1249 * @implemented
1250 */
1251BOOLEAN
1252NTAPI
1254{
1255 return Process->DebugPort != NULL;
1256}
1257
1258/*
1259 * @implemented
1260 */
1261BOOLEAN
1262NTAPI
1264{
1265 /* Return if this is the System Process */
1267}
1268
1269/*
1270 * @implemented
1271 */
1272VOID
1273NTAPI
1275 ULONG PriorityClass)
1276{
1277 Process->PriorityClass = (UCHAR)PriorityClass;
1278}
1279
1280/*
1281 * @implemented
1282 */
1284NTAPI
1286 PVOID SecurityPort)
1287{
1288 Process->SecurityPort = SecurityPort;
1289 return STATUS_SUCCESS;
1290}
1291
1292/*
1293 * @implemented
1294 */
1296NTAPI
1299 _In_opt_ PVOID Win32Process,
1300 _In_opt_ PVOID OldWin32Process)
1301{
1303
1304 /* Assume success */
1306
1307 /* Lock the process */
1309 ExAcquirePushLockExclusive(&Process->ProcessLock);
1310
1311 /* Check if we set a new win32 process */
1312 if (Win32Process != NULL)
1313 {
1314 /* Check if the process is in the right state */
1315 if (((Process->Flags & PSF_PROCESS_DELETE_BIT) == 0) &&
1316 (Process->Win32Process == NULL))
1317 {
1318 /* Set the new win32 process */
1319 Process->Win32Process = Win32Process;
1320 }
1321 else
1322 {
1323 /* Otherwise fail */
1325 }
1326 }
1327 else
1328 {
1329 /* Reset the win32 process, did the caller specify the correct old value? */
1330 if (Process->Win32Process == OldWin32Process)
1331 {
1332 /* Yes, so reset the win32 process to NULL */
1333 Process->Win32Process = NULL;
1334 }
1335 else
1336 {
1337 /* Otherwise fail */
1339 }
1340 }
1341
1342 /* Unlock the process */
1343 ExReleasePushLockExclusive(&Process->ProcessLock);
1345
1346 return Status;
1347}
1348
1349/*
1350 * @implemented
1351 */
1352VOID
1353NTAPI
1355 PVOID WindowStation)
1356{
1357 Process->Win32WindowStation = WindowStation;
1358}
1359
1360/*
1361 * @implemented
1362 */
1363VOID
1364NTAPI
1367{
1368 UCHAR Quantum;
1370 PSTRACE(PS_PROCESS_DEBUG, "Process: %p Type: %lx\n", Process, Type);
1371
1372 /* Compute quantum and priority */
1374
1375 /* Set them */
1377}
1378
1379/*
1380 * @implemented
1381 */
1383NTAPI
1387 IN HANDLE ParentProcess,
1388 IN ULONG Flags,
1389 IN HANDLE SectionHandle OPTIONAL,
1390 IN HANDLE DebugPort OPTIONAL,
1391 IN HANDLE ExceptionPort OPTIONAL,
1392 IN BOOLEAN InJob)
1393{
1396 PAGED_CODE();
1398 "ParentProcess: %p Flags: %lx\n", ParentProcess, Flags);
1399
1400 /* Check if we came from user mode */
1401 if (PreviousMode != KernelMode)
1402 {
1403 _SEH2_TRY
1404 {
1405 /* Probe process handle */
1407 }
1409 {
1410 /* Return the exception code */
1412 }
1413 _SEH2_END;
1414 }
1415
1416 /* Make sure there's a parent process */
1417 if (!ParentProcess)
1418 {
1419 /* Can't create System Processes like this */
1421 }
1422 else
1423 {
1424 /* Create a user Process */
1428 ParentProcess,
1429 Flags,
1430 SectionHandle,
1431 DebugPort,
1432 ExceptionPort,
1433 InJob);
1434 }
1435
1436 /* Return Status */
1437 return Status;
1438}
1439
1440/*
1441 * @implemented
1442 */
1444NTAPI
1448 IN HANDLE ParentProcess,
1449 IN BOOLEAN InheritObjectTable,
1450 IN HANDLE SectionHandle OPTIONAL,
1451 IN HANDLE DebugPort OPTIONAL,
1452 IN HANDLE ExceptionPort OPTIONAL)
1453{
1454 ULONG Flags = 0;
1456 "Parent: %p Attributes: %p\n", ParentProcess, ObjectAttributes);
1457
1458 /* Set new-style flags */
1459 if ((ULONG_PTR)SectionHandle & 1) Flags |= PROCESS_CREATE_FLAGS_BREAKAWAY;
1461 if (InheritObjectTable) Flags |= PROCESS_CREATE_FLAGS_INHERIT_HANDLES;
1462
1463 /* Call the new API */
1467 ParentProcess,
1468 Flags,
1469 SectionHandle,
1470 DebugPort,
1471 ExceptionPort,
1472 FALSE);
1473}
1474
1475/*
1476 * @implemented
1477 */
1479NTAPI
1484{
1486 CLIENT_ID SafeClientId;
1487 ULONG Attributes = 0;
1489 BOOLEAN HasObjectName = FALSE;
1494 AUX_ACCESS_DATA AuxData;
1495 PAGED_CODE();
1497 "ClientId: %p Attributes: %p\n", ClientId, ObjectAttributes);
1498
1499 /* Check if we were called from user mode */
1500 if (PreviousMode != KernelMode)
1501 {
1502 /* Enter SEH for probing */
1503 _SEH2_TRY
1504 {
1505 /* Probe the thread handle */
1507
1508 /* Check for a CID structure */
1509 if (ClientId)
1510 {
1511 /* Probe and capture it */
1512 ProbeForRead(ClientId, sizeof(CLIENT_ID), sizeof(ULONG));
1513 SafeClientId = *ClientId;
1514 ClientId = &SafeClientId;
1515 }
1516
1517 /*
1518 * Just probe the object attributes structure, don't capture it
1519 * completely. This is done later if necessary
1520 */
1522 sizeof(OBJECT_ATTRIBUTES),
1523 sizeof(ULONG));
1524 HasObjectName = (ObjectAttributes->ObjectName != NULL);
1525
1526 /* Validate user attributes */
1528 }
1530 {
1531 /* Return the exception code */
1533 }
1534 _SEH2_END;
1535 }
1536 else
1537 {
1538 /* Otherwise just get the data directly */
1539 HasObjectName = (ObjectAttributes->ObjectName != NULL);
1540
1541 /* Still have to sanitize attributes */
1543 }
1544
1545 /* Can't pass both, fail */
1546 if ((HasObjectName) && (ClientId)) return STATUS_INVALID_PARAMETER_MIX;
1547
1548 /* Create an access state */
1550 &AuxData,
1553 if (!NT_SUCCESS(Status)) return Status;
1554
1555 /* Check if this is a debugger */
1557 {
1558 /* Did he want full access? */
1559 if (AccessState.RemainingDesiredAccess & MAXIMUM_ALLOWED)
1560 {
1561 /* Give it to him */
1562 AccessState.PreviouslyGrantedAccess |= PROCESS_ALL_ACCESS;
1563 }
1564 else
1565 {
1566 /* Otherwise just give every other access he could want */
1567 AccessState.PreviouslyGrantedAccess |=
1568 AccessState.RemainingDesiredAccess;
1569 }
1570
1571 /* The caller desires nothing else now */
1572 AccessState.RemainingDesiredAccess = 0;
1573 }
1574
1575 /* Open by name if one was given */
1576 if (HasObjectName)
1577 {
1578 /* Open it */
1582 &AccessState,
1583 0,
1584 NULL,
1585 &hProcess);
1586
1587 /* Get rid of the access state */
1589 }
1590 else if (ClientId)
1591 {
1592 /* Open by Thread ID */
1594 {
1595 /* Get the Process */
1597 }
1598 else
1599 {
1600 /* Get the Process */
1602 &Process);
1603 }
1604
1605 /* Check if we didn't find anything */
1606 if (!NT_SUCCESS(Status))
1607 {
1608 /* Get rid of the access state and return */
1610 return Status;
1611 }
1612
1613 /* Open the Process Object */
1615 Attributes,
1616 &AccessState,
1617 0,
1620 &hProcess);
1621
1622 /* Delete the access state */
1624
1625 /* Dereference the thread if we used it */
1627
1628 /* Dereference the Process */
1630 }
1631 else
1632 {
1633 /* neither an object name nor a client id was passed */
1635 }
1636
1637 /* Check for success */
1638 if (NT_SUCCESS(Status))
1639 {
1640 /* Use SEH for write back */
1641 _SEH2_TRY
1642 {
1643 /* Write back the handle */
1645 }
1647 {
1648 /* Get the exception code */
1650 }
1651 _SEH2_END;
1652 }
1653
1654 /* Return status */
1655 return Status;
1656}
1657
1659ULONG64
1660PsQueryTotalCycleTimeProcess(
1663{
1664 ULONG64 CurrentCycleTime, TotalCycleTime;
1665 KIRQL OldIrql;
1666
1667 /* Raise IRQL, so we stay on the same processor */
1669
1670#ifdef CONFIG_SMP
1671 // FIXME should send an IPI to all processors running this process to update
1672 // their cycle times.
1673#endif
1674
1675 /* Get the current cycle time */
1676 CurrentCycleTime = KxQueryProcessorCycleTime();
1677
1678 /* Get the process' cycle time */
1679 TotalCycleTime = Process->CycleTime;
1680
1681 /* Check if this is the current process */
1683 {
1684 /* Add the additional cycle time from the current thread */
1685 TotalCycleTime += CurrentCycleTime - KeGetCurrentPrcb()->StartCycles;
1686 }
1687
1688 /* Lower IRQL */
1690
1691 /* Return the current cycle time as the time stamp */
1692 if (CycleTimeStamp)
1693 {
1694 *CycleTimeStamp = CurrentCycleTime;
1695 }
1696
1697 /* Return the total cycle time */
1698 return TotalCycleTime;
1699}
1700
1702NTAPI
1708 _Out_ PHANDLE NewProcessHandle)
1709{
1711 PEPROCESS Process, NextProcess;
1712 HANDLE NextProcessHandle;
1713 BOOLEAN Reverse = FALSE;
1715 PAGED_CODE();
1716
1717 /* Enter SEH for probing */
1718 _SEH2_TRY
1719 {
1720 if (PreviousMode != KernelMode)
1721 ProbeForWriteHandle(NewProcessHandle);
1722 *NewProcessHandle = NULL;
1723 }
1725 {
1726 DPRINT1("Exception while accessing NewProcessHandle\n");
1727 return _SEH2_GetExceptionCode();
1728 }
1729 _SEH2_END;
1730
1731 /* Only allowed flag is PROCESS_GET_NEXT_FLAGS_PREVIOUS_PROCESS */
1733 {
1734 DPRINT1("Invalid flags %lx\n", Flags);
1736 }
1737
1739
1740 /* Validate handle attributes */
1742
1743 /* Check if the user passed a process handle */
1744 if (ProcessHandle != NULL)
1745 {
1746 /* Reference the processs */
1751 (PVOID*)&Process,
1752 NULL);
1753 if (!NT_SUCCESS(Status))
1754 {
1755 DPRINT1("Failed to reference process handle 0x%p\n", ProcessHandle);
1756 return Status;
1757 }
1758 }
1759 else
1760 {
1761 Process = NULL;
1762 }
1763
1764 /* Get the next process (this will dereference the previous process) */
1765 NextProcess = PsGetNextProcessEx(Process, Reverse);
1766
1767 /* Fail, if no process was found */
1768 if (NextProcess == NULL)
1769 {
1771 }
1772
1773 /* Open the process object */
1774 Status = ObOpenObjectByPointer(NextProcess,
1776 NULL,
1780 &NextProcessHandle);
1781
1782 /* Dereference the next process */
1783 ObDereferenceObject(NextProcess);
1784
1785 if (!NT_SUCCESS(Status))
1786 {
1787 DPRINT1("Failed to open next process object\n");
1788 return Status;
1789 }
1790
1791 /* Return the new process handle */
1792 _SEH2_TRY
1793 {
1794 *NewProcessHandle = NextProcessHandle;
1795 }
1797 {
1798 DPRINT1("Exception while accessing NewProcessHandle\n");
1799 ObCloseHandle(NextProcessHandle, PreviousMode);
1800 return _SEH2_GetExceptionCode();
1801 }
1802 _SEH2_END;
1803
1804 return STATUS_SUCCESS;
1805}
1806
1808NTAPI
1811 _In_opt_ HANDLE ThreadHandle,
1815 _Out_ PHANDLE NewThreadHandle)
1816{
1819 PETHREAD Thread, NextThread;
1820 HANDLE NextThreadHandle;
1822 PAGED_CODE();
1823
1824 /* Enter SEH for probing */
1825 _SEH2_TRY
1826 {
1827 if (PreviousMode != KernelMode)
1828 ProbeForWriteHandle(NewThreadHandle);
1829 *NewThreadHandle = NULL;
1830 }
1832 {
1833 DPRINT1("Exception while accessing NewThreadHandle\n");
1834 return _SEH2_GetExceptionCode();
1835 }
1836 _SEH2_END;
1837
1838 /* Flags is reserved and must be 0 */
1839 if (Flags != 0)
1840 {
1841 DPRINT1("Warning: NtGetNextThread Flags %lx\n", Flags);
1843 }
1844
1845 /* Validate handle attributes */
1847
1848 /* Reference the processs */
1853 (PVOID*)&Process,
1854 NULL);
1855 if (!NT_SUCCESS(Status))
1856 {
1857 DPRINT1("Failed to reference process handle 0x%p\n", ProcessHandle);
1858 return Status;
1859 }
1860
1861 /* Check if the user passed a thread handle */
1862 if (ThreadHandle != NULL)
1863 {
1864 /* Reference the thread */
1865 Status = ObReferenceObjectByHandle(ThreadHandle,
1869 (PVOID*)&Thread,
1870 NULL);
1871 if (!NT_SUCCESS(Status))
1872 {
1873 DPRINT1("Failed to reference thread handle 0x%p\n", ThreadHandle);
1875 return Status;
1876 }
1877 }
1878 else
1879 {
1880 Thread = NULL;
1881 }
1882
1883 /* Get the next thread (this will dereference the previous thread) */
1884 NextThread = PsGetNextProcessThread(Process, Thread);
1885
1886 /* Dereference the process */
1888
1889 /* Fail, if no thread was found */
1890 if (NextThread == NULL)
1891 {
1893 }
1894
1895 /* Open the Thread Object */
1896 Status = ObOpenObjectByPointer(NextThread,
1898 NULL,
1902 &NextThreadHandle);
1903
1904 /* Dereference the next thread */
1905 ObDereferenceObject(NextThread);
1906
1907 if (!NT_SUCCESS(Status))
1908 {
1909 DPRINT1("Failed to open next thread object\n");
1910 return Status;
1911 }
1912
1913 /* Return the new thread handle */
1914 _SEH2_TRY
1915 {
1916 *NewThreadHandle = NextThreadHandle;
1917 }
1919 {
1920 DPRINT1("Exception while accessing NewThreadHandle\n");
1921 ObCloseHandle(NextThreadHandle, PreviousMode);
1922 return _SEH2_GetExceptionCode();
1923 }
1924 _SEH2_END;
1925
1926 return STATUS_SUCCESS;
1927}
1928
1929/* 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
#define DPRINT1
Definition: precomp.h:8
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
_In_ UCXUSBDEVICE _In_ UCXENDPOINT _In_ ULONG Priority
Definition: hubucx.h:414
#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
#define THREAD_QUERY_LIMITED_INFORMATION
Definition: security.c:76
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
_In_ HANDLE _In_opt_ HANDLE _Out_opt_ PHANDLE _In_ ACCESS_MASK _In_ ULONG HandleAttributes
Definition: obfuncs.h:451
#define PROCESS_GET_NEXT_FLAGS_PREVIOUS_PROCESS
Definition: psfuncs.h:441
#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_
Definition: no_sal2.h:158
#define _In_opt_
Definition: no_sal2.h:212
#define _Reserved_
Definition: no_sal2.h:504
#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:1042
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:938
VOID NTAPI PsSetProcessPriorityClass(PEPROCESS Process, ULONG PriorityClass)
Definition: process.c:1274
HANDLE NTAPI PsGetProcessInheritedFromUniqueProcessId(PEPROCESS Process)
Definition: process.c:1123
NTSTATUS NTAPI NtGetNextProcess(_In_opt_ HANDLE ProcessHandle, _In_ ACCESS_MASK DesiredAccess, _In_ ULONG HandleAttributes, _In_ ULONG Flags, _Out_ PHANDLE NewProcessHandle)
Definition: process.c:1703
BOOLEAN NTAPI PsIsSystemProcess(IN PEPROCESS Process)
Definition: process.c:1263
PVOID NTAPI PsGetProcessWin32Process(PEPROCESS Process)
Definition: process.c:1233
PPEB NTAPI PsGetProcessPeb(PEPROCESS Process)
Definition: process.c:1143
CHAR PspForegroundQuantum[3]
Definition: process.c:29
LPSTR NTAPI PsGetProcessImageFileName(PEPROCESS Process)
Definition: process.c:1113
NTSTATUS NTAPI PsSetProcessWin32Process(_Inout_ PEPROCESS Process, _In_opt_ PVOID Win32Process, _In_opt_ PVOID OldWin32Process)
Definition: process.c:1297
PVOID NTAPI PsGetProcessSecurityPort(PEPROCESS Process)
Definition: process.c:1193
ULONG NTAPI PsGetProcessPriorityClass(PEPROCESS Process)
Definition: process.c:1153
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:1445
BOOLEAN NTAPI PsGetProcessExitProcessCalled(PEPROCESS Process)
Definition: process.c:1083
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:1384
POBJECT_TYPE PsProcessType
Definition: process.c:20
KPRIORITY NTAPI PspComputeQuantumAndPriority(IN PEPROCESS Process, IN PSPROCESSPRIORITYMODE Mode, OUT PUCHAR Quantum)
Definition: process.c:184
NTSTATUS NTAPI PsLookupProcessThreadByCid(IN PCLIENT_ID Cid, OUT PEPROCESS *Process OPTIONAL, OUT PETHREAD *Thread)
Definition: process.c:1001
static PEPROCESS NTAPI PsGetNextProcessEx(_In_opt_ PEPROCESS OldProcess, _In_ BOOLEAN Reverse)
Definition: process.c:129
ULONG PsMaximumWorkingSet
Definition: process.c:18
BOOLEAN NTAPI PsIsProcessBeingDebugged(PEPROCESS Process)
Definition: process.c:1253
ULONG NTAPI PsGetProcessSessionId(IN PEPROCESS Process)
Definition: process.c:1203
ULONG NTAPI PsGetProcessSessionIdEx(IN PEPROCESS Process)
Definition: process.c:1213
NTSTATUS NTAPI PsLookupProcessByProcessId(IN HANDLE ProcessId, OUT PEPROCESS *Process)
Definition: process.c:959
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:357
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:1285
LIST_ENTRY PsActiveProcessHead
Definition: process.c:22
PEJOB NTAPI PsGetProcessJob(PEPROCESS Process)
Definition: process.c:1133
PEPROCESS NTAPI PsGetNextProcess(_In_opt_ PEPROCESS OldProcess)
Definition: process.c:177
VOID NTAPI PsSetProcessWindowStation(PEPROCESS Process, PVOID WindowStation)
Definition: process.c:1354
ULONG PsPrioritySeparation
Definition: process.c:28
VOID NTAPI PsChangeQuantumTable(IN BOOLEAN Immediate, IN ULONG PrioritySeparation)
Definition: process.c:245
NTSTATUS NTAPI PsGetProcessExitStatus(PEPROCESS Process)
Definition: process.c:1093
CHAR PspFixedQuantums[6]
Definition: process.c:32
LONGLONG NTAPI PsGetProcessCreateTimeQuadPart(PEPROCESS Process)
Definition: process.c:1063
CHAR PspVariableQuantums[6]
Definition: process.c:46
PVOID NTAPI PsGetCurrentProcessWin32Process(VOID)
Definition: process.c:1223
HANDLE NTAPI PsGetCurrentProcessId(VOID)
Definition: process.c:1163
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:1365
HANDLE NTAPI PsGetProcessId(PEPROCESS Process)
Definition: process.c:1103
PVOID NTAPI PsGetProcessDebugPort(PEPROCESS Process)
Definition: process.c:1073
PVOID NTAPI PsGetProcessSectionBaseAddress(PEPROCESS Process)
Definition: process.c:1183
NTSTATUS NTAPI NtGetNextThread(_In_ HANDLE ProcessHandle, _In_opt_ HANDLE ThreadHandle, _In_ ACCESS_MASK DesiredAccess, _In_ ULONG HandleAttributes, _In_opt_ _Reserved_ ULONG Flags, _Out_ PHANDLE NewThreadHandle)
Definition: process.c:1809
KPRIORITY PspPriorityTable[PROCESS_PRIORITY_CLASS_ABOVE_NORMAL+1]
Definition: process.c:60
PVOID NTAPI PsGetProcessWin32WindowStation(PEPROCESS Process)
Definition: process.c:1243
KGUARDED_MUTEX PspActiveProcessMutex
Definition: process.c:23
ULONG NTAPI PsGetCurrentProcessSessionId(VOID)
Definition: process.c:1173
NTSTATUS NTAPI NtOpenProcess(OUT PHANDLE ProcessHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN PCLIENT_ID ClientId)
Definition: process.c:1480
LARGE_INTEGER NTAPI PsGetProcessExitTime(VOID)
Definition: process.c:1053
PACCESS_TOKEN NTAPI PsReferencePrimaryToken(PEPROCESS Process)
Definition: security.c:440
POBJECT_TYPE PsThreadType
Definition: thread.c:20
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
#define STATUS_NO_MORE_ENTRIES
Definition: ntstatus.h:285
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:2116
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:3411
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:2962
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:2769
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:2559
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:1049
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:1701
KPROCESS Pcb
Definition: pstypes.h:1467
PHANDLE_TABLE ObjectTable
Definition: pstypes.h:1491
KTHREAD Tcb
Definition: pstypes.h:1296
CLIENT_ID Cid
Definition: pstypes.h:1321
LIST_ENTRY ThreadListEntry
Definition: pstypes.h:1351
Definition: extypes.h:772
PVOID Object
Definition: extypes.h:775
ULONG GrantedAccess
Definition: extypes.h:782
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 * Blink
Definition: typedefs.h:122
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
GENERIC_MAPPING GenericMapping
Definition: obtypes.h:388
OBJECT_TYPE_INITIALIZER TypeInfo
Definition: obtypes.h:420
#define TAG_SEPA
Definition: tag.h:164
#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_ 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