ReactOS 0.4.15-dev-6656-gbbb33a6
ldrapi.c File Reference
#include <ntdll.h>
#include <debug.h>
Include dependency graph for ldrapi.c:

Go to the source code of this file.

Macros

#define NDEBUG
 
#define STATUS_MUI_FILE_NOT_FOUND   ((NTSTATUS)0xC00B0001L)
 

Functions

NTSTATUS NTAPI LdrFindCreateProcessManifest (IN ULONG Flags, IN PVOID Image, IN PVOID IdPath, IN ULONG IdPathLength, IN PVOID OutDataEntry)
 
NTSTATUS NTAPI LdrDestroyOutOfProcessImage (IN PVOID Image)
 
NTSTATUS NTAPI LdrCreateOutOfProcessImage (IN ULONG Flags, IN HANDLE ProcessHandle, IN HANDLE DllHandle, IN PVOID Unknown3)
 
NTSTATUS NTAPI LdrAccessOutOfProcessResource (IN PVOID Unknown, IN PVOID Image, IN PVOID Unknown1, IN PVOID Unknown2, IN PVOID Unknown3)
 
VOID NTAPI LdrSetDllManifestProber (_In_ PLDR_MANIFEST_PROBER_ROUTINE Routine)
 
BOOLEAN NTAPI LdrAlternateResourcesEnabled (VOID)
 
FORCEINLINE ULONG_PTR LdrpMakeCookie (VOID)
 
NTSTATUS NTAPI LdrUnlockLoaderLock (IN ULONG Flags, IN ULONG Cookie OPTIONAL)
 
NTSTATUS NTAPI LdrLockLoaderLock (IN ULONG Flags, OUT PULONG Disposition OPTIONAL, OUT PULONG_PTR Cookie OPTIONAL)
 
NTSTATUS NTAPI DECLSPEC_HOTPATCH LdrLoadDll (IN PWSTR SearchPath OPTIONAL, IN PULONG DllCharacteristics OPTIONAL, IN PUNICODE_STRING DllName, OUT PVOID *BaseAddress)
 
NTSTATUS NTAPI LdrFindEntryForAddress (PVOID Address, PLDR_DATA_TABLE_ENTRY *Module)
 
NTSTATUS NTAPI LdrGetDllHandleEx (IN ULONG Flags, IN PWSTR DllPath OPTIONAL, IN PULONG DllCharacteristics OPTIONAL, IN PUNICODE_STRING DllName, OUT PVOID *DllHandle OPTIONAL)
 
NTSTATUS NTAPI LdrGetDllHandle (IN PWSTR DllPath OPTIONAL, IN PULONG DllCharacteristics OPTIONAL, IN PUNICODE_STRING DllName, OUT PVOID *DllHandle)
 
NTSTATUS NTAPI LdrGetProcedureAddress (IN PVOID BaseAddress, IN PANSI_STRING Name, IN ULONG Ordinal, OUT PVOID *ProcedureAddress)
 
NTSTATUS NTAPI LdrVerifyImageMatchesChecksum (IN HANDLE FileHandle, IN PLDR_CALLBACK Callback, IN PVOID CallbackContext, OUT PUSHORT ImageCharacteristics)
 
NTSTATUS NTAPI LdrQueryProcessModuleInformationEx (IN ULONG ProcessId, IN ULONG Reserved, OUT PRTL_PROCESS_MODULES ModuleInformation, IN ULONG Size, OUT PULONG ReturnedSize OPTIONAL)
 
NTSTATUS NTAPI LdrQueryProcessModuleInformation (IN PRTL_PROCESS_MODULES ModuleInformation, IN ULONG Size, OUT PULONG ReturnedSize OPTIONAL)
 
NTSTATUS NTAPI LdrEnumerateLoadedModules (IN BOOLEAN ReservedFlag, IN PLDR_ENUM_CALLBACK EnumProc, IN PVOID Context)
 
NTSTATUS NTAPI LdrDisableThreadCalloutsForDll (IN PVOID BaseAddress)
 
NTSTATUS NTAPI LdrAddRefDll (IN ULONG Flags, IN PVOID BaseAddress)
 
NTSTATUS NTAPI LdrUnloadDll (IN PVOID BaseAddress)
 
BOOLEAN NTAPI RtlDllShutdownInProgress (VOID)
 
PIMAGE_BASE_RELOCATION NTAPI LdrProcessRelocationBlock (IN ULONG_PTR Address, IN ULONG Count, IN PUSHORT TypeOffset, IN LONG_PTR Delta)
 
NTSTATUS NTAPI LdrLoadAlternateResourceModule (IN PVOID Module, IN PWSTR Buffer)
 
BOOLEAN NTAPI LdrUnloadAlternateResourceModule (IN PVOID BaseAddress)
 
BOOLEAN NTAPI LdrFlushAlternateResourceModules (VOID)
 
NTSTATUS NTAPI LdrSetAppCompatDllRedirectionCallback (_In_ ULONG Flags, _In_ PLDR_APP_COMPAT_DLL_REDIRECTION_CALLBACK_FUNCTION CallbackFunction, _In_opt_ PVOID CallbackData)
 
BOOLEAN NTAPI LdrInitShimEngineDynamic (IN PVOID BaseAddress)
 

Variables

LIST_ENTRY LdrpUnloadHead
 
LONG LdrpLoaderLockAcquisitionCount
 
BOOLEAN LdrpShowRecursiveLoads
 
BOOLEAN LdrpBreakOnRecursiveDllLoads
 
UNICODE_STRING LdrApiDefaultExtension = RTL_CONSTANT_STRING(L".DLL")
 
ULONG AlternateResourceModuleCount
 
PLDR_MANIFEST_PROBER_ROUTINE LdrpManifestProberRoutine
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 14 of file ldrapi.c.

◆ STATUS_MUI_FILE_NOT_FOUND

#define STATUS_MUI_FILE_NOT_FOUND   ((NTSTATUS)0xC00B0001L)

Definition at line 1607 of file ldrapi.c.

Function Documentation

◆ LdrAccessOutOfProcessResource()

NTSTATUS NTAPI LdrAccessOutOfProcessResource ( IN PVOID  Unknown,
IN PVOID  Image,
IN PVOID  Unknown1,
IN PVOID  Unknown2,
IN PVOID  Unknown3 
)

Definition at line 61 of file ldrapi.c.

66{
69}
#define UNIMPLEMENTED
Definition: debug.h:115
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:239

◆ LdrAddRefDll()

NTSTATUS NTAPI LdrAddRefDll ( IN ULONG  Flags,
IN PVOID  BaseAddress 
)

Definition at line 1237 of file ldrapi.c.

