ReactOS  0.4.13-dev-99-g7e18b6d
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_LOAD_IN_PROGRESS 0x00001000
42 #define LDRP_UNLOAD_IN_PROGRESS 0x00002000
43 #define LDRP_ENTRY_PROCESSED 0x00004000
44 #define LDRP_ENTRY_INSERTED 0x00008000
45 #define LDRP_CURRENT_LOAD 0x00010000
46 #define LDRP_FAILED_BUILTIN_LOAD 0x00020000
47 #define LDRP_DONT_CALL_FOR_THREADS 0x00040000
48 #define LDRP_PROCESS_ATTACH_CALLED 0x00080000
49 #define LDRP_DEBUG_SYMBOLS_LOADED 0x00100000
50 #define LDRP_IMAGE_NOT_AT_BASE 0x00200000
51 #define LDRP_COR_IMAGE 0x00400000
52 #define LDR_COR_OWNS_UNMAP 0x00800000
53 #define LDRP_SYSTEM_MAPPED 0x01000000
54 #define LDRP_IMAGE_VERIFYING 0x02000000
55 #define LDRP_DRIVER_DEPENDENT_DLL 0x04000000
56 #define LDRP_ENTRY_NATIVE 0x08000000
57 #define LDRP_REDIRECTED 0x10000000
58 #define LDRP_NON_PAGED_DEBUG_INFO 0x20000000
59 #define LDRP_MM_LOADED 0x40000000
60 #define LDRP_COMPAT_DATABASE_PROCESSED 0x80000000
61 
62 //
63 // Dll Characteristics for LdrLoadDll
64 //
65 #define LDR_IGNORE_CODE_AUTHZ_LEVEL 0x00001000
66 
67 //
68 // LdrAddRef Flags
69 //
70 #define LDR_ADDREF_DLL_PIN 0x00000001
71 
72 //
73 // LdrLockLoaderLock Flags
74 //
75 #define LDR_LOCK_LOADER_LOCK_FLAG_RAISE_ON_ERRORS 0x00000001
76 #define LDR_LOCK_LOADER_LOCK_FLAG_TRY_ONLY 0x00000002
77 
78 //
79 // LdrUnlockLoaderLock Flags
80 //
81 #define LDR_UNLOCK_LOADER_LOCK_FLAG_RAISE_ON_ERRORS 0x00000001
82 
83 //
84 // LdrGetDllHandleEx Flags
85 //
86 #define LDR_GET_DLL_HANDLE_EX_UNCHANGED_REFCOUNT 0x00000001
87 #define LDR_GET_DLL_HANDLE_EX_PIN 0x00000002
88 
89 
90 #define LDR_LOCK_LOADER_LOCK_DISPOSITION_INVALID 0
91 #define LDR_LOCK_LOADER_LOCK_DISPOSITION_LOCK_ACQUIRED 1
92 #define LDR_LOCK_LOADER_LOCK_DISPOSITION_LOCK_NOT_ACQUIRED 2
93 
94 //
95 // FIXME: THIS SHOULD *NOT* BE USED!
96 //
97 #define IMAGE_SCN_TYPE_NOLOAD 0x00000002
98 
99 //
100 // Loader datafile/imagemapping macros
101 //
102 #define LDR_IS_DATAFILE(handle) (((ULONG_PTR)(handle)) & (ULONG_PTR)1)
103 #define LDR_IS_IMAGEMAPPING(handle) (((ULONG_PTR)(handle)) & (ULONG_PTR)2)
104 #define LDR_IS_RESOURCE(handle) (LDR_IS_IMAGEMAPPING(handle) || LDR_IS_DATAFILE(handle))
105 
106 //
107 // Activation Context
108 //
110 
111 //
112 // Loader Data stored in the PEB
113 //
114 typedef struct _PEB_LDR_DATA
115 {
116  ULONG Length;
123 #if (NTDDI_VERSION >= NTDDI_WIN7)
126 #endif
128 
129 //
130 // Loader Data Table Entry
131 //
132 // NOTE: The field 'InMemoryOrderLinks' MUST have that name.
133 // It's hard-coded into WinDbg for PEB dumping!
134 //
135 typedef struct _LDR_DATA_TABLE_ENTRY
136 {
140  PVOID DllBase;
145  ULONG Flags;
148  union
149  {
151  struct
152  {
154  ULONG CheckSum;
155  };
156  };
157  union
158  {
161  };
165 
166 //
167 // Loaded Imports Reference Counting in Kernel
168 //
169 typedef struct _LOAD_IMPORTS
170 {
174 
175 //
176 // Loader Resource Information
177 //
178 typedef struct _LDR_RESOURCE_INFO
179 {
184 
186 {
194 
195 //
196 // DLL Notifications
197 //
199 {
206 
207 typedef VOID
209  _In_ BOOLEAN Type,
211 );
212 
214 {
218 
219 //
220 // Alternate Resources Support
221 //
222 typedef struct _ALT_RESOURCE_MODULE
223 {
226 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
228 #endif
230 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
234 #endif
236 
237 //
238 // Callback function for LdrEnumerateLoadedModules
239 //
240 typedef VOID (NTAPI LDR_ENUM_CALLBACK)(_In_ PLDR_DATA_TABLE_ENTRY ModuleInformation, _In_ PVOID Parameter, _Out_ BOOLEAN *Stop);
241 typedef LDR_ENUM_CALLBACK *PLDR_ENUM_CALLBACK;
242 
243 //
244 // Manifest prober routine set via LdrSetDllManifestProber
245 //
246 typedef NTSTATUS (NTAPI LDR_MANIFEST_PROBER_ROUTINE)(_In_ PVOID DllHandle, _In_ PCWSTR FullDllName, _Out_ PVOID *ActCtx);
247 typedef LDR_MANIFEST_PROBER_ROUTINE *PLDR_MANIFEST_PROBER_ROUTINE;
248 
249 //
250 // DLL Main Routine
251 //
252 typedef BOOLEAN
254  _In_ PVOID DllHandle,
255  _In_ ULONG Reason,
257 );
258 
259 #endif
BOOLEAN Initialized
Definition: ntddk_ex.h:222
Definition: ldrtypes.h:213
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:121
Type
Definition: Type.h:6
LIST_ENTRY NotificationListEntry
Definition: ldrtypes.h:215
struct _LDR_ENUM_RESOURCE_INFO * PLDR_ENUM_RESOURCE_INFO
LIST_ENTRY InLoadOrderModuleList
Definition: ldrtypes.h:119
PLDR_DLL_LOADED_NOTIFICATION_CALLBACK Callback
Definition: ldrtypes.h:216
struct _LOAD_IMPORTS * PLOAD_IMPORTS
LIST_ENTRY InMemoryOrderModuleList
Definition: btrfs_drv.h:1820
ULONG SizeOfImage
Definition: ldrtypes.h:142
WORD LANGID
Definition: typedefs.h:79
_In_ PVOID Parameter
Definition: ldrtypes.h:240
struct _PEB_LDR_DATA * PPEB_LDR_DATA
ULONG_PTR Type
Definition: ldrtypes.h:180
#define _In_opt_
Definition: no_sal2.h:213
_In_ PVOID _Out_ BOOLEAN * Stop
Definition: ldrtypes.h:240
uint32_t ULONG_PTR
Definition: typedefs.h:63
typedef NTSTATUS(NTAPI LDR_MANIFEST_PROBER_ROUTINE)(_In_ PVOID DllHandle
PVOID DllBase
Definition: btrfs_drv.h:1805
struct _LDR_DLL_LOADED_NOTIFICATION_ENTRY LDR_DLL_LOADED_NOTIFICATION_ENTRY
LDR_MANIFEST_PROBER_ROUTINE * PLDR_MANIFEST_PROBER_ROUTINE
Definition: ldrtypes.h:247
USHORT TlsIndex
Definition: ntddk_ex.h:209
PVOID ShutdownThreadId
Definition: ldrtypes.h:125
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:231
unsigned char BOOLEAN
PVOID EntryInProgress
Definition: ldrtypes.h:122
ULONG_PTR Name
Definition: ldrtypes.h:181
BOOLEAN(NTAPI * PDLL_INIT_ROUTINE)(_In_ PVOID DllHandle, _In_ ULONG Reason, _In_opt_ PCONTEXT Context)
Definition: ldrtypes.h:253
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:241
_In_ PCWSTR FullDllName
Definition: ldrtypes.h:246
struct _LDR_RESOURCE_INFO LDR_RESOURCE_INFO
ULONG Length
Definition: ntddk_ex.h:221
PVOID SsHandle
Definition: ldrtypes.h:118
struct _LDR_DLL_LOADED_NOTIFICATION_DATA LDR_DLL_LOADED_NOTIFICATION_DATA
PVOID PatchInformation
Definition: ldrtypes.h:163
typedef VOID(NTAPI LDR_ENUM_CALLBACK)(_In_ PLDR_DATA_TABLE_ENTRY ModuleInformation
PVOID LoadedImports
Definition: ldrtypes.h:160
struct _ALT_RESOURCE_MODULE * PALT_RESOURCE_MODULE
ULONG CheckSum
Definition: btrfs_drv.h:1811
_In_ PCWSTR _Out_ PVOID * ActCtx
Definition: ldrtypes.h:246
unsigned char UCHAR
Definition: xmlstorage.h:181
struct _PEB_LDR_DATA PEB_LDR_DATA
LIST_ENTRY HashLinks
Definition: ldrtypes.h:150
struct _LDR_DATA_TABLE_ENTRY LDR_DATA_TABLE_ENTRY
Definition: btrfs_drv.h:1801
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:208
PVOID PACTIVATION_CONTEXT
Definition: ldrtypes.h:109
SIZE_T Count
Definition: ldrtypes.h:171
ULONG TimeDateStamp
Definition: btrfs_drv.h:1814
LIST_ENTRY InLoadOrderLinks
Definition: ldrtypes.h:137
#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:1803
UNICODE_STRING FullDllName
Definition: btrfs_drv.h:1807
UNICODE_STRING BaseDllName
Definition: ldrtypes.h:144
PACTIVATION_CONTEXT EntryPointActivationContext
Definition: ldrtypes.h:162
ULONG_PTR Language
Definition: ldrtypes.h:182
#define BOOLEAN
Definition: pedump.c:73
ULONG Flags
Definition: ntddk_ex.h:207
struct tagContext Context
Definition: acpixf.h:1012
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:139
base of all file and directory entries
Definition: entries.h:82
USHORT LoadCount
Definition: ntddk_ex.h:208
UCHAR ShutdownInProgress
Definition: ldrtypes.h:124