ReactOS 0.4.16-dev-125-g798ea90
ntdllp.h
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS System Libraries
4 * FILE: dll/ntdll/include/ntdllp.h
5 * PURPOSE: Native Library Internal Header
6 * PROGRAMMER: Alex Ionescu (alex@relsoft.net)
7 */
8
9#pragma once
10
11#define LDR_HASH_TABLE_ENTRIES 32
12#define LDR_GET_HASH_ENTRY(x) (RtlUpcaseUnicodeChar((x)) & (LDR_HASH_TABLE_ENTRIES - 1))
13
14/* LdrpUpdateLoadCount2 flags */
15#define LDRP_UPDATE_REFCOUNT 0x01
16#define LDRP_UPDATE_DEREFCOUNT 0x02
17#define LDRP_UPDATE_PIN 0x03
18
19/* Loader flags */
20#define IMAGE_LOADER_FLAGS_COMPLUS 0x00000001
21#define IMAGE_LOADER_FLAGS_SYSTEM_GLOBAL 0x01000000
22
23/* Page heap flags */
24#define DPH_FLAG_DLL_NOTIFY 0x40
25
26typedef struct _LDRP_TLS_DATA
27{
31
32typedef
36 _In_ PCWSTR DllName,
38 _Inout_opt_ PULONG DllCharacteristics,
40 _Outptr_ PWSTR* EffectiveDllPath);
41
42/* Global data */
45extern PVOID LdrpHeap;
47extern BOOLEAN ShowSnaps;
69
70/* ldrinit.c */
82
83/* ldrpe.c */
86LdrpSnapThunk(IN PVOID ExportBase,
87 IN PVOID ImportBase,
88 IN PIMAGE_THUNK_DATA OriginalThunk,
90 IN PIMAGE_EXPORT_DIRECTORY ExportEntry,
91 IN ULONG ExportSize,
93 IN LPSTR DllName);
94
97 IN PLDR_DATA_TABLE_ENTRY LdrEntry);
98
99/* libsupp.c */
102NTAPI
104 _In_ PUNICODE_STRING OriginalName,
109 _Inout_ PBOOLEAN RedirectedDll);
110
111/* ldrutils.c */
113NTAPI
117 _In_opt_ _When_(Name == NULL, _In_range_(>, 0)) ULONG Ordinal,
118 _Out_ PVOID *ProcedureAddress,
119 _In_ BOOLEAN ExecuteInit);
120
123
126
128LdrpLoadDll(IN BOOLEAN Redirected,
130 IN PULONG DllCharacteristics OPTIONAL,
131 IN PUNICODE_STRING DllName,
133 IN BOOLEAN CallInit);
134
137 IN ULONG Flags);
138
141
143NTAPI
144LdrpSetProtection(PVOID ViewBase,
145 BOOLEAN Restore);
146
148NTAPI
150 OUT PLDR_DATA_TABLE_ENTRY *LdrEntry);
151
154 IN PUNICODE_STRING DllName,
156 IN BOOLEAN RedirectedDll,
157 OUT PLDR_DATA_TABLE_ENTRY *LdrEntry);
158
161 IN PWSTR DllPath2,
162 IN PWSTR DllName OPTIONAL,
163 IN PULONG DllCharacteristics,
165 IN BOOLEAN Redirect,
166 OUT PLDR_DATA_TABLE_ENTRY *DataTableEntry);
167
170
173
176
179
180VOID
181NTAPI
183 IN PUNICODE_STRING ProcessImage,
184 IN PVOID pShimData);
185
188
189/* verifier.c */
190
193 IN PPEB Peb,
194 IN BOOLEAN SystemWide,
195 IN BOOLEAN ReadAdvancedOptions);
196
199
202
205
208
209
210/* FIXME: Cleanup this mess */
213 PVOID ImageBase,
214 HANDLE SectionHandle,
215 PIMAGE_NT_HEADERS NTHeaders);
217 PHANDLE NTDllSectionHandle);
218ULONG
220
222NTAPI
224 IN LPSTR ImportName,
225 OUT PLDR_DATA_TABLE_ENTRY *DataTableEntry,
226 OUT PBOOLEAN Existing);
227
228VOID
229NTAPI
231
232
233/* path.c */
235NTAPI
238);
239
240VOID
241NTAPI
243 VOID);
244
245/* EOF */
unsigned char BOOLEAN
IN PUNICODE_STRING StaticString
IN PUNICODE_STRING IN PUNICODE_STRING DynamicString
LONG NTSTATUS
Definition: precomp.h:26
#define NTSYSAPI
Definition: ntoskrnl.h:12
struct _PEB * PPEB
#define NULL
Definition: types.h:112
#define NTSTATUS
Definition: precomp.h:21
PPEB Peb
Definition: dllmain.c:27
struct tagCallbackData CallbackData
Definition: fltkernel.h:2090
_Inout_opt_ PUNICODE_STRING Extension
Definition: fltkernel.h:1092
Status
Definition: gdiplustypes.h:25
BOOLEAN(NTAPI * PDLL_INIT_ROUTINE)(_In_ PVOID DllHandle, _In_ ULONG Reason, _In_opt_ PCONTEXT Context)
Definition: ldrtypes.h:254
VOID NTAPI LdrpUnloadShimEngine()
Definition: ldrutils.c:2777
VOID NTAPI LdrpGetShimEngineInterface()
Definition: ldrutils.c:2692
PVOID PVOID PWCHAR PVOID USHORT PULONG Reason
Definition: env.c:47
static const char const char * DllPath
Definition: image.c:34
static const char * ImageName
Definition: image.c:34
#define _Notnull_
Definition: ms_sal.h:658
#define _Inout_
Definition: ms_sal.h:378
#define _Outptr_
Definition: ms_sal.h:427
#define _Inout_opt_
Definition: ms_sal.h:379
#define _Out_
Definition: ms_sal.h:345
#define _When_(expr, annos)
Definition: ms_sal.h:254
#define _In_
Definition: ms_sal.h:308
#define _In_opt_
Definition: ms_sal.h:309
#define _In_range_(lb, ub)
Definition: ms_sal.h:571
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4715
_In_ HANDLE ProcessHandle
Definition: mmfuncs.h:403
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
_In_opt_ ULONG Base
Definition: rtlfuncs.h:2451
BOOLEAN LdrpInLdrInit
Definition: ldrinit.c:30
VOID NTAPI LdrpCallTlsInitializers(IN PLDR_DATA_TABLE_ENTRY LdrEntry, IN ULONG Reason)
Definition: ldrutils.c:447
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, _Inout_ PBOOLEAN RedirectedDll)
NTSTATUS NTAPI LdrpInitializeApplicationVerifierPackage(IN HANDLE KeyHandle, IN PPEB Peb, IN BOOLEAN SystemWide, IN BOOLEAN ReadAdvancedOptions)
BOOLEAN NTAPI RtlDoesFileExists_UStr(IN PUNICODE_STRING FileName)
Definition: path.c:1503
ULONG LdrpGetResidentSize(PIMAGE_NT_HEADERS NTHeaders)
BOOLEAN LdrpShutdownInProgress
Definition: ldrinit.c:34
VOID NTAPI LdrpFreeUnicodeString(PUNICODE_STRING String)
PVOID g_pfnSE_InstallBeforeInit
Definition: ldrutils.c:25
NTSTATUS NTAPI LdrpMapDll(IN PWSTR SearchPath OPTIONAL, IN PWSTR DllPath2, IN PWSTR DllName OPTIONAL, IN PULONG DllCharacteristics, IN BOOLEAN Static, IN BOOLEAN Redirect, OUT PLDR_DATA_TABLE_ENTRY *DataTableEntry)
Definition: ldrutils.c:997
PVOID g_pfnSE_InstallAfterInit
Definition: ldrutils.c:26
UNICODE_STRING LdrpDefaultPath
Definition: ldrinit.c:65
VOID NTAPI LdrpLoadShimEngine(IN PWSTR ImageName, IN PUNICODE_STRING ProcessImage, IN PVOID pShimData)
Definition: ldrutils.c:2752
BOOLEAN NTAPI LdrpCheckForLoadedDllHandle(IN PVOID Base, OUT PLDR_DATA_TABLE_ENTRY *LdrEntry)
Definition: ldrutils.c:1595
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:2409
ULONG RtlpDphGlobalFlags
Definition: heappage.c:108
PVOID g_pShimEngineModule
Definition: ldrutils.c:22
VOID NTAPI LdrpFreeTls(VOID)
Definition: ldrinit.c:1384
NTSTATUS NTAPI LdrpWalkImportDescriptor(IN LPWSTR DllPath OPTIONAL, IN PLDR_DATA_TABLE_ENTRY LdrEntry)
Definition: ldrpe.c:670
PVOID g_pfnSE_ProcessDying
Definition: ldrutils.c:27
NTSTATUS NTAPI AVrfInitializeVerifier(VOID)
Definition: verifier.c:612
ULONG LdrpNumberOfProcessors
Definition: ldrinit.c:55
VOID NTAPI LdrpUpdateLoadCount2(IN PLDR_DATA_TABLE_ENTRY LdrEntry, IN ULONG Flags)
Definition: ldrutils.c:434
PVOID LdrpHeap
Definition: ldrinit.c:59
UNICODE_STRING LdrApiDefaultExtension
Definition: ldrapi.c:22
#define LDR_HASH_TABLE_ENTRIES
Definition: ntdllp.h:11
PLDR_DATA_TABLE_ENTRY LdrpCurrentDllInitializer
Definition: ldrinit.c:43
ULONG LdrpActiveUnloadCount
Definition: ldrinit.c:84
NTSTATUS(NTAPI * PEPFUNC)(PPEB)
Definition: ntdllp.h:211
NTSTATUS LdrMapNTDllForProcess(HANDLE ProcessHandle, PHANDLE NTDllSectionHandle)
VOID NTAPI LdrpFinalizeAndDeallocateDataTableEntry(IN PLDR_DATA_TABLE_ENTRY Entry)
Definition: ldrutils.c:1572
NTSTATUS(NTAPI * PLDR_APP_COMPAT_DLL_REDIRECTION_CALLBACK_FUNCTION)(_In_ ULONG Flags, _In_ PCWSTR DllName, _In_ PCWSTR DllPath OPTIONAL, _Inout_opt_ PULONG DllCharacteristics, _In_ PVOID CallbackData, _Outptr_ PWSTR *EffectiveDllPath)
Definition: ntdllp.h:34
PLDR_DATA_TABLE_ENTRY LdrpGetModuleHandleCache
Definition: ldrutils.c:19
NTSTATUS NTAPI LdrpGetProcedureAddress(_In_ PVOID BaseAddress, _In_opt_ _When_(Ordinal==0, _Notnull_) PANSI_STRING Name, _In_opt_ _When_(Name==NULL, _In_range_(>, 0)) ULONG Ordinal, _Out_ PVOID *ProcedureAddress, _In_ BOOLEAN ExecuteInit)
Definition: ldrutils.c:2226
NTSTATUS NTAPI LdrpLoadImportModule(IN PWSTR DllPath OPTIONAL, IN LPSTR ImportName, OUT PLDR_DATA_TABLE_ENTRY *DataTableEntry, OUT PBOOLEAN Existing)
Definition: ldrpe.c:808
VOID NTAPI LdrpInsertMemoryTableEntry(IN PLDR_DATA_TABLE_ENTRY LdrEntry)
Definition: ldrutils.c:1556
ULONG LdrpFatalHardErrorCount
Definition: ldrinit.c:83
NTSTATUS LdrMapSections(HANDLE ProcessHandle, PVOID ImageBase, HANDLE SectionHandle, PIMAGE_NT_HEADERS NTHeaders)
NTSTATUS NTAPI LdrpSetProtection(PVOID ViewBase, BOOLEAN Restore)
Definition: ldrutils.c:921
struct _LDRP_TLS_DATA * PLDRP_TLS_DATA
VOID NTAPI LdrpValidateImageForMp(IN PLDR_DATA_TABLE_ENTRY LdrDataTableEntry)
Definition: ldrinit.c:1539
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:1953
BOOLEAN NTAPI LdrpCallInitRoutine(IN PDLL_INIT_ROUTINE EntryPoint, IN PVOID BaseAddress, IN ULONG Reason, IN PVOID Context)
Definition: ldrutils.c:100
LIST_ENTRY LdrpHashTable[LDR_HASH_TABLE_ENTRIES]
Definition: ldrinit.c:60
UNICODE_STRING LdrpKnownDllPath
Definition: ldrinit.c:63
PVOID NTAPI LdrpFetchAddressOfEntryPoint(PVOID ImageBase)
NTSTATUS NTAPI LdrpInitializeProcess(IN PCONTEXT Context, IN PVOID SystemArgument1)
Definition: ldrinit.c:1757
NTSTATUS NTAPI LdrpRunInitializeRoutines(IN PCONTEXT Context OPTIONAL)
Definition: ldrinit.c:641
BOOLEAN RtlpPageHeapEnabled
Definition: heappage.c:107
PLDR_DATA_TABLE_ENTRY NTAPI LdrpAllocateDataTableEntry(IN PVOID BaseAddress)
Definition: ldrutils.c:1523
BOOLEAN LdrpLdrDatabaseIsSetup
Definition: ldrinit.c:33
VOID NTAPI AVrfDllUnloadNotification(IN PLDR_DATA_TABLE_ENTRY LdrEntry)
Definition: verifier.c:328
BOOLEAN ShowSnaps
Definition: ldrinit.c:81
HANDLE LdrpKnownDllObjectDirectory
Definition: ldrinit.c:62
VOID NTAPI LdrpRecordUnloadEvent(_In_ PLDR_DATA_TABLE_ENTRY LdrEntry)
Definition: trace.c:28
BOOLEAN g_ShimsEnabled
Definition: ldrutils.c:21
RTL_CRITICAL_SECTION LdrpLoaderLock
Definition: ldrinit.c:70
VOID NTAPI LdrpInitFailure(NTSTATUS Status)
Definition: ldrinit.c:2544
PUNICODE_STRING LdrpTopLevelDllBeingLoaded
Definition: ldrinit.c:40
VOID NTAPI AVrfDllLoadNotification(IN PLDR_DATA_TABLE_ENTRY LdrEntry)
Definition: verifier.c:294
NTSTATUS NTAPI LdrpInitializeTls(VOID)
Definition: ldrinit.c:1258
VOID NTAPI LdrpEnsureLoaderLockIsHeld(VOID)
Definition: ldrinit.c:409
NTSTATUS NTAPI LdrpSnapThunk(IN PVOID ExportBase, IN PVOID ImportBase, IN PIMAGE_THUNK_DATA OriginalThunk, IN OUT PIMAGE_THUNK_DATA Thunk, IN PIMAGE_EXPORT_DIRECTORY ExportEntry, IN ULONG ExportSize, IN BOOLEAN Static, IN LPSTR DllName)
Definition: ldrpe.c:937
ULONG NTAPI LdrpClearLoadInProgress(VOID)
Definition: ldrutils.c:2644
struct _LDRP_TLS_DATA LDRP_TLS_DATA
PVOID g_pfnSE_DllUnloaded
Definition: ldrutils.c:24
VOID NTAPI AVrfPageHeapDllNotification(IN PLDR_DATA_TABLE_ENTRY LdrEntry)
Definition: verifier.c:361
VOID NTAPI LdrpInitializeThread(IN PCONTEXT Context)
Definition: ldrinit.c:506
PLDR_DATA_TABLE_ENTRY LdrpLoadedDllHandleCache
Definition: ntdllp.h:59
PVOID g_pfnSE_DllLoaded
Definition: ldrutils.c:23
NTSTATUS NTAPI LdrpAllocateTls(VOID)
Definition: ldrinit.c:1321
VOID NTAPI RtlpInitializeKeyedEvent(VOID)
Definition: condvar.c:460
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:455
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
base of all file and directory entries
Definition: entries.h:83
Definition: xml2sdb.h:80
Definition: window.h:585
IMAGE_TLS_DIRECTORY TlsDirectory
Definition: ntdllp.h:29
LIST_ENTRY TlsLinks
Definition: ntdllp.h:28
Definition: btrfs_drv.h:1876
Definition: typedefs.h:120
uint16_t * PWSTR
Definition: typedefs.h:56
#define OPTIONAL
Definition: typedefs.h:41
uint32_t * PULONG
Definition: typedefs.h:59
const uint16_t * PCWSTR
Definition: typedefs.h:57
unsigned char * PBOOLEAN
Definition: typedefs.h:53
#define NTAPI
Definition: typedefs.h:36
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2433
#define SearchPath
Definition: winbase.h:3900
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
_In_opt_ PVOID _In_opt_ PVOID SystemArgument1
Definition: ketypes.h:688
char * LPSTR
Definition: xmlstorage.h:182
WCHAR * LPWSTR
Definition: xmlstorage.h:184
_In_ PUNICODE_STRING NewName
Definition: zwfuncs.h:1203