ReactOS  0.4.15-dev-5496-g599ba9c
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 extern ULONG NtGlobalFlag;
17 
18 typedef struct _RTL_RANGE_ENTRY
19 {
23 
26 
27 /* FUNCTIONS *****************************************************************/
28 
29 PVOID
30 NTAPI
32  IN PVOID PcValue,
33  OUT PVOID *BaseOfImage)
34 {
35  PLDR_DATA_TABLE_ENTRY LdrEntry;
36  BOOLEAN InSystem;
37  KIRQL OldIrql;
38 
39  /* Get the base for this file */
41  {
42  /* Acquire the loaded module spinlock */
44 
45  /* We are in kernel */
46  *BaseOfImage = KiPcToFileHeader(PcValue, &LdrEntry, FALSE, &InSystem);
47 
48  /* Release lock */
50  }
51  else
52  {
53  /* User mode is not handled here! */
54  *BaseOfImage = NULL;
55  }
56 
57  return *BaseOfImage;
58 }
59 
60 VOID
61 NTAPI
63 {
64  /* Setup the lookaside list for allocations (not used yet) */
66  NULL,
67  NULL,
69  sizeof(RTL_RANGE_ENTRY),
70  'elRR',
71  16);
72 }
73 
74 BOOLEAN
75 NTAPI
77 {
78  /* This check is meaningless in kernel-mode */
79  return FALSE;
80 }
81 
82 BOOLEAN
83 NTAPI
85 {
86  /* Nothing to set in kernel mode */
87  return FALSE;
88 }
89 
90 VOID
91 NTAPI
93 {
94  /* Nothing to clear in kernel mode */
95 }
96 
98 NTAPI
100 {
101  return KernelMode;
102 }
103 
104 PVOID
105 NTAPI
107  ULONG Tag)
108 {
110  (SIZE_T)Bytes,
111  Tag);
112 }
113 
114 VOID
115 NTAPI
117  ULONG Tag)
118 {
119  if (Tag == TAG_ASTR || Tag == TAG_OSTR || Tag == TAG_USTR)
120  ExFreePool(Mem);
121  else
122  ExFreePoolWithTag(Mem, Tag);
123 }
124 
125 /*
126  * @implemented
127  */
128 VOID NTAPI
130 {
131 
132 }
133 
134 /*
135  * @implemented
136  */
137 VOID NTAPI
139 {
140 
141 }
142 
143 NTSTATUS
144 NTAPI
146 {
147  return STATUS_SUCCESS;
148 }
149 
150 
151 PPEB
152 NTAPI
154 {
155  return ((PEPROCESS)(KeGetCurrentThread()->ApcState.Process))->Peb;
156 }
157 
158 NTSTATUS
159 NTAPI
161 {
162  ExDeleteResourceLite(&Lock->Resource);
164 
165  return STATUS_SUCCESS;
166 }
167 
168 NTSTATUS
169 NTAPI
171 {
173 
174  if (Exclusive)
176  else
178 
179  return STATUS_SUCCESS;
180 }
181 
182 BOOLEAN
183 NTAPI
185 {
188 
189  if (Exclusive)
191  else
193 
194  if (!Success)
196 
197  return Success;
198 }
199 
200 NTSTATUS
201 NTAPI
203 {
205  sizeof(HEAP_LOCK),
206  TAG_RTHL);
207  if (HeapLock == NULL)
208  return STATUS_NO_MEMORY;
209 
211  *Lock = HeapLock;
212 
213  return STATUS_SUCCESS;
214 }
215 
216 NTSTATUS
217 NTAPI
219 {
220  ExReleaseResourceLite(&Lock->Resource);
222 
223  return STATUS_SUCCESS;
224 }
225 
226 struct _HEAP;
227 
228 VOID
229 NTAPI
231 {
233 }
234 
235 VOID
236 NTAPI
238 {
240 }
241 
242 VOID
244 {
245 }
246 
247 #if DBG
249 CHECK_PAGED_CODE_RTL(char *file, int line)
250 {
252  {
253  DbgPrint("%s:%i: Pagable code called at IRQL > APC_LEVEL (%u)\n", file, line, KeGetCurrentIrql());
254  ASSERT(FALSE);
255  }
256 }
257 #endif
258 
259 VOID
260 NTAPI
262 {
263  /* Apply defaults for non-set parameters */
264  if (!Parameters->SegmentCommit) Parameters->SegmentCommit = MmHeapSegmentCommit;
265  if (!Parameters->SegmentReserve) Parameters->SegmentReserve = MmHeapSegmentReserve;
266  if (!Parameters->DeCommitFreeBlockThreshold) Parameters->DeCommitFreeBlockThreshold = MmHeapDeCommitFreeBlockThreshold;
267  if (!Parameters->DeCommitTotalFreeThreshold) Parameters->DeCommitTotalFreeThreshold = MmHeapDeCommitTotalFreeThreshold;
268 }
269 
270 VOID
271 NTAPI
274  IN PVOID ContextData,
275  IN ULONG Size)
276 {
277  /* Check the global flag */
279  {
280  /* FIXME: Log this exception */
281  }
282 }
283 
284 BOOLEAN
285 NTAPI
287  IN ULONG_PTR RegistrationFrameEnd,
288  IN OUT PULONG_PTR StackLow,
289  IN OUT PULONG_PTR StackHigh)
290 {
291  PKPRCB Prcb;
292  ULONG_PTR DpcStack;
293 
294  /* Check if we are at DISPATCH or higher */
296  {
297  /* Get the PRCB and DPC Stack */
298  Prcb = KeGetCurrentPrcb();
299  DpcStack = (ULONG_PTR)Prcb->DpcStack;
300 
301  /* Check if we are in a DPC and the stack matches */
302  if ((Prcb->DpcRoutineActive) &&
303  (RegistrationFrameEnd <= DpcStack) &&
304  ((ULONG_PTR)RegistrationFrame >= DpcStack - KERNEL_STACK_SIZE))
305  {
306  /* Update the limits to the DPC Stack's */
307  *StackHigh = DpcStack;
308  *StackLow = DpcStack - KERNEL_STACK_SIZE;
309  return TRUE;
310  }
311  }
312 
313  /* Not in DPC stack */
314  return FALSE;
315 }
316 
317 #if !defined(_ARM_) && !defined(_AMD64_)
318 
319 BOOLEAN
320 NTAPI
322  IN ULONG_PTR *StackBegin,
323  IN ULONG_PTR *StackEnd)
324 {
326 
327  /* Don't even try at ISR level or later */
328  if (KeGetCurrentIrql() > DISPATCH_LEVEL) return FALSE;
329 
330  /* Start with defaults */
331  *StackBegin = Thread->StackLimit;
332  *StackEnd = (ULONG_PTR)Thread->StackBase;
333 
334  /* Check if EBP is inside the stack */
335  if ((*StackBegin <= Ebp) && (Ebp <= *StackEnd))
336  {
337  /* Then make the stack start at EBP */
338  *StackBegin = Ebp;
339  }
340  else
341  {
342  /* Now we're going to assume we're on the DPC stack */
343  *StackEnd = (ULONG_PTR)(KeGetPcr()->Prcb->DpcStack);
344  *StackBegin = *StackEnd - KERNEL_STACK_SIZE;
345 
346  /* Check if we seem to be on the DPC stack */
347  if ((*StackEnd) && (*StackBegin < Ebp) && (Ebp <= *StackEnd))
348  {
349  /* We're on the DPC stack */
350  *StackBegin = Ebp;
351  }
352  else
353  {
354  /* We're somewhere else entirely... use EBP for safety */
355  *StackBegin = Ebp;
356  *StackEnd = (ULONG_PTR)PAGE_ALIGN(*StackBegin);
357  }
358  }
359 
360  /* Return success */
361  return TRUE;
362 }
363 
364 /*
365  * @implemented
366  */
367 ULONG
368 NTAPI
370  IN ULONG Count,
371  IN ULONG Flags)
372 {
373  ULONG_PTR Stack, NewStack, StackBegin, StackEnd = 0;
374  ULONG Eip;
375  BOOLEAN Result, StopSearch = FALSE;
376  ULONG i = 0;
378  PTEB Teb;
379  PKTRAP_FRAME TrapFrame;
380 
381  /* Get current EBP */
382 #if defined(_M_IX86)
383 #if defined __GNUC__
384  __asm__("mov %%ebp, %0" : "=r" (Stack) : );
385 #elif defined(_MSC_VER)
386  __asm mov Stack, ebp
387 #endif
388 #elif defined(_M_MIPS)
389  __asm__("move $sp, %0" : "=r" (Stack) : );
390 #elif defined(_M_PPC)
391  __asm__("mr %0,1" : "=r" (Stack) : );
392 #elif defined(_M_ARM)
393  __asm__("mov sp, %0" : "=r"(Stack) : );
394 #else
395 #error Unknown architecture
396 #endif
397 
398  /* Set it as the stack begin limit as well */
399  StackBegin = (ULONG_PTR)Stack;
400 
401  /* Check if we're called for non-logging mode */
402  if (!Flags)
403  {
404  /* Get the actual safe limits */
406  &StackBegin,
407  &StackEnd);
408  if (!Result) return 0;
409  }
410 
411  /* Use a SEH block for maximum protection */
412  _SEH2_TRY
413  {
414  /* Check if we want the user-mode stack frame */
415  if (Flags == 1)
416  {
417  /* Get the trap frame and TEB */
418  TrapFrame = KeGetTrapFrame(&Thread->Tcb);
419  Teb = Thread->Tcb.Teb;
420 
421  /* Make sure we can trust the TEB and trap frame */
422  if (!(Teb) ||
423  (KeIsAttachedProcess()) ||
425  {
426  /* Invalid or unsafe attempt to get the stack */
427  _SEH2_YIELD(return 0;)
428  }
429 
430  /* Get the stack limits */
431  StackBegin = (ULONG_PTR)Teb->NtTib.StackLimit;
432  StackEnd = (ULONG_PTR)Teb->NtTib.StackBase;
433 #ifdef _M_IX86
434  Stack = TrapFrame->Ebp;
435 #elif defined(_M_PPC)
436  Stack = TrapFrame->Gpr1;
437 #else
438 #error Unknown architecture
439 #endif
440 
441  /* Validate them */
442  if (StackEnd <= StackBegin) _SEH2_YIELD(return 0);
443  ProbeForRead((PVOID)StackBegin,
444  StackEnd - StackBegin,
445  sizeof(CHAR));
446  }
447 
448  /* Loop the frames */
449  for (i = 0; i < Count; i++)
450  {
451  /*
452  * Leave if we're past the stack,
453  * if we're before the stack,
454  * or if we've reached ourselves.
455  */
456  if ((Stack >= StackEnd) ||
457  (!i ? (Stack < StackBegin) : (Stack <= StackBegin)) ||
458  ((StackEnd - Stack) < (2 * sizeof(ULONG_PTR))))
459  {
460  /* We're done or hit a bad address */
461  break;
462  }
463 
464  /* Get new stack and EIP */
465  NewStack = *(PULONG_PTR)Stack;
466  Eip = *(PULONG_PTR)(Stack + sizeof(ULONG_PTR));
467 
468  /* Check if the new pointer is above the oldone and past the end */
469  if (!((Stack < NewStack) && (NewStack < StackEnd)))
470  {
471  /* Stop searching after this entry */
472  StopSearch = TRUE;
473  }
474 
475  /* Also make sure that the EIP isn't a stack address */
476  if ((StackBegin < Eip) && (Eip < StackEnd)) break;
477 
478  /* Check if we reached a user-mode address */
479  if (!(Flags) && !(Eip & 0x80000000)) break; // FIXME: 3GB breakage
480 
481  /* Save this frame */
482  Callers[i] = (PVOID)Eip;
483 
484  /* Check if we should continue */
485  if (StopSearch)
486  {
487  /* Return the next index */
488  i++;
489  break;
490  }
491 
492  /* Move to the next stack */
493  Stack = NewStack;
494  }
495  }
497  {
498  /* No index */
499  i = 0;
500  }
501  _SEH2_END;
502 
503  /* Return frames parsed */
504  return i;
505 }
506 
507 #endif
508 
509 #if defined(_M_AMD64) || defined(_M_ARM)
510 VOID
511 NTAPI
513  OUT PULONG_PTR LowLimit,
515 {
516  PKTHREAD CurrentThread = KeGetCurrentThread();
517  *HighLimit = (ULONG_PTR)CurrentThread->InitialStack;
518  *LowLimit = (ULONG_PTR)CurrentThread->StackLimit;
519 }
520 #endif
521 
522 /* RTL Atom Tables ************************************************************/
523 
524 NTSTATUS
526 {
527  ExInitializeFastMutex(&AtomTable->FastMutex);
528 
529  return STATUS_SUCCESS;
530 }
531 
532 
533 VOID
535 {
536 }
537 
538 
539 BOOLEAN
541 {
542  ExAcquireFastMutex(&AtomTable->FastMutex);
543  return TRUE;
544 }
545 
546 VOID
548 {
549  ExReleaseFastMutex(&AtomTable->FastMutex);
550 }
551 
552 BOOLEAN
554 {
555  AtomTable->ExHandleTable = ExCreateHandleTable(NULL);
556  return (AtomTable->ExHandleTable != NULL);
557 }
558 
559 BOOLEAN
560 NTAPI
562  IN PHANDLE_TABLE_ENTRY HandleTableEntry,
563  IN HANDLE Handle,
565 {
566  /* Destroy and unlock the handle entry */
567  return ExDestroyHandle(HandleTable, Handle, HandleTableEntry);
568 }
569 
570 VOID
572 {
573  if (AtomTable->ExHandleTable)
574  {
575  ExSweepHandleTable(AtomTable->ExHandleTable,
577  AtomTable->ExHandleTable);
578  ExDestroyHandleTable(AtomTable->ExHandleTable, NULL);
579  AtomTable->ExHandleTable = NULL;
580  }
581 }
582 
585 {
587  Size,
588  TAG_ATMT);
589  if (Table != NULL)
590  {
592  Size);
593  }
594 
595  return Table;
596 }
597 
598 VOID
600 {
601  ExFreePoolWithTag(AtomTable, TAG_ATMT);
602 }
603 
606 {
608 
610  if (Entry != NULL)
611  {
613  }
614 
615  return Entry;
616 }
617 
618 VOID
620 {
622 }
623 
624 VOID
626 {
627  ExDestroyHandle(AtomTable->ExHandleTable,
628  (HANDLE)((ULONG_PTR)Entry->HandleIndex << 2),
629  NULL);
630 }
631 
632 BOOLEAN
634 {
635  HANDLE_TABLE_ENTRY ExEntry;
636  HANDLE Handle;
637  USHORT HandleIndex;
638 
639  /* Initialize ex handle table entry */
640  ExEntry.Object = Entry;
641  ExEntry.GrantedAccess = 0x1; /* FIXME - valid handle */
642 
643  /* Create ex handle */
644  Handle = ExCreateHandle(AtomTable->ExHandleTable,
645  &ExEntry);
646  if (!Handle) return FALSE;
647 
648  /* Calculate HandleIndex (by getting rid of the first two bits) */
649  HandleIndex = (USHORT)((ULONG_PTR)Handle >> 2);
650 
651  /* Index must be less than 0xC000 */
652  if (HandleIndex >= 0xC000)
653  {
654  /* Destroy ex handle */
655  ExDestroyHandle(AtomTable->ExHandleTable,
656  Handle,
657  NULL);
658 
659  /* Return failure */
660  return FALSE;
661  }
662 
663  /* Initialize atom table entry */
664  Entry->HandleIndex = HandleIndex;
665  Entry->Atom = 0xC000 + HandleIndex;
666 
667  /* Return success */
668  return TRUE;
669 }
670 
673 {
674  PHANDLE_TABLE_ENTRY ExEntry;
676 
677  /* NOTE: There's no need to explicitly enter a critical region because it's
678  guaranteed that we're in a critical region right now (as we hold
679  the atom table lock) */
680 
681  ExEntry = ExMapHandleToPointer(AtomTable->ExHandleTable,
682  (HANDLE)((ULONG_PTR)Index << 2));
683  if (ExEntry != NULL)
684  {
685  Entry = ExEntry->Object;
686 
687  ExUnlockHandleTableEntry(AtomTable->ExHandleTable,
688  ExEntry);
689  }
690 
691  return Entry;
692 }
693 
694 /* Ldr SEH-Protected access to IMAGE_NT_HEADERS */
695 
696 /* Rtl SEH-Free version of this */
697 NTSTATUS
698 NTAPI
700  _In_ ULONG Flags,
701  _In_ PVOID Base,
702  _In_ ULONG64 Size,
703  _Out_ PIMAGE_NT_HEADERS *OutHeaders);
704 
705 /*
706  * @implemented
707  * @note: This is here, so that we do not drag SEH into rosload, freeldr and bootmgfw
708  */
709 NTSTATUS
710 NTAPI
712  _In_ ULONG Flags,
713  _In_ PVOID Base,
714  _In_ ULONG64 Size,
715  _Out_ PIMAGE_NT_HEADERS *OutHeaders)
716 {
718 
719  /* Assume failure. This is also done in RtlpImageNtHeaderEx, but this is guarded by SEH. */
720  if (OutHeaders != NULL)
721  *OutHeaders = NULL;
722 
723  _SEH2_TRY
724  {
725  Status = RtlpImageNtHeaderEx(Flags, Base, Size, OutHeaders);
726  }
728  {
729  /* Fail with the SEH error */
731  }
732  _SEH2_END;
733 
734  return Status;
735 }
736 
737 /*
738  * Ldr Resource support code
739  */
740 
742  LPCWSTR name, void *root,
743  int want_dir );
745  USHORT id, void *root, int want_dir );
747  void *root, int want_dir );
748 
749 /**********************************************************************
750  * find_entry
751  *
752  * Find a resource entry
753  */
755  ULONG level, void **ret, int want_dir )
756 {
757  ULONG size;
758  void *root;
759  IMAGE_RESOURCE_DIRECTORY *resdirptr;
760 
763  if (size < sizeof(*resdirptr)) return STATUS_RESOURCE_DATA_NOT_FOUND;
764  resdirptr = root;
765 
766  if (!level--) goto done;
767  if (!(*ret = find_entry_by_name( resdirptr, (LPCWSTR)info->Type, root, want_dir || level )))
769  if (!level--) return STATUS_SUCCESS;
770 
771  resdirptr = *ret;
772  if (!(*ret = find_entry_by_name( resdirptr, (LPCWSTR)info->Name, root, want_dir || level )))
774  if (!level--) return STATUS_SUCCESS;
775  if (level) return STATUS_INVALID_PARAMETER; /* level > 3 */
776 
777  resdirptr = *ret;
778 
779  if ((*ret = find_first_entry( resdirptr, root, want_dir ))) return STATUS_SUCCESS;
780 
782 
783 done:
784  *ret = resdirptr;
785  return STATUS_SUCCESS;
786 }
787 
788 NTSTATUS
789 NTAPI
794 {
795  _SEH2_TRY
796  {
798  }
800  {
802  }
803  _SEH2_END;
804 
805  return STATUS_SUCCESS;
806 }
807 
808 BOOLEAN
809 NTAPI
812 {
813  /* In the kernel we don't have vectored exception handlers */
814  return FALSE;
815 }
816 
817 VOID
818 NTAPI
821 {
822  /* No vectored continue handlers either in kernel mode */
823  return;
824 }
825 
826 #ifdef _M_AMD64
827 
829 NTAPI
831  _In_ DWORD64 ControlPc,
832  _Out_ PDWORD64 ImageBase,
833  _In_ PUNWIND_HISTORY_TABLE HistoryTable)
834 {
835  /* No support for dynamic function tables in the kernel */
836  return NULL;
837 }
838 
839 #endif
840 
841 /* EOF */
VOID RtlpDestroyAtomHandleTable(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:404
_SEH2_TRY
Definition: create.c:4226
#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:40
PAGED_LOOKASIDE_LIST RtlpRangeListEntryLookasideList
Definition: libsupp.c:24
GLint level
Definition: gl.h:1546
#define IN
Definition: typedefs.h:39
_Out_ PULONG_PTR HighLimit
Definition: iofuncs.h:2885
Definition: rtltypes.h:1671
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:984
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:629
#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:1046
char CHAR
Definition: xmlstorage.h:175
struct _root root
VOID NTAPI ExDestroyHandleTable(IN PHANDLE_TABLE HandleTable, IN PVOID DestroyHandleProcedure OPTIONAL)
Definition: handle.c:963
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:1080
_In_opt_ ULONG Base
Definition: rtlfuncs.h:2427
_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:561
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
_SEH2_END
Definition: create.c:4400
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:923
VOID FASTCALL ExReleaseFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:31
VOID NTAPI RtlInitializeRangeListPackage(VOID)
Definition: libsupp.c:62
NTSTATUS NTAPI LdrShutdownThread(VOID)
Definition: libsupp.c:145
#define KeGetPcr()
Definition: ke.h:26
#define TAG_OSTR
Definition: tag.h:147
uint32_t ULONG_PTR
Definition: typedefs.h:65
VOID NTAPI RtlpClearInDbgPrint(VOID)
Definition: libsupp.c:45
VOID RtlInitializeHeapManager(VOID)
Definition: libsupp.c:243
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:827
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
Definition: wdfrequest.h:636
UCHAR KIRQL
Definition: env_spec_w32.h:591
Definition: libsupp.c:18
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
KSPIN_LOCK PsLoadedModuleSpinLock
Definition: sysldr.c:23
#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:230
ULONG Gpr1
Definition: ketypes.h:111
#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
PRUNTIME_FUNCTION NTAPI RtlpLookupDynamicFunctionEntry(_In_ DWORD64 ControlPc, _Out_ PDWORD64 ImageBase, _In_ PUNWIND_HISTORY_TABLE HistoryTable)
Definition: dynfntbl.c:271
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:237
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
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
#define TAG_RTHL
Definition: tag.h:144
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
#define TAG_USTR
Definition: tag.h:145
ULONG NtGlobalFlag
Definition: init.c:54
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:810
volatile VOID * StackLimit
Definition: ketypes.h:1605
__in PWDFDEVICE_INIT __in BOOLEAN Exclusive
#define PAGE_ALIGN(Va)
PHANDLE_TABLE NTAPI ExCreateHandleTable(IN PEPROCESS Process OPTIONAL)
Definition: handle.c:801
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2652
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
Definition: rtlfuncs.h:2991
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 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:693
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
#define RtlImageDirectoryEntryToData
Definition: compat.h:809
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:792
#define KeEnterCriticalRegion()
Definition: ke_x.h:88
Definition: btrfs_drv.h:1876
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
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
#define TAG_ATMT
Definition: tag.h:143
Definition: compat.h:835
VOID RtlpDestroyAtomTableLock(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:370
LIST_ENTRY Entry
Definition: libsupp.c:20
#define KeLeaveCriticalRegion()
Definition: ke_x.h:119
uint64_t DWORD64
Definition: typedefs.h:67
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:682
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:712
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:1727
#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:1232
#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:1747
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:819
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
uint64_t * PDWORD64
Definition: typedefs.h:67
#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:713
#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
#define TAG_ASTR
Definition: tag.h:146
PRTL_ATOM_TABLE_ENTRY RtlpGetAtomEntry(PRTL_ATOM_TABLE AtomTable, ULONG Index)
Definition: libsupp.c:492
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
PVOID InitialStack
Definition: ketypes.h:1604
PRTL_ATOM_TABLE_ENTRY RtlpAllocAtomTableEntry(ULONG Size)
Definition: libsupp.c:426
#define KeGetTrapFrame(Thread)
Definition: ke.h:208
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:21
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:266
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