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