1239{
1240 PLDR_DATA_TABLE_ENTRY LdrEntry;
1244
1245 /* Check for invalid flags */
1246 if (Flags & ~(LDR_ADDREF_DLL_PIN))
1247 {
1248 /* Fail with invalid parameter status if so */
1250 goto quickie;
1251 }
1252
1253 /* Acquire the loader lock if not in init phase */
1254 if (!LdrpInLdrInit)
1255 {
1256 /* Acquire the lock */
1258 if (!NT_SUCCESS(Status)) goto quickie;
1259 Locked = TRUE;
1260 }
1261
1262 /* Get this module's data table entry */
1264 {
1265 if (!LdrEntry)
1266 {
1267 /* Shouldn't happen */
1269 goto quickie;
1270 }
1271
1272 /* If this is not a pinned module */
1273 if (LdrEntry->LoadCount != 0xFFFF)
1274 {
1275 /* Update its load count */
1277 {
1278 /* Pin it by setting load count to -1 */
1279 LdrEntry->LoadCount = 0xFFFF;
1281 }
1282 else
1283 {
1284 /* Increase its load count by one */
1285 LdrEntry->LoadCount++;
1287 }
1288
1289 /* Clear load in progress */
1291 }
1292 }
1293 else
1294 {
1295 /* There was an error getting this module's handle, return invalid param status */
1297 }
1298
1299quickie:
1300 /* Check for error case */
1301 if (!NT_SUCCESS(Status))
1302 {
1303 /* Print debug information */
1304 if ((ShowSnaps) || ((Status != STATUS_NO_SUCH_FILE) &&
1307 {
1308 DPRINT1("LDR: LdrAddRefDll(%p) 0x%08lx\n", BaseAddress, Status);
1309 }
1310 }
1311
1312 /* Release the lock if needed */
1314 return Status;
1315}
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:25
NTSTATUS NTAPI LdrLockLoaderLock(IN ULONG Flags, OUT PULONG Disposition OPTIONAL, OUT PULONG_PTR Cookie OPTIONAL)
Definition: ldrapi.c:173
NTSTATUS NTAPI LdrUnlockLoaderLock(IN ULONG Flags, IN ULONG Cookie OPTIONAL)
Definition: ldrapi.c:101
#define LDR_LOCK_LOADER_LOCK_FLAG_RAISE_ON_ERRORS
Definition: ldrtypes.h:76
#define LDR_ADDREF_DLL_PIN
Definition: ldrtypes.h:71
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
_In_ PMEMORY_AREA _In_ PVOID _In_ BOOLEAN Locked
Definition: newmm.h:209
BOOLEAN LdrpInLdrInit
Definition: ldrinit.c:30
BOOLEAN NTAPI LdrpCheckForLoadedDllHandle(IN PVOID Base, OUT PLDR_DATA_TABLE_ENTRY *LdrEntry)
Definition: ldrutils.c:1621
VOID NTAPI LdrpUpdateLoadCount2(IN PLDR_DATA_TABLE_ENTRY LdrEntry, IN ULONG Flags)
Definition: ldrutils.c:460
BOOLEAN ShowSnaps
Definition: ldrinit.c:81
#define LDRP_UPDATE_PIN
Definition: ntdllp.h:17
#define LDRP_UPDATE_REFCOUNT
Definition: ntdllp.h:15
ULONG NTAPI LdrpClearLoadInProgress(VOID)
Definition: ldrutils.c:2663
#define STATUS_INTERNAL_ERROR
Definition: ntstatus.h:465
#define STATUS_DLL_NOT_FOUND
Definition: ntstatus.h:545
#define STATUS_SUCCESS
Definition: shellext.h:65
Definition: btrfs_drv.h:1876
USHORT LoadCount
Definition: ntddk_ex.h:208
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_NO_SUCH_FILE
Definition: udferr_usr.h:137
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
_In_opt_ PVOID _Out_ PLARGE_INTEGER Cookie
Definition: cmfuncs.h:14

Referenced by BasepGetModuleHandleExW().

◆ LdrAlternateResourcesEnabled()

BOOLEAN NTAPI LdrAlternateResourcesEnabled ( VOID  )

Definition at line 81 of file ldrapi.c.

82{
83 /* ReactOS does not support this */
84 return FALSE;
85}

Referenced by LdrLoadAlternateResourceModule().

◆ LdrCreateOutOfProcessImage()

NTSTATUS NTAPI LdrCreateOutOfProcessImage ( IN ULONG  Flags,
IN HANDLE  ProcessHandle,
IN HANDLE  DllHandle,
IN PVOID  Unknown3 
)

Definition at line 50 of file ldrapi.c.

54{
57}

◆ LdrDestroyOutOfProcessImage()

NTSTATUS NTAPI LdrDestroyOutOfProcessImage ( IN PVOID  Image)

Definition at line 42 of file ldrapi.c.

43{
46}

◆ LdrDisableThreadCalloutsForDll()

NTSTATUS NTAPI LdrDisableThreadCalloutsForDll ( IN PVOID  BaseAddress)

Definition at line 1187 of file ldrapi.c.

1188{
1189 PLDR_DATA_TABLE_ENTRY LdrEntry;
1191 BOOLEAN LockHeld;
1193 DPRINT("LdrDisableThreadCalloutsForDll (BaseAddress %p)\n", BaseAddress);
1194
1195 /* Don't do it during shutdown */
1197
1198 /* Check if we should grab the lock */
1199 LockHeld = FALSE;
1200 if (!LdrpInLdrInit)
1201 {
1202 /* Grab the lock */
1204 if (!NT_SUCCESS(Status)) return Status;
1205 LockHeld = TRUE;
1206 }
1207
1208 /* Make sure the DLL is valid and get its entry */
1211 {
1212 /* Get if it has a TLS slot */
1213 if (!LdrEntry->TlsIndex)
1214 {
1215 /* It doesn't, so you're allowed to call this */
1216 LdrEntry->Flags |= LDRP_DONT_CALL_FOR_THREADS;
1218 }
1219 }
1220
1221 /* Check if the lock was held */
1222 if (LockHeld)
1223 {
1224 /* Release it */
1226 }
1227
1228 /* Return the status */
1229 return Status;
1230}
#define LDRP_DONT_CALL_FOR_THREADS
Definition: ldrtypes.h:48
#define LDR_UNLOCK_LOADER_LOCK_FLAG_RAISE_ON_ERRORS
Definition: ldrtypes.h:82
BOOLEAN LdrpShutdownInProgress
Definition: ldrinit.c:34
#define DPRINT
Definition: sndvol32.h:71
USHORT TlsIndex
Definition: ntddk_ex.h:209
ULONG Flags
Definition: ntddk_ex.h:207

Referenced by DisableThreadLibraryCalls(), and DllMain().

◆ LdrEnumerateLoadedModules()

NTSTATUS NTAPI LdrEnumerateLoadedModules ( IN BOOLEAN  ReservedFlag,
IN PLDR_ENUM_CALLBACK  EnumProc,
IN PVOID  Context 
)

Definition at line 1120 of file ldrapi.c.

1123{
1124 PLIST_ENTRY ListHead, ListEntry;
1125 PLDR_DATA_TABLE_ENTRY LdrEntry;
1128 BOOLEAN Stop = FALSE;
1129
1130 /* Check parameters */
1131 if ((ReservedFlag) || !(EnumProc)) return STATUS_INVALID_PARAMETER;
1132
1133 /* Acquire the loader lock */
1135 if (!NT_SUCCESS(Status)) return Status;
1136
1137 /* Loop all the modules and call enum proc */
1138 ListHead = &NtCurrentPeb()->Ldr->InLoadOrderModuleList;
1139 ListEntry = ListHead->Flink;
1140 while (ListHead != ListEntry)
1141 {
1142 /* Get the entry */
1143 LdrEntry = CONTAINING_RECORD(ListEntry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks);
1144
1145 /* Call the enumeration proc inside SEH */
1146 _SEH2_TRY
1147 {
1148 EnumProc(LdrEntry, Context, &Stop);
1149 }
1151 {
1152 /* Ignoring the exception */
1153 } _SEH2_END;
1154
1155 /* Break if we were asked to stop enumeration */
1156 if (Stop)
1157 {
1158 /* Release loader lock */
1160
1161 /* Reset any successful status to STATUS_SUCCESS, but leave
1162 failure to the caller */
1163 if (NT_SUCCESS(Status))
1165
1166 /* Return any possible failure status */
1167 return Status;
1168 }
1169
1170 /* Advance to the next module */
1171 ListEntry = ListEntry->Flink;
1172 }
1173
1174 /* Release loader lock, it must succeed this time */
1177
1178 /* Return success */
1179 return STATUS_SUCCESS;
1180}
#define NtCurrentPeb()
Definition: FLS.c:22
BOOL CALLBACK EnumProc(_In_ HWND hwnd, _In_ LPARAM lParam)
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
_In_ PVOID _Out_ BOOLEAN * Stop
Definition: ldrtypes.h:241
#define ASSERT(a)
Definition: mode.c:44
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:34
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by BasepComputeProcessPath(), and LoadLibraryExW().

◆ LdrFindCreateProcessManifest()

NTSTATUS NTAPI LdrFindCreateProcessManifest ( IN ULONG  Flags,
IN PVOID  Image,
IN PVOID  IdPath,
IN ULONG  IdPathLength,
IN PVOID  OutDataEntry 
)

Definition at line 30 of file ldrapi.c.

35{
38}

◆ LdrFindEntryForAddress()

NTSTATUS NTAPI LdrFindEntryForAddress ( PVOID  Address,
PLDR_DATA_TABLE_ENTRY Module 
)

Definition at line 443 of file ldrapi.c.

445{
446 PLIST_ENTRY ListHead, NextEntry;
447 PLDR_DATA_TABLE_ENTRY LdrEntry;
448 PIMAGE_NT_HEADERS NtHeader;
449 PPEB_LDR_DATA Ldr = NtCurrentPeb()->Ldr;
450 ULONG_PTR DllBase, DllEnd;
451
452 DPRINT("LdrFindEntryForAddress(Address %p)\n", Address);
453
454 /* Nothing to do */
455 if (!Ldr) return STATUS_NO_MORE_ENTRIES;
456
457 /* Get the current entry */
458 LdrEntry = Ldr->EntryInProgress;
459 if (LdrEntry)
460 {
461 /* Get the NT Headers */
462 NtHeader = RtlImageNtHeader(LdrEntry->DllBase);
463 if (NtHeader)
464 {
465 /* Get the Image Base */
466 DllBase = (ULONG_PTR)LdrEntry->DllBase;
467 DllEnd = DllBase + NtHeader->OptionalHeader.SizeOfImage;
468
469 /* Check if they match */
470 if (((ULONG_PTR)Address >= DllBase) &&
471 ((ULONG_PTR)Address < DllEnd))
472 {
473 /* Return it */
474 *Module = LdrEntry;
475 return STATUS_SUCCESS;
476 }
477 }
478 }
479
480 /* Loop the module list */
481 ListHead = &Ldr->InMemoryOrderModuleList;
482 NextEntry = ListHead->Flink;
483 while (NextEntry != ListHead)
484 {
485 /* Get the entry and NT Headers */
486 LdrEntry = CONTAINING_RECORD(NextEntry, LDR_DATA_TABLE_ENTRY, InMemoryOrderLinks);
487 NtHeader = RtlImageNtHeader(LdrEntry->DllBase);
488 if (NtHeader)
489 {
490 /* Get the Image Base */
491 DllBase = (ULONG_PTR)LdrEntry->DllBase;
492 DllEnd = DllBase + NtHeader->OptionalHeader.SizeOfImage;
493
494 /* Check if they match */
495 if (((ULONG_PTR)Address >= DllBase) &&
496 ((ULONG_PTR)Address < DllEnd))
497 {
498 /* Return it */
499 *Module = LdrEntry;
500 return STATUS_SUCCESS;
501 }
502
503 /* Next Entry */
504 NextEntry = NextEntry->Flink;
505 }
506 }
507
508 /* Nothing found */
511 "LDR: %s() exiting 0x%08lx\n",
515}
#define RtlImageNtHeader
Definition: compat.h:806
@ DPFLTR_LDR_ID
Definition: dpfilter.h:113
#define __FUNCTION__
Definition: types.h:116
#define ULONG_PTR
Definition: config.h:101
if(dx< 0)
Definition: linetemp.h:194
#define DPFLTR_WARNING_LEVEL
Definition: kdtypes.h:31
NTSYSAPI ULONG __cdecl DbgPrintEx(_In_ ULONG ComponentId, _In_ ULONG Level, _In_z_ _Printf_format_string_ PCSTR Format,...)
#define STATUS_NO_MORE_ENTRIES
Definition: ntstatus.h:205
static WCHAR Address[46]
Definition: ping.c:68
IMAGE_OPTIONAL_HEADER32 OptionalHeader
Definition: ntddk_ex.h:184
PVOID DllBase
Definition: btrfs_drv.h:1880
PVOID EntryInProgress
Definition: ldrtypes.h:123
LIST_ENTRY InMemoryOrderModuleList
Definition: btrfs_drv.h:1895

Referenced by find_query_actctx(), and get_module_filename().

◆ LdrFlushAlternateResourceModules()

BOOLEAN NTAPI LdrFlushAlternateResourceModules ( VOID  )

Definition at line 1654 of file ldrapi.c.

1655{
1657 return FALSE;
1658}

◆ LdrGetDllHandle()

NTSTATUS NTAPI LdrGetDllHandle ( IN PWSTR DllPath  OPTIONAL,
IN PULONG DllCharacteristics  OPTIONAL,
IN PUNICODE_STRING  DllName,
OUT PVOID DllHandle 
)

Definition at line 805 of file ldrapi.c.

809{
810 /* Call the newer API */
812 DllPath,
813 DllCharacteristics,
814 DllName,
815 DllHandle);
816}
NTSTATUS NTAPI LdrGetDllHandleEx(IN ULONG Flags, IN PWSTR DllPath OPTIONAL, IN PULONG DllCharacteristics OPTIONAL, IN PUNICODE_STRING DllName, OUT PVOID *DllHandle OPTIONAL)
Definition: ldrapi.c:522
#define LDR_GET_DLL_HANDLE_EX_UNCHANGED_REFCOUNT
Definition: ldrtypes.h:87
static const char const char * DllPath
Definition: image.c:34

Referenced by BroadcastDriveLetterChange(), CsrClientConnectToServer(), CsrConnectToUser(), FirstSoundSentry(), GetModuleHandleForUnicodeString(), SeiAddHooks(), SeiFindHookModuleInfoForImportDescriptor(), and SeiInit().

◆ LdrGetDllHandleEx()

NTSTATUS NTAPI LdrGetDllHandleEx ( IN ULONG  Flags,
IN PWSTR DllPath  OPTIONAL,
IN PULONG DllCharacteristics  OPTIONAL,
IN PUNICODE_STRING  DllName,
OUT PVOID *DllHandle  OPTIONAL 
)

Definition at line 522 of file ldrapi.c.

527{
529 PLDR_DATA_TABLE_ENTRY LdrEntry;
530 UNICODE_STRING RedirectName, DllString1, RawDllName;
531 PUNICODE_STRING pRedirectName, CompareName;
532 PWCHAR p1, p2, p3;
533 BOOLEAN Locked, RedirectedDll;
535 ULONG LoadFlag, Length;
536
537 /* Initialize the strings */
538 RtlInitEmptyUnicodeString(&DllString1, NULL, 0);
539 RtlInitEmptyUnicodeString(&RawDllName, NULL, 0);
540 RedirectName = *DllName;
541 pRedirectName = &RedirectName;
542
543 /* Initialize state */
544 RedirectedDll = Locked = FALSE;
545 LdrEntry = NULL;
546 Cookie = 0;
547
548 /* Clear the handle */
549 if (DllHandle) *DllHandle = NULL;
550
551 /* Check for a valid flag combination */
553 (!DllHandle && !(Flags & LDR_GET_DLL_HANDLE_EX_PIN)))
554 {
555 DPRINT1("Flags are invalid or no DllHandle given\n");
557 goto Quickie;
558 }
559
560 /* If not initializing */
561 if (!LdrpInLdrInit)
562 {
563 /* Acquire the lock */
565 if (!NT_SUCCESS(Status)) goto Quickie;
566
567 /* Remember we own it */
568 Locked = TRUE;
569 }
570
571 /* Check if the SxS Assemblies specify another file */
573 pRedirectName,
575 NULL,
576 &DllString1,
577 &pRedirectName,
578 NULL,
579 NULL,
580 NULL);
581
582 /* Check success */
583 if (NT_SUCCESS(Status))
584 {
585 /* Let Ldrp know */
586 RedirectedDll = TRUE;
587 }
589 {
590 /* Unrecoverable SxS failure */
591 goto Quickie;
592 }
593 else
594 {
595 ASSERT(pRedirectName == &RedirectName);
596 }
597
598 /* Set default failure code */
600
601 /* Use the cache if we can */
603 {
604 /* Check if we were redirected */
605 if (RedirectedDll)
606 {
607 /* Check the flag */
609 {
610 goto DontCompare;
611 }
612
613 /* Use the right name */
615 }
616 else
617 {
618 /* Check the flag */
620 {
621 goto DontCompare;
622 }
623
624 /* Use the right name */
626 }
627
628 /* Check if the name matches */
629 if (RtlEqualUnicodeString(pRedirectName,
631 TRUE))
632 {
633 /* Skip the rest */
634 LdrEntry = LdrpGetModuleHandleCache;
635
636 /* Return success */
638 goto Quickie;
639 }
640 }
641
642DontCompare:
643 /* Find the name without the extension */
644 p1 = pRedirectName->Buffer;
645 p2 = NULL;
646 p3 = &p1[pRedirectName->Length / sizeof(WCHAR)];
647 while (p1 != p3)
648 {
649 if (*p1++ == L'.')
650 {
651 p2 = p1;
652 }
653 else if (*p1 == L'\\')
654 {
655 p2 = NULL;
656 }
657 }
658
659 /* Check if no extension was found or if we got a slash */
660 if (!(p2) || (*p2 == L'\\') || (*p2 == L'/'))
661 {
662 /* Check that we have space to add one */
663 Length = pRedirectName->Length +
666 {
667 /* No space to add the extension */
669 goto Quickie;
670 }
671
672 /* Setup the string */
673 RawDllName.MaximumLength = Length;
674 ASSERT(Length >= sizeof(UNICODE_NULL));
675 RawDllName.Buffer = RtlAllocateHeap(RtlGetProcessHeap(),
676 0,
677 RawDllName.MaximumLength);
678 if (!RawDllName.Buffer)
679 {
681 goto Quickie;
682 }
683
684 /* Copy the string and add extension */
685 RtlCopyUnicodeString(&RawDllName, pRedirectName);
687 }
688 else
689 {
690 /* Check if there's something in the name */
691 Length = pRedirectName->Length;
692 if (Length)
693 {
694 /* Check and remove trailing period */
695 if (pRedirectName->Buffer[Length / sizeof(WCHAR) - sizeof(ANSI_NULL)] == '.')
696 {
697 /* Decrease the size */
698 pRedirectName->Length -= sizeof(WCHAR);
699 }
700 }
701
702 /* Setup the string */
703 RawDllName.MaximumLength = pRedirectName->Length + sizeof(WCHAR);
704 RawDllName.Buffer = RtlAllocateHeap(RtlGetProcessHeap(),
705 0,
706 RawDllName.MaximumLength);
707 if (!RawDllName.Buffer)
708 {
710 goto Quickie;
711 }
712
713 /* Copy the string */
714 RtlCopyUnicodeString(&RawDllName, pRedirectName);
715 }
716
717 /* Display debug string */
718 if (ShowSnaps)
719 {
720 DPRINT1("LDR: LdrGetDllHandleEx, searching for %wZ from %ws\n",
721 &RawDllName,
722 DllPath ? ((ULONG_PTR)DllPath == 1 ? L"" : DllPath) : L"");
723 }
724
725 /* Do the lookup */
727 &RawDllName,
728 ((ULONG_PTR)DllPath == 1) ? TRUE : FALSE,
729 RedirectedDll,
730 &LdrEntry))
731 {
732 /* Update cached entry */
733 LdrpGetModuleHandleCache = LdrEntry;
734
735 /* Return success */
737 }
738 else
739 {
740 /* Make sure to NULL this */
741 LdrEntry = NULL;
742 }
743Quickie:
744 /* The success path must have a valid loader entry */
745 ASSERT((LdrEntry != NULL) == NT_SUCCESS(Status));
746
747 /* Check if we got an entry and success */
748 DPRINT("Got LdrEntry->BaseDllName %wZ\n", LdrEntry ? &LdrEntry->BaseDllName : NULL);
749 if ((LdrEntry) && (NT_SUCCESS(Status)))
750 {
751 /* Check if the DLL is locked */
752 if ((LdrEntry->LoadCount != 0xFFFF) &&
754 {
755 /* Check what to do with the load count */
757 {
758 /* Pin it */
759 LdrEntry->LoadCount = 0xFFFF;
760 LoadFlag = LDRP_UPDATE_PIN;
761 }
762 else
763 {
764 /* Increase the load count */
765 LdrEntry->LoadCount++;
766 LoadFlag = LDRP_UPDATE_REFCOUNT;
767 }
768
769 /* Update the load count now */
770 LdrpUpdateLoadCount2(LdrEntry, LoadFlag);
772 }
773
774 /* Check if the caller is requesting the handle */
775 if (DllHandle) *DllHandle = LdrEntry->DllBase;
776 }
777
778 /* Free string if needed */
779 if (DllString1.Buffer) RtlFreeUnicodeString(&DllString1);
780
781 /* Free the raw DLL Name if needed */
782 if (RawDllName.Buffer)
783 {
784 /* Free the heap-allocated buffer */
785 RtlFreeHeap(RtlGetProcessHeap(), 0, RawDllName.Buffer);
786 RawDllName.Buffer = NULL;
787 }
788
789 /* Release lock */
790 if (Locked)
791 {
793 Cookie);
794 }
795
796 /* Return */
797 return Status;
798}
static BOOL CompareName(LPCWSTR pszName1, LPCWSTR pszName2)
Definition: find.c:72
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
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:821
UNICODE_STRING LdrApiDefaultExtension
Definition: ldrapi.c:22
#define LDRP_REDIRECTED
Definition: ldrtypes.h:58
#define LDR_GET_DLL_HANDLE_EX_PIN
Definition: ldrtypes.h:88
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
NTSYSAPI NTSTATUS NTAPI RtlAppendUnicodeStringToString(PUNICODE_STRING Destination, PUNICODE_STRING Source)
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define UNICODE_NULL
#define UNICODE_STRING_MAX_BYTES
#define ANSI_NULL
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
PLDR_DATA_TABLE_ENTRY LdrpGetModuleHandleCache
Definition: ldrutils.c:19
BOOLEAN NTAPI LdrpCheckForLoadedDll(IN PWSTR DllPath, IN PUNICODE_STRING DllName, IN BOOLEAN Flag, IN BOOLEAN RedirectedDll, OUT PLDR_DATA_TABLE_ENTRY *LdrEntry)
Definition: ldrutils.c:1979
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define STATUS_SXS_KEY_NOT_FOUND
Definition: ntstatus.h:1389
#define STATUS_NAME_TOO_LONG
Definition: ntstatus.h:498
#define L(x)
Definition: ntvdm.h:50
UNICODE_STRING FullDllName
Definition: btrfs_drv.h:1882
UNICODE_STRING BaseDllName
Definition: ldrtypes.h:145
USHORT MaximumLength
Definition: env_spec_w32.h:370
uint16_t * PWCHAR
Definition: typedefs.h:56
uint32_t ULONG
Definition: typedefs.h:59
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by LdrGetDllHandle(), and LoadLibraryExW().

