ReactOS  0.4.15-dev-3297-g037c744
libsupp.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS kernel
4  * FILE: ntoskrnl/rtl/libsupp.c
5  * PURPOSE: RTL Support Routines
6  * PROGRAMMERS: Alex Ionescu (alex@relsoft.net)
7  * Gunnar Dalsnes
8  */
9 
10 /* INCLUDES ******************************************************************/
11 
12 #include <ntoskrnl.h>
13 #define NDEBUG
14 #include <debug.h>
15 
16 #define TAG_ATMT 'TotA' /* Atom table */
17 #define TAG_RTHL 'LHtR' /* Heap Lock */
18 
19 extern ULONG NtGlobalFlag;
20 
21 typedef struct _RTL_RANGE_ENTRY
22 {
26 
29 
30 /* FUNCTIONS *****************************************************************/
31 
32 PVOID
33 NTAPI
35  IN PVOID PcValue,
36  OUT PVOID *BaseOfImage)
37 {
38  PLDR_DATA_TABLE_ENTRY LdrEntry;
39  BOOLEAN InSystem;
40  KIRQL OldIrql;
41 
42  /* Get the base for this file */
44  {
45  /* Acquire the loaded module spinlock */
47 
48  /* We are in kernel */
49  *BaseOfImage = KiPcToFileHeader(PcValue, &LdrEntry, FALSE, &InSystem);
50 
51  /* Release lock */
53  }
54  else
55  {
56  /* User mode is not handled here! */
57  *BaseOfImage = NULL;
58  }
59 
60  return *BaseOfImage;
61 }
62 
63 VOID
64 NTAPI
66 {
67  /* Setup the lookaside list for allocations (not used yet) */
69  NULL,
70  NULL,
72  sizeof(RTL_RANGE_ENTRY),
73  'elRR',
74  16);
75 }
76 
77 BOOLEAN
78 NTAPI
80 {
81  /* This check is meaningless in kernel-mode */
82  return FALSE;
83 }
84 
85 BOOLEAN
86 NTAPI
88 {
89  /* Nothing to set in kernel mode */
90  return FALSE;
91 }
92 
93 VOID
94 NTAPI
96 {
97  /* Nothing to clear in kernel mode */
98 }
99 
101 NTAPI
103 {
104  return KernelMode;
105 }
106 
107 PVOID
108 NTAPI
110  ULONG Tag)
111 {
113  (SIZE_T)Bytes,
114  Tag);
115 }
116 
117 
118 #define TAG_USTR 'RTSU'
119 #define TAG_ASTR 'RTSA'
120 #define TAG_OSTR 'RTSO'
121 VOID
122 NTAPI
124  ULONG Tag)
125 {
126  if (Tag == TAG_ASTR || Tag == TAG_OSTR || Tag == TAG_USTR)
127  ExFreePool(Mem);
128  else
129  ExFreePoolWithTag(Mem, Tag);
130 }
131 
132 /*
133  * @implemented
134  */
135 VOID NTAPI
137 {
138 
139 }
140 
141 /*
142  * @implemented
143  */
144 VOID NTAPI
146 {
147 
148 }
149 
150 NTSTATUS
151 NTAPI
153 {
154  return STATUS_SUCCESS;
155 }
156 
157 
158 PPEB
159 NTAPI
161 {
162  return ((PEPROCESS)(KeGetCurrentThread()->ApcState.Process))->Peb;
163 }
164 
165 NTSTATUS
166 NTAPI
168 {
169  ExDeleteResourceLite(&Lock->Resource);
171 
172  return STATUS_SUCCESS;
173 }
174 
175 NTSTATUS
176 NTAPI
178 {
180 
181  if (Exclusive)
183  else
185 
186  return STATUS_SUCCESS;
187 }
188 
189 BOOLEAN
190 NTAPI
192 {
195 
196  if (Exclusive)
198  else
200 
201  if (!Success)
203 
204  return Success;
205 }
206 
207 NTSTATUS
208 NTAPI
210 {
212  sizeof(HEAP_LOCK),
213  TAG_RTHL);
214  if (HeapLock == NULL)
215  return STATUS_NO_MEMORY;
216 
218  *Lock = HeapLock;
219 
220  return STATUS_SUCCESS;
221 }
222 
223 NTSTATUS
224 NTAPI
226 {
227  ExReleaseResourceLite(&Lock->Resource);
229 
230  return STATUS_SUCCESS;
231 }
232 
233 struct _HEAP;
234 
235 VOID
236 NTAPI
238 {
240 }
241 
242 VOID
243 NTAPI
245 {
247 }
248 
249 VOID
251 {
252 }
253 
254 #if DBG
256 CHECK_PAGED_CODE_RTL(char *file, int line)
257 {
259  {
260  DbgPrint("%s:%i: Pagable code called at IRQL > APC_LEVEL (%u)\n", file, line, KeGetCurrentIrql());
261  ASSERT(FALSE);
262  }
263 }
264 #endif
265 
266 VOID
267 NTAPI
269 {
270  /* Apply defaults for non-set parameters */
271  if (!Parameters->SegmentCommit) Parameters->SegmentCommit = MmHeapSegmentCommit;
272  if (!Parameters->SegmentReserve) Parameters->SegmentReserve = MmHeapSegmentReserve;
273  if (!Parameters->DeCommitFreeBlockThreshold) Parameters->DeCommitFreeBlockThreshold = MmHeapDeCommitFreeBlockThreshold;
274  if (!Parameters->DeCommitTotalFreeThreshold) Parameters->DeCommitTotalFreeThreshold = MmHeapDeCommitTotalFreeThreshold;
275 }
276 
277 VOID
278 NTAPI
281  IN PVOID ContextData,
282  IN ULONG Size)
283 {
284  /* Check the global flag */
286  {
287  /* FIXME: Log this exception */
288  }
289 }
290 
291 BOOLEAN
292 NTAPI
294  IN ULONG_PTR RegistrationFrameEnd,
295  IN OUT PULONG_PTR StackLow,
296  IN OUT PULONG_PTR StackHigh)
297 {
298  PKPRCB Prcb;
299  ULONG_PTR DpcStack;
300 
301  /* Check if we are at DISPATCH or higher */
303  {
304  /* Get the PRCB and DPC Stack */
305  Prcb = KeGetCurrentPrcb();
306  DpcStack = (ULONG_PTR)Prcb->DpcStack;
307 
308  /* Check if we are in a DPC and the stack matches */
309  if ((Prcb->DpcRoutineActive) &&
310  (RegistrationFrameEnd <= DpcStack) &&
311  ((ULONG_PTR)RegistrationFrame >= DpcStack - KERNEL_STACK_SIZE))
312  {
313  /* Update the limits to the DPC Stack's */
314  *StackHigh = DpcStack;
315  *StackLow = DpcStack - KERNEL_STACK_SIZE;
316  return TRUE;
317  }
318  }
319 
320  /* Not in DPC stack */
321  return FALSE;
322 }
323 
324 #if !defined(_ARM_) && !defined(_AMD64_)
325 
326 BOOLEAN
327 NTAPI
329  IN ULONG_PTR *StackBegin,
330  IN ULONG_PTR *StackEnd)
331 {
333 
334  /* Don't even try at ISR level or later */
335  if (KeGetCurrentIrql() > DISPATCH_LEVEL) return FALSE;
336 
337  /* Start with defaults */
338  *StackBegin = Thread->StackLimit;
339  *StackEnd = (ULONG_PTR)Thread->StackBase;
340 
341  /* Check if EBP is inside the stack */
342  if ((*StackBegin <= Ebp) && (Ebp <= *StackEnd))
343  {
344  /* Then make the stack start at EBP */
345  *StackBegin = Ebp;
346  }
347  else
348  {
349  /* Now we're going to assume we're on the DPC stack */
350  *StackEnd = (ULONG_PTR)(KeGetPcr()->Prcb->DpcStack);
351  *StackBegin = *StackEnd - KERNEL_STACK_SIZE;
352 
353  /* Check if we seem to be on the DPC stack */
354  if ((*StackEnd) && (*StackBegin < Ebp) && (Ebp <= *StackEnd))
355  {
356  /* We're on the DPC stack */
357  *StackBegin = Ebp;
358  }
359  else
360  {
361  /* We're somewhere else entirely... use EBP for safety */
362  *StackBegin = Ebp;
363  *StackEnd = (ULONG_PTR)PAGE_ALIGN(*StackBegin);
364  }
365  }
366 
367  /* Return success */
368  return TRUE;
369 }
370 
371 /*
372  * @implemented
373  */
374 ULONG
375 NTAPI
377  IN ULONG Count,
378  IN ULONG Flags)
379 {
380  ULONG_PTR Stack, NewStack, StackBegin, StackEnd = 0;
381  ULONG Eip;
382  BOOLEAN Result, StopSearch = FALSE;
383  ULONG i = 0;
385  PTEB Teb;
386  PKTRAP_FRAME TrapFrame;
387 
388  /* Get current EBP */
389 #if defined(_M_IX86)
390 #if defined __GNUC__
391  __asm__("mov %%ebp, %0" : "=r" (Stack) : );
392 #elif defined(_MSC_VER)
393  __asm mov Stack, ebp
394 #endif
395 #elif defined(_M_MIPS)
396  __asm__("move $sp, %0" : "=r" (Stack) : );
397 #elif defined(_M_PPC)
398  __asm__("mr %0,1" : "=r" (Stack) : );
399 #elif defined(_M_ARM)
400  __asm__("mov sp, %0" : "=r"(Stack) : );
401 #else
402 #error Unknown architecture
403 #endif
404 
405  /* Set it as the stack begin limit as well */
406  StackBegin = (ULONG_PTR)Stack;
407 
408  /* Check if we're called for non-logging mode */
409  if (!Flags)
410  {
411  /* Get the actual safe limits */
413  &StackBegin,
414  &StackEnd);
415  if (!Result) return 0;
416  }
417 
418  /* Use a SEH block for maximum protection */
419  _SEH2_TRY
420  {
421  /* Check if we want the user-mode stack frame */
422  if (Flags == 1)
423  {
424  /* Get the trap frame and TEB */
425  TrapFrame = KeGetTrapFrame(&Thread->Tcb);
426  Teb = Thread->Tcb.Teb;
427 
428  /* Make sure we can trust the TEB and trap frame */
429  if (!(Teb) ||
430  (KeIsAttachedProcess()) ||
432  {
433  /* Invalid or unsafe attempt to get the stack */
434  _SEH2_YIELD(return 0;)
435  }
436 
437  /* Get the stack limits */
438  StackBegin = (ULONG_PTR)Teb->NtTib.StackLimit;
439  StackEnd = (ULONG_PTR)Teb->NtTib.StackBase;
440 #ifdef _M_IX86
441  Stack = TrapFrame->Ebp;
442 #elif defined(_M_PPC)
443  Stack = TrapFrame->Gpr1;
444 #else
445 #error Unknown architecture
446 #endif
447 
448  /* Validate them */
449  if (StackEnd <= StackBegin) _SEH2_YIELD(return 0);
450  ProbeForRead((PVOID)StackBegin,
451  StackEnd - StackBegin,
452  sizeof(CHAR));
453  }
454 
455  /* Loop the frames */
456  for (i = 0; i < Count; i++)
457  {
458  /*
459  * Leave if we're past the stack,
460  * if we're before the stack,
461  * or if we've reached ourselves.
462  */
463  if ((Stack >= StackEnd) ||
464  (!i ? (Stack < StackBegin) : (Stack <= StackBegin)) ||
465  ((StackEnd - Stack) < (2 * sizeof(ULONG_PTR))))
466  {
467  /* We're done or hit a bad address */
468  break;
469  }
470 
471  /* Get new stack and EIP */
472  NewStack = *(PULONG_PTR)Stack;
473  Eip = *(PULONG_PTR)(Stack + sizeof(ULONG_PTR));
474 
475  /* Check if the new pointer is above the oldone and past the end */
476  if (!((Stack < NewStack) && (NewStack < StackEnd)))
477  {
478  /* Stop searching after this entry */
479  StopSearch = TRUE;
480  }
481 
482  /* Also make sure that the EIP isn't a stack address */
483  if ((StackBegin < Eip) && (Eip < StackEnd)) break;
484 
485  /* Check if we reached a user-mode address */
486  if (!(Flags) && !(Eip & 0x80000000)) break; // FIXME: 3GB breakage
487 
488  /* Save this frame */
489  Callers[i] = (PVOID)Eip;
490 
491  /* Check if we should continue */
492  if (StopSearch)
493  {
494  /* Return the next index */
495  i++;
496  break;
497  }
498 
499  /* Move to the next stack */
500  Stack = NewStack;
501  }
502  }
504  {
505  /* No index */
506  i = 0;
507  }
508  _SEH2_END;
509 
510  /* Return frames parsed */
511  return i;
512 }
513 
514 #endif
515 
516 #if defined(_M_AMD64) || defined(_M_ARM)
517 VOID
518 NTAPI
520  OUT PULONG_PTR LowLimit,
522 {
523  PKTHREAD CurrentThread = KeGetCurrentThread();
524  *HighLimit = (ULONG_PTR)CurrentThread->InitialStack;
525  *LowLimit = (ULONG_PTR)CurrentThread->StackLimit;
526 }
527 #endif
528 
529 /* RTL Atom Tables ************************************************************/
530 
531 NTSTATUS
533 {
534  ExInitializeFastMutex(&AtomTable->FastMutex);
535 
536  return STATUS_SUCCESS;
537 }
538 
539 
540 VOID
542 {
543 }
544 
545 
546 BOOLEAN
548 {
549  ExAcquireFastMutex(&AtomTable->FastMutex);
550  return TRUE;
551 }
552 
553 VOID
555 {
556  ExReleaseFastMutex(&AtomTable->FastMutex);
557 }
558 
559 BOOLEAN
561 {
562  AtomTable->ExHandleTable = ExCreateHandleTable(NULL);
563  return (AtomTable->ExHandleTable != NULL);
564 }
565 
566 BOOLEAN
567 NTAPI
569  IN PHANDLE_TABLE_ENTRY HandleTableEntry,
570  IN HANDLE Handle,
572 {
573  /* Destroy and unlock the handle entry */
574  return ExDestroyHandle(HandleTable, Handle, HandleTableEntry);
575 }
576 
577 VOID
579 {
580  if (AtomTable->ExHandleTable)
581  {
582  ExSweepHandleTable(AtomTable->ExHandleTable,
584  AtomTable->ExHandleTable);
585  ExDestroyHandleTable(AtomTable->ExHandleTable, NULL);
586  AtomTable->ExHandleTable = NULL;
587  }
588 }
589 
592 {
594  Size,
595  TAG_ATMT);
596  if (Table != NULL)
597  {
599  Size);
600  }
601 
602  return Table;
603 }
604 
605 VOID
607 {
608  ExFreePoolWithTag(AtomTable, TAG_ATMT);
609 }
610 
613 {
615 
617  if (Entry != NULL)
618  {
620  }
621 
622  return Entry;
623 }
624 
625 VOID
627 {
629 }
630 
631 VOID
633 {
634  ExDestroyHandle(AtomTable->ExHandleTable,
635  (HANDLE)((ULONG_PTR)Entry->HandleIndex << 2),
636  NULL);
637 }
638 
639 BOOLEAN
641 {
642  HANDLE_TABLE_ENTRY ExEntry;
643  HANDLE Handle;
644  USHORT HandleIndex;
645 
646  /* Initialize ex handle table entry */
647  ExEntry.Object = Entry;
648  ExEntry.GrantedAccess = 0x1; /* FIXME - valid handle */
649 
650  /* Create ex handle */
651  Handle = ExCreateHandle(AtomTable->ExHandleTable,
652  &ExEntry);
653  if (!Handle) return FALSE;
654 
655  /* Calculate HandleIndex (by getting rid of the first two bits) */
656  HandleIndex = (USHORT)((ULONG_PTR)Handle >> 2);
657 
658  /* Index must be less than 0xC000 */
659  if (HandleIndex >= 0xC000)
660  {
661  /* Destroy ex handle */
662  ExDestroyHandle(AtomTable->ExHandleTable,
663  Handle,
664  NULL);
665 
666  /* Return failure */
667  return FALSE;
668  }
669 
670  /* Initialize atom table entry */
671  Entry->HandleIndex = HandleIndex;
672  Entry->Atom = 0xC000 + HandleIndex;
673 
674  /* Return success */
675  return TRUE;
676 }
677 
680 {
681  PHANDLE_TABLE_ENTRY ExEntry;
683 
684  /* NOTE: There's no need to explicitly enter a critical region because it's
685  guaranteed that we're in a critical region right now (as we hold
686  the atom table lock) */
687 
688  ExEntry = ExMapHandleToPointer(AtomTable->ExHandleTable,
689  (HANDLE)((ULONG_PTR)Index << 2));
690  if (ExEntry != NULL)
691  {
692  Entry = ExEntry->Object;
693 
694  ExUnlockHandleTableEntry(AtomTable->ExHandleTable,
695  ExEntry);
696  }
697 
698  return Entry;
699 }
700 
701 /* Ldr SEH-Protected access to IMAGE_NT_HEADERS */
702 
703 /* Rtl SEH-Free version of this */
704 NTSTATUS
705 NTAPI
707  _In_ ULONG Flags,
708  _In_ PVOID Base,
709  _In_ ULONG64 Size,
710  _Out_ PIMAGE_NT_HEADERS *OutHeaders);
711 
712 /*
713  * @implemented
714  * @note: This is here, so that we do not drag SEH into rosload, freeldr and bootmgfw
715  */
716 NTSTATUS
717 NTAPI
719  _In_ ULONG Flags,
720  _In_ PVOID Base,
721  _In_ ULONG64 Size,
722  _Out_ PIMAGE_NT_HEADERS *OutHeaders)
723 {
725 
726  /* Assume failure. This is also done in RtlpImageNtHeaderEx, but this is guarded by SEH. */
727  if (OutHeaders != NULL)
728  *OutHeaders = NULL;
729 
730  _SEH2_TRY
731  {
732  Status = RtlpImageNtHeaderEx(Flags, Base, Size, OutHeaders);
733  }
735  {
736  /* Fail with the SEH error */
738  }
739  _SEH2_END;
740 
741  return Status;
742 }
743 
744 /*
745  * Ldr Resource support code
746  */
747 
749  LPCWSTR name, void *root,
750  int want_dir );
752  USHORT id, void *root, int want_dir );
754  void *root, int want_dir );
755 
756 /**********************************************************************
757  * find_entry
758  *
759  * Find a resource entry
760  */
762  ULONG level, void **ret, int want_dir )
763 {
764  ULONG size;
765  void *root;
766  IMAGE_RESOURCE_DIRECTORY *resdirptr;
767 
770  if (size < sizeof(*resdirptr)) return STATUS_RESOURCE_DATA_NOT_FOUND;
771  resdirptr = root;
772 
773  if (!level--) goto done;
774  if (!(*ret = find_entry_by_name( resdirptr, (LPCWSTR)info->Type, root, want_dir || level )))
776  if (!level--) return STATUS_SUCCESS;
777 
778  resdirptr = *ret;
779  if (!(*ret = find_entry_by_name( resdirptr, (LPCWSTR)info->Name, root, want_dir || level )))
781  if (!level--) return STATUS_SUCCESS;
782  if (level) return STATUS_INVALID_PARAMETER; /* level > 3 */
783 
784  resdirptr = *ret;
785 
786  if ((*ret = find_first_entry( resdirptr, root, want_dir ))) return STATUS_SUCCESS;
787 
789 
790 done:
791  *ret = resdirptr;
792  return STATUS_SUCCESS;
793 }
794 
795 NTSTATUS
796 NTAPI
801 {
802  _SEH2_TRY
803  {
805  }
807  {
809  }
810  _SEH2_END;
811 
812  return STATUS_SUCCESS;
813 }
814 
815 BOOLEAN
816 NTAPI
819 {
820  /* In the kernel we don't have vectored exception handlers */
821  return FALSE;
822 }
823 
824 VOID
825 NTAPI
828 {
829  /* No vectored continue handlers either in kernel mode */
830  return;
831 }
832 
833 /* EOF */
VOID RtlpDestroyAtomHandleTable(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:404
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
PVOID NTAPI KiPcToFileHeader(IN PVOID Eip, OUT PLDR_DATA_TABLE_ENTRY *LdrEntry, IN BOOLEAN DriversOnly, OUT PBOOLEAN InKernel)
Definition: bug.c:41
PAGED_LOOKASIDE_LIST RtlpRangeListEntryLookasideList
Definition: libsupp.c:27
GLint level
Definition: gl.h:1546
#define IN
Definition: typedefs.h:39
_Out_ PULONG_PTR HighLimit
Definition: iofuncs.h:2885
Definition: rtltypes.h:1669
#define TAG_OSTR
Definition: libsupp.c:120
ASMGENDATA Table[]
Definition: genincdata.c:61
SIZE_T MmHeapDeCommitTotalFreeThreshold
Definition: mminit.c:368
VOID NTAPI ExInitializePagedLookasideList(IN PPAGED_LOOKASIDE_LIST Lookaside, IN PALLOCATE_FUNCTION Allocate OPTIONAL, IN PFREE_FUNCTION Free OPTIONAL, IN ULONG Flags, IN SIZE_T Size, IN ULONG Tag, IN USHORT Depth)
Definition: lookas.c:270
KPROCESSOR_MODE NTAPI RtlpGetMode(VOID)
Definition: libsupp.c:53
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
BOOLEAN NTAPI ExDestroyHandle(IN PHANDLE_TABLE HandleTable, IN HANDLE Handle, IN PHANDLE_TABLE_ENTRY HandleTableEntry OPTIONAL)
Definition: handle.c:948
BOOLEAN RtlpCreateAtomHandle(PRTL_ATOM_TABLE AtomTable, PRTL_ATOM_TABLE_ENTRY Entry)
Definition: libsupp.c:456
_Must_inspect_result_ _In_ WDFQUEUE _In_opt_ WDFREQUEST _In_opt_ WDFFILEOBJECT _Inout_opt_ PWDF_REQUEST_PARAMETERS Parameters
Definition: wdfio.h:863
#define DbgPrint
Definition: hal.h:12
NTSTATUS find_entry(PVOID BaseAddress, LDR_RESOURCE_INFO *info, ULONG level, void **ret, int want_dir)
Definition: libsupp.c:570
struct _Entry Entry
Definition: kefuncs.h:627
#define PsGetCurrentThread()
Definition: env_spec_w32.h:81
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
NTSTATUS NTAPI RtlpImageNtHeaderEx(_In_ ULONG Flags, _In_ PVOID Base, _In_ ULONG64 Size, _Out_ PIMAGE_NT_HEADERS *OutHeaders)
Definition: image.c:140
ecx edi ebx edx edi decl ecx esi eax jecxz decl eax andl eax esi movl edx movl TEMP incl eax andl eax ecx incl ebx eax jnz xchgl ecx incl TEMP esp ecx subl ebx pushl ecx ecx edx ecx ecx mm0 mm4 mm0 mm4 mm1 mm5 mm1 mm5 mm2 mm6 mm2 mm6 mm3 mm7 mm3 mm7 paddd mm0 paddd mm4 paddd mm0 paddd mm4 paddd mm0 paddd mm4 movq mm1 movq mm5 mm1 mm5 paddd mm0 paddd mm4 mm0 mm4 packssdw mm0 packssdw mm4 mm1 punpckldq mm0 pand mm1 pand mm0 por mm1 movq edi esi edx edi decl ecx jnz popl ecx ecx jecxz mm0 mm0 mm1 mm1 mm2 mm2 mm3 mm3 paddd mm0 paddd mm0 paddd mm0 movq mm1 mm1 paddd mm0 mm0 packssdw mm0 movd eax movw edi esi edx esi ecx mm0 mm4 mm0 mm4 mm1 mm5 mm1 mm5 mm2 mm6 mm2 mm6 mm3 mm7 mm3 mm7 paddd mm0 paddd mm4 paddd mm0 paddd mm4 paddd mm0 paddd mm4 movq mm1 movq mm5 mm1 mm5 paddd mm1 paddd mm5 mm1 mm5 packssdw mm1 packssdw mm5 psubd mm0 psubd mm4 psubsw mm0 psubsw mm4 mm1 punpckldq mm0 pand mm1 pand mm0 por mm1 movq edi esi edx edi decl ecx jnz mm0 mm0 mm1 mm1 mm2 mm2 mm3 mm3 paddd mm0 paddd mm0 paddd mm0 movq mm1 mm1 paddd mm1 mm1 packssdw mm1 psubd mm0 psubsw mm0 movd eax movw edi emms popl ebx popl esi popl edi mov ebp
Definition: synth_sse3d.h:248
#define _Out_
Definition: ms_sal.h:345
NTSTATUS NTAPI RtlEnterHeapLock(IN OUT PHEAP_LOCK Lock, IN BOOLEAN Exclusive)
Definition: libsupp.c:108
#define TRUE
Definition: types.h:120
VOID RtlpUnlockAtomTable(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:385
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
IMAGE_RESOURCE_DIRECTORY * find_entry_by_name(IMAGE_RESOURCE_DIRECTORY *dir, LPCWSTR name, void *root, int want_dir)
Definition: res.c:130
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
PHANDLE_TABLE_ENTRY NTAPI ExMapHandleToPointer(IN PHANDLE_TABLE HandleTable, IN HANDLE Handle)
Definition: handle.c:1010
char CHAR
Definition: xmlstorage.h:175
struct _root root
VOID NTAPI ExDestroyHandleTable(IN PHANDLE_TABLE HandleTable, IN PVOID DestroyHandleProcedure OPTIONAL)
Definition: handle.c:927
struct _RTL_RANGE_ENTRY RTL_RANGE_ENTRY
LONG NTSTATUS
Definition: precomp.h:26
KTHREAD Tcb
Definition: pstypes.h:1103
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1079
_In_opt_ ULONG Base
Definition: rtlfuncs.h:2386
_In_ UINT Bytes
Definition: mmcopy.h:9
VOID NTAPI KeAcquireSpinLock(PKSPIN_LOCK SpinLock, PKIRQL OldIrql)
Definition: spinlock.c:50
NTSTATUS ExInitializeResourceLite(PULONG res)
Definition: env_spec_w32.h:641
NTSTATUS NTAPI ExDeleteResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1456
BOOLEAN NTAPI RtlpCloseHandleCallback(IN PHANDLE_TABLE_ENTRY HandleTableEntry, IN HANDLE Handle, IN PVOID HandleTable)
Definition: libsupp.c:568
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
#define POOL_COLD_ALLOCATION
VOID NTAPI RtlReleasePebLock(VOID)
Definition: libsupp.c:82
NTSTATUS NTAPI RtlpSafeCopyMemory(_Out_writes_bytes_all_(Length) VOID UNALIGNED *Destination, _In_reads_bytes_(Length) CONST VOID UNALIGNED *Source, _In_ SIZE_T Length)
Definition: libsupp.c:52
static XMS_HANDLE HandleTable[XMS_MAX_HANDLES]
Definition: himem.c:83
__asm__("\n\t \ NewInt3Handler:\n\t \ pushl $" STR(REASON_INT3) "\n\t \ // call debugger loop\n\t \ jmp NewInt31Handler\n\t \ ")
VOID RtlpFreeAtomHandle(PRTL_ATOM_TABLE AtomTable, PRTL_ATOM_TABLE_ENTRY Entry)
Definition: libsupp.c:442
if(dx==0 &&dy==0)
Definition: linetemp.h:174
PVOID NTAPI RtlPcToFileHeader(IN PVOID PcValue, PVOID *BaseOfImage)
Definition: libsupp.c:659
#define FASTCALL
Definition: nt_native.h:50
#define FLG_ENABLE_EXCEPTION_LOGGING
Definition: pstypes.h:82
VOID NTAPI ExUnlockHandleTableEntry(IN PHANDLE_TABLE HandleTable, IN PHANDLE_TABLE_ENTRY HandleTableEntry)
Definition: handle.c:887
VOID FASTCALL ExReleaseFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:31
VOID NTAPI RtlInitializeRangeListPackage(VOID)
Definition: libsupp.c:65
NTSTATUS NTAPI LdrShutdownThread(VOID)
Definition: libsupp.c:152
#define KeGetPcr()
Definition: ke.h:26
_SEH2_TRY
Definition: create.c:4226
uint32_t ULONG_PTR
Definition: typedefs.h:65
VOID NTAPI RtlpClearInDbgPrint(VOID)
Definition: libsupp.c:45
VOID RtlInitializeHeapManager(VOID)
Definition: libsupp.c:250
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
HANDLE NTAPI ExCreateHandle(IN PHANDLE_TABLE HandleTable, IN PHANDLE_TABLE_ENTRY HandleTableEntry)
Definition: handle.c:791
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
Definition: wdfrequest.h:636
UCHAR KIRQL
Definition: env_spec_w32.h:591
Definition: libsupp.c:21
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
KSPIN_LOCK PsLoadedModuleSpinLock
Definition: sysldr.c:36
#define FALSE
Definition: types.h:117
VOID NTAPI RtlpSetHeapParameters(IN PRTL_HEAP_PARAMETERS Parameters)
Definition: libsupp.c:174
BOOLEAN NTAPI KeIsAttachedProcess(VOID)
Definition: procobj.c:693
BOOLEAN NTAPI RtlTryEnterHeapLock(IN OUT PHEAP_LOCK Lock, IN BOOLEAN Exclusive)
Definition: libsupp.c:117
Definition: extypes.h:595
unsigned char BOOLEAN
VOID NTAPI RtlpAddHeapToProcessList(struct _HEAP *Heap)
Definition: libsupp.c:237
ULONG Gpr1
Definition: ketypes.h:103
#define _Out_writes_bytes_all_(size)
Definition: ms_sal.h:362
_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:426
#define _In_
Definition: ms_sal.h:308
Definition: parser.c:48
NTSTATUS NTAPI RtlImageNtHeaderEx(_In_ ULONG Flags, _In_ PVOID Base, _In_ ULONG64 Size, _Out_ PIMAGE_NT_HEADERS *OutHeaders)
Definition: libsupp.c:32
VOID NTAPI RtlpRemoveHeapFromProcessList(struct _HEAP *Heap)
Definition: libsupp.c:244
unsigned int dir
Definition: maze.c:112
void * PVOID
Definition: retypes.h:9
BOOLEAN NTAPI RtlpCaptureStackLimits(IN ULONG_PTR Ebp, IN ULONG_PTR *StackBegin, IN ULONG_PTR *StackEnd)
Definition: libsupp.c:211
NTSTATUS NTAPI RtlLeaveHeapLock(IN OUT PHEAP_LOCK Lock)
Definition: libsupp.c:133
KIRQL OldIrql
Definition: mm.h:1502
Status
Definition: gdiplustypes.h:24
#define UNALIGNED
Definition: crtdefs.h:144
int Count
Definition: noreturn.cpp:7
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
GLsizeiptr size
Definition: glext.h:5919
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
IMAGE_RESOURCE_DIRECTORY * find_entry_by_id(IMAGE_RESOURCE_DIRECTORY *dir, WORD id, void *root, int want_dir)
Definition: res.c:95
#define ASSERT(a)
Definition: mode.c:44
IMAGE_RESOURCE_DIRECTORY * find_first_entry(IMAGE_RESOURCE_DIRECTORY *dir, void *root, int want_dir)
Definition: res.c:75
SIZE_T MmHeapDeCommitFreeBlockThreshold
Definition: mminit.c:369
_In_ WDFCOLLECTION _In_ ULONG Index
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
BOOLEAN NTAPI RtlpHandleDpcStackException(IN PEXCEPTION_REGISTRATION_RECORD RegistrationFrame, IN ULONG_PTR RegistrationFrameEnd, IN OUT PULONG_PTR StackLow, IN OUT PULONG_PTR StackHigh)
Definition: libsupp.c:190
ULONG NtGlobalFlag
Definition: init.c:52
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
Definition: exfuncs.h:274
ULONG GrantedAccess
Definition: extypes.h:606
BOOLEAN NTAPI RtlCallVectoredExceptionHandlers(_In_ PEXCEPTION_RECORD ExceptionRecord, _In_ PCONTEXT Context)
Definition: libsupp.c:817
volatile VOID * StackLimit
Definition: ketypes.h:1597
__in PWDFDEVICE_INIT __in BOOLEAN Exclusive
#define PAGE_ALIGN(Va)
PHANDLE_TABLE NTAPI ExCreateHandleTable(IN PEPROCESS Process OPTIONAL)
Definition: handle.c:765
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2652
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
Definition: rtlfuncs.h:2950
PPEB NTAPI RtlGetCurrentPeb(VOID)
Definition: libsupp.c:63
PVOID MmHighestUserAddress
Definition: libsupp.c:23
NTSTATUS RtlpInitAtomTableLock(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:362
#define KERNEL_STACK_SIZE
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1817
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
NTSTATUS NTAPI RtlInitializeHeapLock(IN OUT PHEAP_LOCK *Lock)
Definition: libsupp.c:126
BOOL WINAPI HeapLock(HANDLE hHeap)
Definition: heapmem.c:123
#define TAG_ATMT
Definition: libsupp.c:16
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
_IRQL_requires_same_ _In_ PVOID _Inout_ struct _CONTEXT * ContextRecord
Definition: ntbasedef.h:654
unsigned __int64 ULONG64
Definition: imports.h:198
SIZE_T MmHeapSegmentReserve
Definition: mminit.c:366
int ret
#define STATUS_RESOURCE_DATA_NOT_FOUND
Definition: ntstatus.h:373
VOID RtlpFreeAtomTableEntry(PRTL_ATOM_TABLE_ENTRY Entry)
Definition: libsupp.c:434
BOOLEAN NTAPI RtlpCheckForActiveDebugger(VOID)
Definition: libsupp.c:25
UCHAR DpcRoutineActive
Definition: ketypes.h:692
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
#define RtlImageDirectoryEntryToData
Definition: compat.h:668
#define KeEnterCriticalRegion()
Definition: ke_x.h:88
Definition: btrfs_drv.h:1922
SIZE_T RtlpAllocDeallocQueryBufferSize
Definition: libsupp.c:17
Definition: typedefs.h:119
struct _RTL_RANGE_ENTRY * PRTL_RANGE_ENTRY
VOID NTAPI RtlpGetStackLimits(PULONG_PTR StackBase, PULONG_PTR StackLimit)
struct atom_table ** PRTL_ATOM_TABLE
Definition: atom.c:43
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4061
#define TAG_USTR
Definition: libsupp.c:118
VOID RtlpFreeAtomTable(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:418
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
BOOLEAN RtlpCreateAtomHandleTable(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:394
ULONG_PTR SIZE_T
Definition: typedefs.h:80
Definition: compat.h:694
_SEH2_END
Definition: create.c:4400
VOID RtlpDestroyAtomTableLock(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:370
LIST_ENTRY Entry
Definition: libsupp.c:23
#define KeLeaveCriticalRegion()
Definition: ke_x.h:119
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
PVOID DpcStack
Definition: ketypes.h:681
struct LOOKASIDE_ALIGN _PAGED_LOOKASIDE_LIST PAGED_LOOKASIDE_LIST
VOID FASTCALL ExAcquireFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:23
PVOID StackBase
Definition: compat.h:571
#define TAG_RTHL
Definition: libsupp.c:17
unsigned short USHORT
Definition: pedump.c:61
ULONG NTAPI RtlWalkFrameChain(OUT PVOID *Callers, IN ULONG Count, IN ULONG Flags)
Definition: libsupp.c:227
#define STATUS_RESOURCE_NAME_NOT_FOUND
Definition: ntstatus.h:375
SIZE_T MmHeapSegmentCommit
Definition: mminit.c:367
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
_Out_ PKAPC_STATE ApcState
Definition: mm.h:1679
#define NULL
Definition: types.h:112
VOID NTAPI ExSweepHandleTable(IN PHANDLE_TABLE HandleTable, IN PEX_SWEEP_HANDLE_CALLBACK EnumHandleProcedure, IN PVOID Context)
Definition: handle.c:1196
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
VOID NTAPI RtlAcquirePebLock(VOID)
Definition: libsupp.c:72
PRTL_ATOM_TABLE RtlpAllocAtomTable(ULONG Size)
Definition: libsupp.c:410
BOOLEAN NTAPI ExAcquireResourceSharedLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:885
PVOID Teb
Definition: ketypes.h:1739
BOOLEAN NTAPI RtlpSetInDbgPrint(VOID)
Definition: libsupp.c:33
BOOLEAN RtlpLockAtomTable(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:377
Definition: name.c:38
_In_ HANDLE Handle
Definition: extypes.h:390
#define OUT
Definition: typedefs.h:40
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWAITLOCK * Lock
Definition: wdfsync.h:124
VOID NTAPI RtlCallVectoredContinueHandlers(_In_ PEXCEPTION_RECORD ExceptionRecord, _In_ PCONTEXT Context)
Definition: libsupp.c:826
unsigned int ULONG
Definition: retypes.h:1
VOID NTAPI RtlpFreeMemory(PVOID Mem, ULONG Tag)
Definition: libsupp.c:44
PVOID NTAPI RtlpAllocateMemory(ULONG Bytes, ULONG Tag)
Definition: libsupp.c:35
VOID NTAPI RtlpCheckLogException(IN PEXCEPTION_RECORD ExceptionRecord, IN PCONTEXT ContextRecord, IN PVOID ContextData, IN ULONG Size)
Definition: libsupp.c:201
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define ULONG_PTR
Definition: config.h:101
uint32_t * PULONG_PTR
Definition: typedefs.h:65
PVOID Object
Definition: extypes.h:599
NTSTATUS NTAPI RtlDeleteHeapLock(IN OUT PHEAP_LOCK Lock)
Definition: libsupp.c:101
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3167
PVOID StackLimit
Definition: compat.h:572
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:40
#define STATUS_SUCCESS
Definition: shellext.h:65
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:165
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:168
#define IMAGE_DIRECTORY_ENTRY_RESOURCE
Definition: pedump.c:261
#define KeGetCurrentThread
Definition: hal.h:55
PRTL_ATOM_TABLE_ENTRY RtlpGetAtomEntry(PRTL_ATOM_TABLE AtomTable, ULONG Index)
Definition: libsupp.c:492
#define TAG_ASTR
Definition: libsupp.c:119
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
PVOID InitialStack
Definition: ketypes.h:1596
PRTL_ATOM_TABLE_ENTRY RtlpAllocAtomTableEntry(ULONG Size)
Definition: libsupp.c:426
#define KeGetTrapFrame(Thread)
Definition: ke.h:204
NT_TIB NtTib
Definition: ntddk_ex.h:332
#define APC_LEVEL
Definition: env_spec_w32.h:695
#define CONST
Definition: pedump.c:81
RTL_RANGE Range
Definition: libsupp.c:24
base of all file and directory entries
Definition: entries.h:82
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
ULONG Ebp
Definition: ketypes.h:265
Definition: heap.c:51
#define _In_reads_bytes_(size)
Definition: ms_sal.h:321
Definition: fci.c:126
#define STATUS_RESOURCE_TYPE_NOT_FOUND
Definition: ntstatus.h:374