ReactOS 0.4.16-dev-1890-gbb7a613
query.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/query.c
5 * PURPOSE: Process Manager: Thread/Process Query/Set Information
6 * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
7 * Thomas Weidenmueller (w3seek@reactos.org)
8 * Eric Kohl
9 */
10
11/* INCLUDES ******************************************************************/
12
13#include <ntoskrnl.h>
14#define NDEBUG
15#include <debug.h>
16
17/* Debugging Level */
19
20/* PRIVATE FUNCTIONS *********************************************************/
21
26{
27 PSECTION Section;
28 PAGED_CODE();
29
30 /* Lock the process */
31 if (!ExAcquireRundownProtection(&Process->RundownProtect))
32 {
34 }
35
36 /* Get the section */
37 Section = Process->SectionObject;
38 if (Section)
39 {
40 /* Get the file object and reference it */
43 }
44
45 /* Release the protection */
46 ExReleaseRundownProtection(&Process->RundownProtect);
47
48 /* Return status */
49 return Section ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL;
50}
51
52/* PUBLIC FUNCTIONS **********************************************************/
53
54/*
55 * @implemented
56 */
61 _In_ PROCESSINFOCLASS ProcessInformationClass,
62 _Out_ PVOID ProcessInformation,
63 _In_ ULONG ProcessInformationLength,
65{
69 ULONG Length = 0;
70
71 PAGED_CODE();
72
73 /* Validate the information class */
74 Status = DefaultQueryInfoBufferCheck(ProcessInformationClass,
78 ProcessInformation,
79 ProcessInformationLength,
81 NULL,
83 if (!NT_SUCCESS(Status))
84 {
85 DPRINT1("NtQueryInformationProcess(ProcessInformationClass: %lu): Class validation failed! (Status: 0x%lx)\n",
86 ProcessInformationClass, Status);
87 return Status;
88 }
89
90 if (((ProcessInformationClass == ProcessCookie) ||
91 (ProcessInformationClass == ProcessImageInformation)) &&
93 {
94 /*
95 * Retrieving the process cookie is only allowed for the calling process
96 * itself! XP only allows NtCurrentProcess() as process handles even if
97 * a real handle actually represents the current process.
98 */
100 }
101
102 /* Check the information class */
103 switch (ProcessInformationClass)
104 {
105 /* Basic process information */
107 {
108 PPROCESS_BASIC_INFORMATION ProcessBasicInfo = (PPROCESS_BASIC_INFORMATION)ProcessInformation;
109
110 if (ProcessInformationLength != sizeof(PROCESS_BASIC_INFORMATION))
111 {
113 break;
114 }
115
116 /* Set the return length */
118
119 /* Reference the process */
124 (PVOID*)&Process,
125 NULL);
126 if (!NT_SUCCESS(Status)) break;
127
128 /* Protect writes with SEH */
130 {
131 /* Write all the information from the EPROCESS/KPROCESS */
132 ProcessBasicInfo->ExitStatus = Process->ExitStatus;
133 ProcessBasicInfo->PebBaseAddress = Process->Peb;
134 ProcessBasicInfo->AffinityMask = Process->Pcb.Affinity;
135 ProcessBasicInfo->UniqueProcessId = (ULONG_PTR)Process->
136 UniqueProcessId;
137 ProcessBasicInfo->InheritedFromUniqueProcessId =
138 (ULONG_PTR)Process->InheritedFromUniqueProcessId;
139 ProcessBasicInfo->BasePriority = Process->Pcb.BasePriority;
140
141 }
143 {
144 /* Get exception code */
146 }
147 _SEH2_END;
148
149 /* Dereference the process */
151 break;
152 }
153
154 /* Process quota limits */
156 {
157 QUOTA_LIMITS_EX QuotaLimits;
158 BOOLEAN Extended;
159
160 if (ProcessInformationLength != sizeof(QUOTA_LIMITS) &&
161 ProcessInformationLength != sizeof(QUOTA_LIMITS_EX))
162 {
164 break;
165 }
166
167 /* Set the return length */
168 Length = ProcessInformationLength;
169 Extended = (Length == sizeof(QUOTA_LIMITS_EX));
170
171 /* Reference the process */
176 (PVOID*)&Process,
177 NULL);
178 if (!NT_SUCCESS(Status)) break;
179
180 /* Indicate success */
182
183 RtlZeroMemory(&QuotaLimits, sizeof(QuotaLimits));
184
185 /* Get max/min working set sizes */
186 QuotaLimits.MaximumWorkingSetSize =
187 Process->Vm.MaximumWorkingSetSize << PAGE_SHIFT;
188 QuotaLimits.MinimumWorkingSetSize =
189 Process->Vm.MinimumWorkingSetSize << PAGE_SHIFT;
190
191 /* Get default time limits */
192 QuotaLimits.TimeLimit.QuadPart = -1LL;
193
194 /* Is quota block a default one? */
195 if (Process->QuotaBlock == &PspDefaultQuotaBlock)
196 {
197 /* Get default pools and pagefile limits */
198 QuotaLimits.PagedPoolLimit = (SIZE_T)-1;
199 QuotaLimits.NonPagedPoolLimit = (SIZE_T)-1;
200 QuotaLimits.PagefileLimit = (SIZE_T)-1;
201 }
202 else
203 {
204 /* Get limits from non-default quota block */
205 QuotaLimits.PagedPoolLimit =
206 Process->QuotaBlock->QuotaEntry[PsPagedPool].Limit;
207 QuotaLimits.NonPagedPoolLimit =
208 Process->QuotaBlock->QuotaEntry[PsNonPagedPool].Limit;
209 QuotaLimits.PagefileLimit =
210 Process->QuotaBlock->QuotaEntry[PsPageFile].Limit;
211 }
212
213 /* Get additional information, if needed */
214 if (Extended)
215 {
216 QuotaLimits.Flags |= (Process->Vm.Flags.MaximumWorkingSetHard ?
218 QuotaLimits.Flags |= (Process->Vm.Flags.MinimumWorkingSetHard ?
220
221 /* FIXME: Get the correct information */
222 //QuotaLimits.WorkingSetLimit = (SIZE_T)-1; // Not used on Win2k3, it is set to 0
223 QuotaLimits.CpuRateLimit.RateData = 0;
224 }
225
226 /* Protect writes with SEH */
228 {
229 RtlCopyMemory(ProcessInformation, &QuotaLimits, Length);
230 }
232 {
233 /* Get exception code */
235 }
236 _SEH2_END;
237
238 /* Dereference the process */
240 break;
241 }
242
244 {
245 PIO_COUNTERS IoCounters = (PIO_COUNTERS)ProcessInformation;
246 PROCESS_VALUES ProcessValues;
247
248 if (ProcessInformationLength != sizeof(IO_COUNTERS))
249 {
251 break;
252 }
253
254 Length = sizeof(IO_COUNTERS);
255
256 /* Reference the process */
261 (PVOID*)&Process,
262 NULL);
263 if (!NT_SUCCESS(Status)) break;
264
265 /* Query IO counters from the process */
266 KeQueryValuesProcess(&Process->Pcb, &ProcessValues);
267
269 {
270 RtlCopyMemory(IoCounters, &ProcessValues.IoInfo, sizeof(IO_COUNTERS));
271 }
273 {
274 /* Ignore exception */
275 }
276 _SEH2_END;
277
278 /* Set status to success in any case */
280
281 /* Dereference the process */
283 break;
284 }
285
286 /* Timing */
287 case ProcessTimes:
288 {
289 PKERNEL_USER_TIMES ProcessTime = (PKERNEL_USER_TIMES)ProcessInformation;
290 ULONG UserTime, KernelTime;
291
292 /* Set the return length */
293 if (ProcessInformationLength != sizeof(KERNEL_USER_TIMES))
294 {
296 break;
297 }
298
299 Length = sizeof(KERNEL_USER_TIMES);
300
301 /* Reference the process */
306 (PVOID*)&Process,
307 NULL);
308 if (!NT_SUCCESS(Status)) break;
309
310 /* Protect writes with SEH */
312 {
313 /* Copy time information from EPROCESS/KPROCESS */
314 KernelTime = KeQueryRuntimeProcess(&Process->Pcb, &UserTime);
315 ProcessTime->CreateTime = Process->CreateTime;
317 ProcessTime->KernelTime.QuadPart = (LONGLONG)KernelTime * KeMaximumIncrement;
318 ProcessTime->ExitTime = Process->ExitTime;
319 }
321 {
322 /* Get exception code */
324 }
325 _SEH2_END;
326
327 /* Dereference the process */
329 break;
330 }
331
332 /* Process Debug Port */
333 case ProcessDebugPort:
334
335 if (ProcessInformationLength != sizeof(HANDLE))
336 {
338 break;
339 }
340
341 /* Set the return length */
342 Length = sizeof(HANDLE);
343
344 /* Reference the process */
349 (PVOID*)&Process,
350 NULL);
351 if (!NT_SUCCESS(Status)) break;
352
353 /* Protect write with SEH */
355 {
356 /* Return whether or not we have a debug port */
357 *(PHANDLE)ProcessInformation = (Process->DebugPort ?
358 (HANDLE)-1 : NULL);
359 }
361 {
362 /* Get exception code */
364 }
365 _SEH2_END;
366
367 /* Dereference the process */
369 break;
370
372 {
373 ULONG HandleCount;
374
375 if (ProcessInformationLength != sizeof(ULONG))
376 {
378 break;
379 }
380
381 /* Set the return length*/
382 Length = sizeof(ULONG);
383
384 /* Reference the process */
389 (PVOID*)&Process,
390 NULL);
391 if (!NT_SUCCESS(Status)) break;
392
393 /* Count the number of handles this process has */
394 HandleCount = ObGetProcessHandleCount(Process);
395
396 /* Protect write in SEH */
398 {
399 /* Return the count of handles */
400 *(PULONG)ProcessInformation = HandleCount;
401 }
403 {
404 /* Get the exception code */
406 }
407 _SEH2_END;
408
409 /* Dereference the process */
411 break;
412 }
413
414 /* Session ID for the process */
416 {
418
419 if (ProcessInformationLength != sizeof(PROCESS_SESSION_INFORMATION))
420 {
422 break;
423 }
424
425 /* Set the return length*/
427
428 /* Reference the process */
433 (PVOID*)&Process,
434 NULL);
435 if (!NT_SUCCESS(Status)) break;
436
437 /* Enter SEH for write safety */
439 {
440 /* Write back the Session ID */
442 }
444 {
445 /* Get the exception code */
447 }
448 _SEH2_END;
449
450 /* Dereference the process */
452 break;
453 }
454
455 /* Virtual Memory Statistics */
457 {
458 PVM_COUNTERS VmCounters = (PVM_COUNTERS)ProcessInformation;
459
460 /* Validate the input length */
461 if ((ProcessInformationLength != sizeof(VM_COUNTERS)) &&
462 (ProcessInformationLength != sizeof(VM_COUNTERS_EX)))
463 {
465 break;
466 }
467
468 /* Reference the process */
473 (PVOID*)&Process,
474 NULL);
475 if (!NT_SUCCESS(Status)) break;
476
477 /* Enter SEH for write safety */
479 {
480 /* Return data from EPROCESS */
481 VmCounters->PeakVirtualSize = Process->PeakVirtualSize;
482 VmCounters->VirtualSize = Process->VirtualSize;
483 VmCounters->PageFaultCount = Process->Vm.PageFaultCount;
484 VmCounters->PeakWorkingSetSize = Process->Vm.PeakWorkingSetSize;
485 VmCounters->WorkingSetSize = Process->Vm.WorkingSetSize;
486 VmCounters->QuotaPeakPagedPoolUsage = Process->QuotaPeak[PsPagedPool];
487 VmCounters->QuotaPagedPoolUsage = Process->QuotaUsage[PsPagedPool];
488 VmCounters->QuotaPeakNonPagedPoolUsage = Process->QuotaPeak[PsNonPagedPool];
489 VmCounters->QuotaNonPagedPoolUsage = Process->QuotaUsage[PsNonPagedPool];
490 VmCounters->PagefileUsage = Process->QuotaUsage[PsPageFile] << PAGE_SHIFT;
491 VmCounters->PeakPagefileUsage = Process->QuotaPeak[PsPageFile] << PAGE_SHIFT;
492 //VmCounters->PrivateUsage = Process->CommitCharge << PAGE_SHIFT;
493 //
494
495 /* Set the return length */
496 Length = ProcessInformationLength;
497 }
499 {
500 /* Get the exception code */
502 }
503 _SEH2_END;
504
505 /* Dereference the process */
507 break;
508 }
509
510 /* Hard Error Processing Mode */
512
513 if (ProcessInformationLength != sizeof(ULONG))
514 {
516 break;
517 }
518
519 /* Set the return length*/
520 Length = sizeof(ULONG);
521
522 /* Reference the process */
527 (PVOID*)&Process,
528 NULL);
529 if (!NT_SUCCESS(Status)) break;
530
531 /* Enter SEH for writing back data */
533 {
534 /* Write the current processing mode */
535 *(PULONG)ProcessInformation = Process->
536 DefaultHardErrorProcessing;
537 }
539 {
540 /* Get the exception code */
542 }
543 _SEH2_END;
544
545 /* Dereference the process */
547 break;
548
549 /* Priority Boosting status */
551
552 if (ProcessInformationLength != sizeof(ULONG))
553 {
555 break;
556 }
557
558 /* Set the return length */
559 Length = sizeof(ULONG);
560
561 /* Reference the process */
566 (PVOID*)&Process,
567 NULL);
568 if (!NT_SUCCESS(Status)) break;
569
570 /* Enter SEH for writing back data */
572 {
573 /* Return boost status */
574 *(PULONG)ProcessInformation = Process->Pcb.DisableBoost ?
575 TRUE : FALSE;
576 }
578 {
579 /* Get the exception code */
581 }
582 _SEH2_END;
583
584 /* Dereference the process */
586 break;
587
588 /* DOS Device Map */
589 case ProcessDeviceMap:
590 {
591 ULONG Flags;
592
593 if (ProcessInformationLength == sizeof(PROCESS_DEVICEMAP_INFORMATION_EX))
594 {
595 /* Protect read in SEH */
597 {
598 PPROCESS_DEVICEMAP_INFORMATION_EX DeviceMapEx = ProcessInformation;
599
600 Flags = DeviceMapEx->Flags;
601 }
603 {
604 /* Get the exception code */
606 _SEH2_YIELD(break);
607 }
608 _SEH2_END;
609
610 /* Only one flag is supported and it needs LUID mappings */
611 if ((Flags & ~PROCESS_LUID_DOSDEVICES_ONLY) != 0 ||
613 {
615 break;
616 }
617 }
618 else
619 {
620 /* This has to be the size of the Query union field for x64 compatibility! */
621 if (ProcessInformationLength != RTL_FIELD_SIZE(PROCESS_DEVICEMAP_INFORMATION, Query))
622 {
624 break;
625 }
626
627 /* No flags for standard call */
628 Flags = 0;
629 }
630
631 /* Set the return length */
632 Length = ProcessInformationLength;
633
634 /* Reference the process */
639 (PVOID*)&Process,
640 NULL);
641 if (!NT_SUCCESS(Status)) break;
642
643 /* Query the device map information */
645 ProcessInformation,
646 Flags);
647
648 /* Dereference the process */
650 break;
651 }
652
653 /* Priority class */
655 {
656 PPROCESS_PRIORITY_CLASS PsPriorityClass = (PPROCESS_PRIORITY_CLASS)ProcessInformation;
657
658 if (ProcessInformationLength != sizeof(PROCESS_PRIORITY_CLASS))
659 {
661 break;
662 }
663
664 /* Set the return length*/
666
667 /* Reference the process */
672 (PVOID*)&Process,
673 NULL);
674 if (!NT_SUCCESS(Status)) break;
675
676 /* Enter SEH for writing back data */
678 {
679 /* Return current priority class */
680 PsPriorityClass->PriorityClass = Process->PriorityClass;
681 PsPriorityClass->Foreground = FALSE;
682 }
684 {
685 /* Get the exception code */
687 }
688 _SEH2_END;
689
690 /* Dereference the process */
692 break;
693 }
694
696 {
698
699 /* Reference the process */
704 (PVOID*)&Process,
705 NULL);
706 if (!NT_SUCCESS(Status)) break;
707
708 /* Get the image path */
710 if (NT_SUCCESS(Status))
711 {
712 /* Set the return length */
713 Length = ImageName->MaximumLength +
715
716 /* Make sure it's large enough */
717 if (Length <= ProcessInformationLength)
718 {
719 /* Enter SEH to protect write */
721 {
722 /* Copy it */
723 RtlCopyMemory(ProcessInformation,
724 ImageName,
725 Length);
726
727 /* Update pointer */
728 ((PUNICODE_STRING)ProcessInformation)->Buffer =
729 (PWSTR)((PUNICODE_STRING)ProcessInformation + 1);
730 }
732 {
733 /* Get the exception code */
735 }
736 _SEH2_END;
737 }
738 else
739 {
740 /* Buffer too small */
742 }
743
744 /* Free the image path */
746 }
747 /* Dereference the process */
749 break;
750 }
751
752#if (NTDDI_VERSION >= NTDDI_VISTA) || (DLL_EXPORT_VERSION >= _WIN32_WINNT_VISTA)
754 {
757
758 /* Reference the process */
760 PROCESS_QUERY_INFORMATION, // FIXME: Use PROCESS_QUERY_LIMITED_INFORMATION if implemented
763 (PVOID*)&Process,
764 NULL);
765 if (!NT_SUCCESS(Status))
766 {
767 break;
768 }
769
770 /* Get the image path */
773 if (!NT_SUCCESS(Status))
774 {
775 break;
776 }
779 if (!NT_SUCCESS(Status))
780 {
781 break;
782 }
783
784 /* Determine return length and output */
785 Length = sizeof(UNICODE_STRING) + ObjectNameInformation->Name.MaximumLength;
786 if (Length <= ProcessInformationLength)
787 {
789 {
790 PUNICODE_STRING ImageName = (PUNICODE_STRING)ProcessInformation;
791 ImageName->Length = ObjectNameInformation->Name.Length;
792 ImageName->MaximumLength = ObjectNameInformation->Name.MaximumLength;
793 if (ObjectNameInformation->Name.MaximumLength)
794 {
795 ImageName->Buffer = (PWSTR)(ImageName + 1);
796 RtlCopyMemory(ImageName->Buffer,
797 ObjectNameInformation->Name.Buffer,
798 ObjectNameInformation->Name.MaximumLength);
799 }
800 else
801 {
802 ASSERT(ImageName->Length == 0);
803 ImageName->Buffer = NULL;
804 }
805 }
807 {
809 }
810 _SEH2_END;
811 }
812 else
813 {
815 }
817
818 break;
819 }
820#endif /* (NTDDI_VERSION >= NTDDI_VISTA) || (DLL_EXPORT_VERSION >= _WIN32_WINNT_VISTA) */
821
823
824 if (ProcessInformationLength != sizeof(ULONG))
825 {
827 break;
828 }
829
830 /* Set the return length*/
831 Length = sizeof(ULONG);
832
833 /* Reference the process */
838 (PVOID*)&Process,
839 NULL);
840 if (!NT_SUCCESS(Status)) break;
841
842 /* Enter SEH for writing back data */
844 {
845 /* Return the debug flag state */
846 *(PULONG)ProcessInformation = Process->NoDebugInherit ? 0 : 1;
847 }
849 {
850 /* Get the exception code */
852 }
853 _SEH2_END;
854
855 /* Dereference the process */
857 break;
858
860
861 if (ProcessInformationLength != sizeof(ULONG))
862 {
864 break;
865 }
866
867 /* Set the return length */
868 Length = sizeof(ULONG);
869
870 /* Reference the process */
875 (PVOID*)&Process,
876 NULL);
877 if (!NT_SUCCESS(Status)) break;
878
879 /* Enter SEH for writing back data */
881 {
882 /* Return the BreakOnTermination state */
883 *(PULONG)ProcessInformation = Process->BreakOnTermination;
884 }
886 {
887 /* Get the exception code */
889 }
890 _SEH2_END;
891
892 /* Dereference the process */
894 break;
895
896 /* Per-process security cookie */
897 case ProcessCookie:
898 {
900
901 if (ProcessInformationLength != sizeof(ULONG))
902 {
903 /* Length size wrong, bail out */
905 break;
906 }
907
908 /* Get the current process and cookie */
910 Cookie = Process->Cookie;
911 if (!Cookie)
912 {
913 LARGE_INTEGER SystemTime;
914 ULONG NewCookie;
915 PKPRCB Prcb;
916
917 /* Generate a new cookie */
918 KeQuerySystemTime(&SystemTime);
919 Prcb = KeGetCurrentPrcb();
920 NewCookie = Prcb->KeSystemCalls ^ Prcb->InterruptTime ^
921 SystemTime.u.LowPart ^ SystemTime.u.HighPart;
922
923 /* Set the new cookie or return the current one */
925 NewCookie,
926 Cookie);
927 if (!Cookie) Cookie = NewCookie;
928
929 /* Set the return length */
930 Length = sizeof(ULONG);
931 }
932
933 /* Indicate success */
935
936 /* Enter SEH to protect write */
938 {
939 /* Write back the cookie */
940 *(PULONG)ProcessInformation = Cookie;
941 }
943 {
944 /* Get the exception code */
946 }
947 _SEH2_END;
948 break;
949 }
950
952
953 if (ProcessInformationLength != sizeof(SECTION_IMAGE_INFORMATION))
954 {
955 /* Break out */
957 break;
958 }
959
960 /* Set the length required and validate it */
962
963 /* Indicate success */
965
966 /* Enter SEH to protect write */
968 {
970 }
972 {
973 /* Get the exception code */
975 }
976 _SEH2_END;
977 break;
978
980 {
981 HANDLE DebugPort = NULL;
982
983 if (ProcessInformationLength != sizeof(HANDLE))
984 {
986 break;
987 }
988
989 /* Set the return length */
990 Length = sizeof(HANDLE);
991
992 /* Reference the process */
997 (PVOID*)&Process,
998 NULL);
999 if (!NT_SUCCESS(Status)) break;
1000
1001 /* Get the debug port. Continue even if this fails. */
1003
1004 /* Let go of the process */
1006
1007 /* Protect write in SEH */
1008 _SEH2_TRY
1009 {
1010 /* Return debug port's handle */
1011 *(PHANDLE)ProcessInformation = DebugPort;
1012 }
1014 {
1015 if (DebugPort)
1016 ObCloseHandle(DebugPort, PreviousMode);
1017
1018 /* Get the exception code.
1019 * Note: This overwrites any previous failure status. */
1021 }
1022 _SEH2_END;
1023 break;
1024 }
1025
1027 DPRINT1("Handle tracing not implemented: %lu\n", ProcessInformationClass);
1029 break;
1030
1032
1033 if (ProcessInformationLength != sizeof(ULONG))
1034 {
1036 break;
1037 }
1038
1039 /* Set the return length */
1040 Length = sizeof(ULONG);
1041
1042 /* Indicate success */
1044
1045 /* Protect write in SEH */
1046 _SEH2_TRY
1047 {
1048 /* Query Ob */
1049 *(PULONG)ProcessInformation = ObIsLUIDDeviceMapsEnabled();
1050 }
1052 {
1053 /* Get the exception code */
1055 }
1056 _SEH2_END;
1057 break;
1058
1060
1061 if (ProcessInformationLength != sizeof(ULONG))
1062 {
1064 break;
1065 }
1066
1067 /* Set the return length */
1068 Length = sizeof(ULONG);
1069
1070 /* Reference the process */
1075 (PVOID*)&Process,
1076 NULL);
1077 if (!NT_SUCCESS(Status)) break;
1078
1079 /* Protect write in SEH */
1080 _SEH2_TRY
1081 {
1082 /* Return if the flag is set */
1083 *(PULONG)ProcessInformation = (ULONG)Process->VdmAllowed;
1084 }
1086 {
1087 /* Get the exception code */
1089 }
1090 _SEH2_END;
1091
1092 /* Dereference the process */
1094 break;
1095
1097 {
1098 ULONG_PTR Wow64 = 0;
1099
1100 if (ProcessInformationLength != sizeof(ULONG_PTR))
1101 {
1103 break;
1104 }
1105
1106 /* Set the return length */
1107 Length = sizeof(ULONG_PTR);
1108
1109 /* Reference the process */
1114 (PVOID*)&Process,
1115 NULL);
1116 if (!NT_SUCCESS(Status)) break;
1117
1118#ifdef _WIN64
1119 /* Make sure the process isn't dying */
1120 if (ExAcquireRundownProtection(&Process->RundownProtect))
1121 {
1122 /* Get the WOW64 process structure */
1123 Wow64 = (ULONG_PTR)Process->Wow64Process;
1124 /* Release the lock */
1125 ExReleaseRundownProtection(&Process->RundownProtect);
1126 }
1127#endif
1128
1129 /* Dereference the process */
1131
1132 /* Protect write with SEH */
1133 _SEH2_TRY
1134 {
1135 /* Return the Wow64 process information */
1136 *(PULONG_PTR)ProcessInformation = Wow64;
1137 }
1139 {
1140 /* Get exception code */
1142 }
1143 _SEH2_END;
1144 break;
1145 }
1146
1148 {
1149 ULONG ExecuteOptions = 0;
1150
1151 if (ProcessInformationLength != sizeof(ULONG))
1152 {
1154 break;
1155 }
1156
1157 /* Set the return length */
1158 Length = sizeof(ULONG);
1159
1161 {
1163 break;
1164 }
1165
1166 /* Get the options */
1167 Status = MmGetExecuteOptions(&ExecuteOptions);
1168 if (NT_SUCCESS(Status))
1169 {
1170 /* Protect write with SEH */
1171 _SEH2_TRY
1172 {
1173 /* Return them */
1174 *(PULONG)ProcessInformation = ExecuteOptions;
1175 }
1177 {
1178 /* Get exception code */
1180 }
1181 _SEH2_END;
1182 }
1183 break;
1184 }
1185
1187 DPRINT1("VDM/16-bit not implemented: %lu\n", ProcessInformationClass);
1189 break;
1190
1192 DPRINT1("WS Watch not implemented: %lu\n", ProcessInformationClass);
1194 break;
1195
1197 DPRINT1("Pool limits not implemented: %lu\n", ProcessInformationClass);
1199 break;
1200
1201 /* Not supported by Server 2003 */
1202 default:
1203 DPRINT1("Unsupported info class: %lu\n", ProcessInformationClass);
1205 }
1206
1207 /* Check if caller wants the return length and if there is one */
1208 if (ReturnLength != NULL && Length != 0)
1209 {
1210 /* Protect write with SEH */
1211 _SEH2_TRY
1212 {
1214 }
1216 {
1217 /* Get exception code.
1218 * Note: This overwrites any previous failure status. */
1220 }
1221 _SEH2_END;
1222 }
1223
1224 return Status;
1225}
1226
1227/*
1228 * @implemented
1229 */
1231NTAPI
1233 IN PROCESSINFOCLASS ProcessInformationClass,
1234 IN PVOID ProcessInformation,
1235 IN ULONG ProcessInformationLength)
1236{
1239 ACCESS_MASK Access;
1241 HANDLE PortHandle = NULL;
1245 PROCESS_PRIORITY_CLASS PriorityClass = {0};
1246 PROCESS_FOREGROUND_BACKGROUND Foreground = {0};
1247 PVOID ExceptionPort;
1248 ULONG Break;
1249 KAFFINITY ValidAffinity, Affinity = 0;
1250 KPRIORITY BasePriority = 0;
1251 UCHAR MemoryPriority = 0;
1252 BOOLEAN DisableBoost = 0;
1253 ULONG DefaultHardErrorMode = 0;
1254 ULONG DebugFlags = 0, EnableFixup = 0, Boost = 0;
1255 ULONG NoExecute = 0, VdmPower = 0;
1259 PAGED_CODE();
1260
1261 /* Validate the information class */
1262 Status = DefaultSetInfoBufferCheck(ProcessInformationClass,
1265 ProcessInformation,
1266 ProcessInformationLength,
1267 PreviousMode);
1268 if (!NT_SUCCESS(Status))
1269 {
1270 DPRINT1("NtSetInformationProcess(ProcessInformationClass: %lu): Class validation failed! (Status: 0x%lx)\n",
1271 ProcessInformationClass, Status);
1272 return Status;
1273 }
1274
1275 /* Check what class this is */
1276 Access = PROCESS_SET_INFORMATION;
1277 if (ProcessInformationClass == ProcessSessionInformation)
1278 {
1279 /* Setting the Session ID needs a special mask */
1280 Access |= PROCESS_SET_SESSIONID;
1281 }
1282 else if (ProcessInformationClass == ProcessExceptionPort)
1283 {
1284 /* Setting the exception port needs a special mask */
1285 Access |= PROCESS_SUSPEND_RESUME;
1286 }
1287
1288 /* Reference the process */
1290 Access,
1293 (PVOID*)&Process,
1294 NULL);
1295 if (!NT_SUCCESS(Status)) return Status;
1296
1297 /* Check what kind of information class this is */
1298 switch (ProcessInformationClass)
1299 {
1301
1302 /* Check buffer length */
1303 if (ProcessInformationLength != sizeof(ULONG))
1304 {
1306 break;
1307 }
1308
1309 /* Use SEH for capture */
1310 _SEH2_TRY
1311 {
1312 /* Capture the boolean */
1313 VdmPower = *(PULONG)ProcessInformation;
1314 }
1316 {
1317 /* Get the exception code */
1319 _SEH2_YIELD(break);
1320 }
1321 _SEH2_END;
1322
1323 /* Getting VDM powers requires the SeTcbPrivilege */
1325 {
1326 /* We don't hold the privilege, bail out */
1328 DPRINT1("Need TCB privilege\n");
1329 break;
1330 }
1331
1332 /* Set or clear the flag */
1333 if (VdmPower)
1334 {
1336 }
1337 else
1338 {
1340 }
1341 break;
1342
1343 /* Error/Exception Port */
1345
1346 /* Check buffer length */
1347 if (ProcessInformationLength != sizeof(HANDLE))
1348 {
1350 break;
1351 }
1352
1353 /* Use SEH for capture */
1354 _SEH2_TRY
1355 {
1356 /* Capture the handle */
1357 PortHandle = *(PHANDLE)ProcessInformation;
1358 }
1360 {
1361 /* Get the exception code */
1363 _SEH2_YIELD(break);
1364 }
1365 _SEH2_END;
1366
1367 /* Setting the error port requires the SeTcbPrivilege */
1369 {
1370 /* We don't hold the privilege, bail out */
1372 break;
1373 }
1374
1375 /* Get the LPC Port */
1376 Status = ObReferenceObjectByHandle(PortHandle,
1377 0,
1380 (PVOID)&ExceptionPort,
1381 NULL);
1382 if (!NT_SUCCESS(Status)) break;
1383
1384 /* Change the pointer */
1385 if (InterlockedCompareExchangePointer(&Process->ExceptionPort,
1386 ExceptionPort,
1387 NULL))
1388 {
1389 /* We already had one, fail */
1390 ObDereferenceObject(ExceptionPort);
1392 }
1393 break;
1394
1395 /* Security Token */
1396 case ProcessAccessToken:
1397
1398 /* Check buffer length */
1399 if (ProcessInformationLength != sizeof(PROCESS_ACCESS_TOKEN))
1400 {
1402 break;
1403 }
1404
1405 /* Use SEH for capture */
1406 _SEH2_TRY
1407 {
1408 /* Save the token handle */
1409 TokenHandle = ((PPROCESS_ACCESS_TOKEN)ProcessInformation)->
1410 Token;
1411 }
1413 {
1414 /* Get the exception code */
1416 _SEH2_YIELD(break);
1417 }
1418 _SEH2_END;
1419
1420 /* Assign the actual token */
1422 break;
1423
1424 /* Hard error processing */
1426
1427 /* Check buffer length */
1428 if (ProcessInformationLength != sizeof(ULONG))
1429 {
1431 break;
1432 }
1433
1434 /* Enter SEH for direct buffer read */
1435 _SEH2_TRY
1436 {
1437 DefaultHardErrorMode = *(PULONG)ProcessInformation;
1438 }
1440 {
1441 /* Get exception code */
1443 _SEH2_YIELD(break);
1444 }
1445 _SEH2_END;
1446
1447 /* Set the mode */
1448 Process->DefaultHardErrorProcessing = DefaultHardErrorMode;
1449
1450 /* Call Ke for the update */
1451 if (DefaultHardErrorMode & SEM_NOALIGNMENTFAULTEXCEPT)
1452 {
1454 }
1455 else
1456 {
1458 }
1460 break;
1461
1462 /* Session ID */
1464
1465 /* Check buffer length */
1466 if (ProcessInformationLength != sizeof(PROCESS_SESSION_INFORMATION))
1467 {
1469 break;
1470 }
1471
1472 /* Enter SEH for capture */
1473 _SEH2_TRY
1474 {
1475 /* Capture the caller's buffer */
1476 SessionInfo = *(PPROCESS_SESSION_INFORMATION)ProcessInformation;
1477 }
1479 {
1480 /* Get the exception code */
1482 _SEH2_YIELD(break);
1483 }
1484 _SEH2_END;
1485
1486 /* Setting the session id requires the SeTcbPrivilege */
1488 {
1489 /* We don't hold the privilege, bail out */
1491 break;
1492 }
1493
1494#if 0 // OLD AND DEPRECATED CODE!!!!
1495
1496 /* FIXME - update the session id for the process token */
1497 //Status = PsLockProcess(Process, FALSE);
1498 if (!NT_SUCCESS(Status)) break;
1499
1500 /* Write the session ID in the EPROCESS */
1501 Process->Session = UlongToPtr(SessionInfo.SessionId); // HACK!!!
1502
1503 /* Check if the process also has a PEB */
1504 if (Process->Peb)
1505 {
1506 /*
1507 * Attach to the process to make sure we're in the right
1508 * context to access the PEB structure
1509 */
1510 KeAttachProcess(&Process->Pcb);
1511
1512 /* Enter SEH for write to user-mode PEB */
1513 _SEH2_TRY
1514 {
1515 /* Write the session ID */
1516 Process->Peb->SessionId = SessionInfo.SessionId;
1517 }
1519 {
1520 /* Get exception code */
1522 }
1523 _SEH2_END;
1524
1525 /* Detach from the process */
1527 }
1528
1529 /* Unlock the process */
1530 //PsUnlockProcess(Process);
1531
1532#endif
1533
1534 /*
1535 * Since we cannot change the session ID of the given
1536 * process anymore because it is set once and for all
1537 * at process creation time and because it is stored
1538 * inside the Process->Session structure managed by MM,
1539 * we fake changing it: we just return success if the
1540 * user-defined value is the same as the session ID of
1541 * the process, and otherwise we fail.
1542 */
1543 if (SessionInfo.SessionId == PsGetProcessSessionId(Process))
1544 {
1546 }
1547 else
1548 {
1550 }
1551
1552 break;
1553
1555
1556 /* Check buffer length */
1557 if (ProcessInformationLength != sizeof(PROCESS_PRIORITY_CLASS))
1558 {
1560 break;
1561 }
1562
1563 /* Enter SEH for capture */
1564 _SEH2_TRY
1565 {
1566 /* Capture the caller's buffer */
1567 PriorityClass = *(PPROCESS_PRIORITY_CLASS)ProcessInformation;
1568 }
1570 {
1571 /* Return the exception code */
1573 _SEH2_YIELD(break);
1574 }
1575 _SEH2_END;
1576
1577 /* Check for invalid PriorityClass value */
1579 {
1581 break;
1582 }
1583
1584 if ((PriorityClass.PriorityClass != Process->PriorityClass) &&
1586 {
1587 /* Check the privilege */
1591 PreviousMode);
1592 if (!HasPrivilege)
1593 {
1595 DPRINT1("Privilege to change priority to realtime lacking\n");
1597 }
1598 }
1599
1600 /* Check if we have a job */
1601 if (Process->Job)
1602 {
1603 DPRINT1("Jobs not yet supported\n");
1604 }
1605
1606 /* Set process priority class */
1607 Process->PriorityClass = PriorityClass.PriorityClass;
1608
1609 /* Set process priority mode (foreground or background) */
1611 PriorityClass.Foreground ?
1615 break;
1616
1618
1619 /* Check buffer length */
1620 if (ProcessInformationLength != sizeof(PROCESS_FOREGROUND_BACKGROUND))
1621 {
1623 break;
1624 }
1625
1626 /* Enter SEH for capture */
1627 _SEH2_TRY
1628 {
1629 /* Capture the caller's buffer */
1630 Foreground = *(PPROCESS_FOREGROUND_BACKGROUND)ProcessInformation;
1631 }
1633 {
1634 /* Return the exception code */
1636 _SEH2_YIELD(break);
1637 }
1638 _SEH2_END;
1639
1640 /* Set process priority mode (foreground or background) */
1642 Foreground.Foreground ?
1646 break;
1647
1649
1650 /* Validate input length */
1651 if (ProcessInformationLength != sizeof(KPRIORITY))
1652 {
1654 break;
1655 }
1656
1657 /* Enter SEH for direct buffer read */
1658 _SEH2_TRY
1659 {
1660 BasePriority = *(KPRIORITY*)ProcessInformation;
1661 }
1663 {
1664 /* Get exception code */
1665 Break = 0;
1667 _SEH2_YIELD(break);
1668 }
1669 _SEH2_END;
1670
1671 /* Extract the memory priority out of there */
1672 if (BasePriority & 0x80000000)
1673 {
1674 MemoryPriority = MEMORY_PRIORITY_FOREGROUND;
1675 BasePriority &= ~0x80000000;
1676 }
1677 else
1678 {
1679 MemoryPriority = MEMORY_PRIORITY_BACKGROUND;
1680 }
1681
1682 /* Validate the number */
1683 if ((BasePriority > HIGH_PRIORITY) || (BasePriority <= LOW_PRIORITY))
1684 {
1687 }
1688
1689 /* Check if the new base is higher */
1690 if (BasePriority > Process->Pcb.BasePriority)
1691 {
1695 PreviousMode);
1696 if (!HasPrivilege)
1697 {
1699 DPRINT1("Privilege to change priority from %lx to %lx lacking\n", Process->Pcb.BasePriority, BasePriority);
1701 }
1702 }
1703
1704 /* Call Ke */
1705 KeSetPriorityAndQuantumProcess(&Process->Pcb, BasePriority, 0);
1706
1707 /* Now set the memory priority */
1708 MmSetMemoryPriorityProcess(Process, MemoryPriority);
1710 break;
1711
1713
1714 /* Validate input length */
1715 if (ProcessInformationLength != sizeof(ULONG))
1716 {
1718 break;
1719 }
1720
1721 /* Enter SEH for direct buffer read */
1722 _SEH2_TRY
1723 {
1724 Boost = *(PULONG)ProcessInformation;
1725 }
1727 {
1728 /* Get exception code */
1729 Break = 0;
1731 _SEH2_YIELD(break);
1732 }
1733 _SEH2_END;
1734
1735 /* Make sure the process isn't dying */
1736 if (ExAcquireRundownProtection(&Process->RundownProtect))
1737 {
1738 /* Lock it */
1740 ExAcquirePushLockShared(&Process->ProcessLock);
1741
1742 /* Loop the threads */
1743 for (Next = Process->ThreadListHead.Flink;
1744 Next != &Process->ThreadListHead;
1745 Next = Next->Flink)
1746 {
1747 /* Call Ke for the thread */
1748 Thread = CONTAINING_RECORD(Next, ETHREAD, ThreadListEntry);
1750 }
1751
1752 /* Release the lock and rundown */
1753 ExReleasePushLockShared(&Process->ProcessLock);
1755 ExReleaseRundownProtection(&Process->RundownProtect);
1756
1757 /* Set success code */
1759 }
1760 else
1761 {
1762 /* Avoid race conditions */
1764 }
1765 break;
1766
1768
1769 /* Check buffer length */
1770 if (ProcessInformationLength != sizeof(ULONG))
1771 {
1773 break;
1774 }
1775
1776 /* Enter SEH for direct buffer read */
1777 _SEH2_TRY
1778 {
1779 Break = *(PULONG)ProcessInformation;
1780 }
1782 {
1783 /* Get exception code */
1784 Break = 0;
1786 _SEH2_YIELD(break);
1787 }
1788 _SEH2_END;
1789
1790 /* Setting 'break on termination' requires the SeDebugPrivilege */
1792 {
1793 /* We don't hold the privilege, bail out */
1795 break;
1796 }
1797
1798 /* Set or clear the flag */
1799 if (Break)
1800 {
1802 }
1803 else
1804 {
1806 }
1807
1808 break;
1809
1811
1812 /* Check buffer length */
1813 if (ProcessInformationLength != sizeof(KAFFINITY))
1814 {
1816 break;
1817 }
1818
1819 /* Enter SEH for direct buffer read */
1820 _SEH2_TRY
1821 {
1822 Affinity = *(PKAFFINITY)ProcessInformation;
1823 }
1825 {
1826 /* Get exception code */
1827 Break = 0;
1829 _SEH2_YIELD(break);
1830 }
1831 _SEH2_END;
1832
1833 /* Make sure it's valid for the CPUs present */
1834 ValidAffinity = Affinity & KeActiveProcessors;
1835 if (!Affinity || (ValidAffinity != Affinity))
1836 {
1838 break;
1839 }
1840
1841 /* Check if it's within job affinity limits */
1842 if (Process->Job)
1843 {
1844 /* Not yet implemented */
1847 break;
1848 }
1849
1850 /* Make sure the process isn't dying */
1851 if (ExAcquireRundownProtection(&Process->RundownProtect))
1852 {
1853 /* Lock it */
1855 ExAcquirePushLockShared(&Process->ProcessLock);
1856
1857 /* Call Ke to do the work */
1858 KeSetAffinityProcess(&Process->Pcb, ValidAffinity);
1859
1860 /* Release the lock and rundown */
1861 ExReleasePushLockShared(&Process->ProcessLock);
1863 ExReleaseRundownProtection(&Process->RundownProtect);
1864
1865 /* Set success code */
1867 }
1868 else
1869 {
1870 /* Avoid race conditions */
1872 }
1873 break;
1874
1875 /* Priority Boosting status */
1877
1878 /* Validate input length */
1879 if (ProcessInformationLength != sizeof(ULONG))
1880 {
1882 break;
1883 }
1884
1885 /* Enter SEH for direct buffer read */
1886 _SEH2_TRY
1887 {
1888 DisableBoost = *(PBOOLEAN)ProcessInformation;
1889 }
1891 {
1892 /* Get exception code */
1893 Break = 0;
1895 _SEH2_YIELD(break);
1896 }
1897 _SEH2_END;
1898
1899 /* Make sure the process isn't dying */
1900 if (ExAcquireRundownProtection(&Process->RundownProtect))
1901 {
1902 /* Lock it */
1904 ExAcquirePushLockShared(&Process->ProcessLock);
1905
1906 /* Call Ke to do the work */
1907 KeSetDisableBoostProcess(&Process->Pcb, DisableBoost);
1908
1909 /* Loop the threads too */
1910 for (Next = Process->ThreadListHead.Flink;
1911 Next != &Process->ThreadListHead;
1912 Next = Next->Flink)
1913 {
1914 /* Call Ke for the thread */
1915 Thread = CONTAINING_RECORD(Next, ETHREAD, ThreadListEntry);
1916 KeSetDisableBoostThread(&Thread->Tcb, DisableBoost);
1917 }
1918
1919 /* Release the lock and rundown */
1920 ExReleasePushLockShared(&Process->ProcessLock);
1922 ExReleaseRundownProtection(&Process->RundownProtect);
1923
1924 /* Set success code */
1926 }
1927 else
1928 {
1929 /* Avoid race conditions */
1931 }
1932 break;
1933
1934 case ProcessDebugFlags:
1935
1936 /* Check buffer length */
1937 if (ProcessInformationLength != sizeof(ULONG))
1938 {
1940 break;
1941 }
1942
1943 /* Enter SEH for direct buffer read */
1944 _SEH2_TRY
1945 {
1946 DebugFlags = *(PULONG)ProcessInformation;
1947 }
1949 {
1950 /* Get exception code */
1952 _SEH2_YIELD(break);
1953 }
1954 _SEH2_END;
1955
1956 /* Set the mode */
1957 if (DebugFlags & ~1)
1958 {
1960 }
1961 else
1962 {
1963 if (DebugFlags & 1)
1964 {
1966 }
1967 else
1968 {
1970 }
1971 }
1972
1973 /* Done */
1975 break;
1976
1978
1979 /* Check buffer length */
1980 if (ProcessInformationLength != sizeof(BOOLEAN))
1981 {
1983 break;
1984 }
1985
1986 /* Enter SEH for direct buffer read */
1987 _SEH2_TRY
1988 {
1989 EnableFixup = *(PULONG)ProcessInformation;
1990 }
1992 {
1993 /* Get exception code */
1995 _SEH2_YIELD(break);
1996 }
1997 _SEH2_END;
1998
1999 /* Set the mode */
2000 if (EnableFixup)
2001 {
2002 Process->DefaultHardErrorProcessing |= SEM_NOALIGNMENTFAULTEXCEPT;
2003 }
2004 else
2005 {
2006 Process->DefaultHardErrorProcessing &= ~SEM_NOALIGNMENTFAULTEXCEPT;
2007 }
2008
2009 /* Call Ke for the update */
2012 break;
2013
2015
2016 /* Only TCB can do this */
2018 {
2019 /* We don't hold the privilege, bail out */
2020 DPRINT1("Need TCB to set IOPL\n");
2022 break;
2023 }
2024
2025 /* Only supported on x86 */
2026#if defined (_X86_)
2027 Ke386SetIOPL();
2028#elif defined(_M_AMD64)
2029 /* On x64 this function isn't implemented.
2030 On Windows 2003 it returns success.
2031 On Vista+ it returns STATUS_NOT_IMPLEMENTED. */
2032 if ((ExGetPreviousMode() != KernelMode) &&
2033 (RtlRosGetAppcompatVersion() > _WIN32_WINNT_WS03))
2034 {
2036 }
2037#else
2039#endif
2040 /* Done */
2041 break;
2042
2044
2045 /* Check buffer length */
2046 if (ProcessInformationLength != sizeof(ULONG))
2047 {
2049 break;
2050 }
2051
2053 {
2055 break;
2056 }
2057
2058 /* Enter SEH for direct buffer read */
2059 _SEH2_TRY
2060 {
2061 NoExecute = *(PULONG)ProcessInformation;
2062 }
2064 {
2065 /* Get exception code */
2067 _SEH2_YIELD(break);
2068 }
2069 _SEH2_END;
2070
2071 /* Call Mm for the update */
2072 Status = MmSetExecuteOptions(NoExecute);
2073 break;
2074
2075 case ProcessDeviceMap:
2076
2077 /* Check buffer length */
2078 if (ProcessInformationLength != sizeof(HANDLE))
2079 {
2081 break;
2082 }
2083
2084 /* Use SEH for capture */
2085 _SEH2_TRY
2086 {
2087 /* Capture the handle */
2088 DirectoryHandle = *(PHANDLE)ProcessInformation;
2089 }
2091 {
2092 /* Get the exception code */
2094 _SEH2_YIELD(break);
2095 }
2096 _SEH2_END;
2097
2098 /* Call Ob to set the device map */
2100 break;
2101
2102
2103 /* We currently don't implement any of these */
2105 case ProcessLdtSize:
2107 DPRINT1("VDM/16-bit Request not implemented: %lu\n", ProcessInformationClass);
2109 break;
2110
2111 case ProcessQuotaLimits:
2112
2114 1,
2115 ProcessInformation,
2116 ProcessInformationLength,
2117 PreviousMode);
2118 break;
2119
2121 DPRINT1("WS watch not implemented\n");
2123 break;
2124
2126 DPRINT1("Handle tracing not implemented\n");
2128 break;
2129
2130 /* Anything else is invalid */
2131 default:
2132 DPRINT1("Invalid Server 2003 Info Class: %lu\n", ProcessInformationClass);
2134 }
2135
2136 /* Dereference and return status */
2138 return Status;
2139}
2140
2141/*
2142 * @implemented
2143 */
2145NTAPI
2148 IN PVOID ThreadInformation,
2150{
2155 KPRIORITY Priority = 0;
2156 KAFFINITY Affinity = 0, CombinedAffinity;
2157 PVOID Address = NULL;
2159 ULONG_PTR DisableBoost = 0;
2160 ULONG_PTR IdealProcessor = 0;
2161 ULONG_PTR Break = 0;
2162 PTEB Teb;
2163 ULONG_PTR TlsIndex = 0;
2164 PVOID *ExpansionSlots;
2165 PETHREAD ProcThread;
2167 PAGED_CODE();
2168
2169 /* Validate the information class */
2173 ThreadInformation,
2175 PreviousMode);
2176 if (!NT_SUCCESS(Status))
2177 {
2178 DPRINT1("NtSetInformationThread(ThreadInformationClass: %lu): Class validation failed! (Status: 0x%lx)\n",
2180 return Status;
2181 }
2182
2183 /* Check what kind of information class this is */
2184 switch (ThreadInformationClass)
2185 {
2186 /* Thread priority */
2187 case ThreadPriority:
2188
2189 /* Check buffer length */
2190 if (ThreadInformationLength != sizeof(KPRIORITY))
2191 {
2193 break;
2194 }
2195
2196 /* Use SEH for capture */
2197 _SEH2_TRY
2198 {
2199 /* Get the priority */
2200 Priority = *(PLONG)ThreadInformation;
2201 }
2203 {
2204 /* Get the exception code */
2206 _SEH2_YIELD(break);
2207 }
2208 _SEH2_END;
2209
2210 /* Validate it */
2211 if ((Priority > HIGH_PRIORITY) ||
2213 {
2214 /* Fail */
2216 break;
2217 }
2218
2219 /* Check for the required privilege */
2221 {
2223 ThreadHandle,
2225 PreviousMode);
2226 if (!HasPrivilege)
2227 {
2228 DPRINT1("Privilege to change priority to %lx lacking\n", Priority);
2230 }
2231 }
2232
2233 /* Reference the thread */
2234 Status = ObReferenceObjectByHandle(ThreadHandle,
2238 (PVOID*)&Thread,
2239 NULL);
2240 if (!NT_SUCCESS(Status))
2241 break;
2242
2243 /* Set the priority */
2245
2246 /* Dereference the thread */
2248 break;
2249
2250 case ThreadBasePriority:
2251
2252 /* Check buffer length */
2253 if (ThreadInformationLength != sizeof(LONG))
2254 {
2256 break;
2257 }
2258
2259 /* Use SEH for capture */
2260 _SEH2_TRY
2261 {
2262 /* Get the priority */
2263 Priority = *(PLONG)ThreadInformation;
2264 }
2266 {
2267 /* Get the exception code */
2269 _SEH2_YIELD(break);
2270 }
2271 _SEH2_END;
2272
2273 /* Validate it */
2276 {
2277 /* These ones are OK */
2278 if ((Priority != THREAD_BASE_PRIORITY_LOWRT + 1) &&
2280 {
2281 /* Check if the process is real time */
2282 if (PsGetCurrentProcess()->PriorityClass !=
2284 {
2285 /* It isn't, fail */
2287 break;
2288 }
2289 }
2290 }
2291
2292 /* Reference the thread */
2293 Status = ObReferenceObjectByHandle(ThreadHandle,
2297 (PVOID*)&Thread,
2298 NULL);
2299 if (!NT_SUCCESS(Status))
2300 break;
2301
2302 /* Set the base priority */
2304
2305 /* Dereference the thread */
2307 break;
2308
2309 case ThreadAffinityMask:
2310
2311 /* Check buffer length */
2312 if (ThreadInformationLength != sizeof(ULONG_PTR))
2313 {
2315 break;
2316 }
2317
2318 /* Use SEH for capture */
2319 _SEH2_TRY
2320 {
2321 /* Get the priority */
2322 Affinity = *(PULONG_PTR)ThreadInformation;
2323 }
2325 {
2326 /* Get the exception code */
2328 _SEH2_YIELD(break);
2329 }
2330 _SEH2_END;
2331
2332 /* Validate it */
2333 if (!Affinity)
2334 {
2335 /* Fail */
2337 break;
2338 }
2339
2340 /* Reference the thread */
2341 Status = ObReferenceObjectByHandle(ThreadHandle,
2345 (PVOID*)&Thread,
2346 NULL);
2347 if (!NT_SUCCESS(Status))
2348 break;
2349
2350 /* Get the process */
2351 Process = Thread->ThreadsProcess;
2352
2353 /* Try to acquire rundown */
2354 if (ExAcquireRundownProtection(&Process->RundownProtect))
2355 {
2356 /* Lock it */
2358 ExAcquirePushLockShared(&Process->ProcessLock);
2359
2360 /* Combine masks */
2361 CombinedAffinity = Affinity & Process->Pcb.Affinity;
2362 if (CombinedAffinity != Affinity)
2363 {
2364 /* Fail */
2366 }
2367 else
2368 {
2369 /* Set the affinity */
2370 KeSetAffinityThread(&Thread->Tcb, CombinedAffinity);
2371 }
2372
2373 /* Release the lock and rundown */
2374 ExReleasePushLockShared(&Process->ProcessLock);
2376 ExReleaseRundownProtection(&Process->RundownProtect);
2377 }
2378 else
2379 {
2380 /* Too late */
2382 }
2383
2384 /* Dereference the thread */
2386 break;
2387
2389
2390 /* Check buffer length */
2391 if (ThreadInformationLength != sizeof(HANDLE))
2392 {
2394 break;
2395 }
2396
2397 /* Use SEH for capture */
2398 _SEH2_TRY
2399 {
2400 /* Save the token handle */
2401 TokenHandle = *(PHANDLE)ThreadInformation;
2402 }
2404 {
2405 /* Get the exception code */
2407 _SEH2_YIELD(break);
2408 }
2409 _SEH2_END;
2410
2411 /* Reference the thread */
2412 Status = ObReferenceObjectByHandle(ThreadHandle,
2416 (PVOID*)&Thread,
2417 NULL);
2418 if (!NT_SUCCESS(Status))
2419 break;
2420
2421 /* Assign the actual token */
2423
2424 /* Dereference the thread */
2426 break;
2427
2429
2430 /* Check buffer length */
2431 if (ThreadInformationLength != sizeof(ULONG_PTR))
2432 {
2434 break;
2435 }
2436
2437 /* Use SEH for capture */
2438 _SEH2_TRY
2439 {
2440 /* Get the priority */
2441 Address = *(PVOID*)ThreadInformation;
2442 }
2444 {
2445 /* Get the exception code */
2447 _SEH2_YIELD(break);
2448 }
2449 _SEH2_END;
2450
2451 /* Reference the thread */
2452 Status = ObReferenceObjectByHandle(ThreadHandle,
2456 (PVOID*)&Thread,
2457 NULL);
2458 if (!NT_SUCCESS(Status))
2459 break;
2460
2461 /* Set the address */
2463
2464 /* Dereference the thread */
2466 break;
2467
2469
2470 /* Check buffer length */
2471 if (ThreadInformationLength != sizeof(ULONG_PTR))
2472 {
2474 break;
2475 }
2476
2477 /* Use SEH for capture */
2478 _SEH2_TRY
2479 {
2480 /* Get the priority */
2481 IdealProcessor = *(PULONG_PTR)ThreadInformation;
2482 }
2484 {
2485 /* Get the exception code */
2487 _SEH2_YIELD(break);
2488 }
2489 _SEH2_END;
2490
2491 /* Validate it */
2492 if (IdealProcessor > MAXIMUM_PROCESSORS)
2493 {
2494 /* Fail */
2496 break;
2497 }
2498
2499 /* Reference the thread */
2500 Status = ObReferenceObjectByHandle(ThreadHandle,
2504 (PVOID*)&Thread,
2505 NULL);
2506 if (!NT_SUCCESS(Status))
2507 break;
2508
2509 /* Set the ideal */
2511 (CCHAR)IdealProcessor);
2512
2513 /* Get the TEB and protect the thread */
2514 Teb = Thread->Tcb.Teb;
2516 {
2517 /* Save the ideal processor */
2518 Teb->IdealProcessor = Thread->Tcb.IdealProcessor;
2519
2520 /* Release rundown protection */
2522 }
2523
2524 /* Dereference the thread */
2526 break;
2527
2529
2530 /* Check buffer length */
2531 if (ThreadInformationLength != sizeof(ULONG_PTR))
2532 {
2534 break;
2535 }
2536
2537 /* Use SEH for capture */
2538 _SEH2_TRY
2539 {
2540 /* Get the priority */
2541 DisableBoost = *(PULONG_PTR)ThreadInformation;
2542 }
2544 {
2545 /* Get the exception code */
2547 _SEH2_YIELD(break);
2548 }
2549 _SEH2_END;
2550
2551 /* Reference the thread */
2552 Status = ObReferenceObjectByHandle(ThreadHandle,
2556 (PVOID*)&Thread,
2557 NULL);
2558 if (!NT_SUCCESS(Status))
2559 break;
2560
2561 /* Call the kernel */
2562 KeSetDisableBoostThread(&Thread->Tcb, (BOOLEAN)DisableBoost);
2563
2564 /* Dereference the thread */
2566 break;
2567
2568 case ThreadZeroTlsCell:
2569
2570 /* Check buffer length */
2571 if (ThreadInformationLength != sizeof(ULONG))
2572 {
2574 break;
2575 }
2576
2577 /* Use SEH for capture */
2578 _SEH2_TRY
2579 {
2580 /* Get the priority */
2581 TlsIndex = *(PULONG)ThreadInformation;
2582 }
2584 {
2585 /* Get the exception code */
2587 _SEH2_YIELD(break);
2588 }
2589 _SEH2_END;
2590
2591 /* Reference the thread */
2592 Status = ObReferenceObjectByHandle(ThreadHandle,
2596 (PVOID*)&Thread,
2597 NULL);
2598 if (!NT_SUCCESS(Status))
2599 break;
2600
2601 /* This is only valid for the current thread */
2602 if (Thread != PsGetCurrentThread())
2603 {
2604 /* Fail */
2607 break;
2608 }
2609
2610 /* Get the process */
2611 Process = Thread->ThreadsProcess;
2612
2613 /* Loop the threads */
2614 ProcThread = PsGetNextProcessThread(Process, NULL);
2615 while (ProcThread)
2616 {
2617 /* Acquire rundown */
2619 {
2620 /* Get the TEB */
2621 Teb = ProcThread->Tcb.Teb;
2622 if (Teb)
2623 {
2624 /* Check if we're in the expansion range */
2626 {
2629 {
2630 /* Check if we have expansion slots */
2631 ExpansionSlots = Teb->TlsExpansionSlots;
2632 if (ExpansionSlots)
2633 {
2634 /* Clear the index */
2635 ExpansionSlots[TlsIndex - TLS_MINIMUM_AVAILABLE] = 0;
2636 }
2637 }
2638 }
2639 else
2640 {
2641 /* Clear the index */
2642 Teb->TlsSlots[TlsIndex] = NULL;
2643 }
2644 }
2645
2646 /* Release rundown */
2648 }
2649
2650 /* Go to the next thread */
2651 ProcThread = PsGetNextProcessThread(Process, ProcThread);
2652 }
2653
2654 /* Dereference the thread */
2656 break;
2657
2659
2660 /* Check buffer length */
2661 if (ThreadInformationLength != sizeof(ULONG))
2662 {
2664 break;
2665 }
2666
2667 /* Enter SEH for direct buffer read */
2668 _SEH2_TRY
2669 {
2670 Break = *(PULONG)ThreadInformation;
2671 }
2673 {
2674 /* Get exception code */
2675 Break = 0;
2677 _SEH2_YIELD(break);
2678 }
2679 _SEH2_END;
2680
2681 /* Setting 'break on termination' requires the SeDebugPrivilege */
2683 {
2684 /* We don't hold the privilege, bail out */
2686 break;
2687 }
2688
2689 /* Reference the thread */
2690 Status = ObReferenceObjectByHandle(ThreadHandle,
2694 (PVOID*)&Thread,
2695 NULL);
2696 if (!NT_SUCCESS(Status))
2697 break;
2698
2699 /* Set or clear the flag */
2700 if (Break)
2701 {
2703 }
2704 else
2705 {
2707 }
2708
2709 /* Dereference the thread */
2711 break;
2712
2714
2715 /* Check buffer length */
2716 if (ThreadInformationLength != 0)
2717 {
2719 break;
2720 }
2721
2722 /* Reference the thread */
2723 Status = ObReferenceObjectByHandle(ThreadHandle,
2727 (PVOID*)&Thread,
2728 NULL);
2729 if (!NT_SUCCESS(Status))
2730 break;
2731
2732 /* Set the flag */
2734
2735 /* Dereference the thread */
2737 break;
2738
2739 /* Anything else */
2740 default:
2741 /* Not yet implemented */
2742 DPRINT1("Not implemented: %lu\n", ThreadInformationClass);
2744 }
2745
2746 return Status;
2747}
2748
2749/*
2750 * @implemented
2751 */
2753NTAPI
2756 OUT PVOID ThreadInformation,
2759{
2763 ULONG Access;
2764 ULONG Length = 0;
2765 PTHREAD_BASIC_INFORMATION ThreadBasicInfo =
2766 (PTHREAD_BASIC_INFORMATION)ThreadInformation;
2767 PKERNEL_USER_TIMES ThreadTime = (PKERNEL_USER_TIMES)ThreadInformation;
2768 KIRQL OldIrql;
2769 ULONG ThreadTerminated;
2770 PAGED_CODE();
2771
2772 /* Validate the information class */
2777 ThreadInformation,
2780 NULL,
2781 PreviousMode);
2782 if (!NT_SUCCESS(Status))
2783 {
2784 DPRINT1("NtQueryInformationThread(ThreadInformationClass: %lu): Class validation failed! (Status: 0x%lx)\n",
2786 return Status;
2787 }
2788
2789 /* Check what class this is */
2790 Access = THREAD_QUERY_INFORMATION;
2791
2792 /* Check what kind of information class this is */
2793 switch (ThreadInformationClass)
2794 {
2795 /* Basic thread information */
2797
2798 /* Set the return length */
2800
2802 {
2804 break;
2805 }
2806
2807 /* Reference the thread */
2808 Status = ObReferenceObjectByHandle(ThreadHandle,
2809 Access,
2812 (PVOID*)&Thread,
2813 NULL);
2814 if (!NT_SUCCESS(Status))
2815 break;
2816
2817 /* Protect writes with SEH */
2818 _SEH2_TRY
2819 {
2820 /* Write all the information from the ETHREAD/KTHREAD */
2821 ThreadBasicInfo->ExitStatus = Thread->ExitStatus;
2822 ThreadBasicInfo->TebBaseAddress = (PVOID)Thread->Tcb.Teb;
2823 ThreadBasicInfo->ClientId = Thread->Cid;
2824 ThreadBasicInfo->AffinityMask = Thread->Tcb.Affinity;
2825 ThreadBasicInfo->Priority = Thread->Tcb.Priority;
2826 ThreadBasicInfo->BasePriority = KeQueryBasePriorityThread(&Thread->Tcb);
2827 }
2829 {
2830 /* Get exception code */
2832 }
2833 _SEH2_END;
2834
2835 /* Dereference the thread */
2837 break;
2838
2839 /* Thread time information */
2840 case ThreadTimes:
2841
2842 /* Set the return length */
2843 Length = sizeof(KERNEL_USER_TIMES);
2844
2846 {
2848 break;
2849 }
2850
2851 /* Reference the thread */
2852 Status = ObReferenceObjectByHandle(ThreadHandle,
2853 Access,
2856 (PVOID*)&Thread,
2857 NULL);
2858 if (!NT_SUCCESS(Status))
2859 break;
2860
2861 /* Protect writes with SEH */
2862 _SEH2_TRY
2863 {
2864 /* Copy time information from ETHREAD/KTHREAD */
2867 ThreadTime->CreateTime = Thread->CreateTime;
2868
2869 /* Exit time is in a union and only valid on actual exit! */
2871 {
2872 ThreadTime->ExitTime = Thread->ExitTime;
2873 }
2874 else
2875 {
2876 ThreadTime->ExitTime.QuadPart = 0;
2877 }
2878 }
2880 {
2881 /* Get exception code */
2883 }
2884 _SEH2_END;
2885
2886 /* Dereference the thread */
2888 break;
2889
2891
2892 /* Set the return length*/
2893 Length = sizeof(PVOID);
2894
2896 {
2898 break;
2899 }
2900
2901 /* Reference the thread */
2902 Status = ObReferenceObjectByHandle(ThreadHandle,
2903 Access,
2906 (PVOID*)&Thread,
2907 NULL);
2908 if (!NT_SUCCESS(Status))
2909 break;
2910
2911 /* Protect write with SEH */
2912 _SEH2_TRY
2913 {
2914 /* Return the Win32 Start Address */
2915 *(PVOID*)ThreadInformation = Thread->Win32StartAddress;
2916 }
2918 {
2919 /* Get exception code */
2921 }
2922 _SEH2_END;
2923
2924 /* Dereference the thread */
2926 break;
2927
2929
2930 /* Set the return length*/
2931 Length = sizeof(LARGE_INTEGER);
2932
2934 {
2936 break;
2937 }
2938
2939 /* Reference the thread */
2940 Status = ObReferenceObjectByHandle(ThreadHandle,
2941 Access,
2944 (PVOID*)&Thread,
2945 NULL);
2946 if (!NT_SUCCESS(Status))
2947 break;
2948
2949 /* Protect write with SEH */
2950 _SEH2_TRY
2951 {
2952 /* FIXME */
2953 (*(PLARGE_INTEGER)ThreadInformation).QuadPart = 0;
2954 }
2956 {
2957 /* Get exception code */
2959 }
2960 _SEH2_END;
2961
2962 /* Dereference the thread */
2964 break;
2965
2967
2968 /* Set the return length*/
2969 Length = sizeof(ULONG);
2970
2972 {
2974 break;
2975 }
2976
2977 /* Reference the thread */
2978 Status = ObReferenceObjectByHandle(ThreadHandle,
2979 Access,
2982 (PVOID*)&Thread,
2983 NULL);
2984 if (!NT_SUCCESS(Status))
2985 break;
2986
2987 /* Protect write with SEH */
2988 _SEH2_TRY
2989 {
2990 /* Return whether or not we are the last thread */
2991 *(PULONG)ThreadInformation = ((Thread->ThreadsProcess->
2992 ThreadListHead.Flink->Flink ==
2993 &Thread->ThreadsProcess->
2995 TRUE : FALSE);
2996 }
2998 {
2999 /* Get exception code */
3001 }
3002 _SEH2_END;
3003
3004 /* Dereference the thread */
3006 break;
3007
3008 case ThreadIsIoPending:
3009
3010 /* Set the return length*/
3011 Length = sizeof(ULONG);
3012
3014 {
3016 break;
3017 }
3018
3019 /* Reference the thread */
3020 Status = ObReferenceObjectByHandle(ThreadHandle,
3021 Access,
3024 (PVOID*)&Thread,
3025 NULL);
3026 if (!NT_SUCCESS(Status))
3027 break;
3028
3029 /* Raise the IRQL to protect the IRP list */
3031
3032 /* Protect write with SEH */
3033 _SEH2_TRY
3034 {
3035 /* Check if the IRP list is empty or not */
3036 *(PULONG)ThreadInformation = !IsListEmpty(&Thread->IrpList);
3037 }
3039 {
3040 /* Get exception code */
3042 }
3043 _SEH2_END;
3044
3045 /* Lower IRQL back */
3047
3048 /* Dereference the thread */
3050 break;
3051
3052 /* LDT and GDT information */
3054
3055#if defined(_X86_)
3056 /* Reference the thread */
3057 Status = ObReferenceObjectByHandle(ThreadHandle,
3058 Access,
3061 (PVOID*)&Thread,
3062 NULL);
3063 if (!NT_SUCCESS(Status))
3064 break;
3065
3066 /* Call the worker routine */
3068 ThreadInformation,
3070 ReturnLength);
3071
3072 /* Dereference the thread */
3074#else
3075 /* Only implemented on x86 */
3077#endif
3078 break;
3079
3081
3082 /* Set the return length*/
3083 Length = sizeof(ULONG);
3084
3086 {
3088 break;
3089 }
3090
3091 /* Reference the thread */
3092 Status = ObReferenceObjectByHandle(ThreadHandle,
3093 Access,
3096 (PVOID*)&Thread,
3097 NULL);
3098 if (!NT_SUCCESS(Status))
3099 break;
3100
3101 _SEH2_TRY
3102 {
3103 *(PULONG)ThreadInformation = Thread->Tcb.DisableBoost ? 1 : 0;
3104 }
3106 {
3108 }
3109 _SEH2_END;
3110
3111 /* Dereference the thread */
3113 break;
3114
3116
3117 /* Set the return length */
3118 Length = sizeof(ULONG);
3119
3121 {
3123 break;
3124 }
3125
3126 /* Reference the thread */
3127 Status = ObReferenceObjectByHandle(ThreadHandle,
3128 Access,
3131 (PVOID*)&Thread,
3132 NULL);
3133 if (!NT_SUCCESS(Status))
3134 break;
3135
3136 _SEH2_TRY
3137 {
3138 *(PULONG)ThreadInformation = Thread->BreakOnTermination;
3139 }
3141 {
3143 }
3144 _SEH2_END;
3145
3146 /* Dereference the thread */
3148 break;
3149
3150 case ThreadIsTerminated:
3151
3152 /* Set the return length*/
3153 Length = sizeof(ThreadTerminated);
3154
3156 {
3158 break;
3159 }
3160
3161 /* Reference the thread */
3162 Status = ObReferenceObjectByHandle(ThreadHandle,
3163 Access,
3166 (PVOID*)&Thread,
3167 NULL);
3168 if (!NT_SUCCESS(Status))
3169 break;
3170
3171 ThreadTerminated = PsIsThreadTerminating(Thread);
3172
3173 _SEH2_TRY
3174 {
3175 *(PULONG)ThreadInformation = ThreadTerminated ? 1 : 0;
3176 }
3178 {
3180 }
3181 _SEH2_END;
3182
3183 /* Dereference the thread */
3185 break;
3186
3187 /* Anything else */
3188 default:
3189 /* Not yet implemented */
3190 DPRINT1("Not implemented: %lu\n", ThreadInformationClass);
3192 }
3193
3194 /* Protect write with SEH */
3195 _SEH2_TRY
3196 {
3197 /* Check if caller wanted return length */
3199 }
3201 {
3202 /* Get exception code */
3204 }
3205 _SEH2_END;
3206
3207 return Status;
3208}
3209
3210/* EOF */
#define PAGED_CODE()
#define STATUS_PRIVILEGE_NOT_HELD
Definition: DriverTester.h:9
@ ObjectNameInformation
Definition: DriverTester.h:55
_In_ PVOID _In_ ULONG _Out_ PVOID _In_ ULONG _Inout_ PULONG ReturnLength
_In_ PVOID _In_ ULONG _Out_ PVOID _In_ ULONG _Inout_ PULONG _In_ KPROCESSOR_MODE PreviousMode
static HANDLE DirectoryHandle
Definition: ObType.c:48
unsigned char BOOLEAN
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
BOOL Query(LPCTSTR *ServiceArgs, DWORD ArgCount, BOOL bExtended)
Definition: query.c:292
KAFFINITY * PKAFFINITY
Definition: basetsd.h:189
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
@ ProcessDebugPort
Definition: cicbase.cpp:64
@ ProcessBreakOnTermination
Definition: cicbase.cpp:67
@ ProcessBasicInformation
Definition: cicbase.cpp:63
@ ProcessWow64Information
Definition: cicbase.cpp:65
@ ProcessImageFileName
Definition: cicbase.cpp:66
enum _PROCESSINFOCLASS PROCESSINFOCLASS
Definition: loader.c:63
#define STATUS_NOT_IMPLEMENTED
Definition: d3dkmdt.h:42
NTSTATUS NTAPI DbgkOpenProcessDebugPort(IN PEPROCESS Process, IN KPROCESSOR_MODE PreviousMode, OUT HANDLE *DebugHandle)
Definition: dbgkobj.c:1526
#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
struct _THREAD_BASIC_INFORMATION THREAD_BASIC_INFORMATION
ULONG_PTR KAFFINITY
Definition: compat.h:85
@ ThreadDescriptorTableEntry
Definition: compat.h:941
@ ThreadAmILastThread
Definition: compat.h:947
@ ThreadTimes
Definition: compat.h:936
@ ThreadPriority
Definition: compat.h:937
@ ThreadIdealProcessor
Definition: compat.h:948
@ ThreadQuerySetWin32StartAddress
Definition: compat.h:944
@ ThreadIsTerminated
Definition: compat.h:955
@ ThreadBreakOnTermination
Definition: compat.h:953
@ ThreadImpersonationToken
Definition: compat.h:940
@ ThreadAffinityMask
Definition: compat.h:939
@ ThreadBasePriority
Definition: compat.h:938
@ ThreadBasicInformation
Definition: compat.h:935
@ ThreadPriorityBoost
Definition: compat.h:949
@ ThreadPerformanceCount
Definition: compat.h:946
@ ThreadIsIoPending
Definition: compat.h:951
@ ThreadZeroTlsCell
Definition: compat.h:945
@ ThreadHideFromDebugger
Definition: compat.h:952
enum _THREADINFOCLASS THREADINFOCLASS
Definition: thread.c:101
struct _THREAD_BASIC_INFORMATION * PTHREAD_BASIC_INFORMATION
LONG KPRIORITY
Definition: compat.h:803
#define UlongToPtr(u)
Definition: config.h:106
#define ULONG_PTR
Definition: config.h:101
UNICODE_STRING * PUNICODE_STRING
Definition: env_spec_w32.h:373
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define PsGetCurrentThread()
Definition: env_spec_w32.h:81
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define APC_LEVEL
Definition: env_spec_w32.h:695
#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 ExFreePool(addr)
Definition: env_spec_w32.h:352
struct _UNICODE_STRING UNICODE_STRING
#define ExReleaseRundownProtection
Definition: ex.h:139
#define ExGetPreviousMode
Definition: ex.h:143
FORCEINLINE VOID ExAcquirePushLockShared(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1108
FORCEINLINE VOID ExReleasePushLockShared(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1216
#define ExAcquireRundownProtection
Definition: ex.h:138
#define MAXIMUM_PROCESSORS
Definition: rwlock.h:5
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:223
Status
Definition: gdiplustypes.h:25
#define ICIF_PROBE_READ
Definition: icif.h:25
#define PROCESS_SUSPEND_RESUME
Definition: pstypes.h:168
struct _PROCESS_PRIORITY_CLASS PROCESS_PRIORITY_CLASS
#define PROCESS_QUERY_INFORMATION
Definition: pstypes.h:167
#define THREAD_SET_THREAD_TOKEN
Definition: pstypes.h:151
#define THREAD_BASE_PRIORITY_LOWRT
Definition: pstypes.h:183
struct _PROCESS_PRIORITY_CLASS * PPROCESS_PRIORITY_CLASS
#define THREAD_QUERY_INFORMATION
Definition: pstypes.h:150
#define PROCESS_PRIORITY_CLASS_ABOVE_NORMAL
Definition: pstypes.h:113
#define PSF_NO_DEBUG_INHERIT_BIT
Definition: pstypes.h:275
#define CT_HIDE_FROM_DEBUGGER_BIT
Definition: pstypes.h:241
#define THREAD_BASE_PRIORITY_MIN
Definition: pstypes.h:185
#define PROCESS_SET_SESSIONID
Definition: pstypes.h:160
#define THREAD_BASE_PRIORITY_MAX
Definition: pstypes.h:184
@ PsProcessPriorityForeground
Definition: pstypes.h:422
@ PsProcessPriorityBackground
Definition: pstypes.h:423
#define THREAD_BASE_PRIORITY_IDLE
Definition: pstypes.h:186
#define PROCESS_SET_INFORMATION
Definition: pstypes.h:166
#define PSF_VDM_ALLOWED_BIT
Definition: pstypes.h:297
#define TLS_EXPANSION_SLOTS
Definition: pstypes.h:311
#define PROCESS_PRIORITY_CLASS_REALTIME
Definition: pstypes.h:111
#define CT_BREAK_ON_TERMINATION_BIT
Definition: pstypes.h:245
@ PsNonPagedPool
Definition: pstypes.h:1067
@ PsPageFile
Definition: pstypes.h:1069
@ PsPagedPool
Definition: pstypes.h:1068
struct _PROCESS_FOREGROUND_BACKGROUND * PPROCESS_FOREGROUND_BACKGROUND
#define MEMORY_PRIORITY_BACKGROUND
Definition: pstypes.h:125
#define PSF_BREAK_ON_TERMINATION_BIT
Definition: pstypes.h:286
#define MEMORY_PRIORITY_FOREGROUND
Definition: pstypes.h:127
struct _PROCESS_BASIC_INFORMATION * PPROCESS_BASIC_INFORMATION
struct _PROCESS_BASIC_INFORMATION PROCESS_BASIC_INFORMATION
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
struct _KERNEL_USER_TIMES KERNEL_USER_TIMES
struct _KERNEL_USER_TIMES * PKERNEL_USER_TIMES
@ ProcessLUIDDeviceMapsEnabled
Definition: winternl.h:1910
@ ProcessWx86Information
Definition: winternl.h:1901
@ ProcessDebugFlags
Definition: winternl.h:1913
@ ProcessSessionInformation
Definition: winternl.h:1906
@ ProcessAffinityMask
Definition: winternl.h:1903
@ ProcessIoPortHandlers
Definition: winternl.h:1895
@ ProcessRaisePriority
Definition: winternl.h:1888
@ ProcessVmCounters
Definition: winternl.h:1885
@ ProcessPriorityClass
Definition: winternl.h:1900
@ ProcessPriorityBoost
Definition: winternl.h:1904
@ ProcessImageInformation
Definition: winternl.h:1919
@ ProcessExecuteFlags
Definition: winternl.h:1916
@ ProcessCookie
Definition: winternl.h:1918
@ ProcessPooledUsageAndLimits
Definition: winternl.h:1896
@ ProcessLdtSize
Definition: winternl.h:1893
@ ProcessIoCounters
Definition: winternl.h:1884
@ ProcessImageFileNameWin32
Definition: winternl.h:1925
@ ProcessDefaultHardErrorMode
Definition: winternl.h:1894
@ ProcessEnableAlignmentFaultFixup
Definition: winternl.h:1899
@ ProcessDeviceMap
Definition: winternl.h:1905
@ ProcessBasePriority
Definition: winternl.h:1887
@ ProcessQuotaLimits
Definition: winternl.h:1883
@ ProcessAccessToken
Definition: winternl.h:1891
@ ProcessHandleTracing
Definition: winternl.h:1914
@ ProcessForegroundInformation
Definition: winternl.h:1907
@ ProcessTimes
Definition: winternl.h:1886
@ ProcessDebugObjectHandle
Definition: winternl.h:1912
@ ProcessExceptionPort
Definition: winternl.h:1890
@ ProcessWorkingSetWatch
Definition: winternl.h:1897
@ ProcessLdtInformation
Definition: winternl.h:1892
@ ProcessHandleCount
Definition: winternl.h:1902
@ ProcessUserModeIOPL
Definition: winternl.h:1898
struct _VM_COUNTERS * PVM_COUNTERS
struct _VM_COUNTERS_EX VM_COUNTERS_EX
#define QUOTA_LIMITS_HARDWS_MIN_DISABLE
#define PROCESS_LUID_DOSDEVICES_ONLY
Definition: pstypes.h:228
struct _IO_COUNTERS IO_COUNTERS
struct _PROCESS_SESSION_INFORMATION PROCESS_SESSION_INFORMATION
struct _PROCESS_SESSION_INFORMATION * PPROCESS_SESSION_INFORMATION
#define LOW_PRIORITY
#define QUOTA_LIMITS_HARDWS_MAX_DISABLE
struct _QUOTA_LIMITS_EX QUOTA_LIMITS_EX
#define QUOTA_LIMITS_HARDWS_MAX_ENABLE
#define QUOTA_LIMITS_HARDWS_MIN_ENABLE
#define LOW_REALTIME_PRIORITY
#define HIGH_PRIORITY
struct _IO_COUNTERS * PIO_COUNTERS
#define InterlockedCompareExchangePointer
Definition: interlocked.h:144
#define InterlockedCompareExchange
Definition: interlocked.h:119
static LIST_ENTRY ThreadListHead
Definition: sys_arch.c:6
#define RTL_FIELD_SIZE(type, field)
Definition: kdb_expr.c:86
#define KeLeaveCriticalRegion()
Definition: ke_x.h:119
#define KeEnterCriticalRegion()
Definition: ke_x.h:88
if(dx< 0)
Definition: linetemp.h:194
POBJECT_TYPE LpcPortObjectType
Definition: port.c:17
#define ASSERT(a)
Definition: mode.c:44
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
static const char * ImageName
Definition: image.c:34
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1187
#define KernelMode
Definition: asm.h:38
_In_ HANDLE ProcessHandle
Definition: mmfuncs.h:403
struct _SECTION_IMAGE_INFORMATION SECTION_IMAGE_INFORMATION
_In_ ACCESS_MASK _In_ ULONG _Out_ PHANDLE TokenHandle
Definition: psfuncs.h:726
_In_ THREADINFOCLASS _In_ ULONG ThreadInformationLength
Definition: psfuncs.h:843
_In_ THREADINFOCLASS ThreadInformationClass
Definition: psfuncs.h:840
#define SEM_NOALIGNMENTFAULTEXCEPT
Definition: rtltypes.h:71
#define _Out_opt_
Definition: no_sal2.h:214
#define _Out_
Definition: no_sal2.h:160
#define _In_
Definition: no_sal2.h:158
ULONG ACCESS_MASK
Definition: nt_native.h:40
#define NtCurrentProcess()
Definition: nt_native.h:1660
struct _OBJECT_NAME_INFORMATION OBJECT_NAME_INFORMATION
#define THREAD_SET_INFORMATION
Definition: nt_native.h:1340
struct _PROCESS_ACCESS_TOKEN * PPROCESS_ACCESS_TOKEN
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
LONG NTAPI KeQueryBasePriorityThread(IN PKTHREAD Thread)
Definition: thrdobj.c:52
ULONG NTAPI KeQueryRuntimeProcess(IN PKPROCESS Process, OUT PULONG UserTime)
Definition: procobj.c:860
KAFFINITY NTAPI KeSetAffinityProcess(IN PKPROCESS Process, IN KAFFINITY Affinity)
Definition: procobj.c:265
KAFFINITY KeActiveProcessors
Definition: processor.c:16
VOID NTAPI Ke386SetIOPL(VOID)
Definition: v86vdm.c:595
VOID NTAPI KeQueryValuesProcess(IN PKPROCESS Process, PPROCESS_VALUES Values)
Definition: procobj.c:525
BOOLEAN NTAPI KeSetDisableBoostProcess(IN PKPROCESS Process, IN BOOLEAN Disable)
Definition: procobj.c:331
BOOLEAN NTAPI KeSetDisableBoostThread(IN OUT PKTHREAD Thread, IN BOOLEAN Disable)
Definition: thrdobj.c:86
BOOLEAN NTAPI KeReadStateThread(IN PKTHREAD Thread)
Definition: thrdobj.c:42
BOOLEAN NTAPI KeSetAutoAlignmentProcess(IN PKPROCESS Process, IN BOOLEAN Enable)
Definition: procobj.c:313
VOID NTAPI KeBoostPriorityThread(IN PKTHREAD Thread, IN KPRIORITY Increment)
Definition: thrdobj.c:220
KPRIORITY NTAPI KeSetPriorityAndQuantumProcess(IN PKPROCESS Process, IN KPRIORITY Priority, IN UCHAR Quantum OPTIONAL)
Definition: procobj.c:349
PFILE_OBJECT NTAPI MmGetFileObjectForSection(IN PVOID Section)
Definition: section.c:1540
VOID NTAPI MmGetImageInformation(OUT PSECTION_IMAGE_INFORMATION ImageInformation)
Definition: section.c:1617
NTSTATUS NTAPI MmSetExecuteOptions(IN ULONG ExecuteOptions)
Definition: pagfault.c:2695
NTSTATUS NTAPI MmSetMemoryPriorityProcess(IN PEPROCESS Process, IN UCHAR MemoryPriority)
Definition: procsup.c:487
NTSTATUS NTAPI MmGetExecuteOptions(IN PULONG ExecuteOptions)
Definition: pagfault.c:2653
static __inline NTSTATUS DefaultQueryInfoBufferCheck(_In_ ULONG Class, _In_ const INFORMATION_CLASS_INFO *ClassList, _In_ ULONG ClassListEntries, _In_ ULONG Flags, _In_opt_ PVOID Buffer, _In_ ULONG BufferLength, _In_opt_ PULONG ReturnLength, _In_opt_ PULONG_PTR ReturnLengthPtr, _In_ KPROCESSOR_MODE PreviousMode)
Probe helper that validates the provided parameters whenever a NtQuery*** system call is invoked from...
Definition: probe.h:219
static __inline NTSTATUS DefaultSetInfoBufferCheck(_In_ ULONG Class, _In_ const INFORMATION_CLASS_INFO *ClassList, _In_ ULONG ClassListEntries, _In_ PVOID Buffer, _In_ ULONG BufferLength, _In_ KPROCESSOR_MODE PreviousMode)
Probe helper that validates the provided parameters whenever a NtSet*** system call is invoked from u...
Definition: probe.h:70
const LUID SeDebugPrivilege
Definition: priv.c:39
BOOLEAN NTAPI SeCheckPrivilegedObject(_In_ LUID PrivilegeValue, _In_ HANDLE ObjectHandle, _In_ ACCESS_MASK DesiredAccess, _In_ KPROCESSOR_MODE PreviousMode)
Checks a privileged object if such object has the specific privilege submitted by the caller.
Definition: priv.c:803
const LUID SeTcbPrivilege
Definition: priv.c:26
const LUID SeIncreaseBasePriorityPrivilege
Definition: priv.c:33
NTSTATUS NTAPI IoQueryFileDosDeviceName(IN PFILE_OBJECT FileObject, OUT POBJECT_NAME_INFORMATION *ObjectNameInformation)
Definition: file.c:3664
ULONG KeMaximumIncrement
Definition: clock.c:20
POBJECT_TYPE PsProcessType
Definition: process.c:20
ULONG NTAPI PsGetProcessSessionId(IN PEPROCESS Process)
Definition: process.c:1163
VOID NTAPI PsSetProcessPriorityByClass(IN PEPROCESS Process, IN PSPROCESSPRIORITYMODE Type)
Definition: process.c:1325
NTSTATUS NTAPI NtQueryInformationThread(IN HANDLE ThreadHandle, IN THREADINFOCLASS ThreadInformationClass, OUT PVOID ThreadInformation, IN ULONG ThreadInformationLength, OUT PULONG ReturnLength OPTIONAL)
Definition: query.c:2754
ULONG PspTraceLevel
Definition: query.c:18
NTSTATUS NTAPI PsReferenceProcessFilePointer(IN PEPROCESS Process, OUT PFILE_OBJECT *FileObject)
Definition: query.c:24
NTSTATUS NTAPI NtSetInformationProcess(IN HANDLE ProcessHandle, IN PROCESSINFOCLASS ProcessInformationClass, IN PVOID ProcessInformation, IN ULONG ProcessInformationLength)
Definition: query.c:1232
NTSTATUS NTAPI NtSetInformationThread(IN HANDLE ThreadHandle, IN THREADINFOCLASS ThreadInformationClass, IN PVOID ThreadInformation, IN ULONG ThreadInformationLength)
Definition: query.c:2146
NTSTATUS NTAPI NtQueryInformationProcess(_In_ HANDLE ProcessHandle, _In_ PROCESSINFOCLASS ProcessInformationClass, _Out_ PVOID ProcessInformation, _In_ ULONG ProcessInformationLength, _Out_opt_ PULONG ReturnLength)
Definition: query.c:59
NTSTATUS NTAPI PsAssignImpersonationToken(IN PETHREAD Thread, IN HANDLE TokenHandle)
Definition: security.c:502
POBJECT_TYPE PsThreadType
Definition: thread.c:20
BOOLEAN NTAPI PsIsThreadTerminating(IN PETHREAD Thread)
Definition: thread.c:868
NTSTATUS NTAPI SeLocateProcessImageName(_In_ PEPROCESS Process, _Out_ PUNICODE_STRING *ProcessImageName)
Finds the process image name of a specific process.
Definition: audit.c:199
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_PROCESS_IS_TERMINATING
Definition: ntstatus.h:596
#define STATUS_INVALID_INFO_CLASS
Definition: ntstatus.h:333
#define STATUS_PORT_ALREADY_SET
Definition: ntstatus.h:402
ULONG NTAPI ObGetProcessHandleCount(IN PEPROCESS Process)
Definition: obhandle.c:56
NTSTATUS NTAPI ObSetDeviceMap(IN PEPROCESS Process, IN HANDLE DirectoryHandle)
Definition: devicemap.c:24
ULONG NTAPI ObIsLUIDDeviceMapsEnabled(VOID)
Definition: devicemap.c:662
NTSTATUS NTAPI ObQueryDeviceMapInformation(_In_opt_ PEPROCESS Process, _Out_ PPROCESS_DEVICEMAP_INFORMATION DeviceMapInfo, _In_ ULONG Flags)
Definition: devicemap.c:539
NTSTATUS NTAPI ObCloseHandle(IN HANDLE Handle, IN KPROCESSOR_MODE AccessMode)
Definition: obhandle.c:3379
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:494
long LONG
Definition: pedump.c:60
static WCHAR Address[46]
Definition: ping.c:68
VOID NTAPI KeDetachProcess(VOID)
Definition: procobj.c:621
VOID NTAPI KeAttachProcess(IN PKPROCESS Process)
Definition: procobj.c:582
NTSTATUS NTAPI PspSetPrimaryToken(IN PEPROCESS Process, IN HANDLE TokenHandle OPTIONAL, IN PACCESS_TOKEN Token OPTIONAL)
Definition: security.c:215
NTSTATUS NTAPI PspSetQuotaLimits(_In_ PEPROCESS Process, _In_ ULONG Unused, _In_ PVOID QuotaLimits, _In_ ULONG QuotaLimitsLength, _In_ KPROCESSOR_MODE PreviousMode)
This function adjusts the working set limits of a process and sets up new quota limits when necessary...
Definition: quota.c:1045
PETHREAD NTAPI PsGetNextProcessThread(IN PEPROCESS Process, IN PETHREAD Thread OPTIONAL)
Definition: process.c:75
EPROCESS_QUOTA_BLOCK PspDefaultQuotaBlock
Definition: quota.c:16
static const INFORMATION_CLASS_INFO PsThreadInfoClass[]
Definition: ps_i.h:362
static const INFORMATION_CLASS_INFO PsProcessInfoClass[]
Definition: ps_i.h:15
#define PspSetCrossThreadFlag(Thread, Flag)
Definition: ps_x.h:25
#define PspClearCrossThreadFlag(Thread, Flag)
Definition: ps_x.h:27
#define PspClearProcessFlag(Process, Flag)
Definition: ps_x.h:35
#define PspSetProcessFlag(Process, Flag)
Definition: ps_x.h:33
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:181
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:82
#define _SEH2_END
Definition: pseh2_64.h:171
#define _SEH2_TRY
Definition: pseh2_64.h:71
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:184
NTSTATUS NTAPI PspQueryDescriptorThread(IN PETHREAD Thread, IN PVOID ThreadInformation, IN ULONG ThreadInformationLength, OUT PULONG ReturnLength OPTIONAL)
Definition: psldt.c:43
#define _WIN32_WINNT_WS03
Definition: sdkddkver.h:23
#define STATUS_SUCCESS
Definition: shellext.h:65
STDMETHOD() Next(THIS_ ULONG celt, IAssociationElement *pElement, ULONG *pceltFetched) PURE
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
#define TLS_MINIMUM_AVAILABLE
Definition: ntddk_ex.h:236
LARGE_INTEGER ExitTime
Definition: pstypes.h:1153
NTSTATUS ExitStatus
Definition: pstypes.h:1159
KTHREAD Tcb
Definition: pstypes.h:1149
EX_RUNDOWN_REF RundownProtect
Definition: pstypes.h:1205
PVOID Win32StartAddress
Definition: pstypes.h:1198
CLIENT_ID Cid
Definition: pstypes.h:1174
LIST_ENTRY IrpList
Definition: pstypes.h:1190
LARGE_INTEGER CreateTime
Definition: pstypes.h:1150
ULONG BreakOnTermination
Definition: pstypes.h:1230
LARGE_INTEGER UserTime
Definition: winternl.h:2377
LARGE_INTEGER CreateTime
Definition: winternl.h:2374
LARGE_INTEGER KernelTime
Definition: winternl.h:2376
LARGE_INTEGER ExitTime
Definition: winternl.h:2375
ULONG InterruptTime
Definition: ketypes.h:834
ULONG KeSystemCalls
Definition: ketypes.h:745
GROUP_AFFINITY Affinity
Definition: ketypes.h:2066
ULONG IdealProcessor
Definition: ketypes.h:2072
ULONG DisableBoost
Definition: ketypes.h:1853
SCHAR Priority
Definition: ketypes.h:1910
PVOID Teb
Definition: ketypes.h:1935
ULONG KernelTime
Definition: ketypes.h:2115
ULONG UserTime
Definition: ketypes.h:2131
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
ULONG_PTR InheritedFromUniqueProcessId
Definition: pstypes.h:362
IO_COUNTERS IoInfo
Definition: ke.h:48
SIZE_T MaximumWorkingSetSize
Definition: pstypes.h:71
SIZE_T PagedPoolLimit
Definition: pstypes.h:68
SIZE_T PagefileLimit
Definition: pstypes.h:72
LARGE_INTEGER TimeLimit
Definition: pstypes.h:73
RATE_QUOTA_LIMIT CpuRateLimit
Definition: pstypes.h:79
SIZE_T NonPagedPoolLimit
Definition: pstypes.h:69
SIZE_T MinimumWorkingSetSize
Definition: pstypes.h:70
Definition: compat.h:836
PVOID * TlsExpansionSlots
Definition: compat.h:894
PVOID TlsSlots[64]
Definition: compat.h:879
KPRIORITY BasePriority
Definition: compat.h:932
KAFFINITY AffinityMask
Definition: compat.h:930
SIZE_T PeakWorkingSetSize
Definition: winternl.h:3134
SIZE_T PeakPagefileUsage
Definition: winternl.h:3141
ULONG PageFaultCount
Definition: winternl.h:3133
SIZE_T QuotaPagedPoolUsage
Definition: winternl.h:3137
SIZE_T QuotaPeakPagedPoolUsage
Definition: winternl.h:3136
SIZE_T QuotaPeakNonPagedPoolUsage
Definition: winternl.h:3138
SIZE_T PeakVirtualSize
Definition: winternl.h:3131
SIZE_T VirtualSize
Definition: winternl.h:3132
SIZE_T QuotaNonPagedPoolUsage
Definition: winternl.h:3139
SIZE_T WorkingSetSize
Definition: winternl.h:3135
SIZE_T PagefileUsage
Definition: winternl.h:3140
#define TAG_SEPA
Definition: tag.h:155
UCHAR NTAPI KeSetIdealProcessorThread(IN PKTHREAD Thread, IN UCHAR Processor)
Definition: thrdobj.c:1066
LONG NTAPI KeSetBasePriorityThread(IN PKTHREAD Thread, IN LONG Increment)
Definition: thrdobj.c:1157
KPRIORITY NTAPI KeSetPriorityThread(IN PKTHREAD Thread, IN KPRIORITY Priority)
Definition: thrdobj.c:1300
KAFFINITY NTAPI KeSetAffinityThread(IN PKTHREAD Thread, IN KAFFINITY Affinity)
Definition: thrdobj.c:1276
uint16_t * PWSTR
Definition: typedefs.h:56
uint32_t * PULONG_PTR
Definition: typedefs.h:65
uint32_t * PULONG
Definition: typedefs.h:59
unsigned char * PBOOLEAN
Definition: typedefs.h:53
int64_t LONGLONG
Definition: typedefs.h:68
#define NTAPI
Definition: typedefs.h:36
union _LARGE_INTEGER LARGE_INTEGER
void * PVOID
Definition: typedefs.h:50
PVOID HANDLE
Definition: typedefs.h:73
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#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
union _LARGE_INTEGER * PLARGE_INTEGER
Definition: file.c:85
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
char CCHAR
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_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
LONGLONG QuadPart
Definition: typedefs.h:114
struct _LARGE_INTEGER::@2475 u
ULONG RateData
Definition: pstypes.h:60
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550
_In_ WDFINTERRUPT _In_ WDF_INTERRUPT_POLICY _In_ WDF_INTERRUPT_PRIORITY Priority
Definition: wdfinterrupt.h:655
BOOLEAN HasPrivilege(IN PPRIVILEGE_SET Privilege)
Definition: shutdown.c:92
#define TlsIndex
Definition: ws2_32p.h:277
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
_In_opt_ PVOID _Out_ PLARGE_INTEGER Cookie
Definition: cmfuncs.h:14
_In_ ULONG _In_ ULONG _In_ ULONG _Out_ PKIRQL _Out_ PKAFFINITY Affinity
Definition: halfuncs.h:174
* PFILE_OBJECT
Definition: iotypes.h:1998
_Out_ PULONG UserTime
Definition: kefuncs.h:759
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:778
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
unsigned char UCHAR
Definition: xmlstorage.h:181