◆ LdrGetProcedureAddress()

NTSTATUS NTAPI LdrGetProcedureAddress ( IN PVOID  BaseAddress,
IN PANSI_STRING  Name,
IN ULONG  Ordinal,
OUT PVOID ProcedureAddress 
)

Definition at line 823 of file ldrapi.c.

827{
828 /* Call the internal routine and tell it to execute DllInit */
829 return LdrpGetProcedureAddress(BaseAddress, Name, Ordinal, ProcedureAddress, TRUE);
830}
NTSTATUS NTAPI LdrpGetProcedureAddress(IN PVOID BaseAddress, IN PANSI_STRING Name, IN ULONG Ordinal, OUT PVOID *ProcedureAddress, IN BOOLEAN ExecuteInit)
Definition: ldrutils.c:2252

Referenced by BaseInitApphelp(), BasepReplaceProcessThreadTokens(), BaseSrvDelayLoadKernel32(), BroadcastDriveLetterChange(), CsrClientConnectToServer(), CsrConnectToUser(), CsrLoadServerDll(), FirstSoundSentry(), GetProcAddress(), InitApphelp(), LdrpInitializeProcess(), LoadOle32Export(), LsapAddAuthPackage(), SeiCreateShimModuleInfo(), and SeiResolveAPI().

