ReactOS  0.4.14-dev-50-g13bb5e2
ldrtypes.h
Go to the documentation of this file.
1 /*++ NDK Version: 0098
2 
3 Copyright (c) Alex Ionescu. All rights reserved.
4 
5 Header Name:
6 
7  ldrtypes.h
8 
9 Abstract:
10 
11  Type definitions for the Loader.
12 
13 Author:
14 
15  Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
16 
17 --*/
18 
19 #ifndef _LDRTYPES_H
20 #define _LDRTYPES_H
21 
22 //
23 // Dependencies
24 //
25 #include <umtypes.h>
26 
27 //
28 // Resource Type Levels
29 //
30 #define RESOURCE_TYPE_LEVEL 0
31 #define RESOURCE_NAME_LEVEL 1
32 #define RESOURCE_LANGUAGE_LEVEL 2
33 #define RESOURCE_DATA_LEVEL 3
34 
35 //
36 // Loader Data Table Entry Flags
37 //
38 #define LDRP_STATIC_LINK 0x00000002
39 #define LDRP_IMAGE_DLL 0x00000004
40 #define LDRP_SHIMENG_SUPPRESSED_ENTRY 0x00000008
41 #define LDRP_IMAGE_INTEGRITY_FORCED 0x00000020
42 #define LDRP_LOAD_IN_PROGRESS 0x00001000
43 #define LDRP_UNLOAD_IN_PROGRESS 0x00002000
44 #define LDRP_ENTRY_PROCESSED 0x00004000
45 #define LDRP_ENTRY_INSERTED 0x00008000
46 #define LDRP_CURRENT_LOAD 0x00010000
47 #define LDRP_FAILED_BUILTIN_LOAD 0x00020000
48 #define LDRP_DONT_CALL_FOR_THREADS 0x00040000
49 #define LDRP_PROCESS_ATTACH_CALLED 0x00080000
50 #define LDRP_DEBUG_SYMBOLS_LOADED 0x00100000
51 #define LDRP_IMAGE_NOT_AT_BASE 0x00200000
52 #define LDRP_COR_IMAGE 0x00400000
53 #define LDR_COR_OWNS_UNMAP 0x00800000
54 #define LDRP_SYSTEM_MAPPED 0x01000000
55 #define LDRP_IMAGE_VERIFYING 0x02000000
56 #define LDRP_DRIVER_DEPENDENT_DLL 0x04000000
57 #define LDRP_ENTRY_NATIVE 0x08000000
58 #define LDRP_REDIRECTED 0x10000000
59 #define LDRP_NON_PAGED_DEBUG_INFO 0x20000000
60 #define LDRP_MM_LOADED 0x40000000
61 #define LDRP_COMPAT_DATABASE_PROCESSED 0x80000000
62 
63 //
64 // Dll Characteristics for LdrLoadDll
65 //
66 #define LDR_IGNORE_CODE_AUTHZ_LEVEL 0x00001000
67 
68 //
69 // LdrAddRef Flags
70 //
71 #define LDR_ADDREF_DLL_PIN 0x00000001
72 
73 //
74 // LdrLockLoaderLock Flags
75 //
76 #define LDR_LOCK_LOADER_LOCK_FLAG_RAISE_ON_ERRORS 0x00000001
77 #define LDR_LOCK_LOADER_LOCK_FLAG_TRY_ONLY 0x00000002
78 
79 //
80 // LdrUnlockLoaderLock Flags
81 //
82 #define LDR_UNLOCK_LOADER_LOCK_FLAG_RAISE_ON_ERRORS 0x00000001
83 
84 //
85 // LdrGetDllHandleEx Flags
86 //
87 #define LDR_GET_DLL_HANDLE_EX_UNCHANGED_REFCOUNT 0x00000001
88 #define LDR_GET_DLL_HANDLE_EX_PIN 0x00000002
89 
90 
91 #define LDR_LOCK_LOADER_LOCK_DISPOSITION_INVALID 0
92 #define LDR_LOCK_LOADER_LOCK_DISPOSITION_LOCK_ACQUIRED 1
93 #define LDR_LOCK_LOADER_LOCK_DISPOSITION_LOCK_NOT_ACQUIRED 2
94 
95 //
96 // FIXME: THIS SHOULD *NOT* BE USED!
97 //
98 #define IMAGE_SCN_TYPE_NOLOAD 0x00000002
99 
100 //
101 // Loader datafile/imagemapping macros
102 //
103 #define LDR_IS_DATAFILE(handle) (((ULONG_PTR)(handle)) & (ULONG_PTR)1)
104 #define LDR_IS_IMAGEMAPPING(handle) (((ULONG_PTR)(handle)) & (ULONG_PTR)2)
105 #define LDR_IS_RESOURCE(handle) (LDR_IS_IMAGEMAPPING(handle) || LDR_IS_DATAFILE(handle))
106 
107 //
108 // Activation Context
109 //
111 
112 //
113 // Loader Data stored in the PEB
114 //
115 typedef struct _PEB_LDR_DATA
116 {
117  ULONG Length;
124 #if (NTDDI_VERSION >= NTDDI_WIN7)
127 #endif
129 
130 //
131 // Loader Data Table Entry
132 //
133 // NOTE: The field 'InMemoryOrderLinks' MUST have that name.
134 // It's hard-coded into WinDbg for PEB dumping!
135 //
136 typedef struct _LDR_DATA_TABLE_ENTRY
137 {
141  PVOID DllBase;
146  ULONG Flags;
149  union
150  {
152  struct
153  {
155  ULONG CheckSum;
156  };
157  };
158  union
159  {
162  };
166 
167 //
168 // Loaded Imports Reference Counting in Kernel
169 //
170 typedef struct _LOAD_IMPORTS
171 {
175 
176 //
177 // Loader Resource Information
178 //
179 typedef struct _LDR_RESOURCE_INFO
180 {
185 
187 {
195 
196 //
197 // DLL Notifications
198 //
200 {
207 
208 typedef VOID
210  _In_ BOOLEAN Type,
212 );
213 
215 {
219 
220 //
221 // Alternate Resources Support
222 //
223 typedef struct _ALT_RESOURCE_MODULE
224 {
227 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
229 #endif
231 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
235 #endif
237 
238 //
239 // Callback function for LdrEnumerateLoadedModules
240 //
241 typedef VOID (NTAPI LDR_ENUM_CALLBACK)(_In_ PLDR_DATA_TABLE_ENTRY ModuleInformation, _In_ PVOID Parameter, _Out_ BOOLEAN *Stop);
242 typedef LDR_ENUM_CALLBACK *PLDR_ENUM_CALLBACK;
243 
244 //
245 // Manifest prober routine set via LdrSetDllManifestProber
246 //
247 typedef NTSTATUS (NTAPI LDR_MANIFEST_PROBER_ROUTINE)(_In_ PVOID DllHandle, _In_ PCWSTR FullDllName, _Out_ PVOID *ActCtx);
248 typedef LDR_MANIFEST_PROBER_ROUTINE *PLDR_MANIFEST_PROBER_ROUTINE;
249 
250 //
251 // DLL Main Routine
252 //
253 typedef BOOLEAN
255  _In_ PVOID DllHandle,
256  _In_ ULONG Reason,
258 );
259 
260 #endif
BOOLEAN Initialized
Definition: ntddk_ex.h:222
Definition: ldrtypes.h:214
const uint16_t * PCWSTR
Definition: typedefs.h:55
struct _LDR_DATA_TABLE_ENTRY * PLDR_DATA_TABLE_ENTRY
struct _LOAD_IMPORTS LOAD_IMPORTS
struct _LDR_DLL_LOADED_NOTIFICATION_DATA * PLDR_DLL_LOADED_NOTIFICATION_DATA
LIST_ENTRY InInitializationOrderModuleList
Definition: ldrtypes.h:122
Type
Definition: Type.h:6
LIST_ENTRY NotificationListEntry
Definition: ldrtypes.h:216
struct _LDR_ENUM_RESOURCE_INFO * PLDR_ENUM_RESOURCE_INFO
LIST_ENTRY InLoadOrderModuleList
Definition: ldrtypes.h:120
PLDR_DLL_LOADED_NOTIFICATION_CALLBACK Callback
Definition: ldrtypes.h:217
struct _LOAD_IMPORTS * PLOAD_IMPORTS
LIST_ENTRY InMemoryOrderModuleList
Definition: btrfs_drv.h:1799
ULONG SizeOfImage
Definition: ldrtypes.h:143
WORD LANGID
Definition: typedefs.h:79
_In_ PVOID Parameter
Definition: ldrtypes.h:241
struct _PEB_LDR_DATA * PPEB_LDR_DATA
ULONG_PTR Type
Definition: ldrtypes.h:181
#define _In_opt_
Definition: no_sal2.h:213
_In_ PVOID _Out_ BOOLEAN * Stop
Definition: ldrtypes.h:241
uint32_t ULONG_PTR
Definition: typedefs.h:63
typedef NTSTATUS(NTAPI LDR_MANIFEST_PROBER_ROUTINE)(_In_ PVOID DllHandle
PVOID DllBase
Definition: btrfs_drv.h:1784
struct _LDR_DLL_LOADED_NOTIFICATION_ENTRY LDR_DLL_LOADED_NOTIFICATION_ENTRY
LDR_MANIFEST_PROBER_ROUTINE * PLDR_MANIFEST_PROBER_ROUTINE
Definition: ldrtypes.h:248
USHORT TlsIndex
Definition: ntddk_ex.h:209
PVOID ShutdownThreadId
Definition: ldrtypes.h:126
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
struct _LDR_ENUM_RESOURCE_INFO LDR_ENUM_RESOURCE_INFO
PVOID EntryPoint
Definition: ntddk_ex.h:203
HANDLE AlternateFileHandle
Definition: ldrtypes.h:232
unsigned char BOOLEAN
PVOID EntryInProgress
Definition: ldrtypes.h:123
ULONG_PTR Name
Definition: ldrtypes.h:182
BOOLEAN(NTAPI * PDLL_INIT_ROUTINE)(_In_ PVOID DllHandle, _In_ ULONG Reason, _In_opt_ PCONTEXT Context)
Definition: ldrtypes.h:254
struct _ALT_RESOURCE_MODULE ALT_RESOURCE_MODULE
#define _Out_
Definition: no_sal2.h:323
_In_ LPGUID _In_ PVOID Data
Definition: classpnp.h:778
LDR_ENUM_CALLBACK * PLDR_ENUM_CALLBACK
Definition: ldrtypes.h:242
_In_ PCWSTR FullDllName
Definition: ldrtypes.h:247
struct _LDR_RESOURCE_INFO LDR_RESOURCE_INFO
ULONG Length
Definition: ntddk_ex.h:221
PVOID SsHandle
Definition: ldrtypes.h:119
struct _LDR_DLL_LOADED_NOTIFICATION_DATA LDR_DLL_LOADED_NOTIFICATION_DATA
PVOID PatchInformation
Definition: ldrtypes.h:164
typedef VOID(NTAPI LDR_ENUM_CALLBACK)(_In_ PLDR_DATA_TABLE_ENTRY ModuleInformation
PVOID LoadedImports
Definition: ldrtypes.h:161
struct _ALT_RESOURCE_MODULE * PALT_RESOURCE_MODULE
ULONG CheckSum
Definition: btrfs_drv.h:1790
_In_ PCWSTR _Out_ PVOID * ActCtx
Definition: ldrtypes.h:247
unsigned char UCHAR
Definition: xmlstorage.h:181
struct _PEB_LDR_DATA PEB_LDR_DATA
LIST_ENTRY HashLinks
Definition: ldrtypes.h:151
struct _LDR_DATA_TABLE_ENTRY LDR_DATA_TABLE_ENTRY
Definition: btrfs_drv.h:1780
Definition: typedefs.h:117
VOID(NTAPI * PLDR_DLL_LOADED_NOTIFICATION_CALLBACK)(_In_ BOOLEAN Type, _In_ struct _LDR_DLL_LOADED_NOTIFICATION_DATA *Data)
Definition: ldrtypes.h:209
PVOID PACTIVATION_CONTEXT
Definition: ldrtypes.h:110
SIZE_T Count
Definition: ldrtypes.h:172
ULONG TimeDateStamp
Definition: btrfs_drv.h:1793
LIST_ENTRY InLoadOrderLinks
Definition: ldrtypes.h:138
#define _In_
Definition: no_sal2.h:204
PVOID SectionPointer
Definition: ntddk_ex.h:213
ULONG_PTR SIZE_T
Definition: typedefs.h:78
unsigned short USHORT
Definition: pedump.c:61
LIST_ENTRY InMemoryOrderLinks
Definition: btrfs_drv.h:1782
UNICODE_STRING FullDllName
Definition: btrfs_drv.h:1786
UNICODE_STRING BaseDllName
Definition: ldrtypes.h:145
PACTIVATION_CONTEXT EntryPointActivationContext
Definition: ldrtypes.h:163
ULONG_PTR Language
Definition: ldrtypes.h:183
#define BOOLEAN
Definition: pedump.c:73
ULONG Flags
Definition: ntddk_ex.h:207
struct tagContext Context
Definition: acpixf.h:1024
unsigned int ULONG
Definition: retypes.h:1
struct _LDR_RESOURCE_INFO * PLDR_RESOURCE_INFO
PVOID PVOID PWCHAR PVOID USHORT PULONG Reason
Definition: env.c:45
struct _LDR_DLL_LOADED_NOTIFICATION_ENTRY * PLDR_DLL_LOADED_NOTIFICATION_ENTRY
LIST_ENTRY InInitializationOrderLinks
Definition: ldrtypes.h:140
base of all file and directory entries
Definition: entries.h:82
USHORT LoadCount
Definition: ntddk_ex.h:208
UCHAR ShutdownInProgress
Definition: ldrtypes.h:125