ReactOS 0.4.17-dev-1190-g4c812f4
libsupp.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS NT User-Mode DLL
4 * FILE: lib/ntdll/rtl/libsup.c
5 * PURPOSE: RTL Support Routines
6 * PROGRAMMERS: Alex Ionescu (alex@relsoft.net)
7 * Gunnar Dalsnes
8 */
9
10/* INCLUDES *****************************************************************/
11
12#include <ntdll.h>
13#include <apisets.h>
14#include <compat_undoc.h>
15
16#define NDEBUG
17#include <debug.h>
18
22
23/* FUNCTIONS ***************************************************************/
24
28{
29 /* Return the flag in the PEB */
30 return NtCurrentPeb()->BeingDebugged;
31}
32
36{
37 /* Check if it's already set and return TRUE if so */
38#if (NTDDI_VERSION < NTDDI_LONGHORN)
39 if (NtCurrentTeb()->InDbgPrint) return TRUE;
40
41 /* Set it and return */
42 NtCurrentTeb()->InDbgPrint = TRUE;
43#else
44 if (NtCurrentTeb()->DbgInDebugPrint) return TRUE;
45
46 /* Set it and return */
47 NtCurrentTeb()->DbgInDebugPrint = TRUE;
48#endif
49 return FALSE;
50}
51
52VOID
55{
56#if (NTDDI_VERSION < NTDDI_LONGHORN)
57 /* Clear the flag */
58 NtCurrentTeb()->InDbgPrint = FALSE;
59#else
60 NtCurrentTeb()->DbgInDebugPrint = FALSE;
61#endif
62}
63
67{
68 return UserMode;
69}
70
71/*
72 * @implemented
73 */
74PPEB
77{
78 return NtCurrentPeb();
79}
80
81/*
82 * @implemented
83 */
86{
89}
90
91/*
92 * @implemented
93 */
96{
99}
100
101/*
102* @implemented
103*/
104ULONG
105NTAPI
107{
108 PPEB pPeb = NtCurrentPeb();
109 return pPeb->NtGlobalFlag;
110}
111
113NTAPI
115{
116 return RtlDeleteCriticalSection(&Lock->CriticalSection);
117}
118
120NTAPI
122{
124
125 return RtlEnterCriticalSection(&Lock->CriticalSection);
126}
127
129NTAPI
131{
133
134 return RtlTryEnterCriticalSection(&Lock->CriticalSection);
135}
136
138NTAPI
140{
141 return RtlInitializeCriticalSection(&(*Lock)->CriticalSection);
142}
143
145NTAPI
147{
148 return RtlLeaveCriticalSection(&Lock->CriticalSection);
149}
150
151PVOID
152NTAPI
154 ULONG Tag)
155{
157
158 return RtlAllocateHeap(RtlGetProcessHeap(),
159 0,
160 Bytes);
161}
162
163
164VOID
165NTAPI
167 ULONG Tag)
168{
170
171 RtlFreeHeap(RtlGetProcessHeap(),
172 0,
173 Mem);
174}
175
176
177#if DBG
179CHECK_PAGED_CODE_RTL(char *file, int line)
180{
181 /* meaningless in user mode */
182}
183#endif
184
185VOID
186NTAPI
188{
189 PPEB Peb;
190
191 /* Get PEB */
193
194 /* Apply defaults for non-set parameters */
195 if (!Parameters->SegmentCommit) Parameters->SegmentCommit = Peb->HeapSegmentCommit;
196 if (!Parameters->SegmentReserve) Parameters->SegmentReserve = Peb->HeapSegmentReserve;
197 if (!Parameters->DeCommitFreeBlockThreshold) Parameters->DeCommitFreeBlockThreshold = Peb->HeapDeCommitFreeBlockThreshold;
198 if (!Parameters->DeCommitTotalFreeThreshold) Parameters->DeCommitTotalFreeThreshold = Peb->HeapDeCommitTotalFreeThreshold;
199}
200
202NTAPI
204 IN ULONG_PTR RegistrationFrameEnd,
205 IN OUT PULONG_PTR StackLow,
206 IN OUT PULONG_PTR StackHigh)
207{
208 /* There's no such thing as a DPC stack in user-mode */
209 return FALSE;
210}
211
212VOID
213NTAPI
216 IN PVOID ContextData,
217 IN ULONG Size)
218{
219 /* Exception logging is not done in user-mode */
220}
221
223NTAPI
225 IN ULONG_PTR *StackBegin,
226 IN ULONG_PTR *StackEnd)
227{
228 /* FIXME: Verify */
229 *StackBegin = (ULONG_PTR)NtCurrentTeb()->NtTib.StackLimit;
230 *StackEnd = (ULONG_PTR)NtCurrentTeb()->NtTib.StackBase;
231 return TRUE;
232}
233
234#ifndef _M_AMD64
235/*
236 * @implemented
237 */
238ULONG
239NTAPI
241 IN ULONG Count,
242 IN ULONG Flags)
243{
244 ULONG_PTR Stack, NewStack, StackBegin, StackEnd = 0;
245 ULONG Eip;
246 BOOLEAN Result, StopSearch = FALSE;
247 ULONG i = 0;
248
249 /* Get current EBP */
250#if defined(_M_IX86)
251#if defined __GNUC__
252 __asm__("mov %%ebp, %0" : "=r" (Stack) : );
253#elif defined(_MSC_VER)
254 __asm mov Stack, ebp
255#endif
256#elif defined(_M_MIPS)
257 __asm__("move $sp, %0" : "=r" (Stack) : );
258#elif defined(_M_PPC)
259 __asm__("mr %0,1" : "=r" (Stack) : );
260#elif defined(_M_ARM)
261#if defined __GNUC__
262 __asm__("mov sp, %0" : "=r"(Stack) : );
263#elif defined(_MSC_VER)
264 // FIXME: Hack. Probably won't work if this ever actually manages to run someday.
266#endif
267#else
268#error Unknown architecture
269#endif
270
271 /* Set it as the stack begin limit as well */
272 StackBegin = (ULONG_PTR)Stack;
273
274 /* Check if we're called for non-logging mode */
275 if (!Flags)
276 {
277 /* Get the actual safe limits */
279 &StackBegin,
280 &StackEnd);
281 if (!Result) return 0;
282 }
283
284 /* Use a SEH block for maximum protection */
286 {
287 /* Loop the frames */
288 for (i = 0; i < Count; i++)
289 {
290 /*
291 * Leave if we're past the stack,
292 * if we're before the stack,
293 * or if we've reached ourselves.
294 */
295 if ((Stack >= StackEnd) ||
296 (!i ? (Stack < StackBegin) : (Stack <= StackBegin)) ||
297 ((StackEnd - Stack) < (2 * sizeof(ULONG_PTR))))
298 {
299 /* We're done or hit a bad address */
300 break;
301 }
302
303 /* Get new stack and EIP */
304 NewStack = *(PULONG_PTR)Stack;
305 Eip = *(PULONG_PTR)(Stack + sizeof(ULONG_PTR));
306
307 /* Check if the new pointer is above the oldone and past the end */
308 if (!((Stack < NewStack) && (NewStack < StackEnd)))
309 {
310 /* Stop searching after this entry */
311 StopSearch = TRUE;
312 }
313
314 /* Also make sure that the EIP isn't a stack address */
315 if ((StackBegin < Eip) && (Eip < StackEnd)) break;
316
317 /* FIXME: Check that EIP is inside a loaded module */
318
319 /* Save this frame */
320 Callers[i] = (PVOID)Eip;
321
322 /* Check if we should continue */
323 if (StopSearch)
324 {
325 /* Return the next index */
326 i++;
327 break;
328 }
329
330 /* Move to the next stack */
331 Stack = NewStack;
332 }
333 }
335 {
336 /* No index */
337 i = 0;
338 }
339 _SEH2_END;
340
341 /* Return frames parsed */
342 return i;
343}
344#endif
345
346VOID
347NTAPI
349 OUT PULONG_PTR LowLimit,
351{
352 *LowLimit = (ULONG_PTR)NtCurrentTeb()->NtTib.StackLimit;
353 *HighLimit = (ULONG_PTR)NtCurrentTeb()->NtTib.StackBase;
354}
355
357NTAPI
359{
361}
362
363/* RTL Atom Tables ************************************************************/
364
365typedef struct _RTL_ATOM_HANDLE
366{
370
373{
374 RtlInitializeCriticalSection(&AtomTable->CriticalSection);
375 return STATUS_SUCCESS;
376}
377
378
379VOID
381{
382 RtlDeleteCriticalSection(&AtomTable->CriticalSection);
383}
384
385
388{
389 RtlEnterCriticalSection(&AtomTable->CriticalSection);
390 return TRUE;
391}
392
393
394VOID
396{
397 RtlLeaveCriticalSection(&AtomTable->CriticalSection);
398}
399
400
401/* handle functions */
402
405{
407 sizeof(RTL_ATOM_HANDLE),
408 &AtomTable->RtlHandleTable);
409
410 return TRUE;
411}
412
413VOID
415{
416 RtlDestroyHandleTable(&AtomTable->RtlHandleTable);
417}
418
421{
422 return (PRTL_ATOM_TABLE)RtlAllocateHeap(RtlGetProcessHeap(),
424 Size);
425}
426
427VOID
429{
430 RtlFreeHeap(RtlGetProcessHeap(),
431 0,
432 AtomTable);
433}
434
437{
438 return (PRTL_ATOM_TABLE_ENTRY)RtlAllocateHeap(RtlGetProcessHeap(),
440 Size);
441}
442
443VOID
445{
446 RtlFreeHeap(RtlGetProcessHeap(),
447 0,
448 Entry);
449}
450
451VOID
453{
454 PRTL_HANDLE_TABLE_ENTRY RtlHandleEntry;
455
456 if (RtlIsValidIndexHandle(&AtomTable->RtlHandleTable,
457 (ULONG)Entry->HandleIndex,
458 &RtlHandleEntry))
459 {
460 RtlFreeHandle(&AtomTable->RtlHandleTable,
461 RtlHandleEntry);
462 }
463}
464
467{
468 ULONG HandleIndex;
469 PRTL_HANDLE_TABLE_ENTRY RtlHandle;
470
471 RtlHandle = RtlAllocateHandle(&AtomTable->RtlHandleTable,
472 &HandleIndex);
473 if (RtlHandle != NULL)
474 {
475 PRTL_ATOM_HANDLE AtomHandle = (PRTL_ATOM_HANDLE)RtlHandle;
476
477 /* FIXME - Handle Indexes >= 0xC000 ?! */
478 if (HandleIndex < 0xC000)
479 {
480 Entry->HandleIndex = (USHORT)HandleIndex;
481 Entry->Atom = 0xC000 + (USHORT)HandleIndex;
482
483 AtomHandle->AtomEntry = Entry;
484 AtomHandle->Handle.Flags = RTL_HANDLE_VALID;
485
486 return TRUE;
487 }
488 else
489 {
490 /* set the valid flag, otherwise RtlFreeHandle will fail! */
491 AtomHandle->Handle.Flags = RTL_HANDLE_VALID;
492
493 RtlFreeHandle(&AtomTable->RtlHandleTable,
494 RtlHandle);
495 }
496 }
497
498 return FALSE;
499}
500
503{
504 PRTL_HANDLE_TABLE_ENTRY RtlHandle;
505
506 if (RtlIsValidIndexHandle(&AtomTable->RtlHandleTable,
507 Index,
508 &RtlHandle))
509 {
510 PRTL_ATOM_HANDLE AtomHandle = (PRTL_ATOM_HANDLE)RtlHandle;
511
512 return AtomHandle->AtomEntry;
513 }
514
515 return NULL;
516}
517
518/* Ldr SEH-Protected access to IMAGE_NT_HEADERS */
519
520/* Rtl SEH-Free version of this */
522NTAPI
527 _Out_ PIMAGE_NT_HEADERS *OutHeaders);
528
529
530/*
531 * @implemented
532 * @note: This is here, so that we do not drag SEH into rosload, freeldr and bootmgfw
533 */
535NTAPI
540 _Out_ PIMAGE_NT_HEADERS *OutHeaders)
541{
543
544 /* Assume failure. This is also done in RtlpImageNtHeaderEx, but this is guarded by SEH. */
545 if (OutHeaders != NULL)
546 *OutHeaders = NULL;
547
549 {
550 Status = RtlpImageNtHeaderEx(Flags, Base, Size, OutHeaders);
551 }
553 {
554 /* Fail with the SEH error */
556 }
557 _SEH2_END;
558
559 return Status;
560}
561
562/*
563 * Ldr Resource support code
564 */
565
567 LPCWSTR name, void *root,
568 int want_dir );
570 WORD id, void *root, int want_dir );
572 void *root, int want_dir );
574
575/**********************************************************************
576 * find_entry
577 *
578 * Find a resource entry
579 */
581 ULONG level, void **ret, int want_dir )
582{
583 ULONG size;
584 void *root;
585 IMAGE_RESOURCE_DIRECTORY *resdirptr;
586 USHORT list[9]; /* list of languages to try */
587 int i, pos = 0;
589
592 if (size < sizeof(*resdirptr)) return STATUS_RESOURCE_DATA_NOT_FOUND;
593 resdirptr = root;
594
595 if (!level--) goto done;
596 if (!(*ret = find_entry_by_name( resdirptr, (LPCWSTR)info->Type, root, want_dir || level )))
598 if (!level--) return STATUS_SUCCESS;
599
600 resdirptr = *ret;
601 if (!(*ret = find_entry_by_name( resdirptr, (LPCWSTR)info->Name, root, want_dir || level )))
603 if (!level--) return STATUS_SUCCESS;
604 if (level) return STATUS_INVALID_PARAMETER; /* level > 3 */
605
606 /* 1. specified language */
607 pos = push_language( list, pos, info->Language );
608
609 /* 2. specified language with neutral sublanguage */
611
612 /* 3. neutral language with neutral sublanguage */
614
615 /* if no explicitly specified language, try some defaults */
616 if (PRIMARYLANGID(info->Language) == LANG_NEUTRAL)
617 {
618 /* user defaults, unless SYS_DEFAULT sublanguage specified */
619 if (SUBLANGID(info->Language) != SUBLANG_SYS_DEFAULT)
620 {
621 /* 4. current thread locale language */
622 pos = push_language( list, pos, LANGIDFROMLCID(NtCurrentTeb()->CurrentLocale) );
623
625 {
626 /* 5. user locale language */
628
629 /* 6. user locale language with neutral sublanguage */
631 }
632 }
633
634 /* now system defaults */
635
637 {
638 /* 7. system locale language */
640
641 /* 8. system locale language with neutral sublanguage */
643 }
644
645 /* 9. English */
647 }
648
649 resdirptr = *ret;
650 for (i = 0; i < pos; i++)
651 if ((*ret = find_entry_by_id( resdirptr, list[i], root, want_dir ))) return STATUS_SUCCESS;
652
653 /* if no explicitly specified language, return the first entry */
654 if (PRIMARYLANGID(info->Language) == LANG_NEUTRAL)
655 {
656 if ((*ret = find_first_entry( resdirptr, root, want_dir ))) return STATUS_SUCCESS;
657 }
659
660done:
661 *ret = resdirptr;
662 return STATUS_SUCCESS;
663}
664
665/*
666 * @implemented
667 */
670 PVOID* BaseOfImage)
671{
675 PVOID ImageBase = NULL;
676
678 ModuleListHead = &NtCurrentPeb()->Ldr->InLoadOrderModuleList;
680 while (Entry != ModuleListHead)
681 {
682 Module = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks);
683
684 if ((ULONG_PTR)PcValue >= (ULONG_PTR)Module->DllBase &&
685 (ULONG_PTR)PcValue < (ULONG_PTR)Module->DllBase + Module->SizeOfImage)
686 {
687 ImageBase = Module->DllBase;
688 break;
689 }
690 Entry = Entry->Flink;
691 }
693
694 *BaseOfImage = ImageBase;
695 return ImageBase;
696}
697
698NTSTATUS get_buffer(LPWSTR *buffer, SIZE_T needed, PUNICODE_STRING CallerBuffer, BOOLEAN bAllocateBuffer)
699{
700 WCHAR *p;
701
702 if (CallerBuffer && CallerBuffer->MaximumLength > needed)
703 {
704 p = CallerBuffer->Buffer;
705 CallerBuffer->Length = needed - sizeof(WCHAR);
706 }
707 else
708 {
709 if (!bAllocateBuffer)
711
712 if (CallerBuffer)
713 CallerBuffer->Buffer[0] = 0;
714
715 p = RtlAllocateHeap(RtlGetProcessHeap(), 0, needed );
716 if (!p)
717 return STATUS_NO_MEMORY;
718 }
719 *buffer = p;
720
721 return STATUS_SUCCESS;
722}
723
724/* NOTE: Remove this one once our actctx support becomes better */
726{
727 static const WCHAR winsxsW[] = {'\\','w','i','n','s','x','s','\\'};
728 static const WCHAR dotManifestW[] = {'.','m','a','n','i','f','e','s','t',0};
729
730 ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION *info;
731 ACTCTX_SECTION_KEYED_DATA data;
733 SIZE_T needed, size = 1024;
734 WCHAR *p;
735
736 data.cbSize = sizeof(data);
737 status = RtlFindActivationContextSectionString( FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX, NULL,
738 ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION,
739 pnameW, &data );
740 if (status != STATUS_SUCCESS)
741 {
742 //DPRINT1("RtlFindActivationContextSectionString returned 0x%x for %wZ\n", status, pnameW);
743 return status;
744 }
745
746 for (;;)
747 {
748 if (!(info = RtlAllocateHeap( RtlGetProcessHeap(), 0, size )))
749 {
751 goto done;
752 }
753 status = RtlQueryInformationActivationContext( 0, data.hActCtx, &data.ulAssemblyRosterIndex,
754 AssemblyDetailedInformationInActivationContext,
755 info, size, &needed );
756 if (status == STATUS_SUCCESS) break;
757 if (status != STATUS_BUFFER_TOO_SMALL) goto done;
758 RtlFreeHeap( RtlGetProcessHeap(), 0, info );
759 size = needed;
760 }
761
762 DPRINT("manifestpath === %S\n", info->lpAssemblyManifestPath);
763 DPRINT("DirectoryName === %S\n", info->lpAssemblyDirectoryName);
764 if (!info->lpAssemblyManifestPath /*|| !info->lpAssemblyDirectoryName*/)
765 {
767 goto done;
768 }
769
770 if ((p = wcsrchr( info->lpAssemblyManifestPath, '\\' )))
771 {
772 DWORD dirlen = info->ulAssemblyDirectoryNameLength / sizeof(WCHAR);
773
774 p++;
775 if (!info->lpAssemblyDirectoryName || _wcsnicmp( p, info->lpAssemblyDirectoryName, dirlen ) || _wcsicmp( p + dirlen, dotManifestW ))
776 {
777 /* manifest name does not match directory name, so it's not a global
778 * windows/winsxs manifest; use the manifest directory name instead */
779 dirlen = p - info->lpAssemblyManifestPath;
780 needed = (dirlen + 1) * sizeof(WCHAR) + pnameW->Length;
781
782 status = get_buffer(fullname, needed, CallerBuffer, bAllocateBuffer);
783 if (!NT_SUCCESS(status))
784 goto done;
785
786 p = *fullname;
787
788 memcpy( p, info->lpAssemblyManifestPath, dirlen * sizeof(WCHAR) );
789 p += dirlen;
790 memcpy( p, pnameW->Buffer, pnameW->Length);
791 p += (pnameW->Length / sizeof(WCHAR));
792 *p = L'\0';
793
794 goto done;
795 }
796 }
797
798 needed = (wcslen(SharedUserData->NtSystemRoot) * sizeof(WCHAR) +
799 sizeof(winsxsW) + info->ulAssemblyDirectoryNameLength + pnameW->Length + 2*sizeof(WCHAR));
800
801 status = get_buffer(fullname, needed, CallerBuffer, bAllocateBuffer);
802 if (!NT_SUCCESS(status))
803 goto done;
804
805 p = *fullname;
806
807 wcscpy( p, SharedUserData->NtSystemRoot );
808 p += wcslen(p);
809 memcpy( p, winsxsW, sizeof(winsxsW) );
810 p += sizeof(winsxsW) / sizeof(WCHAR);
811 memcpy( p, info->lpAssemblyDirectoryName, info->ulAssemblyDirectoryNameLength );
812 p += info->ulAssemblyDirectoryNameLength / sizeof(WCHAR);
813 *p++ = L'\\';
814 memcpy( p, pnameW->Buffer, pnameW->Length);
815 p += (pnameW->Length / sizeof(WCHAR));
816 *p = L'\0';
817
818done:
819 RtlFreeHeap( RtlGetProcessHeap(), 0, info );
821 DPRINT("%S\n", fullname);
822 return status;
823}
824
825/*
826 * @unimplemented
827 */
830NTAPI
832 IN PUNICODE_STRING OriginalName,
837 IN PULONG NewFlags,
838 IN PSIZE_T FileNameSize,
840{
844 UNICODE_STRING localStr, localStr2, *pstrParam;
845 WCHAR *p;
846 BOOLEAN GotExtension;
847 WCHAR c;
848 C_ASSERT(sizeof(UNICODE_NULL) == sizeof(WCHAR));
849
850
851 /* Check for invalid parameters */
852 if (!OriginalName)
853 {
855 }
856
858 {
860 }
861
862 if ((DynamicString) && (StaticString) && !(NewName))
863 {
865 }
866
867 if (!OriginalName->Buffer || OriginalName->Length == 0)
868 {
870 }
871
872 if (StaticString && (OriginalName == StaticString || OriginalName->Buffer == StaticString->Buffer))
873 {
875 }
876
877 if ((Flags & RTL_DOS_APPLY_FILE_REDIRECTION_USTR_FLAG_RESPECT_DOT_LOCAL) &&
878 NtCurrentPeb()->ProcessParameters &&
879 (NtCurrentPeb()->ProcessParameters->Flags & RTL_USER_PROCESS_PARAMETERS_PRIVATE_DLL_PATH))
880 {
881 UNICODE_STRING RealName, LocalName;
882 WCHAR RealNameBuf[MAX_PATH], LocalNameBuf[MAX_PATH];
883
884 RtlInitEmptyUnicodeString(&RealName, RealNameBuf, sizeof(RealNameBuf));
885 RtlInitEmptyUnicodeString(&LocalName, LocalNameBuf, sizeof(LocalNameBuf));
886
887 Status = RtlComputePrivatizedDllName_U(OriginalName, &RealName, &LocalName);
888 if (!NT_SUCCESS(Status))
889 {
890 DPRINT1("RtlComputePrivatizedDllName_U failed for %wZ: 0x%lx\n", OriginalName, Status);
891 return Status;
892 }
893
894 if (RtlDoesFileExists_UStr(&LocalName))
895 {
897 if (NT_SUCCESS(Status))
898 {
899 RtlCopyMemory(fullname, LocalName.Buffer, LocalName.Length + sizeof(UNICODE_NULL));
900 }
901 else
902 {
903 DPRINT1("Error while retrieving buffer for %wZ: 0x%lx\n", OriginalName, Status);
904 }
905 }
906 else if (RtlDoesFileExists_UStr(&RealName))
907 {
909 if (NT_SUCCESS(Status))
910 {
911 RtlCopyMemory(fullname, RealName.Buffer, RealName.Length + sizeof(UNICODE_NULL));
912 }
913 else
914 {
915 DPRINT1("Error while retrieving buffer for %wZ: 0x%lx\n", OriginalName, Status);
916 }
917 }
918 else
919 {
921 }
922
923 if (RealName.Buffer != RealNameBuf)
924 RtlFreeUnicodeString(&RealName);
925 if (LocalName.Buffer != LocalNameBuf)
926 RtlFreeUnicodeString(&LocalName);
927
928 if (NT_SUCCESS(Status))
929 {
930 DPRINT("Redirecting %wZ to %S\n", OriginalName, fullname);
932 {
935 }
936 else
937 {
939 }
940 return Status;
941 }
942 }
943
944 pstrParam = OriginalName;
945
946 /* Get the file name with an extension */
947 p = OriginalName->Buffer + OriginalName->Length / sizeof(WCHAR) - 1;
948 GotExtension = FALSE;
949 while (p >= OriginalName->Buffer)
950 {
951 c = *p--;
952 if (c == L'.')
953 {
954 GotExtension = TRUE;
955 }
956 else if (c == L'\\')
957 {
958 localStr.Buffer = p + 2;
959 localStr.Length = OriginalName->Length - ((ULONG_PTR)localStr.Buffer - (ULONG_PTR)OriginalName->Buffer);
960 localStr.MaximumLength = OriginalName->MaximumLength - ((ULONG_PTR)localStr.Buffer - (ULONG_PTR)OriginalName->Buffer);
961 pstrParam = &localStr;
962 break;
963 }
964 }
965
966 if (!GotExtension)
967 {
968 if (!Extension)
969 {
971 }
972
973 if (pstrParam->Length + Extension->Length > sizeof(buffer))
974 {
975 //FIXME!
976 return STATUS_NO_MEMORY;
977 }
978
979 RtlInitEmptyUnicodeString(&localStr2, buffer, sizeof(buffer));
980 RtlAppendUnicodeStringToString(&localStr2, pstrParam);
982 pstrParam = &localStr2;
983 }
984
985 /* Use wine's function as long as we use wine's sxs implementation in ntdll */
987 if (!NT_SUCCESS(Status))
988 {
989 return Status;
990 }
991
992 DPRINT("Redirecting %wZ to %S\n", OriginalName, fullname);
993
995 {
998 }
999 else
1000 {
1002 }
1003
1004 return Status;
1005}
1006
1007#ifndef TAG_USTR
1008#define TAG_USTR 'RTSU'
1009#endif
1010#ifndef RtlpAllocateStringMemory
1011#define RtlpAllocateStringMemory(Bytes, Tag) RtlpAllocateMemory(Bytes, Tag)
1012#endif
1013
1014static DWORD
1016{
1017 static DWORD CachedApisetVersion = ~0u;
1018
1019 if (CachedApisetVersion == ~0u)
1020 {
1021 DWORD CompatVersion = RosGetProcessCompatVersion();
1022
1023 switch (CompatVersion)
1024 {
1025 case 0:
1026 break;
1027 case _WIN32_WINNT_VISTA:
1028 /* No apisets in vista yet*/
1029 CachedApisetVersion = 0;
1030 break;
1031 case _WIN32_WINNT_WIN7:
1032 CachedApisetVersion = APISET_WIN7;
1033 DPRINT1("Activating apisets for Win7\n");
1034 break;
1035 case _WIN32_WINNT_WIN8:
1036 CachedApisetVersion = APISET_WIN8;
1037 DPRINT1("Activating apisets for Win8\n");
1038 break;
1040 CachedApisetVersion = APISET_WIN81;
1041 DPRINT1("Activating apisets for Win8.1\n");
1042 break;
1043 case _WIN32_WINNT_WIN10:
1044 CachedApisetVersion = APISET_WIN10;
1045 DPRINT1("Activating apisets for Win10\n");
1046 break;
1047 default:
1048 DPRINT1("Unknown version 0x%x\n", CompatVersion);
1049 CachedApisetVersion = 0;
1050 break;
1051 }
1052 }
1053
1054 return CachedApisetVersion;
1055}
1056
1059NTAPI
1061 _In_ PUNICODE_STRING OriginalName,
1066 _Out_ PBOOLEAN RedirectedDll)
1067{
1068
1069 /* Check for invalid parameters */
1070 if (!OriginalName)
1071 {
1073 }
1074
1075 if (!DynamicString && !StaticString)
1076 {
1078 }
1079
1080 if (!NewName)
1081 {
1083 }
1084
1085 *RedirectedDll = FALSE;
1086
1087 PCUNICODE_STRING PrevNewName = *NewName;
1088 UNICODE_STRING ApisetName = {0};
1090
1091 DWORD ApisetVersion = LdrpApisetVersion();
1092 if (ApisetVersion)
1093 {
1094 Status = ApiSetResolveToHost(ApisetVersion, OriginalName, RedirectedDll, &ApisetName);
1095 if (!NT_SUCCESS(Status))
1096 {
1097 DPRINT1("ApiSetResolveToHost FAILED: (Status 0x%x)\n", Status);
1098 return Status;
1099 }
1100 }
1101
1102 if (*RedirectedDll)
1103 {
1105 static const UNICODE_STRING System32 = RTL_CONSTANT_STRING(L"\\System32\\");
1106 PUNICODE_STRING ResultPath = NULL;
1107
1108 /* This is an apiset we can use */
1110
1111 SIZE_T Needed = System32.Length + ApisetName.Length + NtSystemRoot.Length + sizeof(UNICODE_NULL);
1112
1113 if (StaticString && StaticString->MaximumLength >= (USHORT)Needed)
1114 {
1115 StaticString->Length = 0;
1116 ResultPath = StaticString;
1117 }
1118 else if (DynamicString)
1119 {
1121 if (DynamicString->Buffer == NULL)
1122 {
1123 DPRINT1("LdrpApplyFileNameRedirection out of memory\n");
1124 return STATUS_NO_MEMORY;
1125 }
1127 DynamicString->Length = 0;
1128
1129 ResultPath = DynamicString;
1130 }
1131 else
1132 {
1133 DPRINT1("ERROR: LdrpApplyFileNameRedirection no inputbuffer valid\n");
1135 }
1136
1138 RtlAppendUnicodeStringToString(ResultPath, &System32);
1139 RtlAppendUnicodeStringToString(ResultPath, &ApisetName);
1140 DPRINT1("ApiSetResolveToHost redirected %wZ to %wZ\n", OriginalName, ResultPath);
1141 *NewName = ResultPath;
1142 }
1143 else
1144 {
1145 /* Check if the SxS Assemblies specify another file */
1146 Status = RtlDosApplyFileIsolationRedirection_Ustr(RTL_DOS_APPLY_FILE_REDIRECTION_USTR_FLAG_RESPECT_DOT_LOCAL, OriginalName, Extension, StaticString, DynamicString, NewName, NULL, NULL, NULL);
1147
1148 /* Check success */
1149 if (NT_SUCCESS(Status))
1150 {
1151 /* Let Ldrp know */
1152 *RedirectedDll = TRUE;
1153 }
1154 else if (Status == STATUS_SXS_KEY_NOT_FOUND)
1155 {
1156 ASSERT(*NewName == PrevNewName);
1158 }
1159 else
1160 {
1161 /* Unrecoverable SxS failure; did we get a string? */
1164 return Status;
1165 }
1166 }
1167
1168 return Status;
1169}
1170
1171/*
1172 * @implemented
1173 */
1176NTAPI
1177RtlWow64EnableFsRedirection(IN BOOLEAN Wow64FsEnableRedirection)
1178{
1179 /* This is what Windows returns on x86 */
1181}
1182
1183/*
1184 * @implemented
1185 */
1188NTAPI
1189RtlWow64EnableFsRedirectionEx(IN PVOID Wow64FsEnableRedirection,
1190 OUT PVOID *OldFsRedirectionLevel)
1191{
1192 /* This is what Windows returns on x86 */
1194}
1195
1196/*
1197 * @unimplemented
1198 */
1201NTAPI
1203 OUT PCHAR Hash,
1204 IN ULONG ImportTableHashSize)
1205{
1208}
1209
1211NTAPI
1216{
1217 _SEH2_TRY
1218 {
1220 }
1222 {
1224 }
1225 _SEH2_END;
1226
1227 return STATUS_SUCCESS;
1228}
1229
1230/* FIXME: code duplication with kernel32/client/time.c */
1231ULONG
1232NTAPI
1234{
1235 LARGE_INTEGER TickCount;
1236
1237 TickCount = KiReadSystemTime(&SharedUserData->TickCount);
1238
1239 /* Convert to milliseconds */
1240 return KiTickCountToMs(TickCount);
1241}
1242
1243/* EOF */
#define NtCurrentPeb()
Definition: FLS.c:22
IN PUNICODE_STRING StaticString
IN PUNICODE_STRING IN PUNICODE_STRING DynamicString
unsigned char BOOLEAN
Definition: actypes.h:127
#define APISET_WIN7
Definition: apisets.h:16
#define APISET_WIN8
Definition: apisets.h:17
#define APISET_WIN81
Definition: apisets.h:18
#define APISET_WIN10
Definition: apisets.h:19
unsigned int dir
Definition: maze.c:112
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
#define NTSYSAPI
Definition: ntoskrnl.h:12
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:616
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:634
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
NTSTATUS NTAPI RtlImageNtHeaderEx(_In_ ULONG Flags, _In_ PVOID Base, _In_ ULONG64 Size, _Out_ PIMAGE_NT_HEADERS *OutHeaders)
Definition: libsupp.c:78
NTSTATUS NTAPI RtlpImageNtHeaderEx(_In_ ULONG Flags, _In_ PVOID Base, _In_ ULONG64 Size, _Out_ PIMAGE_NT_HEADERS *OutHeaders)
Definition: image.c:140
PVOID NTAPI RtlpAllocateMemory(ULONG Bytes, ULONG Tag)
Definition: libsupp.c:35
VOID NTAPI RtlpFreeMemory(PVOID Mem, ULONG Tag)
Definition: libsupp.c:44
PVOID MmHighestUserAddress
Definition: libsupp.c:23
struct _root root
Definition: list.h:39
static DWORD RosGetProcessCompatVersion(VOID)
Definition: compat_undoc.h:26
#define STATUS_NOT_IMPLEMENTED
Definition: d3dkmdt.h:42
#define STATUS_NO_MEMORY
Definition: d3dkmdt.h:51
_In_ HANDLE _In_ CONST PDXGKMDT_OPM_GET_INFO_PARAMETERS Parameters
Definition: dispmprt.h:321
_In_ D3DDDI_VIDEO_PRESENT_TARGET_ID _In_ ULONG _In_ ULONG Flags
Definition: dispmprt.h:245
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
BOOLEAN NTAPI RtlpCheckForActiveDebugger(VOID)
Definition: libsupp.c:27
NTSYSAPI NTSTATUS NTAPI RtlWow64EnableFsRedirection(IN BOOLEAN Wow64FsEnableRedirection)
Definition: libsupp.c:1177
NTSTATUS NTAPI RtlInitializeHeapLock(IN OUT PHEAP_LOCK *Lock)
Definition: libsupp.c:139
VOID NTAPI RtlpCheckLogException(IN PEXCEPTION_RECORD ExceptionRecord, IN PCONTEXT ContextRecord, IN PVOID ContextData, IN ULONG Size)
Definition: libsupp.c:214
IMAGE_RESOURCE_DIRECTORY * find_entry_by_id(IMAGE_RESOURCE_DIRECTORY *dir, WORD id, void *root, int want_dir)
Definition: res.c:95
BOOLEAN NTAPI RtlIsThreadWithinLoaderCallout(VOID)
Definition: libsupp.c:358
PRTL_ATOM_TABLE_ENTRY RtlpAllocAtomTableEntry(ULONG Size)
Definition: libsupp.c:436
#define TAG_USTR
Definition: libsupp.c:1008
NTSTATUS NTAPI RtlEnterHeapLock(IN OUT PHEAP_LOCK Lock, IN BOOLEAN Exclusive)
Definition: libsupp.c:121
VOID NTAPI RtlpClearInDbgPrint(VOID)
Definition: libsupp.c:54
IMAGE_RESOURCE_DIRECTORY * find_entry_by_name(IMAGE_RESOURCE_DIRECTORY *dir, LPCWSTR name, void *root, int want_dir)
Definition: res.c:177
static DWORD LdrpApisetVersion(VOID)
Definition: libsupp.c:1015
BOOLEAN RtlpLockAtomTable(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:387
ULONG NTAPI RtlWalkFrameChain(OUT PVOID *Callers, IN ULONG Count, IN ULONG Flags)
Definition: libsupp.c:240
KPROCESSOR_MODE NTAPI RtlpGetMode(VOID)
Definition: libsupp.c:66
BOOLEAN NTAPI RtlpSetInDbgPrint(VOID)
Definition: libsupp.c:35
int push_language(USHORT *list, ULONG pos, WORD lang)
Definition: res.c:61
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:203
VOID NTAPI RtlpSetHeapParameters(IN PRTL_HEAP_PARAMETERS Parameters)
Definition: libsupp.c:187
NTSYSAPI NTSTATUS NTAPI LdrpApplyFileNameRedirection(_In_ PUNICODE_STRING OriginalName, _In_ PUNICODE_STRING Extension, _Inout_opt_ PUNICODE_STRING StaticString, _Inout_opt_ PUNICODE_STRING DynamicString, _Inout_ PUNICODE_STRING *NewName, _Out_ PBOOLEAN RedirectedDll)
Definition: libsupp.c:1060
PTEB LdrpTopLevelDllBeingLoadedTeb
Definition: libsupp.c:20
struct _RTL_ATOM_HANDLE RTL_ATOM_HANDLE
ULONG NTAPI RtlGetTickCount(VOID)
Definition: libsupp.c:1233
BOOLEAN NTAPI RtlTryEnterHeapLock(IN OUT PHEAP_LOCK Lock, IN BOOLEAN Exclusive)
Definition: libsupp.c:130
NTSTATUS NTAPI RtlDeleteHeapLock(IN OUT PHEAP_LOCK Lock)
Definition: libsupp.c:114
PVOID NTAPI RtlPcToFileHeader(IN PVOID PcValue, PVOID *BaseOfImage)
Definition: libsupp.c:669
#define RtlpAllocateStringMemory(Bytes, Tag)
Definition: libsupp.c:1011
VOID RtlpFreeAtomTable(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:428
VOID RtlpDestroyAtomHandleTable(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:414
struct _RTL_ATOM_HANDLE * PRTL_ATOM_HANDLE
BOOLEAN RtlpCreateAtomHandleTable(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:404
NTSYSAPI NTSTATUS NTAPI RtlDosApplyFileIsolationRedirection_Ustr(IN ULONG Flags, IN PUNICODE_STRING OriginalName, IN PUNICODE_STRING Extension, IN OUT PUNICODE_STRING StaticString, IN OUT PUNICODE_STRING DynamicString, IN OUT PUNICODE_STRING *NewName, IN PULONG NewFlags, IN PSIZE_T FileNameSize, IN PSIZE_T RequiredLength)
Definition: libsupp.c:831
NTSYSAPI NTSTATUS NTAPI RtlComputeImportTableHash(IN HANDLE FileHandle, OUT PCHAR Hash, IN ULONG ImportTableHashSize)
Definition: libsupp.c:1202
VOID RtlpUnlockAtomTable(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:395
NTSTATUS RtlpInitAtomTableLock(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:372
VOID RtlpDestroyAtomTableLock(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:380
VOID RtlpFreeAtomTableEntry(PRTL_ATOM_TABLE_ENTRY Entry)
Definition: libsupp.c:444
IMAGE_RESOURCE_DIRECTORY * find_first_entry(IMAGE_RESOURCE_DIRECTORY *dir, void *root, int want_dir)
Definition: res.c:75
NTSTATUS find_entry(PVOID BaseAddress, LDR_RESOURCE_INFO *info, ULONG level, void **ret, int want_dir)
Definition: libsupp.c:580
PRTL_ATOM_TABLE RtlpAllocAtomTable(ULONG Size)
Definition: libsupp.c:420
PRTL_ATOM_TABLE_ENTRY RtlpGetAtomEntry(PRTL_ATOM_TABLE AtomTable, ULONG Index)
Definition: libsupp.c:502
NTSTATUS NTAPI RtlLeaveHeapLock(IN OUT PHEAP_LOCK Lock)
Definition: libsupp.c:146
BOOLEAN RtlpCreateAtomHandle(PRTL_ATOM_TABLE AtomTable, PRTL_ATOM_TABLE_ENTRY Entry)
Definition: libsupp.c:466
NTSYSAPI NTSTATUS NTAPI RtlWow64EnableFsRedirectionEx(IN PVOID Wow64FsEnableRedirection, OUT PVOID *OldFsRedirectionLevel)
Definition: libsupp.c:1189
VOID RtlpFreeAtomHandle(PRTL_ATOM_TABLE AtomTable, PRTL_ATOM_TABLE_ENTRY Entry)
Definition: libsupp.c:452
BOOLEAN NTAPI RtlpCaptureStackLimits(IN ULONG_PTR Ebp, IN ULONG_PTR *StackBegin, IN ULONG_PTR *StackEnd)
Definition: libsupp.c:224
NTSTATUS find_actctx_dll(PUNICODE_STRING pnameW, LPWSTR *fullname, PUNICODE_STRING CallerBuffer, BOOLEAN bAllocateBuffer)
Definition: libsupp.c:725
SIZE_T RtlpAllocDeallocQueryBufferSize
Definition: libsupp.c:19
VOID NTAPI RtlpGetStackLimits(OUT PULONG_PTR LowLimit, OUT PULONG_PTR HighLimit)
Definition: libsupp.c:348
#define RTL_CONSTANT_STRING(s)
Definition: combase.c:35
#define wcsrchr
Definition: compat.h:16
#define RtlImageDirectoryEntryToData
Definition: compat.h:809
#define MAX_PATH
Definition: compat.h:34
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
PPEB Peb
Definition: dllmain.c:27
static LCID system_lcid
Definition: locale.c:308
static LCID user_lcid
Definition: locale.c:309
_ACRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:164
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2988
_ACRTIMP int __cdecl _wcsnicmp(const wchar_t *, const wchar_t *, size_t)
Definition: wcs.c:200
static int Hash(const char *)
Definition: reader.c:2237
return ret
Definition: mutex.c:147
#define L(x)
Definition: resources.c:13
#define ULONG_PTR
Definition: config.h:101
#define PAGE_SIZE
Definition: env_spec_w32.h:49
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
_Inout_opt_ PUNICODE_STRING Extension
Definition: fltkernel.h:1092
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE FileHandle
Definition: fltkernel.h:1231
__in PWDFDEVICE_INIT __in BOOLEAN Exclusive
Status
Definition: gdiplustypes.h:24
GLint level
Definition: gl.h:1546
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLuint buffer
Definition: glext.h:5915
GLsizeiptr size
Definition: glext.h:5919
const GLubyte * c
Definition: glext.h:8905
GLfloat GLfloat p
Definition: glext.h:8902
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
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 * u
Definition: glfuncs.h:240
unsigned int UINT
Definition: sysinfo.c:13
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
#define C_ASSERT(e)
Definition: intsafe.h:73
#define NtCurrentTeb
LIST_ENTRY * ModuleListHead
Definition: kdpacket.c:23
#define c
Definition: ke_i.h:80
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
_In_ UINT Bytes
Definition: mmcopy.h:9
#define ASSERT(a)
Definition: mode.c:44
unsigned __int64 ULONG64
Definition: imports.h:198
const char * fullname
Definition: shader.c:1979
struct atom_table ** PRTL_ATOM_TABLE
Definition: atom.c:43
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3169
#define MI_HIGHEST_USER_ADDRESS
Definition: mmtypes.h:43
#define UserMode
Definition: asm.h:39
FORCEINLINE ULONG64 KiTickCountToMs(_In_ LARGE_INTEGER TickCount)
Definition: kefuncs.h:453
FORCEINLINE LARGE_INTEGER KiReadSystemTime(_In_ volatile const KSYSTEM_TIME *SystemTime)
Definition: kefuncs.h:403
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize _Pre_valid_ PVOID * BaseAddress
Definition: mmfuncs.h:408
NTSYSAPI NTSTATUS NTAPI RtlDeleteCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
NTSYSAPI VOID NTAPI RtlInitializeHandleTable(_In_ ULONG TableSize, _In_ ULONG HandleSize, _In_ PRTL_HANDLE_TABLE HandleTable)
NTSYSAPI BOOLEAN NTAPI RtlFreeHandle(_In_ PRTL_HANDLE_TABLE HandleTable, _In_ PRTL_HANDLE_TABLE_ENTRY Handle)
NTSYSAPI VOID NTAPI RtlDestroyHandleTable(_Inout_ PRTL_HANDLE_TABLE HandleTable)
NTSYSAPI PRTL_HANDLE_TABLE_ENTRY NTAPI RtlAllocateHandle(_In_ PRTL_HANDLE_TABLE HandleTable, _Inout_ PULONG Index)
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
Definition: rtlfuncs.h:3051
NTSYSAPI NTSTATUS NTAPI RtlEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
_In_opt_ ULONG Base
Definition: rtlfuncs.h:2486
NTSYSAPI LOGICAL NTAPI RtlTryEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
NTSYSAPI NTSTATUS NTAPI RtlLeaveCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
NTSYSAPI NTSTATUS NTAPI RtlInitializeCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
NTSYSAPI NTSTATUS NTAPI RtlComputePrivatizedDllName_U(_In_ PUNICODE_STRING DllName, _Inout_ PUNICODE_STRING RealName, _Inout_ PUNICODE_STRING LocalName)
Definition: path.c:586
#define RTL_HANDLE_VALID
Definition: rtltypes.h:378
#define RTL_USER_PROCESS_PARAMETERS_PRIVATE_DLL_PATH
Definition: rtltypes.h:52
#define _In_reads_bytes_(s)
Definition: no_sal2.h:170
#define _Inout_
Definition: no_sal2.h:162
#define _Inout_opt_
Definition: no_sal2.h:216
#define _Out_
Definition: no_sal2.h:160
#define _In_
Definition: no_sal2.h:158
#define _Out_writes_bytes_all_(s)
Definition: no_sal2.h:194
int Count
Definition: noreturn.cpp:7
NTSYSAPI NTSTATUS NTAPI RtlAppendUnicodeStringToString(PUNICODE_STRING Destination, PUNICODE_STRING Source)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define FASTCALL
Definition: nt_native.h:50
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
_IRQL_requires_same_ _In_ PVOID _Inout_ struct _CONTEXT * ContextRecord
Definition: ntbasedef.h:666
#define UNICODE_NULL
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
BOOLEAN NTAPI RtlDoesFileExists_UStr(IN PUNICODE_STRING FileName)
Definition: path.c:1503
UNICODE_STRING NtSystemRoot
Definition: init.c:80
NTSTATUS NTAPI NtQueryDefaultLocale(IN BOOLEAN UserProfile, OUT PLCID DefaultLocaleId)
Definition: locale.c:392
#define STATUS_RESOURCE_LANG_NOT_FOUND
Definition: ntstatus.h:770
#define STATUS_RESOURCE_NAME_NOT_FOUND
Definition: ntstatus.h:469
#define STATUS_RESOURCE_TYPE_NOT_FOUND
Definition: ntstatus.h:468
#define STATUS_RESOURCE_DATA_NOT_FOUND
Definition: ntstatus.h:467
#define STATUS_SXS_KEY_NOT_FOUND
Definition: ntstatus.h:1777
#define UNALIGNED
Definition: pecoff.h:347
#define CONST
Definition: pedump.c:81
short WCHAR
Definition: pedump.c:58
unsigned short USHORT
Definition: pedump.c:61
#define IMAGE_DIRECTORY_ENTRY_RESOURCE
Definition: pedump.c:261
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:204
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:104
__asm__(".p2align 4, 0x90\n" ".seh_proc __seh2_global_filter_func\n" "__seh2_global_filter_func:\n" "\tsub %rbp, %rax\n" "\tpush %rbp\n" "\t.seh_pushreg %rbp\n" "\tpush %rbx\n" "\t.seh_pushreg %rbx\n" "\tpush %rdi\n" "\t.seh_pushreg %rdi\n" "\tpush %rsi\n" "\t.seh_pushreg %rsi\n" "\tpush %r12\n" "\t.seh_pushreg %r12\n" "\tpush %r13\n" "\t.seh_pushreg %r13\n" "\tpush %r14\n" "\t.seh_pushreg %r14\n" "\tpush %r15\n" "\t.seh_pushreg %r15\n" "\tsub $40, %rsp\n" "\t.seh_stackalloc 40\n" "\t.seh_endprologue\n" "\tsub %rax, %rdx\n" "\tmov %rdx, %rbp\n" "\tjmp *%r8\n" "__seh2_global_filter_func_exit:\n" "\t.p2align 4\n" "\tadd $40, %rsp\n" "\tpop %r15\n" "\tpop %r14\n" "\tpop %r13\n" "\tpop %r12\n" "\tpop %rsi\n" "\tpop %rdi\n" "\tpop %rbx\n" "\tpop %rbp\n" "\tret\n" "\t.seh_endproc")
#define _SEH2_END
Definition: pseh2_64.h:194
#define _SEH2_TRY
Definition: pseh2_64.h:93
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:207
#define LANG_NEUTRAL
Definition: nls.h:22
#define MAKELANGID(p, s)
Definition: nls.h:15
#define SUBLANGID(l)
Definition: nls.h:17
#define LANG_ENGLISH
Definition: nls.h:52
#define LANGIDFROMLCID(l)
Definition: nls.h:18
#define SUBLANG_NEUTRAL
Definition: nls.h:167
#define SUBLANG_DEFAULT
Definition: nls.h:168
DWORD LCID
Definition: nls.h:13
#define PRIMARYLANGID(l)
Definition: nls.h:16
#define SUBLANG_SYS_DEFAULT
Definition: nls.h:169
wcscpy
#define SharedUserData
NTSTATUS ApiSetResolveToHost(_In_ DWORD ApisetVersion, _In_ PCUNICODE_STRING ApiToResolve, _Out_ PBOOLEAN Resolved, _Out_ PUNICODE_STRING Output)
Definition: apisets.c:32
static char * get_buffer(void)
Definition: debug.c:124
#define _WIN32_WINNT_WIN10
Definition: sdkddkver.h:32
#define _WIN32_WINNT_WINBLUE
Definition: sdkddkver.h:30
#define _WIN32_WINNT_WIN8
Definition: sdkddkver.h:29
#define _WIN32_WINNT_WIN7
Definition: sdkddkver.h:28
#define _WIN32_WINNT_VISTA
Definition: sdkddkver.h:25
Entry
Definition: section.c:5216
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_NOT_FOUND
Definition: shellext.h:72
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define DPRINT
Definition: sndvol32.h:73
Definition: btrfs_drv.h:1876
ULONG SizeOfImage
Definition: ldrtypes.h:147
PVOID DllBase
Definition: btrfs_drv.h:1880
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
ULONG HeapSegmentReserve
Definition: ntddk_ex.h:275
ULONG HeapDeCommitFreeBlockThreshold
Definition: ntddk_ex.h:278
ULONG HeapDeCommitTotalFreeThreshold
Definition: ntddk_ex.h:277
ULONG HeapSegmentCommit
Definition: ntddk_ex.h:276
ULONG NtGlobalFlag
Definition: ntddk_ex.h:270
PVOID FastPebLock
Definition: ntddk_ex.h:250
RTL_HANDLE_TABLE_ENTRY Handle
Definition: libsupp.c:367
PRTL_ATOM_TABLE_ENTRY AtomEntry
Definition: libsupp.c:368
Definition: rtltypes.h:1719
Definition: rtltypes.h:1252
ULONG Flags
Definition: rtltypes.h:1255
Definition: compat.h:836
USHORT MaximumLength
Definition: env_spec_w32.h:370
Definition: fci.c:123
Definition: parser.c:49
Definition: name.c:39
Definition: ps.c:97
ecx edi movl ebx edx edi decl ecx esi eax jecxz decl eax andl eax esi movl edx movl TEMP incl eax andl eax ecx incl ebx testl eax jnz xchgl ecx incl TEMP esp ecx subl ebx pushl ecx ecx edx ecx shrl 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 psrlq mm1 psrlq mm5 paddd mm0 paddd mm4 psrad mm0 psrad mm4 packssdw mm0 packssdw mm4 mm1 punpckldq mm0 pand mm1 pand mm0 por mm1 movq edi esi edx edi decl ecx jnz popl ecx andl ecx jecxz mm0 mm0 mm1 mm1 mm2 mm2 mm3 mm3 paddd mm0 paddd mm0 paddd mm0 movq mm1 psrlq mm1 paddd mm0 psrad mm0 packssdw mm0 movd eax movw edi esi edx esi movl 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 psrlq mm1 psrlq mm5 paddd mm1 paddd mm5 psrad mm1 psrad mm5 packssdw mm1 packssdw mm5 psubd mm0 psubd mm4 psubsw mm0 psubsw mm4 mm1 punpckldq mm0 pand mm1 pand mm0 por mm1 movq edi subl esi addl edx edi decl ecx jnz mm0 mm0 mm1 mm1 mm2 mm2 mm3 mm3 paddd mm0 paddd mm0 paddd mm0 movq mm1 psrlq mm1 paddd mm1 psrad mm1 packssdw mm1 psubd mm0 psubsw mm0 movd eax movw edi emms popl ebx popl esi popl edi mov ebp
Definition: synth_sse3d.h:266
ULONG_PTR * PSIZE_T
Definition: typedefs.h:80
uint32_t * PULONG_PTR
Definition: typedefs.h:65
uint32_t * PULONG
Definition: typedefs.h:59
const uint16_t * LPCWSTR
Definition: typedefs.h:57
unsigned char * PBOOLEAN
Definition: typedefs.h:53
uint16_t * LPWSTR
Definition: typedefs.h:56
#define NTAPI
Definition: typedefs.h:36
void * PVOID
Definition: typedefs.h:50
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
char * PCHAR
Definition: typedefs.h:51
_Must_inspect_result_ _In_ UCXENDPOINT _In_ PVOID Tag
Definition: ucxendpoint.h:325
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
static const WCHAR lang[]
Definition: wbemdisp.c:287
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
Definition: wdfrequest.h:639
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWAITLOCK * Lock
Definition: wdfsync.h:127
NTSYSAPI void WINAPI RtlReleasePebLock(void)
Definition: libsupp.c:95
NTSYSAPI BOOLEAN WINAPI RtlIsValidIndexHandle(const RTL_HANDLE_TABLE *, ULONG Index, RTL_HANDLE **)
NTSYSAPI NTSTATUS WINAPI RtlFindActivationContextSectionString(ULONG, const GUID *, ULONG, const UNICODE_STRING *, PVOID)
Definition: actctx.c:6137
NTSYSAPI void WINAPI RtlAcquirePebLock(void)
Definition: libsupp.c:85
NTSYSAPI void WINAPI RtlReleaseActivationContext(HANDLE)
Definition: actctx.c:5664
NTSYSAPI PEB *WINAPI RtlGetCurrentPeb(void)
Definition: libsupp.c:76
NTSYSAPI NTSTATUS WINAPI RtlQueryInformationActivationContext(ULONG, HANDLE, PVOID, ULONG, PVOID, SIZE_T, SIZE_T *)
Definition: actctx.c:5833
NTSYSAPI ULONG WINAPI RtlGetNtGlobalFlags(void)
Definition: libsupp.c:106
_In_ ULONG _Out_opt_ PULONG RequiredLength
Definition: wmifuncs.h:30
_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
_Out_ PULONG_PTR HighLimit
Definition: iofuncs.h:2892
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
_In_ PUNICODE_STRING NewName
Definition: zwfuncs.h:1203