◆ LdrInitShimEngineDynamic()

BOOLEAN NTAPI LdrInitShimEngineDynamic ( IN PVOID  BaseAddress)

Definition at line 1677 of file ldrapi.c.

1678{
1681 if (NT_SUCCESS(Status))
1682 {
1684 {
1687 }
1689 return TRUE;
1690 }
1691 return FALSE;
1692}
VOID NTAPI LdrpGetShimEngineInterface()
Definition: ldrutils.c:2711
PVOID g_pShimEngineModule
Definition: ldrutils.c:22

Referenced by SE_DynamicShim().

◆ LdrLoadAlternateResourceModule()

NTSTATUS NTAPI LdrLoadAlternateResourceModule ( IN PVOID  Module,
IN PWSTR  Buffer 
)

Definition at line 1614 of file ldrapi.c.

1616{
1617 /* Is MUI Support enabled? */
1619
1622}
#define STATUS_MUI_FILE_NOT_FOUND
Definition: ldrapi.c:1607
BOOLEAN NTAPI LdrAlternateResourcesEnabled(VOID)
Definition: ldrapi.c:81

◆ LdrLoadDll()

NTSTATUS NTAPI DECLSPEC_HOTPATCH LdrLoadDll ( IN PWSTR SearchPath  OPTIONAL,
IN PULONG DllCharacteristics  OPTIONAL,
IN PUNICODE_STRING  DllName,
OUT PVOID BaseAddress 
)

Definition at line 310 of file ldrapi.c.

