ReactOS 0.4.15-dev-7788-g1ad9096
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
24VOID
27 IN PVOID StartContext)
28{
30 PTEB Teb;
31 BOOLEAN DeadThread = FALSE;
33 PAGED_CODE();
35 "StartRoutine: %p StartContext: %p\n", StartRoutine, StartContext);
36
37 /* Go to Passive Level */
40
41 /* Check if the thread is dead */
42 if (Thread->DeadThread)
43 {
44 /* Remember that we're dead */
45 DeadThread = TRUE;
46 }
47 else
48 {
49 /* Get the Locale ID and save Preferred Proc */
50 Teb = NtCurrentTeb();
52 Teb->IdealProcessor = Thread->Tcb.IdealProcessor;
53 }
54
55 /* Check if this is a dead thread, or if we're hiding */
56 if (!(Thread->DeadThread) && !(Thread->HideFromDebugger))
57 {
58 /* We're not, so notify the debugger */
59 DbgkCreateThread(Thread, StartContext);
60 }
61
62 /* Make sure we're not already dead */
63 if (!DeadThread)
64 {
65 /* Check if the Prefetcher is enabled */
67 {
68 /* FIXME: Prepare to prefetch this process */
69 }
70
71 /* Raise to APC */
73
74 /* Queue the User APC */
78 NULL,
80 NULL);
81
82 /* Lower it back to passive */
84 }
85 else
86 {
87 /* We're dead, kill us now */
90 TRUE);
91 }
92
93 /* Do we have a cookie set yet? */
94 while (!SharedUserData->Cookie)
95 {
96 LARGE_INTEGER SystemTime;
97 ULONG NewCookie;
98 PKPRCB Prcb;
99
100 /* Generate a new cookie */
101 KeQuerySystemTime(&SystemTime);
102 Prcb = KeGetCurrentPrcb();
103 NewCookie = (Prcb->MmPageFaultCount ^ Prcb->InterruptTime ^
104 SystemTime.u.LowPart ^ SystemTime.u.HighPart ^
105 (ULONG)(ULONG_PTR)&SystemTime);
106
107 /* Set the new cookie*/
109 NewCookie,
110 0);
111 }
112}
113
114LONG
116{
117 /* Print debugging information */
118 DPRINT1("PS: Unhandled Kernel Mode Exception Pointers = 0x%p\n",
119 ExceptionPointers);
120 DPRINT1("Code %x Addr %p Info0 %p Info1 %p Info2 %p Info3 %p\n",
121 ExceptionPointers->ExceptionRecord->ExceptionCode,
122 ExceptionPointers->ExceptionRecord->ExceptionAddress,
123 ExceptionPointers->ExceptionRecord->ExceptionInformation[0],
124 ExceptionPointers->ExceptionRecord->ExceptionInformation[1],
125 ExceptionPointers->ExceptionRecord->ExceptionInformation[2],
126 ExceptionPointers->ExceptionRecord->ExceptionInformation[3]);
127
128 /* Bugcheck the system */
129 KeBugCheckEx(SYSTEM_THREAD_EXCEPTION_NOT_HANDLED,
130 ExceptionPointers->ExceptionRecord->ExceptionCode,
131 (ULONG_PTR)ExceptionPointers->ExceptionRecord->ExceptionAddress,
132 (ULONG_PTR)ExceptionPointers->ExceptionRecord,
133 (ULONG_PTR)ExceptionPointers->ContextRecord);
134 return 0;
135}
136
137VOID
138NTAPI
140 IN PVOID StartContext)
141{
144 "StartRoutine: %p StartContext: %p\n", StartRoutine, StartContext);
145
146 /* Unlock the dispatcher Database */
149
150 /* Make sure the thread isn't gone */
152 {
153 if (!(Thread->Terminated) && !(Thread->DeadThread))
154 {
155 /* Call the Start Routine */
156 StartRoutine(StartContext);
157 }
158 }
160 {
161 /* Bugcheck if we got here */
162 KeBugCheck(KMODE_EXCEPTION_NOT_HANDLED);
163 }
164 _SEH2_END;
165
166 /* Exit the thread */
168}
169
171NTAPI
176 IN PEPROCESS TargetProcess,
178 IN PCONTEXT ThreadContext,
179 IN PINITIAL_TEB InitialTeb,
180 IN BOOLEAN CreateSuspended,
182 IN PVOID StartContext OPTIONAL)
183{
187 PTEB TebBase = NULL;
190 HANDLE_TABLE_ENTRY CidEntry;
191 ACCESS_STATE LocalAccessState;
192 PACCESS_STATE AccessState = &LocalAccessState;
193 AUX_ACCESS_DATA AuxData;
194 BOOLEAN Result, SdAllocated;
197 PAGED_CODE();
199 "ThreadContext: %p TargetProcess: %p ProcessHandle: %p\n",
200 ThreadContext, TargetProcess, ProcessHandle);
201
202 /* If we were called from PsCreateSystemThread, then we're kernel mode */
204
205 /* Reference the Process by handle or pointer, depending on what we got */
206 if (ProcessHandle)
207 {
208 /* Normal thread or System Thread */
213 (PVOID*)&Process,
214 NULL);
216 }
217 else
218 {
219 /* System thread inside System Process, or Normal Thread with a bug */
220 if (StartRoutine)
221 {
222 /* Reference the Process by Pointer */
223 ObReferenceObject(TargetProcess);
224 Process = TargetProcess;
226 }
227 else
228 {
229 /* Fake ObReference returning this */
231 }
232 }
233
234 /* Check for success */
235 if (!NT_SUCCESS(Status)) return Status;
236
237 /* Also make sure that User-Mode isn't trying to create a system thread */
239 {
240 /* Fail */
243 }
244
245 /* Create Thread Object */
250 NULL,
251 sizeof(ETHREAD),
252 0,
253 0,
254 (PVOID*)&Thread);
255 if (!NT_SUCCESS(Status))
256 {
257 /* We failed; dereference the process and exit */
259 return Status;
260 }
261
262 /* Zero the Object entirely */
263 RtlZeroMemory(Thread, sizeof(ETHREAD));
264
265 /* Initialize rundown protection */
267
268 /* Initialize exit code */
270
271 /* Set the Process CID */
272 Thread->ThreadsProcess = Process;
273 Thread->Cid.UniqueProcess = Process->UniqueProcessId;
274
275 /* Create Cid Handle */
276 CidEntry.Object = Thread;
277 CidEntry.GrantedAccess = 0;
279 if (!Thread->Cid.UniqueThread)
280 {
281 /* We couldn't create the CID, dereference the thread and fail */
284 }
285
286 /* Save the read cluster size */
288
289 /* Initialize the LPC Reply Semaphore */
290 KeInitializeSemaphore(&Thread->LpcReplySemaphore, 0, 1);
291
292 /* Initialize the list heads and locks */
298
299 /* Acquire rundown protection */
300 if (!ExAcquireRundownProtection (&Process->RundownProtect))
301 {
302 /* Fail */
305 }
306
307 /* Now let the kernel initialize the context */
308 if (ThreadContext)
309 {
310 /* User-mode Thread, create Teb */
311 Status = MmCreateTeb(Process, &Thread->Cid, InitialTeb, &TebBase);
312 if (!NT_SUCCESS(Status))
313 {
314 /* Failed to create the TEB. Release rundown and dereference */
315 ExReleaseRundownProtection(&Process->RundownProtect);
317 return Status;
318 }
319
320 /* Set the Start Addresses from the untrusted ThreadContext */
322 {
323 Thread->StartAddress = (PVOID)KeGetContextPc(ThreadContext);
325 }
327 {
329 }
330 _SEH2_END;
331
332 /* Let the kernel intialize the Thread */
333 if (NT_SUCCESS(Status))
334 {
336 NULL,
338 NULL,
340 ThreadContext,
341 TebBase,
342 &Process->Pcb);
343 }
344 }
345 else
346 {
347 /* System Thread */
350
351 /* Let the kernel intialize the Thread */
353 NULL,
356 StartContext,
357 NULL,
358 NULL,
359 &Process->Pcb);
360 }
361
362 /* Check if we failed */
363 if (!NT_SUCCESS(Status))
364 {
365 /* Delete the TEB if we had done */
366 if (TebBase) MmDeleteTeb(Process, TebBase);
367
368 /* Release rundown and dereference */
369 ExReleaseRundownProtection(&Process->RundownProtect);
371 return Status;
372 }
373
374 /* Lock the process */
376 ExAcquirePushLockExclusive(&Process->ProcessLock);
377
378 /* Make sure the process didn't just die on us */
379 if (Process->ProcessDelete) goto Quickie;
380
381 /* Check if the thread was ours, terminated and it was user mode */
382 if ((Thread->Terminated) &&
383 (ThreadContext) &&
384 (Thread->ThreadsProcess == Process))
385 {
386 /* Cleanup, we don't want to start it up and context switch */
387 goto Quickie;
388 }
389
390 /*
391 * Insert the Thread into the Process's Thread List
392 * Note, this is the ETHREAD Thread List. It is removed in
393 * ps/kill.c!PspExitThread.
394 */
395 InsertTailList(&Process->ThreadListHead, &Thread->ThreadListEntry);
396 Process->ActiveThreads++;
397
398 /* Start the thread */
400
401 /* Release the process lock */
402 ExReleasePushLockExclusive(&Process->ProcessLock);
404
405 /* Release rundown */
406 ExReleaseRundownProtection(&Process->RundownProtect);
407
408 /* Notify WMI */
409 //WmiTraceProcess(Process, TRUE);
410 //WmiTraceThread(Thread, InitialTeb, TRUE);
411
412 /* Notify Thread Creation */
414
415 /* Reference ourselves as a keep-alive */
417
418 /* Suspend the Thread if we have to */
419 if (CreateSuspended) KeSuspendThread(&Thread->Tcb);
420
421 /* Check if we were already terminated */
423
424 /* Create an access state */
426 ThreadContext ?
428 &LocalAccessState,
429 &AuxData,
432 if (!NT_SUCCESS(Status))
433 {
434 /* Access state failed, thread is dead */
436
437 /* If we were suspended, wake it up */
438 if (CreateSuspended) KeResumeThread(&Thread->Tcb);
439
440 /* Dispatch thread */
442
443 /* Dereference completely to kill it */
445 return Status;
446 }
447
448 /* Insert the Thread into the Object Manager */
452 0,
453 NULL,
454 &hThread);
455
456 /* Delete the access state if we had one */
458
459 /* Check for success */
460 if (NT_SUCCESS(Status))
461 {
462 /* Wrap in SEH to protect against bad user-mode pointers */
464 {
465 /* Return Cid and Handle */
466 if (ClientId) *ClientId = Thread->Cid;
467 *ThreadHandle = hThread;
468 }
470 {
471 /* Thread insertion failed, thread is dead */
473
474 /* If we were suspended, wake it up */
475 if (CreateSuspended) KeResumeThread(&Thread->Tcb);
476
477 /* Dispatch thread */
479
480 /* Dereference it, leaving only the keep-alive */
482
483 /* Close its handle, killing it */
485
486 /* Return the exception code */
488 }
489 _SEH2_END;
490 }
491 else
492 {
493 /* Thread insertion failed, thread is dead */
495
496 /* If we were suspended, wake it up */
497 if (CreateSuspended) KeResumeThread(&Thread->Tcb);
498 }
499
500 /* Get the create time */
502 ASSERT(!(Thread->CreateTime.HighPart & 0xF0000000));
503
504 /* Make sure the thread isn't dead */
505 if (!Thread->DeadThread)
506 {
507 /* Get the thread's SD */
510 &SdAllocated);
511 if (!NT_SUCCESS(Status))
512 {
513 /* Thread insertion failed, thread is dead */
515
516 /* If we were suspended, wake it up */
517 if (CreateSuspended) KeResumeThread(&Thread->Tcb);
518
519 /* Dispatch thread */
521
522 /* Dereference it, leaving only the keep-alive */
524
525 /* Close its handle, killing it */
527 return Status;
528 }
529
530 /* Create the subject context */
531 SubjectContext.ProcessAuditId = Process;
533 SubjectContext.ClientToken = NULL;
534
535 /* Do the access check */
538 FALSE,
540 0,
541 NULL,
544 &Thread->GrantedAccess,
545 &AccessStatus);
546
547 /* Dereference the token and let go the SD */
549 SubjectContext.PrimaryToken);
551
552 /* Remove access if it failed */
553 if (!Result) Process->GrantedAccess = 0;
554
555 /* Set least some minimum access */
556 Thread->GrantedAccess |= (THREAD_TERMINATE |
559 }
560 else
561 {
562 /* Set the thread access mask to maximum */
563 Thread->GrantedAccess = THREAD_ALL_ACCESS;
564 }
565
566 /* Dispatch thread */
568
569 /* Dereference it, leaving only the keep-alive */
571
572 /* Return */
573 return Status;
574
575 /* Most annoying failure case ever, where we undo almost all manually */
576Quickie:
577 /* When we get here, the process is locked, unlock it */
578 ExReleasePushLockExclusive(&Process->ProcessLock);
580
581 /* Uninitailize it */
583
584 /* If we had a TEB, delete it */
585 if (TebBase) MmDeleteTeb(Process, TebBase);
586
587 /* Release rundown protection, which we also hold */
588 ExReleaseRundownProtection(&Process->RundownProtect);
589
590 /* Dereference the thread and return failure */
593}
594
595/* PUBLIC FUNCTIONS **********************************************************/
596
597/*
598 * @implemented
599 */
601NTAPI
608 IN PVOID StartContext)
609{
610 PEPROCESS TargetProcess = NULL;
612 PAGED_CODE();
614 "ProcessHandle: %p StartRoutine: %p StartContext: %p\n",
615 ProcessHandle, StartRoutine, StartContext);
616
617 /* Check if we have a handle. If not, use the System Process */
618 if (!ProcessHandle)
619 {
620 Handle = NULL;
621 TargetProcess = PsInitialSystemProcess;
622 }
623
624 /* Call the shared function */
625 return PspCreateThread(ThreadHandle,
628 Handle,
629 TargetProcess,
630 ClientId,
631 NULL,
632 NULL,
633 FALSE,
635 StartContext);
636}
637
638/*
639 * @implemented
640 */
642NTAPI
645{
646 PHANDLE_TABLE_ENTRY CidEntry;
647 PETHREAD FoundThread;
649 PAGED_CODE();
650 PSTRACE(PS_THREAD_DEBUG, "ThreadId: %p\n", ThreadId);
652
653 /* Get the CID Handle Entry */
654 CidEntry = ExMapHandleToPointer(PspCidTable, ThreadId);
655 if (CidEntry)
656 {
657 /* Get the Thread */
658 FoundThread = CidEntry->Object;
659
660 /* Make sure it's really a thread */
661 if (FoundThread->Tcb.Header.Type == ThreadObject)
662 {
663 /* Safe Reference and return it */
664 if (ObReferenceObjectSafe(FoundThread))
665 {
666 *Thread = FoundThread;
668 }
669 }
670
671 /* Unlock the Entry */
673 }
674
675 /* Return to caller */
677 return Status;
678}
679
680/*
681 * @implemented
682 */
683ULONG
684NTAPI
686{
687 return Thread->Tcb.FreezeCount;
688}
689
690/*
691 * @implemented
692 */
694NTAPI
696{
698}
699
700/*
701 * @implemented
702 */
703HANDLE
704NTAPI
706{
707 return Thread->Cid.UniqueThread;
708}
709
710/*
711 * @implemented
712 */
713HANDLE
714NTAPI
716{
717 return PsGetCurrentThread()->Cid.UniqueThread;
718}
719
720/*
721 * @implemented
722 */
724NTAPI
726{
727 return Thread->ThreadsProcess;
728}
729
730/*
731 * @implemented
732 */
734NTAPI
736{
737 return PsGetCurrentThread()->ThreadsProcess;
738}
739
740/*
741 * @implemented
742 */
743HANDLE
744NTAPI
746{
747 return Thread->Cid.UniqueProcess;
748}
749
750/*
751 * @implemented
752 */
753HANDLE
754NTAPI
756{
757 return PsGetCurrentThread()->Cid.UniqueProcess;
758}
759
760/*
761 * @implemented
762 */
763ULONG
764NTAPI
766{
767 return MmGetSessionId(Thread->ThreadsProcess);
768}
769
770/*
771 * @implemented
772 */
773PTEB
774NTAPI
776{
777 return Thread->Tcb.Teb;
778}
779
780/*
781 * @implemented
782 */
783PVOID
784NTAPI
786{
787 return PsGetCurrentThread()->Tcb.Teb;
788}
789
790/*
791 * @implemented
792 */
793PVOID
794NTAPI
796{
797 return Thread->Tcb.Win32Thread;
798}
799
800/*
801 * @implemented
802 */
803PVOID
804NTAPI
806{
807 return PsGetCurrentThread()->Tcb.Win32Thread;
808}
809
810/*
811 * @implemented
812 */
813PVOID
814NTAPI
816 _Out_ HANDLE* OutProcessId)
817{
818 PETHREAD CurrentThread;
819
820 /* Get the current thread */
821 CurrentThread = PsGetCurrentThread();
822
823 /* Return the process id */
824 *OutProcessId = CurrentThread->Cid.UniqueProcess;
825
826 /* Enter critical region */
828
829 /* Return the win32 thread */
830 return CurrentThread->Tcb.Win32Thread;
831}
832
833/*
834 * @implemented
835 */
837NTAPI
839{
840 return (KPROCESSOR_MODE)PsGetCurrentThread()->Tcb.PreviousMode;
841}
842
843/*
844 * @implemented
845 */
846PVOID
847NTAPI
849{
850 return PsGetCurrentThread()->Tcb.StackBase;
851}
852
853/*
854 * @implemented
855 */
856PVOID
857NTAPI
859{
860 return (PVOID)PsGetCurrentThread()->Tcb.StackLimit;
861}
862
863/*
864 * @implemented
865 */
867NTAPI
869{
870 return Thread->Terminated ? TRUE : FALSE;
871}
872
873/*
874 * @implemented
875 */
877NTAPI
879{
880 return Thread->SystemThread ? TRUE: FALSE;
881}
882
883/*
884 * @implemented
885 */
887NTAPI
889{
891}
892
893/*
894 * @implemented
895 */
896VOID
897NTAPI
899 IN BOOLEAN HardErrorsAreDisabled)
900{
901 Thread->HardErrorsAreDisabled = HardErrorsAreDisabled;
902}
903
904/*
905 * @implemented
906 */
907PVOID
908NTAPI
911 _In_ PVOID Win32Thread,
912 _In_ PVOID OldWin32Thread)
913{
914 /* Are we setting the win32 process? */
915 if (Win32Thread != NULL)
916 {
917 /* Just exchange it */
919 Win32Thread);
920 }
921 else
922 {
923 /* We are resetting, only exchange when the old win32 thread matches */
925 Win32Thread,
926 OldWin32Thread);
927 }
928}
929
931NTAPI
934{
937}
938
940NTAPI
946 IN PCONTEXT ThreadContext,
947 IN PINITIAL_TEB InitialTeb,
948 IN BOOLEAN CreateSuspended)
949{
950 INITIAL_TEB SafeInitialTeb;
951 PAGED_CODE();
953 "ProcessHandle: %p Context: %p\n", ProcessHandle, ThreadContext);
954
955 /* Check if this was from user-mode */
957 {
958 /* Make sure that we got a context */
959 if (!ThreadContext) return STATUS_INVALID_PARAMETER;
960
961 /* Protect checks */
963 {
964 /* Make sure the handle pointer we got is valid */
965 ProbeForWriteHandle(ThreadHandle);
966
967 /* Check if the caller wants a client id */
968 if (ClientId)
969 {
970 /* Make sure we can write to it */
971 ProbeForWrite(ClientId, sizeof(CLIENT_ID), sizeof(ULONG));
972 }
973
974 /* Make sure that the entire context is readable */
975 ProbeForRead(ThreadContext, sizeof(CONTEXT), sizeof(ULONG));
976
977 /* Check the Initial TEB */
978 ProbeForRead(InitialTeb, sizeof(INITIAL_TEB), sizeof(ULONG));
979 SafeInitialTeb = *InitialTeb;
980 }
982 {
983 /* Return the exception code */
985 }
986 _SEH2_END;
987 }
988 else
989 {
990 /* Use the Initial TEB as is */
991 SafeInitialTeb = *InitialTeb;
992 }
993
994 /* Call the shared function */
995 return PspCreateThread(ThreadHandle,
999 NULL,
1000 ClientId,
1001 ThreadContext,
1002 &SafeInitialTeb,
1003 CreateSuspended,
1004 NULL,
1005 NULL);
1006}
1007
1008/*
1009 * @implemented
1010 */
1012NTAPI
1017{
1019 CLIENT_ID SafeClientId;
1020 ULONG Attributes = 0;
1024 BOOLEAN HasObjectName = FALSE;
1026 AUX_ACCESS_DATA AuxData;
1027 PAGED_CODE();
1029 "ClientId: %p ObjectAttributes: %p\n", ClientId, ObjectAttributes);
1030
1031 /* Check if we were called from user mode */
1032 if (PreviousMode != KernelMode)
1033 {
1034 /* Enter SEH for probing */
1035 _SEH2_TRY
1036 {
1037 /* Probe the thread handle */
1038 ProbeForWriteHandle(ThreadHandle);
1039
1040 /* Check for a CID structure */
1041 if (ClientId)
1042 {
1043 /* Probe and capture it */
1044 ProbeForRead(ClientId, sizeof(CLIENT_ID), sizeof(ULONG));
1045 SafeClientId = *ClientId;
1046 ClientId = &SafeClientId;
1047 }
1048
1049 /*
1050 * Just probe the object attributes structure, don't capture it
1051 * completely. This is done later if necessary
1052 */
1054 sizeof(OBJECT_ATTRIBUTES),
1055 sizeof(ULONG));
1056 HasObjectName = (ObjectAttributes->ObjectName != NULL);
1057
1058 /* Validate user attributes */
1060 }
1062 {
1063 /* Return the exception code */
1065 }
1066 _SEH2_END;
1067 }
1068 else
1069 {
1070 /* Otherwise just get the data directly */
1071 HasObjectName = (ObjectAttributes->ObjectName != NULL);
1072
1073 /* Still have to sanitize attributes */
1075 }
1076
1077 /* Can't pass both, fail */
1078 if ((HasObjectName) && (ClientId)) return STATUS_INVALID_PARAMETER_MIX;
1079
1080 /* Create an access state */
1082 &AuxData,
1085 if (!NT_SUCCESS(Status)) return Status;
1086
1087 /* Check if this is a debugger */
1089 {
1090 /* Did he want full access? */
1091 if (AccessState.RemainingDesiredAccess & MAXIMUM_ALLOWED)
1092 {
1093 /* Give it to him */
1094 AccessState.PreviouslyGrantedAccess |= THREAD_ALL_ACCESS;
1095 }
1096 else
1097 {
1098 /* Otherwise just give every other access he could want */
1099 AccessState.PreviouslyGrantedAccess |=
1100 AccessState.RemainingDesiredAccess;
1101 }
1102
1103 /* The caller desires nothing else now */
1104 AccessState.RemainingDesiredAccess = 0;
1105 }
1106
1107 /* Open by name if one was given */
1108 if (HasObjectName)
1109 {
1110 /* Open it */
1114 &AccessState,
1115 0,
1116 NULL,
1117 &hThread);
1118
1119 /* Get rid of the access state */
1121 }
1122 else if (ClientId)
1123 {
1124 /* Open by Thread ID */
1126 {
1127 /* Get the Process */
1129 }
1130 else
1131 {
1132 /* Get the Process */
1134 }
1135
1136 /* Check if we didn't find anything */
1137 if (!NT_SUCCESS(Status))
1138 {
1139 /* Get rid of the access state and return */
1141 return Status;
1142 }
1143
1144 /* Open the Thread Object */
1146 Attributes,
1147 &AccessState,
1148 0,
1151 &hThread);
1152
1153 /* Delete the access state and dereference the thread */
1156 }
1157 else
1158 {
1159 /* Neither an object name nor a client id was passed */
1161 }
1162
1163 /* Check for success */
1164 if (NT_SUCCESS(Status))
1165 {
1166 /* Protect against bad user-mode pointers */
1167 _SEH2_TRY
1168 {
1169 /* Write back the handle */
1170 *ThreadHandle = hThread;
1171 }
1173 {
1174 /* Get the exception code */
1176 }
1177 _SEH2_END;
1178 }
1179
1180 /* Return status */
1181 return Status;
1182}
1183
1184/* EOF */
#define PAGED_CODE()
unsigned char BOOLEAN
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
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define UNIMPLEMENTED
Definition: debug.h:115
DECLSPEC_NORETURN VOID NTAPI KeBugCheck(ULONG BugCheckCode)
Definition: bug.c:1431
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
VOID NTAPI DbgkCreateThread(IN PETHREAD Thread, IN PVOID StartAddress)
Definition: dbgkutil.c:87
#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:32
#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:136
#define ExGetPreviousMode
Definition: ex.h:140
#define ExInitializeRundownProtection
Definition: ex.h:137
FORCEINLINE VOID ExAcquirePushLockExclusive(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1036
FORCEINLINE VOID ExReleasePushLockExclusive(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1252
#define ExAcquireRundownProtection
Definition: ex.h:135
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
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
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:25
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define PROCESS_CREATE_THREAD
Definition: pstypes.h:158
#define THREAD_QUERY_INFORMATION
Definition: pstypes.h:149
#define CT_DEAD_THREAD_BIT
Definition: pstypes.h:239
#define CT_SYSTEM_THREAD_BIT
Definition: pstypes.h:242
#define InterlockedCompareExchangePointer
Definition: interlocked.h:129
#define InterlockedCompareExchange
Definition: interlocked.h:104
#define NtCurrentTeb
#define KeLeaveCriticalRegion()
Definition: ke_x.h:119
#define KeEnterCriticalRegion()
Definition: ke_x.h:88
#define ASSERT(a)
Definition: mode.c:44
static ULONG
Definition: thread.c:78
static PVOID
Definition: thread.c:78
#define _Inout_
Definition: ms_sal.h:378
#define _Out_
Definition: ms_sal.h:345
#define _In_
Definition: ms_sal.h:308
#define KernelMode
Definition: asm.h:34
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1148
#define KeGetPreviousMode()
Definition: ketypes.h:1115
_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:412
_In_ HANDLE ProcessHandle
Definition: mmfuncs.h:403
HANDLE hThread
Definition: wizard.c:28
#define THREAD_ALL_ACCESS
Definition: nt_native.h:1339
#define THREAD_TERMINATE
Definition: nt_native.h:1336
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:1337
#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:225
#define KeGetTrapFrame(Thread)
Definition: ke.h:208
#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:757
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:961
PACCESS_TOKEN NTAPI PsReferencePrimaryToken(PEPROCESS Process)
Definition: security.c:440
ULONG NTAPI PsGetThreadFreezeCount(IN PETHREAD Thread)
Definition: thread.c:685
PEPROCESS NTAPI PsGetCurrentThreadProcess(VOID)
Definition: thread.c:735
PTEB NTAPI PsGetThreadTeb(IN PETHREAD Thread)
Definition: thread.c:775
PVOID NTAPI PsGetCurrentThreadStackLimit(VOID)
Definition: thread.c:858
VOID NTAPI PspUserThreadStartup(IN PKSTART_ROUTINE StartRoutine, IN PVOID StartContext)
Definition: thread.c:26
BOOLEAN NTAPI PsIsThreadImpersonating(IN PETHREAD Thread)
Definition: thread.c:888
POBJECT_TYPE PsThreadType
Definition: thread.c:20
PVOID NTAPI PsSetThreadWin32Thread(_Inout_ PETHREAD Thread, _In_ PVOID Win32Thread, _In_ PVOID OldWin32Thread)
Definition: thread.c:909
PVOID NTAPI PsGetCurrentThreadStackBase(VOID)
Definition: thread.c:848
NTSTATUS NTAPI NtOpenThread(OUT PHANDLE ThreadHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN PCLIENT_ID ClientId OPTIONAL)
Definition: thread.c:1013
PVOID NTAPI PsGetCurrentThreadTeb(VOID)
Definition: thread.c:785
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:602
VOID NTAPI PsSetThreadHardErrorsAreDisabled(IN PETHREAD Thread, IN BOOLEAN HardErrorsAreDisabled)
Definition: thread.c:898
HANDLE NTAPI PsGetThreadId(IN PETHREAD Thread)
Definition: thread.c:705
BOOLEAN NTAPI PsGetThreadHardErrorsAreDisabled(IN PETHREAD Thread)
Definition: thread.c:695
NTSTATUS NTAPI PsLookupThreadByThreadId(IN HANDLE ThreadId, OUT PETHREAD *Thread)
Definition: thread.c:643
NTSTATUS NTAPI PsWrapApcWow64Thread(IN OUT PVOID *ApcContext, IN OUT PVOID *ApcRoutine)
Definition: thread.c:932
ULONG NTAPI PsGetThreadSessionId(IN PETHREAD Thread)
Definition: thread.c:765
PVOID NTAPI PsGetThreadWin32Thread(IN PETHREAD Thread)
Definition: thread.c:795
ULONG MmReadClusterSize
Definition: mminit.c:21
VOID NTAPI PspSystemThreadStartup(IN PKSTART_ROUTINE StartRoutine, IN PVOID StartContext)
Definition: thread.c:139
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
HANDLE NTAPI PsGetThreadProcessId(IN PETHREAD Thread)
Definition: thread.c:745
PEPROCESS NTAPI PsGetThreadProcess(IN PETHREAD Thread)
Definition: thread.c:725
BOOLEAN NTAPI PsIsSystemThread(IN PETHREAD Thread)
Definition: thread.c:878
PVOID NTAPI PsGetCurrentThreadWin32ThreadAndEnterCriticalRegion(_Out_ HANDLE *OutProcessId)
Definition: thread.c:815
HANDLE NTAPI PsGetCurrentThreadProcessId(VOID)
Definition: thread.c:755
LONG PspUnhandledExceptionInSystemThread(PEXCEPTION_POINTERS ExceptionPointers)
Definition: thread.c:115
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:172
BOOLEAN CcPfEnablePrefetcher
Definition: cacheman.c:17
KPROCESSOR_MODE NTAPI PsGetCurrentThreadPreviousMode(VOID)
Definition: thread.c:838
BOOLEAN NTAPI PsIsThreadTerminating(IN PETHREAD Thread)
Definition: thread.c:868
NTSTATUS NTAPI SeCreateAccessState(_Inout_ PACCESS_STATE AccessState, _In_ PAUX_ACCESS_DATA AuxData, _In_ ACCESS_MASK Access, _In_ PGENERIC_MAPPING GenericMapping)
Creates an access state.
Definition: access.c:121
VOID NTAPI SeDeleteAccessState(_In_ PACCESS_STATE AccessState)
Deletes an allocated access state from the memory.
Definition: access.c:150
BOOLEAN NTAPI SeSinglePrivilegeCheck(_In_ LUID PrivilegeValue, _In_ KPROCESSOR_MODE PreviousMode)
Checks if a single privilege is present in the context of the calling thread.
Definition: priv.c:744
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:455
#define STATUS_INVALID_HANDLE
Definition: ntstatus.h:245
#define STATUS_THREAD_IS_TERMINATING
Definition: ntstatus.h:311
#define STATUS_INVALID_PARAMETER_MIX
Definition: ntstatus.h:285
#define STATUS_PENDING
Definition: ntstatus.h:82
#define STATUS_PROCESS_IS_TERMINATING
Definition: ntstatus.h:502
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:239
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:3379
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:2935
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:2742
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:2532
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:1039
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
NTSTATUS NTAPI ObGetObjectSecurity(IN PVOID Object, OUT PSECURITY_DESCRIPTOR *SecurityDescriptor, OUT PBOOLEAN MemoryAllocated)
Definition: obsecure.c:611
VOID NTAPI ObReleaseObjectSecurity(IN PSECURITY_DESCRIPTOR SecurityDescriptor, IN BOOLEAN MemoryAllocated)
Definition: obsecure.c:709
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:988
#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:159
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:34
#define _SEH2_GetExceptionInformation()
Definition: pseh2_64.h:158
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:162
PEPROCESS PsInitialSystemProcess
Definition: psmgr.c:50
VOID NTAPI KeBugCheckEx(_In_ ULONG BugCheckCode, _In_ ULONG_PTR BugCheckParameter1, _In_ ULONG_PTR BugCheckParameter2, _In_ ULONG_PTR BugCheckParameter3, _In_ ULONG_PTR BugCheckParameter4)
Definition: rtlcompat.c:108
#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:1155
NTSTATUS ExitStatus
Definition: pstypes.h:1113
KTHREAD Tcb
Definition: pstypes.h:1103
EX_RUNDOWN_REF RundownProtect
Definition: pstypes.h:1159
ULONG ReadClusterSize
Definition: pstypes.h:1164
PVOID Win32StartAddress
Definition: pstypes.h:1152
CLIENT_ID Cid
Definition: pstypes.h:1128
LIST_ENTRY IrpList
Definition: pstypes.h:1144
LIST_ENTRY ActiveTimerListHead
Definition: pstypes.h:1127
KSPIN_LOCK ActiveTimerListLock
Definition: pstypes.h:1126
LARGE_INTEGER CreateTime
Definition: pstypes.h:1104
ULONG ActiveImpersonationInfo
Definition: pstypes.h:1181
ULONG SystemThread
Definition: pstypes.h:1182
ULONG HardErrorsAreDisabled
Definition: pstypes.h:1183
LIST_ENTRY ThreadListEntry
Definition: pstypes.h:1158
LIST_ENTRY LpcReplyChain
Definition: pstypes.h:1108
ULONG HideFromDebugger
Definition: pstypes.h:1180
ULONG Terminated
Definition: pstypes.h:1174
LIST_ENTRY PostBlockList
Definition: pstypes.h:1116
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:596
PVOID Object
Definition: extypes.h:599
ULONG GrantedAccess
Definition: extypes.h:606
ULONG InterruptTime
Definition: ketypes.h:806
LONG MmPageFaultCount
Definition: ketypes.h:699
ULONG IdealProcessor
Definition: ketypes.h:1944
ULONG FreezeCount
Definition: ketypes.h:1737
PVOID Win32Thread
Definition: ketypes.h:1866
PVOID Teb
Definition: ketypes.h:1807
DISPATCHER_HEADER Header
Definition: ketypes.h:1661
GENERIC_MAPPING GenericMapping
Definition: obtypes.h:358
OBJECT_TYPE_INITIALIZER TypeInfo
Definition: obtypes.h:390
Definition: compat.h:836
ULONG CurrentLocale
Definition: compat.h:849
#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
struct _LARGE_INTEGER::@2290 u
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK DesiredAccess
Definition: wdfdevice.h:2658
_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:499
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
#define ObDereferenceObject
Definition: obfuncs.h:203
#define ObReferenceObject
Definition: obfuncs.h:204
#define PsGetCurrentProcess
Definition: psfuncs.h:17
_In_ ULONG _In_opt_ POBJECT_ATTRIBUTES _In_opt_ HANDLE _Out_opt_ PCLIENT_ID _In_ PKSTART_ROUTINE StartRoutine
Definition: psfuncs.h:91
_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_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
_In_opt_ PVOID _In_opt_ PUNICODE_STRING _In_ PSECURITY_DESCRIPTOR _In_ PACCESS_STATE AccessState
Definition: sefuncs.h:417