ReactOS 0.4.17-dev-1133-gc25e4fd
thread.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/thread.c
5 * PURPOSE: Process Manager: Thread 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
21
22/* PRIVATE FUNCTIONS *********************************************************/
23
30 _In_ PVOID ObjectBody,
33{
35 {
37 }
38
40 {
42 }
43
44 return STATUS_SUCCESS;
45}
46
47VOID
50 IN PVOID StartContext)
51{
53 PTEB Teb;
54 BOOLEAN DeadThread = FALSE;
56 PAGED_CODE();
58 "StartRoutine: %p StartContext: %p\n", StartRoutine, StartContext);
59
60 /* Go to Passive Level */
63
64 /* Check if the thread is dead */
65 if (Thread->DeadThread)
66 {
67 /* Remember that we're dead */
68 DeadThread = TRUE;
69 }
70 else
71 {
72 /* Get the Locale ID and save Preferred Proc */
73 Teb = NtCurrentTeb();
75 Teb->IdealProcessor = Thread->Tcb.IdealProcessor;
76 }
77
78 /* Check if this is a dead thread, or if we're hiding */
79 if (!(Thread->DeadThread) && !(Thread->HideFromDebugger))
80 {
81 /* We're not, so notify the debugger */
82 DbgkCreateThread(Thread, StartContext);
83 }
84
85 /* Make sure we're not already dead */
86 if (!DeadThread)
87 {
88 /* Check if the Prefetcher is enabled */
90 {
91 /* FIXME: Prepare to prefetch this process */
92 }
93
94 /* Raise to APC */
96
97 /* Queue the User APC */
101 NULL,
103 NULL);
104
105 /* Lower it back to passive */
107 }
108 else
109 {
110 /* We're dead, kill us now */
113 TRUE);
114 }
115
116 /* Do we have a cookie set yet? */
117 while (!SharedUserData->Cookie)
118 {
119 LARGE_INTEGER SystemTime;
120 ULONG NewCookie;
121 PKPRCB Prcb;
122
123 /* Generate a new cookie */
124 KeQuerySystemTime(&SystemTime);
125 Prcb = KeGetCurrentPrcb();
126 NewCookie = (Prcb->MmPageFaultCount ^ Prcb->InterruptTime ^
127 SystemTime.u.LowPart ^ SystemTime.u.HighPart ^
128 (ULONG)(ULONG_PTR)&SystemTime);
129
130 /* Set the new cookie*/
132 NewCookie,
133 0);
134 }
135}
136
137LONG
139{
140 /* Print debugging information */
141 DPRINT1("PS: Unhandled Kernel Mode Exception Pointers = 0x%p\n",
142 ExceptionPointers);
143 DPRINT1("Code %x Addr %p Info0 %p Info1 %p Info2 %p Info3 %p\n",
144 ExceptionPointers->ExceptionRecord->ExceptionCode,
145 ExceptionPointers->ExceptionRecord->ExceptionAddress,
146 ExceptionPointers->ExceptionRecord->ExceptionInformation[0],
147 ExceptionPointers->ExceptionRecord->ExceptionInformation[1],
148 ExceptionPointers->ExceptionRecord->ExceptionInformation[2],
149 ExceptionPointers->ExceptionRecord->ExceptionInformation[3]);
150
151 /* Bugcheck the system */
152 KeBugCheckEx(SYSTEM_THREAD_EXCEPTION_NOT_HANDLED,
153 ExceptionPointers->ExceptionRecord->ExceptionCode,
154 (ULONG_PTR)ExceptionPointers->ExceptionRecord->ExceptionAddress,
155 (ULONG_PTR)ExceptionPointers->ExceptionRecord,
156 (ULONG_PTR)ExceptionPointers->ContextRecord);
157 return 0;
158}
159
160VOID
161NTAPI
163 IN PVOID StartContext)
164{
167 "StartRoutine: %p StartContext: %p\n", StartRoutine, StartContext);
168
169 /* Unlock the dispatcher Database */
172
173 /* Make sure the thread isn't gone */
175 {
176 if (!(Thread->Terminated) && !(Thread->DeadThread))
177 {
178 /* Call the Start Routine */
179 StartRoutine(StartContext);
180 }
181 }
183 {
184 /* Bugcheck if we got here */
185 KeBugCheck(KMODE_EXCEPTION_NOT_HANDLED);
186 }
187 _SEH2_END;
188
189 /* Exit the thread */
191}
192
194NTAPI
199 IN PEPROCESS TargetProcess,
201 IN PCONTEXT ThreadContext,
202 IN PINITIAL_TEB InitialTeb,
203 IN BOOLEAN CreateSuspended,
205 IN PVOID StartContext OPTIONAL)
206{
210 PTEB TebBase = NULL;
213 HANDLE_TABLE_ENTRY CidEntry;
214 ACCESS_STATE LocalAccessState;
215 PACCESS_STATE AccessState = &LocalAccessState;
216 AUX_ACCESS_DATA AuxData;
217 BOOLEAN Result, SdAllocated;
220 PAGED_CODE();
222 "ThreadContext: %p TargetProcess: %p ProcessHandle: %p\n",
223 ThreadContext, TargetProcess, ProcessHandle);
224
225 /* If we were called from PsCreateSystemThread, then we're kernel mode */
227
228 /* Reference the Process by handle or pointer, depending on what we got */
229 if (ProcessHandle)
230 {
231 /* Normal thread or System Thread */
236 (PVOID*)&Process,
237 NULL);
239 }
240 else
241 {
242 /* System thread inside System Process, or Normal Thread with a bug */
243 if (StartRoutine)
244 {
245 /* Reference the Process by Pointer */
246 ObReferenceObject(TargetProcess);
247 Process = TargetProcess;
249 }
250 else
251 {
252 /* Fake ObReference returning this */
254 }
255 }
256
257 /* Check for success */
258 if (!NT_SUCCESS(Status)) return Status;
259
260 /* Also make sure that User-Mode isn't trying to create a system thread */
262 {
263 /* Fail */
266 }
267
268 /* Create Thread Object */
273 NULL,
274 sizeof(ETHREAD),
275 0,
276 0,
277 (PVOID*)&Thread);
278 if (!NT_SUCCESS(Status))
279 {
280 /* We failed; dereference the process and exit */
282 return Status;
283 }
284
285 /* Zero the Object entirely */
286 RtlZeroMemory(Thread, sizeof(ETHREAD));
287
288 /* Initialize rundown protection */
290
291 /* Initialize exit code */
293
294 /* Set the Process CID */
295 Thread->ThreadsProcess = Process;
296 Thread->Cid.UniqueProcess = Process->UniqueProcessId;
297
298 /* Create Cid Handle */
299 CidEntry.Object = Thread;
300 CidEntry.GrantedAccess = 0;
302 if (!Thread->Cid.UniqueThread)
303 {
304 /* We couldn't create the CID, dereference the thread and fail */
307 }
308
309 /* Save the read cluster size */
311
312 /* Initialize the LPC Reply Semaphore */
313 KeInitializeSemaphore(&Thread->LpcReplySemaphore, 0, 1);
314
315 /* Initialize the list heads and locks */
321
322 /* Acquire rundown protection */
323 if (!ExAcquireRundownProtection (&Process->RundownProtect))
324 {
325 /* Fail */
328 }
329
330 /* Now let the kernel initialize the context */
331 if (ThreadContext)
332 {
333 /* User-mode Thread, create Teb */
334 Status = MmCreateTeb(Process, &Thread->Cid, InitialTeb, &TebBase);
335 if (!NT_SUCCESS(Status))
336 {
337 /* Failed to create the TEB. Release rundown and dereference */
338 ExReleaseRundownProtection(&Process->RundownProtect);
340 return Status;
341 }
342
343 /* Set the Start Addresses from the untrusted ThreadContext */
345 {
346 Thread->StartAddress = (PVOID)KeGetContextPc(ThreadContext);
348 }
350 {
352 }
353 _SEH2_END;
354
355 /* Let the kernel intialize the Thread */
356 if (NT_SUCCESS(Status))
357 {
359 NULL,
361 NULL,
363 ThreadContext,
364 TebBase,
365 &Process->Pcb);
366 }
367 }
368 else
369 {
370 /* System Thread */
373
374 /* Let the kernel intialize the Thread */
376 NULL,
379 StartContext,
380 NULL,
381 NULL,
382 &Process->Pcb);
383 }
384
385 /* Check if we failed */
386 if (!NT_SUCCESS(Status))
387 {
388 /* Delete the TEB if we had done */
389 if (TebBase) MmDeleteTeb(Process, TebBase);
390
391 /* Release rundown and dereference */
392 ExReleaseRundownProtection(&Process->RundownProtect);
394 return Status;
395 }
396
397 /* Lock the process */
399 ExAcquirePushLockExclusive(&Process->ProcessLock);
400
401 /* Make sure the process didn't just die on us */
402 if (Process->ProcessDelete) goto Quickie;
403
404 /* Check if the thread was ours, terminated and it was user mode */
405 if ((Thread->Terminated) &&
406 (ThreadContext) &&
407 (Thread->ThreadsProcess == Process))
408 {
409 /* Cleanup, we don't want to start it up and context switch */
410 goto Quickie;
411 }
412
413 /*
414 * Insert the Thread into the Process's Thread List
415 * Note, this is the ETHREAD Thread List. It is removed in
416 * ps/kill.c!PspExitThread.
417 */
418 InsertTailList(&Process->ThreadListHead, &Thread->ThreadListEntry);
419 Process->ActiveThreads++;
420
421 /* Start the thread */
423
424 /* Release the process lock */
425 ExReleasePushLockExclusive(&Process->ProcessLock);
427
428 /* Release rundown */
429 ExReleaseRundownProtection(&Process->RundownProtect);
430
431 /* Notify WMI */
432 //WmiTraceProcess(Process, TRUE);
433 //WmiTraceThread(Thread, InitialTeb, TRUE);
434
435 /* Notify Thread Creation */
437
438 /* Reference ourselves as a keep-alive */
440
441 /* Suspend the Thread if we have to */
442 if (CreateSuspended) KeSuspendThread(&Thread->Tcb);
443
444 /* Check if we were already terminated */
446
447 /* Create an access state */
449 ThreadContext ?
451 &LocalAccessState,
452 &AuxData,
455 if (!NT_SUCCESS(Status))
456 {
457 /* Access state failed, thread is dead */
459
460 /* If we were suspended, wake it up */
461 if (CreateSuspended) KeResumeThread(&Thread->Tcb);
462
463 /* Dispatch thread */
465
466 /* Dereference completely to kill it */
468 return Status;
469 }
470
471 /* Insert the Thread into the Object Manager */
475 0,
476 NULL,
477 &hThread);
478
479 /* Delete the access state if we had one */
481
482 /* Check for success */
483 if (NT_SUCCESS(Status))
484 {
485 /* Wrap in SEH to protect against bad user-mode pointers */
487 {
488 /* Return Cid and Handle */
489 if (ClientId) *ClientId = Thread->Cid;
490 *ThreadHandle = hThread;
491 }
493 {
494 /* Thread insertion failed, thread is dead */
496
497 /* If we were suspended, wake it up */
498 if (CreateSuspended) KeResumeThread(&Thread->Tcb);
499
500 /* Dispatch thread */
502
503 /* Dereference it, leaving only the keep-alive */
505
506 /* Close its handle, killing it */
508
509 /* Return the exception code */
511 }
512 _SEH2_END;
513 }
514 else
515 {
516 /* Thread insertion failed, thread is dead */
518
519 /* If we were suspended, wake it up */
520 if (CreateSuspended) KeResumeThread(&Thread->Tcb);
521 }
522
523 /* Get the create time */
525 ASSERT(!(Thread->CreateTime.HighPart & 0xF0000000));
526
527 /* Make sure the thread isn't dead */
528 if (!Thread->DeadThread)
529 {
530 /* Get the thread's SD */
533 &SdAllocated);
534 if (!NT_SUCCESS(Status))
535 {
536 /* Thread insertion failed, thread is dead */
538
539 /* If we were suspended, wake it up */
540 if (CreateSuspended) KeResumeThread(&Thread->Tcb);
541
542 /* Dispatch thread */
544
545 /* Dereference it, leaving only the keep-alive */
547
548 /* Close its handle, killing it */
550 return Status;
551 }
552
553 /* Create the subject context */
554 SubjectContext.ProcessAuditId = Process;
556 SubjectContext.ClientToken = NULL;
557
558 /* Do the access check */
561 FALSE,
563 0,
564 NULL,
567 &Thread->GrantedAccess,
568 &AccessStatus);
569
570 /* Dereference the token and let go the SD */
572 SubjectContext.PrimaryToken);
574
575 /* Remove access if it failed */
576 if (!Result) Process->GrantedAccess = 0;
577
578 /* Set at least some minimum access */
579 Thread->GrantedAccess |= (THREAD_TERMINATE |
583 }
584 else
585 {
586 /* Set the thread access mask to maximum */
587 Thread->GrantedAccess = THREAD_ALL_ACCESS;
588 }
589
590 /* Dispatch thread */
592
593 /* Dereference it, leaving only the keep-alive */
595
596 /* Return */
597 return Status;
598
599 /* Most annoying failure case ever, where we undo almost all manually */
600Quickie:
601 /* When we get here, the process is locked, unlock it */
602 ExReleasePushLockExclusive(&Process->ProcessLock);
604
605 /* Uninitialize it */
607
608 /* If we had a TEB, delete it */
609 if (TebBase) MmDeleteTeb(Process, TebBase);
610
611 /* Release rundown protection, which we also hold */
612 ExReleaseRundownProtection(&Process->RundownProtect);
613
614 /* Dereference the thread and return failure */
617}
618
619/* PUBLIC FUNCTIONS **********************************************************/
620
621/*
622 * @implemented
623 */
625NTAPI
632 IN PVOID StartContext)
633{
634 PEPROCESS TargetProcess = NULL;
636 PAGED_CODE();
638 "ProcessHandle: %p StartRoutine: %p StartContext: %p\n",
639 ProcessHandle, StartRoutine, StartContext);
640
641 /* Check if we have a handle. If not, use the System Process */
642 if (!ProcessHandle)
643 {
644 Handle = NULL;
645 TargetProcess = PsInitialSystemProcess;
646 }
647
648 /* Call the shared function */
649 return PspCreateThread(ThreadHandle,
652 Handle,
653 TargetProcess,
654 ClientId,
655 NULL,
656 NULL,
657 FALSE,
659 StartContext);
660}
661
662/*
663 * @implemented
664 */
666NTAPI
669{
670 PHANDLE_TABLE_ENTRY CidEntry;
671 PETHREAD FoundThread;
673 PAGED_CODE();
674 PSTRACE(PS_THREAD_DEBUG, "ThreadId: %p\n", ThreadId);
676
677 /* Get the CID Handle Entry */
678 CidEntry = ExMapHandleToPointer(PspCidTable, ThreadId);
679 if (CidEntry)
680 {
681 /* Get the Thread */
682 FoundThread = CidEntry->Object;
683
684 /* Make sure it's really a thread */
685 if (FoundThread->Tcb.Header.Type == ThreadObject)
686 {
687 /* Safe Reference and return it */
688 if (ObReferenceObjectSafe(FoundThread))
689 {
690 *Thread = FoundThread;
692 }
693 }
694
695 /* Unlock the Entry */
697 }
698
699 /* Return to caller */
701 return Status;
702}
703
704/*
705 * @implemented
706 */
707ULONG
708NTAPI
710{
711 return Thread->Tcb.FreezeCount;
712}
713
714/*
715 * @implemented
716 */
718NTAPI
720{
722}
723
724/*
725 * @implemented
726 */
727HANDLE
728NTAPI
730{
731 return Thread->Cid.UniqueThread;
732}
733
734/*
735 * @implemented
736 */
737HANDLE
738NTAPI
740{
741 return PsGetCurrentThread()->Cid.UniqueThread;
742}
743
744/*
745 * @implemented
746 */
748NTAPI
750{
751 return Thread->ThreadsProcess;
752}
753
754/*
755 * @implemented
756 */
758NTAPI
760{
761 return PsGetCurrentThread()->ThreadsProcess;
762}
763
764/*
765 * @implemented
766 */
767HANDLE
768NTAPI
770{
771 return Thread->Cid.UniqueProcess;
772}
773
774/*
775 * @implemented
776 */
777HANDLE
778NTAPI
780{
781 return PsGetCurrentThread()->Cid.UniqueProcess;
782}
783
784/*
785 * @implemented
786 */
787ULONG
788NTAPI
790{
791 return MmGetSessionId(Thread->ThreadsProcess);
792}
793
794/*
795 * @implemented
796 */
797PTEB
798NTAPI
800{
801 return Thread->Tcb.Teb;
802}
803
804/*
805 * @implemented
806 */
807PVOID
808NTAPI
810{
811 return PsGetCurrentThread()->Tcb.Teb;
812}
813
814/*
815 * @implemented
816 */
817PVOID
818NTAPI
820{
821 return Thread->Tcb.Win32Thread;
822}
823
824/*
825 * @implemented
826 */
827PVOID
828NTAPI
830{
831 return PsGetCurrentThread()->Tcb.Win32Thread;
832}
833
834/*
835 * @implemented
836 */
837PVOID
838NTAPI
840 _Out_ HANDLE* OutProcessId)
841{
842 PETHREAD CurrentThread;
843
844 /* Get the current thread */
845 CurrentThread = PsGetCurrentThread();
846
847 /* Return the process id */
848 *OutProcessId = CurrentThread->Cid.UniqueProcess;
849
850 /* Enter critical region */
852
853 /* Return the win32 thread */
854 return CurrentThread->Tcb.Win32Thread;
855}
856
857/*
858 * @implemented
859 */
861NTAPI
863{
864 return (KPROCESSOR_MODE)PsGetCurrentThread()->Tcb.PreviousMode;
865}
866
867/*
868 * @implemented
869 */
870PVOID
871NTAPI
873{
874 return PsGetCurrentThread()->Tcb.StackBase;
875}
876
877/*
878 * @implemented
879 */
880PVOID
881NTAPI
883{
884 return (PVOID)PsGetCurrentThread()->Tcb.StackLimit;
885}
886
887/*
888 * @implemented
889 */
891NTAPI
893{
894 return Thread->Terminated ? TRUE : FALSE;
895}
896
897/*
898 * @implemented
899 */
901NTAPI
903{
904 return Thread->SystemThread ? TRUE: FALSE;
905}
906
907/*
908 * @implemented
909 */
911NTAPI
913{
915}
916
917/*
918 * @implemented
919 */
920VOID
921NTAPI
923 IN BOOLEAN HardErrorsAreDisabled)
924{
925 Thread->HardErrorsAreDisabled = HardErrorsAreDisabled;
926}
927
928/*
929 * @implemented
930 */
931PVOID
932NTAPI
935 _In_ PVOID Win32Thread,
936 _In_ PVOID OldWin32Thread)
937{
938 /* Are we setting the win32 process? */
939 if (Win32Thread != NULL)
940 {
941 /* Just exchange it */
943 Win32Thread);
944 }
945 else
946 {
947 /* We are resetting, only exchange when the old win32 thread matches */
949 Win32Thread,
950 OldWin32Thread);
951 }
952}
953
955NTAPI
958{
961}
962
964NTAPI
970 IN PCONTEXT ThreadContext,
971 IN PINITIAL_TEB InitialTeb,
972 IN BOOLEAN CreateSuspended)
973{
974 INITIAL_TEB SafeInitialTeb;
975 PAGED_CODE();
977 "ProcessHandle: %p Context: %p\n", ProcessHandle, ThreadContext);
978
979 /* Check if this was from user-mode */
981 {
982 /* Make sure that we got a context */
983 if (!ThreadContext) return STATUS_INVALID_PARAMETER;
984
985 /* Protect checks */
987 {
988 /* Make sure the handle pointer we got is valid */
989 ProbeForWriteHandle(ThreadHandle);
990
991 /* Check if the caller wants a client id */
992 if (ClientId)
993 {
994 /* Make sure we can write to it */
995 ProbeForWrite(ClientId, sizeof(CLIENT_ID), sizeof(ULONG));
996 }
997
998 /* Make sure that the entire context is readable */
999 ProbeForRead(ThreadContext, sizeof(CONTEXT), sizeof(ULONG));
1000
1001 /* Check the Initial TEB */
1002 ProbeForRead(InitialTeb, sizeof(INITIAL_TEB), sizeof(ULONG));
1003 SafeInitialTeb = *InitialTeb;
1004 }
1006 {
1007 /* Return the exception code */
1009 }
1010 _SEH2_END;
1011 }
1012 else
1013 {
1014 /* Use the Initial TEB as is */
1015 SafeInitialTeb = *InitialTeb;
1016 }
1017
1018 /* Call the shared function */
1019 return PspCreateThread(ThreadHandle,
1023 NULL,
1024 ClientId,
1025 ThreadContext,
1026 &SafeInitialTeb,
1027 CreateSuspended,
1028 NULL,
1029 NULL);
1030}
1031
1032/*
1033 * @implemented
1034 */
1036NTAPI
1041{
1043 CLIENT_ID SafeClientId;
1044 ULONG Attributes = 0;
1048 BOOLEAN HasObjectName = FALSE;
1050 AUX_ACCESS_DATA AuxData;
1051 PAGED_CODE();
1053 "ClientId: %p ObjectAttributes: %p\n", ClientId, ObjectAttributes);
1054
1055 /* Check if we were called from user mode */
1056 if (PreviousMode != KernelMode)
1057 {
1058 /* Enter SEH for probing */
1059 _SEH2_TRY
1060 {
1061 /* Probe the thread handle */
1062 ProbeForWriteHandle(ThreadHandle);
1063
1064 /* Check for a CID structure */
1065 if (ClientId)
1066 {
1067 /* Probe and capture it */
1068 ProbeForRead(ClientId, sizeof(CLIENT_ID), sizeof(ULONG));
1069 SafeClientId = *ClientId;
1070 ClientId = &SafeClientId;
1071 }
1072
1073 /*
1074 * Just probe the object attributes structure, don't capture it
1075 * completely. This is done later if necessary
1076 */
1078 sizeof(OBJECT_ATTRIBUTES),
1079 sizeof(ULONG));
1080 HasObjectName = (ObjectAttributes->ObjectName != NULL);
1081
1082 /* Validate user attributes */
1084 }
1086 {
1087 /* Return the exception code */
1089 }
1090 _SEH2_END;
1091 }
1092 else
1093 {
1094 /* Otherwise just get the data directly */
1095 HasObjectName = (ObjectAttributes->ObjectName != NULL);
1096
1097 /* Still have to sanitize attributes */
1099 }
1100
1101 /* Can't pass both, fail */
1102 if ((HasObjectName) && (ClientId)) return STATUS_INVALID_PARAMETER_MIX;
1103
1104 /* Create an access state */
1106 &AuxData,
1109 if (!NT_SUCCESS(Status)) return Status;
1110
1111 /* Check if this is a debugger */
1113 {
1114 /* Did he want full access? */
1115 if (AccessState.RemainingDesiredAccess & MAXIMUM_ALLOWED)
1116 {
1117 /* Give it to him */
1118 AccessState.PreviouslyGrantedAccess |= THREAD_ALL_ACCESS;
1119 }
1120 else
1121 {
1122 /* Otherwise just give every other access he could want */
1123 AccessState.PreviouslyGrantedAccess |=
1124 AccessState.RemainingDesiredAccess;
1125 }
1126
1127 /* The caller desires nothing else now */
1128 AccessState.RemainingDesiredAccess = 0;
1129 }
1130
1131 /* Open by name if one was given */
1132 if (HasObjectName)
1133 {
1134 /* Open it */
1138 &AccessState,
1139 0,
1140 NULL,
1141 &hThread);
1142
1143 /* Get rid of the access state */
1145 }
1146 else if (ClientId)
1147 {
1148 /* Open by Thread ID */
1150 {
1151 /* Get the Process */
1153 }
1154 else
1155 {
1156 /* Get the Process */
1158 }
1159
1160 /* Check if we didn't find anything */
1161 if (!NT_SUCCESS(Status))
1162 {
1163 /* Get rid of the access state and return */
1165 return Status;
1166 }
1167
1168 /* Open the Thread Object */
1170 Attributes,
1171 &AccessState,
1172 0,
1175 &hThread);
1176
1177 /* Delete the access state and dereference the thread */
1180 }
1181 else
1182 {
1183 /* Neither an object name nor a client id was passed */
1185 }
1186
1187 /* Check for success */
1188 if (NT_SUCCESS(Status))
1189 {
1190 /* Protect against bad user-mode pointers */
1191 _SEH2_TRY
1192 {
1193 /* Write back the handle */
1194 *ThreadHandle = hThread;
1195 }
1197 {
1198 /* Get the exception code */
1200 }
1201 _SEH2_END;
1202 }
1203
1204 /* Return status */
1205 return Status;
1206}
1207
1208/* EOF */
#define PAGED_CODE()
_In_ PVOID _In_ ULONG _Out_ PVOID _In_ ULONG _Inout_ PULONG _In_ KPROCESSOR_MODE PreviousMode
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
unsigned char BOOLEAN
Definition: actypes.h:127
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
DECLSPEC_NORETURN VOID NTAPI KeBugCheckEx(IN ULONG BugCheckCode, IN ULONG_PTR BugCheckParameter1, IN ULONG_PTR BugCheckParameter2, IN ULONG_PTR BugCheckParameter3, IN ULONG_PTR BugCheckParameter4)
Definition: debug.c:485
DECLSPEC_NORETURN VOID NTAPI KeBugCheck(ULONG BugCheckCode)
Definition: bug.c:1434
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
#define STATUS_INVALID_HANDLE
Definition: d3dkmdt.h:40
#define STATUS_NOT_IMPLEMENTED
Definition: d3dkmdt.h:42
VOID NTAPI DbgkCreateThread(IN PETHREAD Thread, IN PVOID StartAddress)
Definition: dbgkutil.c:87
_In_ ULONG Attributes
Definition: dispmprt.h:1077
#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
#define InterlockedExchangePointer(Target, Value)
Definition: dshow.h:45
#define InsertTailList(ListHead, Entry)
#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 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 KeQuerySystemTime(t)
Definition: env_spec_w32.h:570
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define KeInitializeSpinLock(sl)
Definition: env_spec_w32.h:604
#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 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
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
PsGetCurrentThreadId
Definition: CrNtStubs.h:8
_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
ULONG Handle
Definition: gdb_input.c:15
Status
Definition: gdiplustypes.h:24
#define PROCESS_CREATE_THREAD
Definition: pstypes.h:154
#define THREAD_QUERY_INFORMATION
Definition: pstypes.h:145
#define CT_DEAD_THREAD_BIT
Definition: pstypes.h:265
#define CT_SYSTEM_THREAD_BIT
Definition: pstypes.h:268
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
#define InterlockedCompareExchangePointer
Definition: interlocked.h:144
#define InterlockedCompareExchange
Definition: interlocked.h:119
#define NtCurrentTeb
#define KeLeaveCriticalRegion()
Definition: ke_x.h:119
#define KeEnterCriticalRegion()
Definition: ke_x.h:88
#define ASSERT(a)
Definition: mode.c:44
PVOID PVOID PWCHAR PVOID USHORT PULONG Reason
Definition: env.c:47
#define THREAD_QUERY_LIMITED_INFORMATION
Definition: security.c:76
#define THREAD_SET_LIMITED_INFORMATION
Definition: security.c:75
static ULONG
Definition: thread.c:81
static PVOID
Definition: thread.c:81
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1197
#define KeGetPreviousMode()
Definition: ketypes.h:1115
#define KernelMode
Definition: asm.h:38
_In_opt_ HANDLE _In_opt_ PIO_APC_ROUTINE _In_opt_ PVOID ApcContext
Definition: iofuncs.h:727
_In_opt_ HANDLE _In_opt_ PIO_APC_ROUTINE ApcRoutine
Definition: iofuncs.h:726
@ ThreadObject
Definition: ketypes.h:431
_In_ HANDLE ProcessHandle
Definition: mmfuncs.h:407
enum _OB_OPEN_REASON OB_OPEN_REASON
HANDLE hThread
Definition: wizard.c:28
#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 THREAD_ALL_ACCESS
Definition: nt_native.h:1342
#define THREAD_TERMINATE
Definition: nt_native.h:1339
ACCESS_MASK * PACCESS_MASK
Definition: nt_native.h:41
ULONG ACCESS_MASK
Definition: nt_native.h:40
NTSYSAPI NTSTATUS NTAPI NtCreateThread(OUT PHANDLE phThread, IN ACCESS_MASK AccessMask, IN POBJECT_ATTRIBUTES ObjectAttributes, IN HANDLE hProcess, OUT PCLIENT_ID pClientId, IN PCONTEXT pContext, OUT PSTACKINFO pStackInfo, IN BOOLEAN bSuspended)
#define THREAD_SET_INFORMATION
Definition: nt_native.h:1340
#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
#define KeGetExceptionFrame(Thread)
Definition: ke.h:235
#define KeGetTrapFrame(Thread)
Definition: ke.h:218
#define KeGetContextPc(Context)
Definition: ke.h:31
#define KeGetContextReturnRegister(Context)
Definition: ke.h:40
NTSTATUS NTAPI KeInitThread(IN OUT PKTHREAD Thread, IN PVOID KernelStack, IN PKSYSTEM_ROUTINE SystemRoutine, IN PKSTART_ROUTINE StartRoutine, IN PVOID StartContext, IN PCONTEXT Context, IN PVOID Teb, IN PKPROCESS Process)
Definition: thrdobj.c:756
ULONG NTAPI KeForceResumeThread(IN PKTHREAD Thread)
Definition: thrdobj.c:267
VOID NTAPI KeUninitThread(IN PKTHREAD Thread)
Definition: thrdobj.c:917
ULONG NTAPI KeSuspendThread(PKTHREAD Thread)
Definition: thrdobj.c:601
ULONG NTAPI KeResumeThread(IN PKTHREAD Thread)
Definition: thrdobj.c:388
VOID NTAPI KiInitializeUserApc(IN PKEXCEPTION_FRAME Reserved, IN PKTRAP_FRAME TrapFrame, IN PKNORMAL_ROUTINE NormalRoutine, IN PVOID NormalContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
Definition: usercall.c:266
VOID NTAPI KeStartThread(IN OUT PKTHREAD Thread)
Definition: thrdobj.c:489
VOID NTAPI KeReadyThread(IN PKTHREAD Thread)
Definition: thrdobj.c:106
ULONG NTAPI MmGetSessionId(IN PEPROCESS Process)
Definition: session.c:179
ULONG NTAPI MmGetSessionLocaleId(VOID)
Definition: session.c:56
NTSTATUS NTAPI MmCreateTeb(IN PEPROCESS Process, IN PCLIENT_ID ClientId, IN PINITIAL_TEB InitialTeb, OUT PTEB *BaseTeb)
Definition: procsup.c:809
VOID NTAPI MmDeleteTeb(struct _EPROCESS *Process, PTEB Teb)
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)
POBJECT_TYPE PsProcessType
Definition: process.c:20
NTSTATUS NTAPI PsLookupProcessThreadByCid(IN PCLIENT_ID Cid, OUT PEPROCESS *Process OPTIONAL, OUT PETHREAD *Thread)
Definition: process.c:1001
PACCESS_TOKEN NTAPI PsReferencePrimaryToken(PEPROCESS Process)
Definition: security.c:440
ULONG NTAPI PsGetThreadFreezeCount(IN PETHREAD Thread)
Definition: thread.c:709
PEPROCESS NTAPI PsGetCurrentThreadProcess(VOID)
Definition: thread.c:759
PTEB NTAPI PsGetThreadTeb(IN PETHREAD Thread)
Definition: thread.c:799
PVOID NTAPI PsGetCurrentThreadStackLimit(VOID)
Definition: thread.c:882
VOID NTAPI PspUserThreadStartup(IN PKSTART_ROUTINE StartRoutine, IN PVOID StartContext)
Definition: thread.c:49
BOOLEAN NTAPI PsIsThreadImpersonating(IN PETHREAD Thread)
Definition: thread.c:912
NTSTATUS NTAPI PspThreadOpen(_In_ OB_OPEN_REASON Reason, _In_ KPROCESSOR_MODE AccessMode, _In_opt_ PEPROCESS Process, _In_ PVOID ObjectBody, _Inout_ PACCESS_MASK GrantedAccess, _In_ ULONG HandleCount)
Definition: thread.c:26
POBJECT_TYPE PsThreadType
Definition: thread.c:20
PVOID NTAPI PsSetThreadWin32Thread(_Inout_ PETHREAD Thread, _In_ PVOID Win32Thread, _In_ PVOID OldWin32Thread)
Definition: thread.c:933
PVOID NTAPI PsGetCurrentThreadStackBase(VOID)
Definition: thread.c:872
NTSTATUS NTAPI NtOpenThread(OUT PHANDLE ThreadHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN PCLIENT_ID ClientId OPTIONAL)
Definition: thread.c:1037
PVOID NTAPI PsGetCurrentThreadTeb(VOID)
Definition: thread.c:809
NTSTATUS NTAPI PsCreateSystemThread(OUT PHANDLE ThreadHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN HANDLE ProcessHandle, IN PCLIENT_ID ClientId, IN PKSTART_ROUTINE StartRoutine, IN PVOID StartContext)
Definition: thread.c:626
VOID NTAPI PsSetThreadHardErrorsAreDisabled(IN PETHREAD Thread, IN BOOLEAN HardErrorsAreDisabled)
Definition: thread.c:922
HANDLE NTAPI PsGetThreadId(IN PETHREAD Thread)
Definition: thread.c:729
BOOLEAN NTAPI PsGetThreadHardErrorsAreDisabled(IN PETHREAD Thread)
Definition: thread.c:719
NTSTATUS NTAPI PsLookupThreadByThreadId(IN HANDLE ThreadId, OUT PETHREAD *Thread)
Definition: thread.c:667
NTSTATUS NTAPI PsWrapApcWow64Thread(IN OUT PVOID *ApcContext, IN OUT PVOID *ApcRoutine)
Definition: thread.c:956
ULONG NTAPI PsGetThreadSessionId(IN PETHREAD Thread)
Definition: thread.c:789
PVOID NTAPI PsGetThreadWin32Thread(IN PETHREAD Thread)
Definition: thread.c:819
ULONG MmReadClusterSize
Definition: mminit.c:21
VOID NTAPI PspSystemThreadStartup(IN PKSTART_ROUTINE StartRoutine, IN PVOID StartContext)
Definition: thread.c:162
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:829
HANDLE NTAPI PsGetThreadProcessId(IN PETHREAD Thread)
Definition: thread.c:769
PEPROCESS NTAPI PsGetThreadProcess(IN PETHREAD Thread)
Definition: thread.c:749
BOOLEAN NTAPI PsIsSystemThread(IN PETHREAD Thread)
Definition: thread.c:902
PVOID NTAPI PsGetCurrentThreadWin32ThreadAndEnterCriticalRegion(_Out_ HANDLE *OutProcessId)
Definition: thread.c:839
HANDLE NTAPI PsGetCurrentThreadProcessId(VOID)
Definition: thread.c:779
LONG PspUnhandledExceptionInSystemThread(PEXCEPTION_POINTERS ExceptionPointers)
Definition: thread.c:138
NTSTATUS NTAPI PspCreateThread(OUT PHANDLE ThreadHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN HANDLE ProcessHandle, IN PEPROCESS TargetProcess, OUT PCLIENT_ID ClientId, IN PCONTEXT ThreadContext, IN PINITIAL_TEB InitialTeb, IN BOOLEAN CreateSuspended, IN PKSTART_ROUTINE StartRoutine OPTIONAL, IN PVOID StartContext OPTIONAL)
Definition: thread.c:195
BOOLEAN CcPfEnablePrefetcher
Definition: cacheman.c:17
KPROCESSOR_MODE NTAPI PsGetCurrentThreadPreviousMode(VOID)
Definition: thread.c:862
BOOLEAN NTAPI PsIsThreadTerminating(IN PETHREAD Thread)
Definition: thread.c:892
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_THREAD_IS_TERMINATING
Definition: ntstatus.h:405
#define STATUS_INVALID_PARAMETER_MIX
Definition: ntstatus.h:378
#define STATUS_PROCESS_IS_TERMINATING
Definition: ntstatus.h:596
LONG FASTCALL ObDereferenceObjectEx(IN PVOID Object, IN LONG Count)
Definition: obref.c:88
BOOLEAN FASTCALL ObReferenceObjectSafe(IN PVOID Object)
Definition: obref.c:22
LONG FASTCALL ObReferenceObjectEx(IN PVOID Object, IN LONG Count)
Definition: obref.c:77
VOID FASTCALL ObFastDereferenceObject(IN PEX_FAST_REF FastRef, IN PVOID Object)
Definition: obref.c:167
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
long LONG
Definition: pedump.c:60
PVOID PspSystemDllEntryPoint
Definition: psmgr.c:43
#define PSTRACE(x, fmt,...)
Definition: ps.h:57
#define PSREFTRACE(x)
Definition: ps.h:58
PHANDLE_TABLE PspCidTable
Definition: psmgr.c:48
NTSTATUS NTAPI PspTerminateThreadByPointer(IN PETHREAD Thread, IN NTSTATUS ExitStatus, IN BOOLEAN bSelf)
Definition: kill.c:1012
#define PS_THREAD_DEBUG
Definition: ps.h:17
PVOID PspSystemDllBase
Definition: psmgr.c:41
#define PspSetCrossThreadFlag(Thread, Flag)
Definition: ps_x.h:25
FORCEINLINE VOID PspRunCreateThreadNotifyRoutines(IN PETHREAD CurrentThread, IN BOOLEAN Create)
Definition: ps_x.h:40
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:204
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:104
#define _SEH2_GetExceptionInformation()
Definition: pseh2_64.h:203
#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
#define SharedUserData
VOID NTAPI KeInitializeSemaphore(IN PKSEMAPHORE Semaphore, IN LONG Count, IN LONG Limit)
Definition: semphobj.c:22
#define STATUS_SUCCESS
Definition: shellext.h:65
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
HANDLE UniqueThread
Definition: compat.h:826
HANDLE UniqueProcess
Definition: compat.h:825
PKSTART_ROUTINE StartAddress
Definition: pstypes.h:1348
NTSTATUS ExitStatus
Definition: pstypes.h:1306
KTHREAD Tcb
Definition: pstypes.h:1296
EX_RUNDOWN_REF RundownProtect
Definition: pstypes.h:1352
ULONG ReadClusterSize
Definition: pstypes.h:1357
PVOID Win32StartAddress
Definition: pstypes.h:1345
CLIENT_ID Cid
Definition: pstypes.h:1321
LIST_ENTRY IrpList
Definition: pstypes.h:1337
LIST_ENTRY ActiveTimerListHead
Definition: pstypes.h:1320
KSPIN_LOCK ActiveTimerListLock
Definition: pstypes.h:1319
LARGE_INTEGER CreateTime
Definition: pstypes.h:1297
ULONG ActiveImpersonationInfo
Definition: pstypes.h:1374
ULONG SystemThread
Definition: pstypes.h:1375
ULONG HardErrorsAreDisabled
Definition: pstypes.h:1376
LIST_ENTRY ThreadListEntry
Definition: pstypes.h:1351
LIST_ENTRY LpcReplyChain
Definition: pstypes.h:1301
ULONG HideFromDebugger
Definition: pstypes.h:1373
ULONG Terminated
Definition: pstypes.h:1367
LIST_ENTRY PostBlockList
Definition: pstypes.h:1309
PEXCEPTION_RECORD ExceptionRecord
Definition: rtltypes.h:200
PCONTEXT ContextRecord
Definition: rtltypes.h:201
DWORD ExceptionCode
Definition: compat.h:208
ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS]
Definition: compat.h:213
PVOID ExceptionAddress
Definition: compat.h:211
Definition: extypes.h:767
PVOID Object
Definition: extypes.h:770
ULONG GrantedAccess
Definition: extypes.h:777
ULONG InterruptTime
Definition: ketypes.h:840
LONG MmPageFaultCount
Definition: ketypes.h:733
ULONG IdealProcessor
Definition: ketypes.h:2091
ULONG FreezeCount
Definition: ketypes.h:1884
PVOID Win32Thread
Definition: ketypes.h:2013
PVOID Teb
Definition: ketypes.h:1954
DISPATCHER_HEADER Header
Definition: ketypes.h:1808
GENERIC_MAPPING GenericMapping
Definition: obtypes.h:388
OBJECT_TYPE_INITIALIZER TypeInfo
Definition: obtypes.h:420
Definition: compat.h:836
ULONG CurrentLocale
Definition: compat.h:849
#define STATUS_PENDING
Definition: telnetd.h:14
#define NTAPI
Definition: typedefs.h:36
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
static ULONG HandleCount
Definition: uefidisk.c:67
struct _LARGE_INTEGER::@2750 u
_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
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:778
_Out_ PCLIENT_ID ClientId
Definition: kefuncs.h:1151
KSTART_ROUTINE * PKSTART_ROUTINE
Definition: ketypes.h:567
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
_In_ PEPROCESS _In_ KPROCESSOR_MODE AccessMode
Definition: mmfuncs.h:396
#define ObDereferenceObject
Definition: obfuncs.h:203
#define ObReferenceObject
Definition: obfuncs.h:204
#define PsGetCurrentProcess
Definition: psfuncs.h:17
_In_ ULONG _In_opt_ POBJECT_ATTRIBUTES _In_opt_ HANDLE _Out_opt_ PCLIENT_ID _In_ PKSTART_ROUTINE StartRoutine
Definition: psfuncs.h:92
_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
_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 GrantedAccess
Definition: sefuncs.h:20