314{
316 UNICODE_STRING DllString1, DllString2;
317 BOOLEAN RedirectedDll = FALSE;
320 PUNICODE_STRING OldTldDll;
321 PTEB Teb = NtCurrentTeb();
322
323 /* Initialize the strings */
324 RtlInitEmptyUnicodeString(&DllString1, StringBuffer, sizeof(StringBuffer));
325 RtlInitEmptyUnicodeString(&DllString2, NULL, 0);
326
327 /* Check if the SxS Assemblies specify another file */
329 DllName,
331 &DllString1,
332 &DllString2,
333 &DllName,
334 NULL,
335 NULL,
336 NULL);
337
338 /* Check success */
339 if (NT_SUCCESS(Status))
340 {
341 /* Let Ldrp know */
342 RedirectedDll = TRUE;
343 }
345 {
346 /* Unrecoverable SxS failure; did we get a string? */
347 if (DllString2.Buffer) RtlFreeUnicodeString(&DllString2);
348 return Status;
349 }
350
351 /* Lock the loader lock */
353
354 /* Check if there's a TLD DLL being loaded */
355 OldTldDll = LdrpTopLevelDllBeingLoaded;
357 {
358
359 if (OldTldDll)
360 {
361 /* This is a recursive load, do something about it? */
363 {
364 /* Print out debug messages */
365 DPRINT1("[%p, %p] LDR: Recursive DLL Load\n",
368 DPRINT1("[%p, %p] Previous DLL being loaded \"%wZ\"\n",
371 OldTldDll);
372 DPRINT1("[%p, %p] DLL being requested \"%wZ\"\n",
375 DllName);
376
377 /* Was it initializing too? */
379 {
380 DPRINT1("[%p, %p] LDR: No DLL Initializer was running\n",
383 }
384 else
385 {
386 DPRINT1("[%p, %p] DLL whose initializer was currently running \"%wZ\"\n",
390 }
391 }
392 }
393
394 /* Set this one as the TLD DLL being loaded*/
396
397 /* Load the DLL */
398 Status = LdrpLoadDll(RedirectedDll,
400 DllCharacteristics,
401 DllName,
403 TRUE);
404 if (NT_SUCCESS(Status))
405 {
407 }
408 else if ((Status != STATUS_NO_SUCH_FILE) &&
412 {
415 "LDR: %s - failing because LdrpLoadDll(%wZ) returned status %x\n",
417 DllName,
418 Status);
419 }
420 }
422 {
423 /* Restore the old TLD DLL */
424 LdrpTopLevelDllBeingLoaded = OldTldDll;
425
426 /* Release the lock */
428 }
429 _SEH2_END;
430
431 /* Do we have a redirect string? */
432 if (DllString2.Buffer) RtlFreeUnicodeString(&DllString2);
433
434 /* Return */
435 return Status;
436}
#define MAX_PATH
Definition: compat.h:34
#define _SEH2_FINALLY
Definition: filesup.c:21
#define NtCurrentTeb
BOOLEAN LdrpBreakOnRecursiveDllLoads
Definition: ldrapi.c:21
BOOLEAN LdrpShowRecursiveLoads
Definition: ldrapi.c:21
WCHAR StringBuffer[156]
Definition: ldrinit.c:41
NTSTATUS NTAPI LdrpLoadDll(IN BOOLEAN Redirected, IN PWSTR DllPath OPTIONAL, IN PULONG DllCharacteristics OPTIONAL, IN PUNICODE_STRING DllName, OUT PVOID *BaseAddress, IN BOOLEAN CallInit)
Definition: ldrutils.c:2429
PLDR_DATA_TABLE_ENTRY LdrpCurrentDllInitializer
Definition: ldrinit.c:43
PUNICODE_STRING LdrpTopLevelDllBeingLoaded
Definition: ldrinit.c:40
#define STATUS_DLL_INIT_FAILED
Definition: ntstatus.h:558
HANDLE UniqueThread
Definition: compat.h:826
HANDLE UniqueProcess
Definition: compat.h:825
Definition: compat.h:836
CLIENT_ID ClientId
Definition: compat.h:839
CLIENT_ID RealClientId
Definition: compat.h:861
#define SearchPath
Definition: winbase.h:3825

Referenced by AVrfpLoadAndInitializeProvider(), BaseInitApphelp(), BaseSrvDelayLoadKernel32(), CsrLoadServerDll(), InitApphelp(), LdrpInitializeProcess(), LoadLibraryExW(), LoadOle32Export(), LsapAddAuthPackage(), and SeiInit().

◆ LdrLockLoaderLock()

NTSTATUS NTAPI LdrLockLoaderLock ( IN ULONG  Flags,
OUT PULONG Disposition  OPTIONAL,
OUT PULONG_PTR Cookie  OPTIONAL 
)

Definition at line 173 of file ldrapi.c.

176{
178 BOOLEAN InInit = LdrpInLdrInit;
179
180 DPRINT("LdrLockLoaderLock(%x %p %p)\n", Flags, Disposition, Cookie);
181
182 /* Zero out the outputs */
184 if (Cookie) *Cookie = 0;
185
186 /* Validate the flags */
189 {
190 /* Flags are invalid, check how to fail */
192 {
193 /* The caller wants us to raise status */
195 }
196
197 /* A normal failure */
199 }
200
201 /* Make sure we got a cookie */
202 if (!Cookie)
203 {
204 /* No cookie check how to fail */
206 {
207 /* The caller wants us to raise status */
209 }
210
211 /* A normal failure */
213 }
214
215 /* If the flag is set, make sure we have a valid pointer to use */
217 {
218 /* No pointer to return the data to */
220 {
221 /* The caller wants us to raise status */
223 }
224
225 /* Fail */
227 }
228
229 /* Return now if we are in the init phase */
230 if (InInit) return STATUS_SUCCESS;
231
232 /* Check what locking semantic to use */
234 {
235 /* Check if we should enter or simply try */
237 {
238 /* Do a try */
240 {
241 /* It's locked */
243 }
244 else
245 {
246 /* It worked */
249 }
250 }
251 else
252 {
253 /* Do a enter */
255
256 /* See if result was requested */
259 }
260 }
261 else
262 {
263 /* Wrap this in SEH, since we're not supposed to raise */
265 {
266 /* Check if we should enter or simply try */
268 {
269 /* Do a try */
271 {
272 /* It's locked */
274 }
275 else
276 {
277 /* It worked */
280 }
281 }
282 else
283 {
284 /* Do an enter */
286
287 /* See if result was requested */
290 }
291 }
293 {
294 /* We should use the LDR Filter instead */
296 }
297 _SEH2_END;
298 }
299
300 /* Return status */
301 return Status;
302}
FORCEINLINE ULONG_PTR LdrpMakeCookie(VOID)
Definition: ldrapi.c:89
#define LDR_LOCK_LOADER_LOCK_DISPOSITION_LOCK_NOT_ACQUIRED
Definition: ldrtypes.h:93
#define LDR_LOCK_LOADER_LOCK_FLAG_TRY_ONLY
Definition: ldrtypes.h:77
#define LDR_LOCK_LOADER_LOCK_DISPOSITION_INVALID
Definition: ldrtypes.h:91
#define LDR_LOCK_LOADER_LOCK_DISPOSITION_LOCK_ACQUIRED
Definition: ldrtypes.h:92
_In_ ACCESS_MASK _In_ POBJECT_ATTRIBUTES _Reserved_ ULONG _In_opt_ PUNICODE_STRING _In_ ULONG _Out_opt_ PULONG Disposition
Definition: cmfuncs.h:56
NTSYSAPI BOOLEAN NTAPI RtlTryEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
NTSYSAPI NTSTATUS NTAPI RtlEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
DECLSPEC_NORETURN NTSYSAPI VOID NTAPI RtlRaiseStatus(_In_ NTSTATUS Status)
RTL_CRITICAL_SECTION LdrpLoaderLock
Definition: ldrinit.c:70
#define STATUS_INVALID_PARAMETER_2
Definition: ntstatus.h:476
#define STATUS_INVALID_PARAMETER_1
Definition: ntstatus.h:475
#define STATUS_INVALID_PARAMETER_3
Definition: ntstatus.h:477
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:159

Referenced by BasepGetModuleHandleExW(), find_query_actctx(), get_module_filename(), GetModuleFileNameW(), LdrAddRefDll(), LdrDisableThreadCalloutsForDll(), LdrEnumerateLoadedModules(), LdrGetDllHandleEx(), LdrInitShimEngineDynamic(), LdrLoadDll(), and LdrUnloadAlternateResourceModule().

◆ LdrpMakeCookie()

FORCEINLINE ULONG_PTR LdrpMakeCookie ( VOID  )

Definition at line 89 of file ldrapi.c.

90{
91 /* Generate a cookie */
92 return (((ULONG_PTR)NtCurrentTeb()->RealClientId.UniqueThread & 0xFFF) << 16) |
94}
long __cdecl _InterlockedIncrement(_Interlocked_operand_ long volatile *_Addend)
LONG LdrpLoaderLockAcquisitionCount
Definition: ldrapi.c:20

Referenced by LdrLockLoaderLock().

◆ LdrProcessRelocationBlock()

PIMAGE_BASE_RELOCATION NTAPI LdrProcessRelocationBlock ( IN ULONG_PTR  Address,
IN ULONG  Count,
IN PUSHORT  TypeOffset,
IN LONG_PTR  Delta 
)

Definition at line 1598 of file ldrapi.c.

1602{
1604}
PIMAGE_BASE_RELOCATION NTAPI LdrProcessRelocationBlockLongLong(_In_ ULONG_PTR Address, _In_ ULONG Count, _In_ PUSHORT TypeOffset, _In_ LONGLONG Delta)
int Count
Definition: noreturn.cpp:7
static ULONG Delta
Definition: xboxvideo.c:33

◆ LdrQueryProcessModuleInformation()

NTSTATUS NTAPI LdrQueryProcessModuleInformation ( IN PRTL_PROCESS_MODULES  ModuleInformation,
IN ULONG  Size,
OUT PULONG ReturnedSize  OPTIONAL 
)

Definition at line 1107 of file ldrapi.c.

1110{
1111 /* Call Ex version of the API */
1112 return LdrQueryProcessModuleInformationEx(0, 0, ModuleInformation, Size, ReturnedSize);
1113}
ULONG ReturnedSize
NTSTATUS NTAPI LdrQueryProcessModuleInformationEx(IN ULONG ProcessId, IN ULONG Reserved, OUT PRTL_PROCESS_MODULES ModuleInformation, IN ULONG Size, OUT PULONG ReturnedSize OPTIONAL)
Definition: ldrapi.c:979
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533

Referenced by RtlQueryProcessDebugInformation(), and Test_ProcessModules().

◆ LdrQueryProcessModuleInformationEx()

NTSTATUS NTAPI LdrQueryProcessModuleInformationEx ( IN ULONG  ProcessId,
IN ULONG  Reserved,
OUT PRTL_PROCESS_MODULES  ModuleInformation,
IN ULONG  Size,
OUT PULONG ReturnedSize  OPTIONAL 
)

Definition at line 979 of file ldrapi.c.

984{
985 PLIST_ENTRY ModuleListHead, InitListHead;
986 PLIST_ENTRY Entry, InitEntry;
987 PLDR_DATA_TABLE_ENTRY Module, InitModule;
990 ULONG UsedSize = sizeof(ULONG);
992 PCHAR p;
993
994 DPRINT("LdrQueryProcessModuleInformation() called\n");
995
996 /* Acquire loader lock */
998
1000 {
1001 /* Check if we were given enough space */
1002 if (Size < UsedSize)
1003 {
1005 }
1006 else
1007 {
1008 ModuleInformation->NumberOfModules = 0;
1009 ModulePtr = &ModuleInformation->Modules[0];
1011 }
1012
1013 /* Traverse the list of modules */
1014 ModuleListHead = &NtCurrentPeb()->Ldr->InLoadOrderModuleList;
1016
1017 while (Entry != ModuleListHead)
1018 {
1019 Module = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks);
1020
1021 DPRINT(" Module %wZ\n", &Module->FullDllName);
1022
1023 /* Increase the used size */
1024 UsedSize += sizeof(RTL_PROCESS_MODULE_INFORMATION);
1025
1026 if (UsedSize > Size)
1027 {
1029 }
1030 else
1031 {
1032 ModulePtr->ImageBase = Module->DllBase;
1033 ModulePtr->ImageSize = Module->SizeOfImage;
1034 ModulePtr->Flags = Module->Flags;
1035 ModulePtr->LoadCount = Module->LoadCount;
1036 ModulePtr->MappedBase = NULL;
1037 ModulePtr->InitOrderIndex = 0;
1038 ModulePtr->LoadOrderIndex = ModuleInformation->NumberOfModules;
1039
1040 /* Now get init order index by traversing init list */
1041 InitListHead = &NtCurrentPeb()->Ldr->InInitializationOrderModuleList;
1042 InitEntry = InitListHead->Flink;
1043
1044 while (InitEntry != InitListHead)
1045 {
1046 InitModule = CONTAINING_RECORD(InitEntry, LDR_DATA_TABLE_ENTRY, InInitializationOrderLinks);
1047
1048 /* Increase the index */
1049 ModulePtr->InitOrderIndex++;
1050
1051 /* Quit the loop if our module is found */
1052 if (InitModule == Module) break;
1053
1054 /* Advance to the next entry */
1055 InitEntry = InitEntry->Flink;
1056 }
1057
1058 /* Prepare ANSI string with the module's name */
1059 AnsiString.Length = 0;
1060 AnsiString.MaximumLength = sizeof(ModulePtr->FullPathName);
1061 AnsiString.Buffer = ModulePtr->FullPathName;
1063 &Module->FullDllName,
1064 FALSE);
1065
1066 /* Calculate OffsetToFileName field */
1067 p = strrchr(ModulePtr->FullPathName, '\\');
1068 if (p != NULL)
1069 ModulePtr->OffsetToFileName = p - ModulePtr->FullPathName + 1;
1070 else
1071 ModulePtr->OffsetToFileName = 0;
1072
1073 /* Advance to the next module in the output list */
1074 ModulePtr++;
1075
1076 /* Increase number of modules */
1077 if (ModuleInformation)
1078 ModuleInformation->NumberOfModules++;
1079 }
1080
1081 /* Go to the next entry in the modules list */
1082 Entry = Entry->Flink;
1083 }
1084
1085 /* Set returned size if it was provided */
1086 if (ReturnedSize)
1087 *ReturnedSize = UsedSize;
1088 }
1090 {
1091 /* Ignoring the exception */
1092 } _SEH2_END;
1093
1094 /* Release the lock */
1096
1097 DPRINT("LdrQueryProcessModuleInformation() done\n");
1098
1099 return Status;
1100}
@ AnsiString
Definition: dnslib.h:19
GLfloat GLfloat p
Definition: glext.h:8902
LIST_ENTRY * ModuleListHead
Definition: kdpacket.c:23
NTSYSAPI NTSTATUS NTAPI RtlLeaveCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
struct _RTL_PROCESS_MODULE_INFORMATION RTL_PROCESS_MODULE_INFORMATION
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToAnsiString(PANSI_STRING DestinationString, PUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
base of all file and directory entries
Definition: entries.h:83
ULONG SizeOfImage
Definition: ldrtypes.h:143
char * PCHAR
Definition: typedefs.h:51
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133

Referenced by LdrQueryProcessModuleInformation().

◆ LdrSetAppCompatDllRedirectionCallback()

NTSTATUS NTAPI LdrSetAppCompatDllRedirectionCallback ( _In_ ULONG  Flags,
_In_ PLDR_APP_COMPAT_DLL_REDIRECTION_CALLBACK_FUNCTION  CallbackFunction,
_In_opt_ PVOID  CallbackData 
)

Definition at line 1666 of file ldrapi.c.

1670{
1673}

◆ LdrSetDllManifestProber()

VOID NTAPI LdrSetDllManifestProber ( _In_ PLDR_MANIFEST_PROBER_ROUTINE  Routine)

Definition at line 73 of file ldrapi.c.

75{
77}
PLDR_MANIFEST_PROBER_ROUTINE LdrpManifestProberRoutine
Definition: ldrpe.c:18

Referenced by DllMain().

◆ LdrUnloadAlternateResourceModule()

BOOLEAN NTAPI LdrUnloadAlternateResourceModule ( IN PVOID  BaseAddress)

Definition at line 1629 of file ldrapi.c.

1630{
1632
1633 /* Acquire the loader lock */
1635
1636 /* Check if there's any alternate resources loaded */
1638 {
1640 }
1641
1642 /* Release the loader lock */
1644
1645 /* All done */
1646 return TRUE;
1647}
ULONG AlternateResourceModuleCount
Definition: ldrapi.c:23

Referenced by FreeLibrary(), FreeLibraryAndExitThread(), and LdrUnloadDll().

◆ LdrUnloadDll()

NTSTATUS NTAPI LdrUnloadDll ( IN PVOID  BaseAddress)

Definition at line 1322 of file ldrapi.c.

1323{
1325 PPEB Peb = NtCurrentPeb();
1326 PLDR_DATA_TABLE_ENTRY LdrEntry, CurrentEntry;
1327 PVOID EntryPoint;
1328 PLIST_ENTRY NextEntry;
1329 LIST_ENTRY UnloadList;
1330 RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED ActCtx;
1331 PVOID CorImageData;
1332 ULONG ComSectionSize;
1333
1334 /* Get the LDR Lock */
1336
1337 /* Increase the unload count */
1339
1340 /* Skip unload */
1341 if (LdrpShutdownInProgress) goto Quickie;
1342
1343 /* Make sure the DLL is valid and get its entry */
1345 {
1347 goto Quickie;
1348 }
1349
1350 /* Check the current Load Count */
1351 if (LdrEntry->LoadCount != 0xFFFF)
1352 {
1353 /* Decrease it */
1354 LdrEntry->LoadCount--;
1355
1356 /* If it's a dll */
1357 if (LdrEntry->Flags & LDRP_IMAGE_DLL)
1358 {
1359 /* Set up the Act Ctx */
1360 ActCtx.Size = sizeof(ActCtx);
1363
1364 /* Activate the ActCtx */
1366 LdrEntry->EntryPointActivationContext);
1367
1368 /* Update the load count */
1370
1371 /* Release the context */
1373 }
1374 }
1375 else
1376 {
1377 /* The DLL is locked */
1378 goto Quickie;
1379 }
1380
1381 /* Show debug message */
1382 if (ShowSnaps) DPRINT1("LDR: UNINIT LIST\n");
1383
1384 /* Check if this is our only unload and initialize the list if so */
1386
1387 /* Loop the modules to build the list */
1389 while (NextEntry != &Peb->Ldr->InInitializationOrderModuleList)
1390 {
1391 /* Get the entry */
1392 LdrEntry = CONTAINING_RECORD(NextEntry,
1394 InInitializationOrderLinks);
1395 NextEntry = NextEntry->Blink;
1396
1397 /* Remove flag */
1398 LdrEntry->Flags &= ~LDRP_UNLOAD_IN_PROGRESS;
1399
1400 /* If the load count is now 0 */
1401 if (!LdrEntry->LoadCount)
1402 {
1403 /* Show message */
1404 if (ShowSnaps)
1405 {
1406 DPRINT1("(%lu) [%ws] %ws (%lx) deinit %p\n",
1408 LdrEntry->BaseDllName.Buffer,
1409 LdrEntry->FullDllName.Buffer,
1410 (ULONG)LdrEntry->LoadCount,
1411 LdrEntry->EntryPoint);
1412 }
1413
1414 /* Call Shim Engine and notify */
1415 if (g_ShimsEnabled)
1416 {
1418 SE_DllUnloaded(LdrEntry);
1419 }
1420
1421 /* Unlink it */
1422 CurrentEntry = LdrEntry;
1424 RemoveEntryList(&CurrentEntry->InMemoryOrderLinks);
1425 RemoveEntryList(&CurrentEntry->HashLinks);
1426
1427 /* If there's more then one active unload */
1428 if (LdrpActiveUnloadCount > 1)
1429 {
1430 /* Flush the cached DLL handle and clear the list */
1432 CurrentEntry->InMemoryOrderLinks.Flink = NULL;
1433 }
1434
1435 /* Add the entry on the unload list */
1436 InsertTailList(&LdrpUnloadHead, &CurrentEntry->HashLinks);
1437 }
1438 }
1439
1440 /* Only call the entrypoints once */
1441 if (LdrpActiveUnloadCount > 1) goto Quickie;
1442
1443 /* Now loop the unload list and create our own */
1444 InitializeListHead(&UnloadList);
1445 CurrentEntry = NULL;
1446 NextEntry = LdrpUnloadHead.Flink;
1447 while (NextEntry != &LdrpUnloadHead)
1448 {
1449 /* Get the current entry */
1450 LdrEntry = CONTAINING_RECORD(NextEntry, LDR_DATA_TABLE_ENTRY, HashLinks);
1451
1452 LdrpRecordUnloadEvent(LdrEntry);
1453
1454 /* Set the entry and clear it from the list */
1455 CurrentEntry = LdrEntry;
1457 CurrentEntry->InMemoryOrderLinks.Flink = NULL;
1458
1459 /* Move it from the global to the local list */
1460 RemoveEntryList(&CurrentEntry->HashLinks);
1461 InsertTailList(&UnloadList, &CurrentEntry->HashLinks);
1462
1463 /* Get the entrypoint */
1464 EntryPoint = LdrEntry->EntryPoint;
1465
1466 /* Check if we should call it */
1467 if ((EntryPoint) && (LdrEntry->Flags & LDRP_PROCESS_ATTACH_CALLED))
1468 {
1469 /* Show message */
1470 if (ShowSnaps)
1471 {
1472 DPRINT1("LDR: Calling deinit %p\n", EntryPoint);
1473 }
1474
1475 /* Set up the Act Ctx */
1476 ActCtx.Size = sizeof(ActCtx);
1479
1480 /* Activate the ActCtx */
1482 LdrEntry->EntryPointActivationContext);
1483
1484 /* Call the entrypoint */
1485 _SEH2_TRY
1486 {
1488 LdrEntry->DllBase,
1490 NULL);
1491 }
1493 {
1494 DPRINT1("WARNING: Exception 0x%x during LdrpCallInitRoutine(DLL_PROCESS_DETACH) for %wZ\n",
1495 _SEH2_GetExceptionCode(), &LdrEntry->BaseDllName);
1496 }
1497 _SEH2_END;
1498
1499 /* Release the context */
1501 }
1502
1503 /* Remove it from the list */
1504 RemoveEntryList(&CurrentEntry->InLoadOrderLinks);
1505 CurrentEntry = NULL;
1506 NextEntry = LdrpUnloadHead.Flink;
1507 }
1508
1509 /* Now loop our local list */
1510 NextEntry = UnloadList.Flink;
1511 while (NextEntry != &UnloadList)
1512 {
1513 /* Get the entry */
1514 LdrEntry = CONTAINING_RECORD(NextEntry, LDR_DATA_TABLE_ENTRY, HashLinks);
1515 NextEntry = NextEntry->Flink;
1516 CurrentEntry = LdrEntry;
1517
1518 /* Notify Application Verifier */
1520 {
1521 AVrfDllUnloadNotification(LdrEntry);
1522 }
1523
1524 /* Show message */
1525 if (ShowSnaps)
1526 {
1527 DPRINT1("LDR: Unmapping [%ws]\n", LdrEntry->BaseDllName.Buffer);
1528 }
1529
1530 /* Check if this is a .NET executable */
1531 CorImageData = RtlImageDirectoryEntryToData(LdrEntry->DllBase,
1532 TRUE,
1534 &ComSectionSize);
1535 if (CorImageData)
1536 {
1537 /* FIXME */
1538 DPRINT1(".NET Images are not supported yet\n");
1539 }
1540
1541 /* Check if we should unmap*/
1542 if (!(CurrentEntry->Flags & LDR_COR_OWNS_UNMAP))
1543 {
1544 /* Unmap the DLL */
1546 CurrentEntry->DllBase);
1548 }
1549
1550 /* Unload the alternate resource module, if any */
1552
1553 /* FIXME: Send shutdown notification */
1554 //LdrpSendDllNotifications(CurrentEntry, 2, LdrpShutdownInProgress);
1555
1556 /* Check if a Hotpatch is active */
1557 if (LdrEntry->PatchInformation)
1558 {
1559 /* FIXME */
1560 DPRINT1("We don't support Hotpatching yet\n");
1561 }
1562
1563 /* Deallocate the Entry */
1565
1566 /* If this is the cached entry, invalidate it */
1567 if (LdrpGetModuleHandleCache == CurrentEntry)
1568 {
1570 }
1571 }
1572
1573Quickie:
1574 /* Decrease unload count */
1577
1578 /* Return to caller */
1579 return Status;
1580}
NTSTATUS NTAPI NtUnmapViewOfSection(IN HANDLE ProcessHandle, IN PVOID BaseAddress)
Definition: section.c:3848
#define VOID
Definition: acefi.h:82
#define DLL_PROCESS_DETACH
Definition: compat.h:130
#define RtlImageDirectoryEntryToData
Definition: compat.h:809
PPEB Peb
Definition: dllmain.c:27
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
#define InsertTailList(ListHead, Entry)
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define FLG_HEAP_ENABLE_TAIL_CHECK
Definition: pstypes.h:60
LIST_ENTRY LdrpUnloadHead
Definition: ldrapi.c:19
BOOLEAN NTAPI LdrUnloadAlternateResourceModule(IN PVOID BaseAddress)
Definition: ldrapi.c:1629
#define LDR_COR_OWNS_UNMAP
Definition: ldrtypes.h:53
_In_ PCWSTR _Out_ PVOID * ActCtx
Definition: ldrtypes.h:247
#define LDRP_IMAGE_DLL
Definition: ldrtypes.h:39
#define LDRP_PROCESS_ATTACH_CALLED
Definition: ldrtypes.h:49
#define RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_FORMAT_WHISTLER
Definition: rtltypes.h:101
#define NtCurrentProcess()
Definition: nt_native.h:1657
#define LDRP_UPDATE_DEREFCOUNT
Definition: ntdllp.h:16
ULONG LdrpActiveUnloadCount
Definition: ldrinit.c:84
VOID NTAPI LdrpFinalizeAndDeallocateDataTableEntry(IN PLDR_DATA_TABLE_ENTRY Entry)
Definition: ldrutils.c:1598
BOOLEAN NTAPI LdrpCallInitRoutine(IN PDLL_INIT_ROUTINE EntryPoint, IN PVOID BaseAddress, IN ULONG Reason, IN PVOID Context)
Definition: ldrutils.c:100
VOID NTAPI AVrfDllUnloadNotification(IN PLDR_DATA_TABLE_ENTRY LdrEntry)
Definition: verifier.c:328
VOID NTAPI LdrpRecordUnloadEvent(_In_ PLDR_DATA_TABLE_ENTRY LdrEntry)
Definition: trace.c:28
BOOLEAN g_ShimsEnabled
Definition: ldrutils.c:21
PVOID g_pfnSE_DllUnloaded
Definition: ldrutils.c:24
PLDR_DATA_TABLE_ENTRY LdrpLoadedDllHandleCache
Definition: ntdllp.h:59
#define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR
Definition: ntimage.h:489
PRTL_ACTIVATION_CONTEXT_STACK_FRAME FASTCALL RtlActivateActivationContextUnsafeFast(IN PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame, IN PVOID Context)
Definition: actctx.c:5934
PRTL_ACTIVATION_CONTEXT_STACK_FRAME FASTCALL RtlDeactivateActivationContextUnsafeFast(IN PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame)
Definition: actctx.c:6011
PVOID NTAPI RtlDecodeSystemPointer(IN PVOID Pointer)
Definition: process.c:439
VOID WINAPI SE_DllUnloaded(PLDR_DATA_TABLE_ENTRY LdrEntry)
Definition: shimeng.c:1465
PACTIVATION_CONTEXT EntryPointActivationContext
Definition: ldrtypes.h:163
PVOID EntryPoint
Definition: ntddk_ex.h:203
LIST_ENTRY InLoadOrderLinks
Definition: ldrtypes.h:138
LIST_ENTRY InInitializationOrderLinks
Definition: ldrtypes.h:140
LIST_ENTRY InMemoryOrderLinks
Definition: btrfs_drv.h:1878
LIST_ENTRY HashLinks
Definition: ldrtypes.h:151
PVOID PatchInformation
Definition: ldrtypes.h:164
struct _LIST_ENTRY * Blink
Definition: typedefs.h:122
LIST_ENTRY InInitializationOrderModuleList
Definition: ldrtypes.h:122
PVOID LoaderLock
Definition: ntddk_ex.h:295
PPEB_LDR_DATA Ldr
Definition: btrfs_drv.h:1912
ULONG NtGlobalFlag
Definition: ntddk_ex.h:270
#define NTAPI
Definition: typedefs.h:36
void * PVOID
Definition: typedefs.h:50
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262

