ReactOS  0.4.15-dev-1054-gd029a62
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 
26 typedef struct _LDRP_TLS_DATA
27 {
31 
32 typedef
36  _In_ PCWSTR DllName,
38  _Inout_opt_ PULONG DllCharacteristics,
40  _Outptr_ PWSTR* EffectiveDllPath);
41 
42 /* Global data */
44 extern BOOLEAN LdrpInLdrInit;
45 extern PVOID LdrpHeap;
47 extern BOOLEAN ShowSnaps;
62 extern BOOLEAN g_ShimsEnabled;
69 
70 /* ldrinit.c */
82 
83 /* ldrpe.c */
85 NTAPI
86 LdrpSnapThunk(IN PVOID ExportBase,
87  IN PVOID ImportBase,
88  IN PIMAGE_THUNK_DATA OriginalThunk,
89  IN OUT PIMAGE_THUNK_DATA Thunk,
90  IN PIMAGE_EXPORT_DIRECTORY ExportEntry,
91  IN ULONG ExportSize,
93  IN LPSTR DllName);
94 
97  IN PLDR_DATA_TABLE_ENTRY LdrEntry);
98 
99 
100 /* ldrutils.c */
104  IN ULONG Ordinal,
105  OUT PVOID *ProcedureAddress,
106  IN BOOLEAN ExecuteInit);
107 
110 
111 VOID NTAPI
113 
115 LdrpLoadDll(IN BOOLEAN Redirected,
117  IN PULONG DllCharacteristics OPTIONAL,
118  IN PUNICODE_STRING DllName,
120  IN BOOLEAN CallInit);
121 
122 VOID NTAPI
124  IN ULONG Flags);
125 
126 ULONG NTAPI
128 
129 NTSTATUS
130 NTAPI
131 LdrpSetProtection(PVOID ViewBase,
132  BOOLEAN Restore);
133 
134 BOOLEAN
135 NTAPI
137  OUT PLDR_DATA_TABLE_ENTRY *LdrEntry);
138 
141  IN PUNICODE_STRING DllName,
142  IN BOOLEAN Flag,
143  IN BOOLEAN RedirectedDll,
144  OUT PLDR_DATA_TABLE_ENTRY *LdrEntry);
145 
148  IN PWSTR DllPath2,
149  IN PWSTR DllName OPTIONAL,
150  IN PULONG DllCharacteristics,
151  IN BOOLEAN Static,
152  IN BOOLEAN Redirect,
153  OUT PLDR_DATA_TABLE_ENTRY *DataTableEntry);
154 
155 PVOID NTAPI
157 
158 VOID NTAPI
160 
161 VOID NTAPI
163 
164 VOID NTAPI
166 
167 VOID
168 NTAPI
170  IN PUNICODE_STRING ProcessImage,
171  IN PVOID pShimData);
172 
173 VOID NTAPI
175 
176 /* verifier.c */
177 
180  IN PPEB Peb,
181  IN BOOLEAN SystemWide,
182  IN BOOLEAN ReadAdvancedOptions);
183 
186 
187 VOID NTAPI
189 
190 VOID NTAPI
192 
193 VOID NTAPI
195 
196 
197 /* FIXME: Cleanup this mess */
200  PVOID ImageBase,
201  HANDLE SectionHandle,
202  PIMAGE_NT_HEADERS NTHeaders);
204  PHANDLE NTDllSectionHandle);
205 ULONG
207 
208 NTSTATUS
209 NTAPI
211  IN LPSTR ImportName,
212  OUT PLDR_DATA_TABLE_ENTRY *DataTableEntry,
213  OUT PBOOLEAN Existing);
214 
215 VOID
216 NTAPI
218 
219 
220 /* path.c */
221 BOOLEAN
222 NTAPI
225 );
226 
227 /* EOF */
NTSTATUS LdrMapSections(HANDLE ProcessHandle, PVOID ImageBase, HANDLE SectionHandle, PIMAGE_NT_HEADERS NTHeaders)
VOID NTAPI LdrpCallTlsInitializers(IN PLDR_DATA_TABLE_ENTRY LdrEntry, IN ULONG Reason)
Definition: ldrutils.c:473
Definition: window.h:584
ULONG LdrpFatalHardErrorCount
Definition: ldrinit.c:83
const uint16_t * PCWSTR
Definition: typedefs.h:57
#define IN
Definition: typedefs.h:39
VOID NTAPI LdrpUpdateLoadCount2(IN PLDR_DATA_TABLE_ENTRY LdrEntry, IN ULONG Flags)
Definition: ldrutils.c:460
BOOLEAN g_ShimsEnabled
Definition: ldrutils.c:21
IMAGE_TLS_DIRECTORY TlsDirectory
Definition: ntdllp.h:29
VOID NTAPI LdrpFreeTls(VOID)
Definition: ldrinit.c:1380
VOID NTAPI LdrpFreeUnicodeString(PUNICODE_STRING String)
PPEB Peb
Definition: dllmain.c:27
NTSTATUS NTAPI LdrpWalkImportDescriptor(IN LPWSTR DllPath OPTIONAL, IN PLDR_DATA_TABLE_ENTRY LdrEntry)
Definition: ldrpe.c:670
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
PVOID g_pfnSE_ProcessDying
Definition: ldrutils.c:27
BOOLEAN LdrpLdrDatabaseIsSetup
Definition: ldrinit.c:33
PLDR_DATA_TABLE_ENTRY LdrpLoadedDllHandleCache
Definition: ldrutils.c:19
uint16_t * PWSTR
Definition: typedefs.h:56
PVOID g_pfnSE_DllLoaded
Definition: ldrutils.c:23
VOID NTAPI LdrpGetShimEngineInterface(VOID)
UNICODE_STRING LdrpDefaultPath
Definition: ldrinit.c:65
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN ShowSnaps
Definition: ldrinit.c:81
_In_opt_ ULONG Base
Definition: rtlfuncs.h:2373
#define _Outptr_
Definition: no_sal2.h:396
VOID NTAPI LdrpRecordUnloadEvent(_In_ PLDR_DATA_TABLE_ENTRY LdrEntry)
Definition: trace.c:28
static WCHAR String[]
Definition: stringtable.c:55
char * LPSTR
Definition: xmlstorage.h:182
ULONG LdrpActiveUnloadCount
Definition: ldrinit.c:84
BOOLEAN RtlpPageHeapEnabled
Definition: heappage.c:106
VOID NTAPI AVrfPageHeapDllNotification(IN PLDR_DATA_TABLE_ENTRY LdrEntry)
Definition: verifier.c:361
NTSTATUS NTAPI LdrpAllocateTls(VOID)
Definition: ldrinit.c:1317
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
#define SearchPath
Definition: winbase.h:3740
NTSTATUS NTAPI LdrpInitializeTls(VOID)
Definition: ldrinit.c:1254
PVOID g_pfnSE_DllUnloaded
Definition: ldrutils.c:24
NTSTATUS NTAPI LdrpRunInitializeRoutines(IN PCONTEXT Context OPTIONAL)
Definition: ldrinit.c:637
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:1976
struct _PEB * PPEB
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
VOID NTAPI AVrfDllLoadNotification(IN PLDR_DATA_TABLE_ENTRY LdrEntry)
Definition: verifier.c:294
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
NTSTATUS LdrMapNTDllForProcess(HANDLE ProcessHandle, PHANDLE NTDllSectionHandle)
LIST_ENTRY LdrpHashTable[LDR_HASH_TABLE_ENTRIES]
Definition: ldrinit.c:60
LIST_ENTRY TlsLinks
Definition: ntdllp.h:28
VOID NTAPI LdrpUnloadShimEngine(VOID)
PLDR_DATA_TABLE_ENTRY LdrpCurrentDllInitializer
Definition: ldrinit.c:43
unsigned char BOOLEAN
ULONG RtlpDphGlobalFlags
Definition: heappage.c:107
PVOID NTAPI LdrpFetchAddressOfEntryPoint(PVOID ImageBase)
BOOLEAN(NTAPI * PDLL_INIT_ROUTINE)(_In_ PVOID DllHandle, _In_ ULONG Reason, _In_opt_ PCONTEXT Context)
Definition: ldrtypes.h:254
VOID NTAPI AVrfDllUnloadNotification(IN PLDR_DATA_TABLE_ENTRY LdrEntry)
Definition: verifier.c:328
VOID NTAPI LdrpInitFailure(NTSTATUS Status)
Definition: ldrinit.c:2532
NTSTATUS NTAPI LdrpInitializeApplicationVerifierPackage(IN HANDLE KeyHandle, IN PPEB Peb, IN BOOLEAN SystemWide, IN BOOLEAN ReadAdvancedOptions)
VOID NTAPI LdrpFinalizeAndDeallocateDataTableEntry(IN PLDR_DATA_TABLE_ENTRY Entry)
Definition: ldrutils.c:1595
_In_opt_ PVOID _In_opt_ PVOID SystemArgument1
Definition: ketypes.h:675
struct _LDRP_TLS_DATA LDRP_TLS_DATA
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
VOID NTAPI LdrpLoadShimEngine(IN PWSTR ImageName, IN PUNICODE_STRING ProcessImage, IN PVOID pShimData)
Definition: ldrutils.c:2768
NTSTATUS NTAPI LdrpInitializeProcess(IN PCONTEXT Context, IN PVOID SystemArgument1)
Definition: ldrinit.c:1753
HANDLE LdrpKnownDllObjectDirectory
Definition: ldrinit.c:62
Definition: xml2sdb.h:79
VOID NTAPI LdrpEnsureLoaderLockIsHeld(VOID)
Definition: ldrinit.c:405
NTSTATUS NTAPI LdrpGetProcedureAddress(IN PVOID BaseAddress, IN PANSI_STRING Name, IN ULONG Ordinal, OUT PVOID *ProcedureAddress, IN BOOLEAN ExecuteInit)
Definition: ldrutils.c:2249
PVOID g_pfnSE_InstallAfterInit
Definition: ldrutils.c:26
ULONG NTAPI LdrpClearLoadInProgress(VOID)
Definition: ldrutils.c:2660
PLDR_DATA_TABLE_ENTRY LdrpGetModuleHandleCache
Definition: ldrutils.c:19
static const char * ImageName
Definition: image.c:34
char * PBOOLEAN
Definition: retypes.h:11
Status
Definition: gdiplustypes.h:24
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:1020
#define NTSTATUS
Definition: precomp.h:20
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:454
Definition: btrfs_drv.h:1922
PUNICODE_STRING LdrpTopLevelDllBeingLoaded
Definition: ldrinit.c:40
ULONG LdrpNumberOfProcessors
Definition: ldrinit.c:55
Definition: typedefs.h:119
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:2426
#define LDR_HASH_TABLE_ENTRIES
Definition: ntdllp.h:11
VOID NTAPI LdrpInsertMemoryTableEntry(IN PLDR_DATA_TABLE_ENTRY LdrEntry)
Definition: ldrutils.c:1579
UNICODE_STRING LdrpKnownDllPath
Definition: ldrinit.c:63
NTSTATUS NTAPI AVrfInitializeVerifier(VOID)
Definition: verifier.c:612
#define _In_
Definition: no_sal2.h:204
BOOLEAN LdrpShutdownInProgress
Definition: ldrinit.c:34
NTSTATUS NTAPI LdrpSetProtection(PVOID ViewBase, BOOLEAN Restore)
Definition: ldrutils.c:944
BOOLEAN NTAPI RtlDoesFileExists_UStr(IN PUNICODE_STRING FileName)
Definition: path.c:1384
NTSTATUS NTAPI LdrpLoadImportModule(IN PWSTR DllPath OPTIONAL, IN LPSTR ImportName, OUT PLDR_DATA_TABLE_ENTRY *DataTableEntry, OUT PBOOLEAN Existing)
Definition: ldrpe.c:808
PLDR_DATA_TABLE_ENTRY NTAPI LdrpAllocateDataTableEntry(IN PVOID BaseAddress)
Definition: ldrutils.c:1546
static const char const char * DllPath
Definition: image.c:34
#define OPTIONAL
Definition: typedefs.h:41
unsigned int * PULONG
Definition: retypes.h:1
struct tagCallbackData CallbackData
Definition: fltkernel.h:2091
PVOID g_pfnSE_InstallBeforeInit
Definition: ldrutils.c:25
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:950
VOID NTAPI LdrpInitializeThread(IN PCONTEXT Context)
Definition: ldrinit.c:502
#define OUT
Definition: typedefs.h:40
BOOLEAN NTAPI LdrpCheckForLoadedDllHandle(IN PVOID Base, OUT PLDR_DATA_TABLE_ENTRY *LdrEntry)
Definition: ldrutils.c:1618
RTL_CRITICAL_SECTION LdrpLoaderLock
Definition: ldrinit.c:70
unsigned int ULONG
Definition: retypes.h:1
BOOLEAN LdrpInLdrInit
Definition: ldrinit.c:30
UNICODE_STRING LdrApiDefaultExtension
Definition: ldrapi.c:22
WCHAR * LPWSTR
Definition: xmlstorage.h:184
ULONG LdrpGetResidentSize(PIMAGE_NT_HEADERS NTHeaders)
_In_ HANDLE ProcessHandle
Definition: mmfuncs.h:403
VOID NTAPI LdrpValidateImageForMp(IN PLDR_DATA_TABLE_ENTRY LdrDataTableEntry)
Definition: ldrinit.c:1535
PVOID PVOID PWCHAR PVOID USHORT PULONG Reason
Definition: env.c:45
PVOID LdrpHeap
Definition: ldrinit.c:59
base of all file and directory entries
Definition: entries.h:82
struct _LDRP_TLS_DATA * PLDRP_TLS_DATA
PVOID g_pShimEngineModule
Definition: ldrutils.c:22
#define _Inout_opt_
Definition: no_sal2.h:258
BOOLEAN NTAPI LdrpCallInitRoutine(IN PDLL_INIT_ROUTINE EntryPoint, IN PVOID BaseAddress, IN ULONG Reason, IN PVOID Context)
Definition: ldrutils.c:100
NTSTATUS(NTAPI * PEPFUNC)(PPEB)
Definition: ntdllp.h:198
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68