ReactOS 0.4.16-dev-197-g92996da
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 (NtCurrentTeb()->InDbgPrint) return TRUE;
39
40 /* Set it and return */
41 NtCurrentTeb()->InDbgPrint = TRUE;
42 return FALSE;
43}
44
45VOID
48{
49 /* Clear the flag */
50 NtCurrentTeb()->InDbgPrint = FALSE;
51}
52
56{
57 return UserMode;
58}
59
60/*
61 * @implemented
62 */
63PPEB
66{
67 return NtCurrentPeb();
68}
69
70/*
71 * @implemented
72 */
75{
78}
79
80/*
81 * @implemented
82 */
85{
88}
89
90/*
91* @implemented
92*/
96{
97 PPEB pPeb = NtCurrentPeb();
98 return pPeb->NtGlobalFlag;
99}
100
102NTAPI
104{
105 return RtlDeleteCriticalSection(&Lock->CriticalSection);
106}
107
109NTAPI
111{
113
114 return RtlEnterCriticalSection(&Lock->CriticalSection);
115}
116
118NTAPI
120{
122
123 return RtlTryEnterCriticalSection(&Lock->CriticalSection);
124}
125
127NTAPI
129{
130 return RtlInitializeCriticalSection(&(*Lock)->CriticalSection);
131}
132
134NTAPI
136{
137 return RtlLeaveCriticalSection(&Lock->CriticalSection);
138}
139
140PVOID
141NTAPI
143 ULONG Tag)
144{
146
147 return RtlAllocateHeap(RtlGetProcessHeap(),
148 0,
149 Bytes);
150}
151
152
153VOID
154NTAPI
156 ULONG Tag)
157{
159
160 RtlFreeHeap(RtlGetProcessHeap(),
161 0,
162 Mem);
163}
164
165
166#if DBG
168CHECK_PAGED_CODE_RTL(char *file, int line)
169{
170 /* meaningless in user mode */
171}
172#endif
173
174VOID
175NTAPI
177{
178 PPEB Peb;
179
180 /* Get PEB */
182
183 /* Apply defaults for non-set parameters */
184 if (!Parameters->SegmentCommit) Parameters->SegmentCommit = Peb->HeapSegmentCommit;
185 if (!Parameters->SegmentReserve) Parameters->SegmentReserve = Peb->HeapSegmentReserve;
186 if (!Parameters->DeCommitFreeBlockThreshold) Parameters->DeCommitFreeBlockThreshold = Peb->HeapDeCommitFreeBlockThreshold;
187 if (!Parameters->DeCommitTotalFreeThreshold) Parameters->DeCommitTotalFreeThreshold = Peb->HeapDeCommitTotalFreeThreshold;
188}
189
191NTAPI
193 IN ULONG_PTR RegistrationFrameEnd,
194 IN OUT PULONG_PTR StackLow,
195 IN OUT PULONG_PTR StackHigh)
196{
197 /* There's no such thing as a DPC stack in user-mode */
198 return FALSE;
199}
200
201VOID
202NTAPI
205 IN PVOID ContextData,
206 IN ULONG Size)
207{
208 /* Exception logging is not done in user-mode */
209}
210
212NTAPI
214 IN ULONG_PTR *StackBegin,
215 IN ULONG_PTR *StackEnd)
216{
217 /* FIXME: Verify */
218 *StackBegin = (ULONG_PTR)NtCurrentTeb()->NtTib.StackLimit;
219 *StackEnd = (ULONG_PTR)NtCurrentTeb()->NtTib.StackBase;
220 return TRUE;
221}
222
223#ifndef _M_AMD64
224/*
225 * @implemented
226 */
227ULONG
228NTAPI
230 IN ULONG Count,
231 IN ULONG Flags)
232{
233 ULONG_PTR Stack, NewStack, StackBegin, StackEnd = 0;
234 ULONG Eip;
235 BOOLEAN Result, StopSearch = FALSE;
236 ULONG i = 0;
237
238 /* Get current EBP */
239#if defined(_M_IX86)
240#if defined __GNUC__
241 __asm__("mov %%ebp, %0" : "=r" (Stack) : );
242#elif defined(_MSC_VER)
243 __asm mov Stack, ebp
244#endif
245#elif defined(_M_MIPS)
246 __asm__("move $sp, %0" : "=r" (Stack) : );
247#elif defined(_M_PPC)
248 __asm__("mr %0,1" : "=r" (Stack) : );
249#elif defined(_M_ARM)
250#if defined __GNUC__
251 __asm__("mov sp, %0" : "=r"(Stack) : );
252#elif defined(_MSC_VER)
253 // FIXME: Hack. Probably won't work if this ever actually manages to run someday.
255#endif
256#else
257#error Unknown architecture
258#endif
259
260 /* Set it as the stack begin limit as well */
261 StackBegin = (ULONG_PTR)Stack;
262
263 /* Check if we're called for non-logging mode */
264 if (!Flags)
265 {
266 /* Get the actual safe limits */
268 &StackBegin,
269 &StackEnd);
270 if (!Result) return 0;
271 }
272
273 /* Use a SEH block for maximum protection */
275 {
276 /* Loop the frames */
277 for (i = 0; i < Count; i++)
278 {
279 /*
280 * Leave if we're past the stack,
281 * if we're before the stack,
282 * or if we've reached ourselves.
283 */
284 if ((Stack >= StackEnd) ||
285 (!i ? (Stack < StackBegin) : (Stack <= StackBegin)) ||
286 ((StackEnd - Stack) < (2 * sizeof(ULONG_PTR))))
287 {
288 /* We're done or hit a bad address */
289 break;
290 }
291
292 /* Get new stack and EIP */
293 NewStack = *(PULONG_PTR)Stack;
294 Eip = *(PULONG_PTR)(Stack + sizeof(ULONG_PTR));
295
296 /* Check if the new pointer is above the oldone and past the end */
297 if (!((Stack < NewStack) && (NewStack < StackEnd)))
298 {
299 /* Stop searching after this entry */
300 StopSearch = TRUE;
301 }
302
303 /* Also make sure that the EIP isn't a stack address */
304 if ((StackBegin < Eip) && (Eip < StackEnd)) break;
305
306 /* FIXME: Check that EIP is inside a loaded module */
307
308 /* Save this frame */
309 Callers[i] = (PVOID)Eip;
310
311 /* Check if we should continue */
312 if (StopSearch)
313 {
314 /* Return the next index */
315 i++;
316 break;
317 }
318
319 /* Move to the next stack */
320 Stack = NewStack;
321 }
322 }
324 {
325 /* No index */
326 i = 0;
327 }
328 _SEH2_END;
329
330 /* Return frames parsed */
331 return i;
332}
333#endif
334
335VOID
336NTAPI
338 OUT PULONG_PTR LowLimit,
340{
341 *LowLimit = (ULONG_PTR)NtCurrentTeb()->NtTib.StackLimit;
342 *HighLimit = (ULONG_PTR)NtCurrentTeb()->NtTib.StackBase;
343}
344
346NTAPI
348{
350}
351
352/* RTL Atom Tables ************************************************************/
353
354typedef struct _RTL_ATOM_HANDLE
355{
359
362{
363 RtlInitializeCriticalSection(&AtomTable->CriticalSection);
364 return STATUS_SUCCESS;
365}
366
367
368VOID
370{
371 RtlDeleteCriticalSection(&AtomTable->CriticalSection);
372}
373
374
377{
378 RtlEnterCriticalSection(&AtomTable->CriticalSection);
379 return TRUE;
380}
381
382
383VOID
385{
386 RtlLeaveCriticalSection(&AtomTable->CriticalSection);
387}
388
389
390/* handle functions */
391
394{
396 sizeof(RTL_ATOM_HANDLE),
397 &AtomTable->RtlHandleTable);
398
399 return TRUE;
400}
401
402VOID
404{
405 RtlDestroyHandleTable(&AtomTable->RtlHandleTable);
406}
407
410{
411 return (PRTL_ATOM_TABLE)RtlAllocateHeap(RtlGetProcessHeap(),
413 Size);
414}
415
416VOID
418{
419 RtlFreeHeap(RtlGetProcessHeap(),
420 0,
421 AtomTable);
422}
423
426{
427 return (PRTL_ATOM_TABLE_ENTRY)RtlAllocateHeap(RtlGetProcessHeap(),
429 Size);
430}
431
432VOID
434{
435 RtlFreeHeap(RtlGetProcessHeap(),
436 0,
437 Entry);
438}
439
440VOID
442{
443 PRTL_HANDLE_TABLE_ENTRY RtlHandleEntry;
444
445 if (RtlIsValidIndexHandle(&AtomTable->RtlHandleTable,
446 (ULONG)Entry->HandleIndex,
447 &RtlHandleEntry))
448 {
449 RtlFreeHandle(&AtomTable->RtlHandleTable,
450 RtlHandleEntry);
451 }
452}
453
456{
457 ULONG HandleIndex;
458 PRTL_HANDLE_TABLE_ENTRY RtlHandle;
459
460 RtlHandle = RtlAllocateHandle(&AtomTable->RtlHandleTable,
461 &HandleIndex);
462 if (RtlHandle != NULL)
463 {
464 PRTL_ATOM_HANDLE AtomHandle = (PRTL_ATOM_HANDLE)RtlHandle;
465
466 /* FIXME - Handle Indexes >= 0xC000 ?! */
467 if (HandleIndex < 0xC000)
468 {
469 Entry->HandleIndex = (USHORT)HandleIndex;
470 Entry->Atom = 0xC000 + (USHORT)HandleIndex;
471
472 AtomHandle->AtomEntry = Entry;
473 AtomHandle->Handle.Flags = RTL_HANDLE_VALID;
474
475 return TRUE;
476 }
477 else
478 {
479 /* set the valid flag, otherwise RtlFreeHandle will fail! */
480 AtomHandle->Handle.Flags = RTL_HANDLE_VALID;
481
482 RtlFreeHandle(&AtomTable->RtlHandleTable,
483 RtlHandle);
484 }
485 }
486
487 return FALSE;
488}
489
492{
493 PRTL_HANDLE_TABLE_ENTRY RtlHandle;
494
495 if (RtlIsValidIndexHandle(&AtomTable->RtlHandleTable,
496 Index,
497 &RtlHandle))
498 {
499 PRTL_ATOM_HANDLE AtomHandle = (PRTL_ATOM_HANDLE)RtlHandle;
500
501 return AtomHandle->AtomEntry;
502 }
503
504 return NULL;
505}
506
507/* Ldr SEH-Protected access to IMAGE_NT_HEADERS */
508
509/* Rtl SEH-Free version of this */
511NTAPI
516 _Out_ PIMAGE_NT_HEADERS *OutHeaders);
517
518
519/*
520 * @implemented
521 * @note: This is here, so that we do not drag SEH into rosload, freeldr and bootmgfw
522 */
524NTAPI
529 _Out_ PIMAGE_NT_HEADERS *OutHeaders)
530{
532
533 /* Assume failure. This is also done in RtlpImageNtHeaderEx, but this is guarded by SEH. */
534 if (OutHeaders != NULL)
535 *OutHeaders = NULL;
536
538 {
539 Status = RtlpImageNtHeaderEx(Flags, Base, Size, OutHeaders);
540 }
542 {
543 /* Fail with the SEH error */
545 }
546 _SEH2_END;
547
548 return Status;
549}
550
551/*
552 * Ldr Resource support code
553 */
554
556 LPCWSTR name, void *root,
557 int want_dir );
559 WORD id, void *root, int want_dir );
561 void *root, int want_dir );
563
564/**********************************************************************
565 * find_entry
566 *
567 * Find a resource entry
568 */
570 ULONG level, void **ret, int want_dir )
571{
572 ULONG size;
573 void *root;
574 IMAGE_RESOURCE_DIRECTORY *resdirptr;
575 USHORT list[9]; /* list of languages to try */
576 int i, pos = 0;
577 LCID user_lcid, system_lcid;
578
581 if (size < sizeof(*resdirptr)) return STATUS_RESOURCE_DATA_NOT_FOUND;
582 resdirptr = root;
583
584 if (!level--) goto done;
585 if (!(*ret = find_entry_by_name( resdirptr, (LPCWSTR)info->Type, root, want_dir || level )))
587 if (!level--) return STATUS_SUCCESS;
588
589 resdirptr = *ret;
590 if (!(*ret = find_entry_by_name( resdirptr, (LPCWSTR)info->Name, root, want_dir || level )))
592 if (!level--) return STATUS_SUCCESS;
593 if (level) return STATUS_INVALID_PARAMETER; /* level > 3 */
594
595 /* 1. specified language */
596 pos = push_language( list, pos, info->Language );
597
598 /* 2. specified language with neutral sublanguage */
600
601 /* 3. neutral language with neutral sublanguage */
603
604 /* if no explicitly specified language, try some defaults */
605 if (PRIMARYLANGID(info->Language) == LANG_NEUTRAL)
606 {
607 /* user defaults, unless SYS_DEFAULT sublanguage specified */
608 if (SUBLANGID(info->Language) != SUBLANG_SYS_DEFAULT)
609 {
610 /* 4. current thread locale language */
611 pos = push_language( list, pos, LANGIDFROMLCID(NtCurrentTeb()->CurrentLocale) );
612
613 if (NT_SUCCESS(NtQueryDefaultLocale(TRUE, &user_lcid)))
614 {
615 /* 5. user locale language */
616 pos = push_language( list, pos, LANGIDFROMLCID(user_lcid) );
617
618 /* 6. user locale language with neutral sublanguage */
620 }
621 }
622
623 /* now system defaults */
624
625 if (NT_SUCCESS(NtQueryDefaultLocale(FALSE, &system_lcid)))
626 {
627 /* 7. system locale language */
628 pos = push_language( list, pos, LANGIDFROMLCID( system_lcid ) );
629
630 /* 8. system locale language with neutral sublanguage */
632 }
633
634 /* 9. English */
636 }
637
638 resdirptr = *ret;
639 for (i = 0; i < pos; i++)
640 if ((*ret = find_entry_by_id( resdirptr, list[i], root, want_dir ))) return STATUS_SUCCESS;
641
642 /* if no explicitly specified language, return the first entry */
643 if (PRIMARYLANGID(info->Language) == LANG_NEUTRAL)
644 {
645 if ((*ret = find_first_entry( resdirptr, root, want_dir ))) return STATUS_SUCCESS;
646 }
648
649done:
650 *ret = resdirptr;
651 return STATUS_SUCCESS;
652}
653
654/*
655 * @implemented
656 */
659 PVOID* BaseOfImage)
660{
664 PVOID ImageBase = NULL;
665
667 ModuleListHead = &NtCurrentPeb()->Ldr->InLoadOrderModuleList;
669 while (Entry != ModuleListHead)
670 {
671 Module = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks);
672
673 if ((ULONG_PTR)PcValue >= (ULONG_PTR)Module->DllBase &&
674 (ULONG_PTR)PcValue < (ULONG_PTR)Module->DllBase + Module->SizeOfImage)
675 {
676 ImageBase = Module->DllBase;
677 break;
678 }
679 Entry = Entry->Flink;
680 }
682
683 *BaseOfImage = ImageBase;
684 return ImageBase;
685}
686
687NTSTATUS get_buffer(LPWSTR *buffer, SIZE_T needed, PUNICODE_STRING CallerBuffer, BOOLEAN bAllocateBuffer)
688{
689 WCHAR *p;
690
691 if (CallerBuffer && CallerBuffer->MaximumLength > needed)
692 {
693 p = CallerBuffer->Buffer;
694 CallerBuffer->Length = needed - sizeof(WCHAR);
695 }
696 else
697 {
698 if (!bAllocateBuffer)
700
701 if (CallerBuffer)
702 CallerBuffer->Buffer[0] = 0;
703
704 p = RtlAllocateHeap(RtlGetProcessHeap(), 0, needed );
705 if (!p)
706 return STATUS_NO_MEMORY;
707 }
708 *buffer = p;
709
710 return STATUS_SUCCESS;
711}
712
713/* NOTE: Remove this one once our actctx support becomes better */
715{
716 static const WCHAR winsxsW[] = {'\\','w','i','n','s','x','s','\\'};
717 static const WCHAR dotManifestW[] = {'.','m','a','n','i','f','e','s','t',0};
718
719 ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION *info;
720 ACTCTX_SECTION_KEYED_DATA data;
722 SIZE_T needed, size = 1024;
723 WCHAR *p;
724
725 data.cbSize = sizeof(data);
726 status = RtlFindActivationContextSectionString( FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX, NULL,
727 ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION,
728 pnameW, &data );
729 if (status != STATUS_SUCCESS)
730 {
731 //DPRINT1("RtlFindActivationContextSectionString returned 0x%x for %wZ\n", status, pnameW);
732 return status;
733 }
734
735 for (;;)
736 {
737 if (!(info = RtlAllocateHeap( RtlGetProcessHeap(), 0, size )))
738 {
740 goto done;
741 }
742 status = RtlQueryInformationActivationContext( 0, data.hActCtx, &data.ulAssemblyRosterIndex,
743 AssemblyDetailedInformationInActivationContext,
744 info, size, &needed );
745 if (status == STATUS_SUCCESS) break;
746 if (status != STATUS_BUFFER_TOO_SMALL) goto done;
747 RtlFreeHeap( RtlGetProcessHeap(), 0, info );
748 size = needed;
749 }
750
751 DPRINT("manifestpath === %S\n", info->lpAssemblyManifestPath);
752 DPRINT("DirectoryName === %S\n", info->lpAssemblyDirectoryName);
753 if (!info->lpAssemblyManifestPath /*|| !info->lpAssemblyDirectoryName*/)
754 {
756 goto done;
757 }
758
759 if ((p = wcsrchr( info->lpAssemblyManifestPath, '\\' )))
760 {
761 DWORD dirlen = info->ulAssemblyDirectoryNameLength / sizeof(WCHAR);
762
763 p++;
764 if (!info->lpAssemblyDirectoryName || _wcsnicmp( p, info->lpAssemblyDirectoryName, dirlen ) || _wcsicmp( p + dirlen, dotManifestW ))
765 {
766 /* manifest name does not match directory name, so it's not a global
767 * windows/winsxs manifest; use the manifest directory name instead */
768 dirlen = p - info->lpAssemblyManifestPath;
769 needed = (dirlen + 1) * sizeof(WCHAR) + pnameW->Length;
770
771 status = get_buffer(fullname, needed, CallerBuffer, bAllocateBuffer);
772 if (!NT_SUCCESS(status))
773 goto done;
774
775 p = *fullname;
776
777 memcpy( p, info->lpAssemblyManifestPath, dirlen * sizeof(WCHAR) );
778 p += dirlen;
779 memcpy( p, pnameW->Buffer, pnameW->Length);
780 p += (pnameW->Length / sizeof(WCHAR));
781 *p = L'\0';
782
783 goto done;
784 }
785 }
786
787 needed = (wcslen(SharedUserData->NtSystemRoot) * sizeof(WCHAR) +
788 sizeof(winsxsW) + info->ulAssemblyDirectoryNameLength + pnameW->Length + 2*sizeof(WCHAR));
789
790 status = get_buffer(fullname, needed, CallerBuffer, bAllocateBuffer);
791 if (!NT_SUCCESS(status))
792 goto done;
793
794 p = *fullname;
795
796 wcscpy( p, SharedUserData->NtSystemRoot );
797 p += wcslen(p);
798 memcpy( p, winsxsW, sizeof(winsxsW) );
799 p += sizeof(winsxsW) / sizeof(WCHAR);
800 memcpy( p, info->lpAssemblyDirectoryName, info->ulAssemblyDirectoryNameLength );
801 p += info->ulAssemblyDirectoryNameLength / sizeof(WCHAR);
802 *p++ = L'\\';
803 memcpy( p, pnameW->Buffer, pnameW->Length);
804 p += (pnameW->Length / sizeof(WCHAR));
805 *p = L'\0';
806
807done:
808 RtlFreeHeap( RtlGetProcessHeap(), 0, info );
810 DPRINT("%S\n", fullname);
811 return status;
812}
813
814/*
815 * @unimplemented
816 */
819NTAPI
821 IN PUNICODE_STRING OriginalName,
826 IN PULONG NewFlags,
827 IN PSIZE_T FileNameSize,
829{
833 UNICODE_STRING localStr, localStr2, *pstrParam;
834 WCHAR *p;
835 BOOLEAN GotExtension;
836 WCHAR c;
837 C_ASSERT(sizeof(UNICODE_NULL) == sizeof(WCHAR));
838
839
840 /* Check for invalid parameters */
841 if (!OriginalName)
842 {
844 }
845
847 {
849 }
850
851 if ((DynamicString) && (StaticString) && !(NewName))
852 {
854 }
855
856 if (!OriginalName->Buffer || OriginalName->Length == 0)
857 {
859 }
860
861 if (StaticString && (OriginalName == StaticString || OriginalName->Buffer == StaticString->Buffer))
862 {
864 }
865
866 if ((Flags & RTL_DOS_APPLY_FILE_REDIRECTION_USTR_FLAG_RESPECT_DOT_LOCAL) &&
867 NtCurrentPeb()->ProcessParameters &&
868 (NtCurrentPeb()->ProcessParameters->Flags & RTL_USER_PROCESS_PARAMETERS_PRIVATE_DLL_PATH))
869 {
870 UNICODE_STRING RealName, LocalName;
871 WCHAR RealNameBuf[MAX_PATH], LocalNameBuf[MAX_PATH];
872
873 RtlInitEmptyUnicodeString(&RealName, RealNameBuf, sizeof(RealNameBuf));
874 RtlInitEmptyUnicodeString(&LocalName, LocalNameBuf, sizeof(LocalNameBuf));
875
876 Status = RtlComputePrivatizedDllName_U(OriginalName, &RealName, &LocalName);
877 if (!NT_SUCCESS(Status))
878 {
879 DPRINT1("RtlComputePrivatizedDllName_U failed for %wZ: 0x%lx\n", OriginalName, Status);
880 return Status;
881 }
882
883 if (RtlDoesFileExists_UStr(&LocalName))
884 {
886 if (NT_SUCCESS(Status))
887 {
888 RtlCopyMemory(fullname, LocalName.Buffer, LocalName.Length + sizeof(UNICODE_NULL));
889 }
890 else
891 {
892 DPRINT1("Error while retrieving buffer for %wZ: 0x%lx\n", OriginalName, Status);
893 }
894 }
895 else if (RtlDoesFileExists_UStr(&RealName))
896 {
898 if (NT_SUCCESS(Status))
899 {
900 RtlCopyMemory(fullname, RealName.Buffer, RealName.Length + sizeof(UNICODE_NULL));
901 }
902 else
903 {
904 DPRINT1("Error while retrieving buffer for %wZ: 0x%lx\n", OriginalName, Status);
905 }
906 }
907 else
908 {
910 }
911
912 if (RealName.Buffer != RealNameBuf)
913 RtlFreeUnicodeString(&RealName);
914 if (LocalName.Buffer != LocalNameBuf)
915 RtlFreeUnicodeString(&LocalName);
916
917 if (NT_SUCCESS(Status))
918 {
919 DPRINT("Redirecting %wZ to %S\n", OriginalName, fullname);
921 {
924 }
925 else
926 {
928 }
929 return Status;
930 }
931 }
932
933 pstrParam = OriginalName;
934
935 /* Get the file name with an extension */
936 p = OriginalName->Buffer + OriginalName->Length / sizeof(WCHAR) - 1;
937 GotExtension = FALSE;
938 while (p >= OriginalName->Buffer)
939 {
940 c = *p--;
941 if (c == L'.')
942 {
943 GotExtension = TRUE;
944 }
945 else if (c == L'\\')
946 {
947 localStr.Buffer = p + 2;
948 localStr.Length = OriginalName->Length - ((ULONG_PTR)localStr.Buffer - (ULONG_PTR)OriginalName->Buffer);
949 localStr.MaximumLength = OriginalName->MaximumLength - ((ULONG_PTR)localStr.Buffer - (ULONG_PTR)OriginalName->Buffer);
950 pstrParam = &localStr;
951 break;
952 }
953 }
954
955 if (!GotExtension)
956 {
957 if (!Extension)
958 {
960 }
961
962 if (pstrParam->Length + Extension->Length > sizeof(buffer))
963 {
964 //FIXME!
965 return STATUS_NO_MEMORY;
966 }
967
968 RtlInitEmptyUnicodeString(&localStr2, buffer, sizeof(buffer));
969 RtlAppendUnicodeStringToString(&localStr2, pstrParam);
971 pstrParam = &localStr2;
972 }
973
974 /* Use wine's function as long as we use wine's sxs implementation in ntdll */
976 if (!NT_SUCCESS(Status))
977 {
978 return Status;
979 }
980
981 DPRINT("Redirecting %wZ to %S\n", OriginalName, fullname);
982
984 {
987 }
988 else
989 {
991 }
992
993 return Status;
994}
995
996#ifndef TAG_USTR
997#define TAG_USTR 'RTSU'
998#endif
999#ifndef RtlpAllocateStringMemory
1000#define RtlpAllocateStringMemory(Bytes, Tag) RtlpAllocateMemory(Bytes, Tag)
1001#endif
1002
1003static DWORD
1005{
1006 static DWORD CachedApisetVersion = ~0u;
1007
1008 if (CachedApisetVersion == ~0u)
1009 {
1010 DWORD CompatVersion = RosGetProcessCompatVersion();
1011
1012 switch (CompatVersion)
1013 {
1014 case 0:
1015 break;
1016 case _WIN32_WINNT_VISTA:
1017 /* No apisets in vista yet*/
1018 CachedApisetVersion = 0;
1019 break;
1020 case _WIN32_WINNT_WIN7:
1021 CachedApisetVersion = APISET_WIN7;
1022 DPRINT1("Activating apisets for Win7\n");
1023 break;
1024 case _WIN32_WINNT_WIN8:
1025 CachedApisetVersion = APISET_WIN8;
1026 DPRINT1("Activating apisets for Win8\n");
1027 break;
1029 CachedApisetVersion = APISET_WIN81;
1030 DPRINT1("Activating apisets for Win8.1\n");
1031 break;
1032 case _WIN32_WINNT_WIN10:
1033 CachedApisetVersion = APISET_WIN10;
1034 DPRINT1("Activating apisets for Win10\n");
1035 break;
1036 default:
1037 DPRINT1("Unknown version 0x%x\n", CompatVersion);
1038 CachedApisetVersion = 0;
1039 break;
1040 }
1041 }
1042
1043 return CachedApisetVersion;
1044}
1045
1048NTAPI
1050 _In_ PUNICODE_STRING OriginalName,
1055 _Out_ PBOOLEAN RedirectedDll)
1056{
1057
1058 /* Check for invalid parameters */
1059 if (!OriginalName)
1060 {
1062 }
1063
1064 if (!DynamicString && !StaticString)
1065 {
1067 }
1068
1069 if (!NewName)
1070 {
1072 }
1073
1074 *RedirectedDll = FALSE;
1075
1076 PCUNICODE_STRING PrevNewName = *NewName;
1077 UNICODE_STRING ApisetName = {0};
1079
1080 DWORD ApisetVersion = LdrpApisetVersion();
1081 if (ApisetVersion)
1082 {
1083 Status = ApiSetResolveToHost(ApisetVersion, OriginalName, RedirectedDll, &ApisetName);
1084 if (!NT_SUCCESS(Status))
1085 {
1086 DPRINT1("ApiSetResolveToHost FAILED: (Status 0x%x)\n", Status);
1087 return Status;
1088 }
1089 }
1090
1091 if (*RedirectedDll)
1092 {
1094 static const UNICODE_STRING System32 = RTL_CONSTANT_STRING(L"\\System32\\");
1095 PUNICODE_STRING ResultPath = NULL;
1096
1097 /* This is an apiset we can use */
1099
1100 SIZE_T Needed = System32.Length + ApisetName.Length + NtSystemRoot.Length + sizeof(UNICODE_NULL);
1101
1102 if (StaticString && StaticString->MaximumLength >= (USHORT)Needed)
1103 {
1104 StaticString->Length = 0;
1105 ResultPath = StaticString;
1106 }
1107 else if (DynamicString)
1108 {
1110 if (DynamicString->Buffer == NULL)
1111 {
1112 DPRINT1("LdrpApplyFileNameRedirection out of memory\n");
1113 return STATUS_NO_MEMORY;
1114 }
1116 DynamicString->Length = 0;
1117
1118 ResultPath = DynamicString;
1119 }
1120 else
1121 {
1122 DPRINT1("ERROR: LdrpApplyFileNameRedirection no inputbuffer valid\n");
1124 }
1125
1127 RtlAppendUnicodeStringToString(ResultPath, &System32);
1128 RtlAppendUnicodeStringToString(ResultPath, &ApisetName);
1129 DPRINT1("ApiSetResolveToHost redirected %wZ to %wZ\n", OriginalName, ResultPath);
1130 *NewName = ResultPath;
1131 }
1132 else
1133 {
1134 /* Check if the SxS Assemblies specify another file */
1135 Status = RtlDosApplyFileIsolationRedirection_Ustr(RTL_DOS_APPLY_FILE_REDIRECTION_USTR_FLAG_RESPECT_DOT_LOCAL, OriginalName, Extension, StaticString, DynamicString, NewName, NULL, NULL, NULL);
1136
1137 /* Check success */
1138 if (NT_SUCCESS(Status))
1139 {
1140 /* Let Ldrp know */
1141 *RedirectedDll = TRUE;
1142 }
1143 else if (Status == STATUS_SXS_KEY_NOT_FOUND)
1144 {
1145 ASSERT(*NewName == PrevNewName);
1147 }
1148 else
1149 {
1150 /* Unrecoverable SxS failure; did we get a string? */
1153 return Status;
1154 }
1155 }
1156
1157 return Status;
1158}
1159
1160/*
1161 * @implemented
1162 */
1165NTAPI
1166RtlWow64EnableFsRedirection(IN BOOLEAN Wow64FsEnableRedirection)
1167{
1168 /* This is what Windows returns on x86 */
1170}
1171
1172/*
1173 * @implemented
1174 */
1177NTAPI
1178RtlWow64EnableFsRedirectionEx(IN PVOID Wow64FsEnableRedirection,
1179 OUT PVOID *OldFsRedirectionLevel)
1180{
1181 /* This is what Windows returns on x86 */
1183}
1184
1185/*
1186 * @unimplemented
1187 */
1190NTAPI
1192 OUT PCHAR Hash,
1193 IN ULONG ImportTableHashSize)
1194{
1197}
1198
1200NTAPI
1205{
1206 _SEH2_TRY
1207 {
1209 }
1211 {
1213 }
1214 _SEH2_END;
1215
1216 return STATUS_SUCCESS;
1217}
1218
1219/* FIXME: code duplication with kernel32/client/time.c */
1220ULONG
1221NTAPI
1223{
1224 ULARGE_INTEGER TickCount;
1225
1226#ifdef _WIN64
1227 TickCount.QuadPart = *((volatile ULONG64*)&SharedUserData->TickCount);
1228#else
1229 while (TRUE)
1230 {
1231 TickCount.HighPart = (ULONG)SharedUserData->TickCount.High1Time;
1232 TickCount.LowPart = SharedUserData->TickCount.LowPart;
1233
1234 if (TickCount.HighPart == (ULONG)SharedUserData->TickCount.High2Time)
1235 break;
1236
1238 }
1239#endif
1240
1241 return (ULONG)((UInt32x32To64(TickCount.LowPart,
1242 SharedUserData->TickCountMultiplier) >> 24) +
1243 UInt32x32To64((TickCount.HighPart << 8) & 0xFFFFFFFF,
1244 SharedUserData->TickCountMultiplier));
1245}
1246
1247/* EOF */
#define NtCurrentPeb()
Definition: FLS.c:22
unsigned char BOOLEAN
IN PUNICODE_STRING StaticString
IN PUNICODE_STRING IN PUNICODE_STRING DynamicString
#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
NTSTATUS NTAPI RtlImageNtHeaderEx(_In_ ULONG Flags, _In_ PVOID Base, _In_ ULONG64 Size, _Out_ PIMAGE_NT_HEADERS *OutHeaders)
Definition: libsupp.c:32
NTSTATUS NTAPI RtlpImageNtHeaderEx(_In_ ULONG Flags, _In_ PVOID Base, _In_ ULONG64 Size, _Out_ PIMAGE_NT_HEADERS *OutHeaders)
Definition: image.c:140
#define UNIMPLEMENTED
Definition: debug.h:118
#define NTSYSAPI
Definition: ntoskrnl.h:12
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:590
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:608
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
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:37
static DWORD RosGetProcessCompatVersion(VOID)
Definition: compat_undoc.h:22
#define UNALIGNED
Definition: crtdefs.h:149
#define STATUS_NO_MEMORY
Definition: d3dkmdt.h:51
#define STATUS_NOT_IMPLEMENTED
Definition: d3dkmdt.h:42
#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:1166
NTSTATUS NTAPI RtlInitializeHeapLock(IN OUT PHEAP_LOCK *Lock)
Definition: libsupp.c:128
VOID NTAPI RtlpCheckLogException(IN PEXCEPTION_RECORD ExceptionRecord, IN PCONTEXT ContextRecord, IN PVOID ContextData, IN ULONG Size)
Definition: libsupp.c:203
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:347
PRTL_ATOM_TABLE_ENTRY RtlpAllocAtomTableEntry(ULONG Size)
Definition: libsupp.c:425
#define TAG_USTR
Definition: libsupp.c:997
NTSTATUS NTAPI RtlEnterHeapLock(IN OUT PHEAP_LOCK Lock, IN BOOLEAN Exclusive)
Definition: libsupp.c:110
VOID NTAPI RtlpClearInDbgPrint(VOID)
Definition: libsupp.c:47
IMAGE_RESOURCE_DIRECTORY * find_entry_by_name(IMAGE_RESOURCE_DIRECTORY *dir, LPCWSTR name, void *root, int want_dir)
Definition: res.c:130
static DWORD LdrpApisetVersion(VOID)
Definition: libsupp.c:1004
BOOLEAN RtlpLockAtomTable(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:376
NTSTATUS get_buffer(LPWSTR *buffer, SIZE_T needed, PUNICODE_STRING CallerBuffer, BOOLEAN bAllocateBuffer)
Definition: libsupp.c:687
ULONG NTAPI RtlWalkFrameChain(OUT PVOID *Callers, IN ULONG Count, IN ULONG Flags)
Definition: libsupp.c:229
KPROCESSOR_MODE NTAPI RtlpGetMode(VOID)
Definition: libsupp.c:55
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:192
VOID NTAPI RtlpSetHeapParameters(IN PRTL_HEAP_PARAMETERS Parameters)
Definition: libsupp.c:176
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:1049
PTEB LdrpTopLevelDllBeingLoadedTeb
Definition: libsupp.c:20
struct _RTL_ATOM_HANDLE RTL_ATOM_HANDLE
ULONG NTAPI RtlGetTickCount(VOID)
Definition: libsupp.c:1222
BOOLEAN NTAPI RtlTryEnterHeapLock(IN OUT PHEAP_LOCK Lock, IN BOOLEAN Exclusive)
Definition: libsupp.c:119
NTSTATUS NTAPI RtlDeleteHeapLock(IN OUT PHEAP_LOCK Lock)
Definition: libsupp.c:103
PVOID NTAPI RtlPcToFileHeader(IN PVOID PcValue, PVOID *BaseOfImage)
Definition: libsupp.c:658
#define RtlpAllocateStringMemory(Bytes, Tag)
Definition: libsupp.c:1000
VOID RtlpFreeAtomTable(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:417
VOID RtlpDestroyAtomHandleTable(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:403
struct _RTL_ATOM_HANDLE * PRTL_ATOM_HANDLE
BOOLEAN RtlpCreateAtomHandleTable(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:393
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:820
NTSYSAPI NTSTATUS NTAPI RtlComputeImportTableHash(IN HANDLE FileHandle, OUT PCHAR Hash, IN ULONG ImportTableHashSize)
Definition: libsupp.c:1191
VOID RtlpUnlockAtomTable(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:384
NTSTATUS RtlpInitAtomTableLock(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:361
VOID RtlpDestroyAtomTableLock(PRTL_ATOM_TABLE AtomTable)
Definition: libsupp.c:369
VOID RtlpFreeAtomTableEntry(PRTL_ATOM_TABLE_ENTRY Entry)
Definition: libsupp.c:433
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:569
PRTL_ATOM_TABLE RtlpAllocAtomTable(ULONG Size)
Definition: libsupp.c:409
PRTL_ATOM_TABLE_ENTRY RtlpGetAtomEntry(PRTL_ATOM_TABLE AtomTable, ULONG Index)
Definition: libsupp.c:491
NTSTATUS NTAPI RtlLeaveHeapLock(IN OUT PHEAP_LOCK Lock)
Definition: libsupp.c:135
BOOLEAN RtlpCreateAtomHandle(PRTL_ATOM_TABLE AtomTable, PRTL_ATOM_TABLE_ENTRY Entry)
Definition: libsupp.c:455
NTSYSAPI NTSTATUS NTAPI RtlWow64EnableFsRedirectionEx(IN PVOID Wow64FsEnableRedirection, OUT PVOID *OldFsRedirectionLevel)
Definition: libsupp.c:1178
VOID RtlpFreeAtomHandle(PRTL_ATOM_TABLE AtomTable, PRTL_ATOM_TABLE_ENTRY Entry)
Definition: libsupp.c:441
BOOLEAN NTAPI RtlpCaptureStackLimits(IN ULONG_PTR Ebp, IN ULONG_PTR *StackBegin, IN ULONG_PTR *StackEnd)
Definition: libsupp.c:213
NTSTATUS find_actctx_dll(PUNICODE_STRING pnameW, LPWSTR *fullname, PUNICODE_STRING CallerBuffer, BOOLEAN bAllocateBuffer)
Definition: libsupp.c:714
SIZE_T RtlpAllocDeallocQueryBufferSize
Definition: libsupp.c:19
VOID NTAPI RtlpGetStackLimits(OUT PULONG_PTR LowLimit, OUT PULONG_PTR HighLimit)
Definition: libsupp.c:337
#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 int Hash(const char *)
Definition: reader.c:2257
#define ULONG_PTR
Definition: config.h:101
#define PAGE_SIZE
Definition: env_spec_w32.h:49
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
_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:25
GLint level
Definition: gl.h:1546
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLsizeiptr size
Definition: glext.h:5919
GLuint buffer
Definition: glext.h:5915
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
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
NTSYSAPI void WINAPI RtlReleasePebLock(void)
Definition: libsupp.c:84
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:5908
NTSYSAPI void WINAPI RtlAcquirePebLock(void)
Definition: libsupp.c:74
NTSYSAPI void WINAPI RtlReleaseActivationContext(HANDLE)
Definition: actctx.c:5416
NTSYSAPI PEB *WINAPI RtlGetCurrentPeb(void)
Definition: libsupp.c:65
NTSYSAPI NTSTATUS WINAPI RtlQueryInformationActivationContext(ULONG, HANDLE, PVOID, ULONG, PVOID, SIZE_T, SIZE_T *)
Definition: actctx.c:5606
NTSYSAPI ULONG WINAPI RtlGetNtGlobalFlags(void)
Definition: libsupp.c:95
#define UInt32x32To64(a, b)
Definition: intsafe.h:252
#define C_ASSERT(e)
Definition: intsafe.h:73
#define NtCurrentTeb
LIST_ENTRY * ModuleListHead
Definition: kdpacket.c:23
#define c
Definition: ke_i.h:80
if(dx< 0)
Definition: linetemp.h:194
#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:1766
struct atom_table ** PRTL_ATOM_TABLE
Definition: atom.c:43
#define _In_reads_bytes_(size)
Definition: ms_sal.h:321
#define _Inout_
Definition: ms_sal.h:378
#define _Out_writes_bytes_all_(size)
Definition: ms_sal.h:362
#define _Inout_opt_
Definition: ms_sal.h:379
#define _Out_
Definition: ms_sal.h:345
#define _In_
Definition: ms_sal.h:308
unsigned int UINT
Definition: ndis.h:50
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3169
#define UserMode
Definition: asm.h:35
#define MI_HIGHEST_USER_ADDRESS
Definition: mmtypes.h:43
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
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 RtlTryEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
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:3016
NTSYSAPI NTSTATUS NTAPI RtlEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
_In_opt_ ULONG Base
Definition: rtlfuncs.h:2451
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:376
#define RTL_USER_PROCESS_PARAMETERS_PRIVATE_DLL_PATH
Definition: rtltypes.h:52
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:654
#define UNICODE_NULL
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
_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:76
NTSTATUS NTAPI NtQueryDefaultLocale(IN BOOLEAN UserProfile, OUT PLCID DefaultLocaleId)
Definition: locale.c:396
#define STATUS_RESOURCE_LANG_NOT_FOUND
Definition: ntstatus.h:648
#define STATUS_RESOURCE_NAME_NOT_FOUND
Definition: ntstatus.h:375
#define STATUS_RESOURCE_TYPE_NOT_FOUND
Definition: ntstatus.h:374
#define STATUS_RESOURCE_DATA_NOT_FOUND
Definition: ntstatus.h:373
#define STATUS_SXS_KEY_NOT_FOUND
Definition: ntstatus.h:1389
#define L(x)
Definition: ntvdm.h:50
#define CONST
Definition: pedump.c:81
unsigned short USHORT
Definition: pedump.c:61
#define IMAGE_DIRECTORY_ENTRY_RESOURCE
Definition: pedump.c:261
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:165
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:66
__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" "\tsub $32, %rsp\n" "\t.seh_stackalloc 32\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 $32, %rsp\n" "\tpop %rbp\n" "\tret\n" "\t.seh_endproc")
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:168
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
#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
#define YieldProcessor
Definition: ke.h:48
#define SharedUserData
NTSTATUS ApiSetResolveToHost(_In_ DWORD ApisetVersion, _In_ PCUNICODE_STRING ApiToResolve, _Out_ PBOOLEAN Resolved, _Out_ PUNICODE_STRING Output)
Definition: apisets.c:32
static const WCHAR dotManifestW[]
Definition: actctx.c:827
#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
#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
base of all file and directory entries
Definition: entries.h:83
Definition: btrfs_drv.h:1876
ULONG SizeOfImage
Definition: ldrtypes.h:143
PVOID DllBase
Definition: btrfs_drv.h:1880
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
ULONG HeapDeCommitTotalFreeThreshold
Definition: ntddk_ex.h:277
ULONG HeapSegmentCommit
Definition: ntddk_ex.h:276
ULONG HeapSegmentReserve
Definition: ntddk_ex.h:275
PVOID FastPebLock
Definition: ntddk_ex.h:250
ULONG NtGlobalFlag
Definition: ntddk_ex.h:270
ULONG HeapDeCommitFreeBlockThreshold
Definition: ntddk_ex.h:278
RTL_HANDLE_TABLE_ENTRY Handle
Definition: libsupp.c:356
PRTL_ATOM_TABLE_ENTRY AtomEntry
Definition: libsupp.c:357
Definition: rtltypes.h:1672
Definition: rtltypes.h:1247
ULONG Flags
Definition: rtltypes.h:1250
Definition: compat.h:836
$ULONG LowPart
Definition: ntbasedef.h:569
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
$ULONG HighPart
Definition: ntbasedef.h:570
USHORT MaximumLength
Definition: env_spec_w32.h:370
Definition: fci.c:127
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
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
ULONG_PTR * PSIZE_T
Definition: typedefs.h:80
uint32_t * PULONG_PTR
Definition: typedefs.h:65
uint32_t * PULONG
Definition: typedefs.h:59
unsigned char * PBOOLEAN
Definition: typedefs.h:53
#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
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
static const WCHAR lang[]
Definition: wbemdisp.c:287
int ret
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4065
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
_Must_inspect_result_ _In_ WDFQUEUE _In_opt_ WDFREQUEST _In_opt_ WDFFILEOBJECT _Inout_opt_ PWDF_REQUEST_PARAMETERS Parameters
Definition: wdfio.h:869
_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
_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
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
_Out_ PULONG_PTR HighLimit
Definition: iofuncs.h:2885
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
_In_ PUNICODE_STRING NewName
Definition: zwfuncs.h:1203