Referenced by BasepReplaceProcessThreadTokens(), CsrLoadServerDll(), FreeLibrary(), FreeLibraryAndExitThread(), InitApphelp(), LdrpLoadDll(), LdrpUnloadShimEngine(), LsapAddAuthPackage(), PropertyLengthAsVariant(), RtlConvertPropertyToVariant(), and RtlConvertVariantToProperty().

◆ LdrUnlockLoaderLock()

NTSTATUS NTAPI LdrUnlockLoaderLock ( IN ULONG  Flags,
IN ULONG Cookie  OPTIONAL 
)

Definition at line 101 of file ldrapi.c.

103{
105
106 DPRINT("LdrUnlockLoaderLock(%x %x)\n", Flags, Cookie);
107
108 /* Check for valid flags */
110 {
111 /* Flags are invalid, check how to fail */
113 {
114 /* The caller wants us to raise status */
116 }
117
118 /* A normal failure */
120 }
121
122 /* If we don't have a cookie, just return */
123 if (!Cookie) return STATUS_SUCCESS;
124
125 /* Validate the cookie */
126 if ((Cookie & 0xF0000000) ||
127 ((Cookie >> 16) ^ (HandleToUlong(NtCurrentTeb()->RealClientId.UniqueThread) & 0xFFF)))
128 {
129 DPRINT1("LdrUnlockLoaderLock() called with an invalid cookie!\n");
130
131 /* Invalid cookie, check how to fail */
133 {
134 /* The caller wants us to raise status */
136 }
137
138 /* A normal failure */
140 }
141
142 /* Ready to release the lock */
144 {
145 /* Do a direct leave */
147 }
148 else
149 {
150 /* Wrap this in SEH, since we're not supposed to raise */
152 {
153 /* Leave the lock */
155 }
157 {
158 /* We should use the LDR Filter instead */
160 }
161 _SEH2_END;
162 }
163
164 /* All done */
165 return Status;
166}
#define HandleToUlong(h)
Definition: basetsd.h:79

Referenced by BasepGetModuleHandleExW(), find_query_actctx(), get_module_filename(), GetModuleFileNameW(), LdrAddRefDll(), LdrDisableThreadCalloutsForDll(), LdrEnumerateLoadedModules(), LdrGetDllHandleEx(), LdrInitShimEngineDynamic(), LdrLoadDll(), and LdrUnloadAlternateResourceModule().

◆ LdrVerifyImageMatchesChecksum()

NTSTATUS NTAPI LdrVerifyImageMatchesChecksum ( IN HANDLE  FileHandle,
IN PLDR_CALLBACK  Callback,
IN PVOID  CallbackContext,
OUT PUSHORT  ImageCharacteristics 
)

Definition at line 837 of file ldrapi.c.

841{
842 FILE_STANDARD_INFORMATION FileStandardInfo;
843 PIMAGE_IMPORT_DESCRIPTOR ImportData;
844 PIMAGE_SECTION_HEADER LastSection = NULL;
846 PIMAGE_NT_HEADERS NtHeader;
847 HANDLE SectionHandle;
849 PVOID ViewBase;
850 BOOLEAN Result, NoActualCheck;
852 PVOID ImportName;
853 ULONG Size;
854 DPRINT("LdrVerifyImageMatchesChecksum() called\n");
855
856 /* If the handle has the magic KnownDll flag, skip actual checksums */
857 NoActualCheck = ((ULONG_PTR)FileHandle & 1);
858
859 /* Create the section */
860 Status = NtCreateSection(&SectionHandle,
862 NULL,
863 NULL,
866 FileHandle);
867 if (!NT_SUCCESS(Status))
868 {
869 DPRINT1 ("NtCreateSection() failed (Status 0x%x)\n", Status);
870 return Status;
871 }
872
873 /* Map the section */
874 ViewSize = 0;
875 ViewBase = NULL;
876 Status = NtMapViewOfSection(SectionHandle,
878 &ViewBase,
879 0,
880 0,
881 NULL,
882 &ViewSize,
883 ViewShare,
884 0,
886 if (!NT_SUCCESS(Status))
887 {
888 DPRINT1("NtMapViewOfSection() failed (Status 0x%x)\n", Status);
889 NtClose(SectionHandle);
890 return Status;
891 }
892
893 /* Get the file information */
896 &FileStandardInfo,
899 if (!NT_SUCCESS(Status))
900 {
901 DPRINT1("NtMapViewOfSection() failed (Status 0x%x)\n", Status);
903 NtClose(SectionHandle);
904 return Status;
905 }
906
907 /* Protect with SEH */
909 {
910 /* Check if this is the KnownDll hack */
911 if (NoActualCheck)
912 {
913 /* Don't actually do it */
914 Result = TRUE;
915 }
916 else
917 {
918 /* Verify the checksum */
920 FileStandardInfo.EndOfFile.LowPart,
921 FileStandardInfo.EndOfFile.LowPart);
922 }
923
924 /* Check if a callback was supplied */
925 if ((Result) && (Callback))
926 {
927 /* Get the NT Header */
928 NtHeader = RtlImageNtHeader(ViewBase);
929
930 /* Check if caller requested this back */
931 if (ImageCharacteristics)
932 {
933 /* Return to caller */
934 *ImageCharacteristics = NtHeader->FileHeader.Characteristics;
935 }
936
937 /* Get the Import Directory Data */
938 ImportData = RtlImageDirectoryEntryToData(ViewBase,
939 FALSE,
941 &Size);
942
943 /* Make sure there is one */
944 if (ImportData)
945 {
946 /* Loop the imports */
947 while (ImportData->Name)
948 {
949 /* Get the name */
950 ImportName = RtlImageRvaToVa(NtHeader,
951 ViewBase,
952 ImportData->Name,
953 &LastSection);
954
955 /* Notify the callback */
956 Callback(CallbackContext, ImportName);
957 ImportData++;
958 }
959 }
960 }
961 }
963 {
964 /* Fail the request returning STATUS_IMAGE_CHECKSUM_MISMATCH */
965 Result = FALSE;
966 }
967 _SEH2_END;
968
969 /* Unmap file and close handle */
971 NtClose(SectionHandle);
972
973 /* Return status */
975}
NTSTATUS NTAPI NtCreateSection(OUT PHANDLE SectionHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN PLARGE_INTEGER MaximumSize OPTIONAL, IN ULONG SectionPageProtection OPTIONAL, IN ULONG AllocationAttributes, IN HANDLE FileHandle OPTIONAL)
Definition: section.c:3441
NTSTATUS NTAPI NtMapViewOfSection(IN HANDLE SectionHandle, IN HANDLE ProcessHandle, IN OUT PVOID *BaseAddress, IN ULONG_PTR ZeroBits, IN SIZE_T CommitSize, IN OUT PLARGE_INTEGER SectionOffset OPTIONAL, IN OUT PSIZE_T ViewSize, IN SECTION_INHERIT InheritDisposition, IN ULONG AllocationType, IN ULONG Protect)
Definition: section.c:3622
#define RtlImageRvaToVa
Definition: compat.h:807
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE FileHandle
Definition: fltkernel.h:1231
BOOLEAN NTAPI LdrVerifyMappedImageMatchesChecksum(_In_ PVOID BaseAddress, _In_ SIZE_T NumberOfBytes, _In_ ULONG FileLength)
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID _In_ ULONG_PTR _In_ SIZE_T _Inout_opt_ PLARGE_INTEGER _Inout_ PSIZE_T ViewSize
Definition: mmfuncs.h:408
#define SEC_COMMIT
Definition: mmtypes.h:100
#define SECTION_MAP_EXECUTE
Definition: nt_native.h:1290
#define PAGE_EXECUTE
Definition: nt_native.h:1306
NTSYSAPI NTSTATUS NTAPI NtQueryInformationFile(IN HANDLE hFile, OUT PIO_STATUS_BLOCK pIoStatusBlock, OUT PVOID FileInformationBuffer, IN ULONG FileInformationBufferLength, IN FILE_INFORMATION_CLASS FileInfoClass)
@ ViewShare
Definition: nt_native.h:1278
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
#define STATUS_IMAGE_CHECKSUM_MISMATCH
Definition: ntstatus.h:677
#define IMAGE_DIRECTORY_ENTRY_IMPORT
Definition: pedump.c:260
#define FileStandardInformation
Definition: propsheet.cpp:61
IMAGE_FILE_HEADER FileHeader
Definition: ntddk_ex.h:183
ULONG_PTR SIZE_T
Definition: typedefs.h:80
ULONG LowPart
Definition: typedefs.h:106
_In_ WDFINTERRUPT _In_ PFN_WDF_INTERRUPT_SYNCHRONIZE Callback
Definition: wdfinterrupt.h:458
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR _In_ ULONGLONG _In_ ULONGLONG _In_opt_ PEVENT_FILTER_DESCRIPTOR _Inout_opt_ PVOID CallbackContext
Definition: wmitypes.h:60
_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

Referenced by SmpInitializeKnownDllsInternal().

◆ RtlDllShutdownInProgress()

BOOLEAN NTAPI RtlDllShutdownInProgress ( VOID  )

Definition at line 1587 of file ldrapi.c.

1588{
1589 /* Return the internal global */
1591}

Variable Documentation

◆ AlternateResourceModuleCount

ULONG AlternateResourceModuleCount

Definition at line 23 of file ldrapi.c.

Referenced by LdrUnloadAlternateResourceModule().

◆ LdrApiDefaultExtension

◆ LdrpBreakOnRecursiveDllLoads

BOOLEAN LdrpBreakOnRecursiveDllLoads

Definition at line 21 of file ldrapi.c.

Referenced by LdrLoadDll().

◆ LdrpLoaderLockAcquisitionCount

LONG LdrpLoaderLockAcquisitionCount

Definition at line 20 of file ldrapi.c.

Referenced by LdrpMakeCookie().

◆ LdrpManifestProberRoutine

PLDR_MANIFEST_PROBER_ROUTINE LdrpManifestProberRoutine
extern

Definition at line 18 of file ldrpe.c.

Referenced by LdrpWalkImportDescriptor(), and LdrSetDllManifestProber().

◆ LdrpShowRecursiveLoads

BOOLEAN LdrpShowRecursiveLoads

Definition at line 21 of file ldrapi.c.

Referenced by LdrLoadDll().

◆ LdrpUnloadHead

LIST_ENTRY LdrpUnloadHead

Definition at line 19 of file ldrapi.c.

Referenced by LdrUnloadDll().