ReactOS 0.4.15-dev-7928-g68a8619
ldrtypes.h
Go to the documentation of this file.
1/*++ NDK Version: 0098
2
3Copyright (c) Alex Ionescu. All rights reserved.
4
5Header Name:
6
7 ldrtypes.h
8
9Abstract:
10
11 Type definitions for the Loader.
12
13Author:
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//
115typedef struct _PEB_LDR_DATA
116{
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//
136typedef struct _LDR_DATA_TABLE_ENTRY
137{
146 ULONG Flags;
149 union
150 {
152 struct
153 {
156 };
157 };
158 union
159 {
162 };
166
167//
168// Loaded Imports Reference Counting in Kernel
169//
170typedef struct _LOAD_IMPORTS
171{
175
176//
177// Loader Resource Information
178//
179typedef struct _LDR_RESOURCE_INFO
180{
185
187{
195
196//
197// DLL Notifications
198//
200{
207
208typedef VOID
212);
213
215{
219
220//
221// Alternate Resources Support
222//
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//
241typedef VOID (NTAPI LDR_ENUM_CALLBACK)(_In_ PLDR_DATA_TABLE_ENTRY ModuleInformation, _In_opt_ PVOID Context, _Out_ BOOLEAN *Stop);
242typedef LDR_ENUM_CALLBACK *PLDR_ENUM_CALLBACK;
243
244//
245// Manifest prober routine set via LdrSetDllManifestProber
246//
247typedef NTSTATUS (NTAPI LDR_MANIFEST_PROBER_ROUTINE)(_In_ PVOID DllHandle, _In_ PCWSTR FullDllName, _Out_ PVOID *ActCtx);
248typedef LDR_MANIFEST_PROBER_ROUTINE *PLDR_MANIFEST_PROBER_ROUTINE;
249
250//
251// DLL Main Routine
252//
253typedef BOOLEAN
255 _In_ PVOID DllHandle,
258);
259
260#endif
unsigned char BOOLEAN
Type
Definition: Type.h:7
#define VOID
Definition: acefi.h:82
#define NTSTATUS
Definition: precomp.h:21
struct _LDR_DLL_LOADED_NOTIFICATION_DATA * PLDR_DLL_LOADED_NOTIFICATION_DATA
struct _LDR_RESOURCE_INFO * PLDR_RESOURCE_INFO
struct _ALT_RESOURCE_MODULE * PALT_RESOURCE_MODULE
_In_opt_ PVOID _Out_ BOOLEAN * Stop
Definition: ldrtypes.h:241
struct _LDR_ENUM_RESOURCE_INFO LDR_ENUM_RESOURCE_INFO
BOOLEAN(NTAPI * PDLL_INIT_ROUTINE)(_In_ PVOID DllHandle, _In_ ULONG Reason, _In_opt_ PCONTEXT Context)
Definition: ldrtypes.h:254
_In_opt_ PVOID Context
Definition: ldrtypes.h:241
struct _ALT_RESOURCE_MODULE ALT_RESOURCE_MODULE
_In_ PCWSTR _Out_ PVOID * ActCtx
Definition: ldrtypes.h:247
struct _LDR_DLL_LOADED_NOTIFICATION_DATA LDR_DLL_LOADED_NOTIFICATION_DATA
struct _LDR_DATA_TABLE_ENTRY * PLDR_DATA_TABLE_ENTRY
struct _LDR_DATA_TABLE_ENTRY LDR_DATA_TABLE_ENTRY
struct _LDR_DLL_LOADED_NOTIFICATION_ENTRY LDR_DLL_LOADED_NOTIFICATION_ENTRY
struct _LOAD_IMPORTS LOAD_IMPORTS
struct _PEB_LDR_DATA * PPEB_LDR_DATA
struct _LDR_RESOURCE_INFO LDR_RESOURCE_INFO
VOID(NTAPI * PLDR_DLL_LOADED_NOTIFICATION_CALLBACK)(_In_ BOOLEAN Type, _In_ struct _LDR_DLL_LOADED_NOTIFICATION_DATA *Data)
Definition: ldrtypes.h:209
struct _LDR_DLL_LOADED_NOTIFICATION_ENTRY * PLDR_DLL_LOADED_NOTIFICATION_ENTRY
LDR_MANIFEST_PROBER_ROUTINE * PLDR_MANIFEST_PROBER_ROUTINE
Definition: ldrtypes.h:248
_In_ PCWSTR FullDllName
Definition: ldrtypes.h:247
struct _LDR_ENUM_RESOURCE_INFO * PLDR_ENUM_RESOURCE_INFO
LDR_ENUM_CALLBACK * PLDR_ENUM_CALLBACK
Definition: ldrtypes.h:242
struct _PEB_LDR_DATA PEB_LDR_DATA
PVOID PACTIVATION_CONTEXT
Definition: ldrtypes.h:110
struct _LOAD_IMPORTS * PLOAD_IMPORTS
USHORT LANGID
Definition: mui.h:9
PVOID PVOID PWCHAR PVOID USHORT PULONG Reason
Definition: env.c:47
#define _Out_
Definition: ms_sal.h:345
#define _In_
Definition: ms_sal.h:308
#define _In_opt_
Definition: ms_sal.h:309
#define BOOLEAN
Definition: pedump.c:73
unsigned short USHORT
Definition: pedump.c:61
base of all file and directory entries
Definition: entries.h:83
HANDLE AlternateFileHandle
Definition: ldrtypes.h:232
Definition: btrfs_drv.h:1876
PACTIVATION_CONTEXT EntryPointActivationContext
Definition: ldrtypes.h:163
USHORT LoadCount
Definition: ntddk_ex.h:208
PVOID EntryPoint
Definition: ntddk_ex.h:203
UNICODE_STRING FullDllName
Definition: btrfs_drv.h:1882
ULONG SizeOfImage
Definition: ldrtypes.h:143
LIST_ENTRY InLoadOrderLinks
Definition: ldrtypes.h:138
LIST_ENTRY InInitializationOrderLinks
Definition: ldrtypes.h:140
PVOID DllBase
Definition: btrfs_drv.h:1880
LIST_ENTRY InMemoryOrderLinks
Definition: btrfs_drv.h:1878
PVOID LoadedImports
Definition: ldrtypes.h:161
USHORT TlsIndex
Definition: ntddk_ex.h:209
ULONG Flags
Definition: ntddk_ex.h:207
ULONG TimeDateStamp
Definition: btrfs_drv.h:1889
PVOID SectionPointer
Definition: ntddk_ex.h:213
LIST_ENTRY HashLinks
Definition: ldrtypes.h:151
UNICODE_STRING BaseDllName
Definition: ldrtypes.h:145
ULONG CheckSum
Definition: btrfs_drv.h:1886
PVOID PatchInformation
Definition: ldrtypes.h:164
Definition: ldrtypes.h:215
LIST_ENTRY NotificationListEntry
Definition: ldrtypes.h:216
PLDR_DLL_LOADED_NOTIFICATION_CALLBACK Callback
Definition: ldrtypes.h:217
ULONG_PTR Language
Definition: ldrtypes.h:183
ULONG_PTR Name
Definition: ldrtypes.h:182
ULONG_PTR Type
Definition: ldrtypes.h:181
Definition: typedefs.h:120
SIZE_T Count
Definition: ldrtypes.h:172
PVOID EntryInProgress
Definition: ldrtypes.h:123
UCHAR ShutdownInProgress
Definition: ldrtypes.h:125
PVOID ShutdownThreadId
Definition: ldrtypes.h:126
LIST_ENTRY InInitializationOrderModuleList
Definition: ldrtypes.h:122
LIST_ENTRY InMemoryOrderModuleList
Definition: btrfs_drv.h:1895
PVOID SsHandle
Definition: ldrtypes.h:119
ULONG Length
Definition: ntddk_ex.h:221
LIST_ENTRY InLoadOrderModuleList
Definition: ldrtypes.h:120
BOOLEAN Initialized
Definition: ntddk_ex.h:222
const uint16_t * PCWSTR
Definition: typedefs.h:57
#define NTAPI
Definition: typedefs.h:36
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59
unsigned char UCHAR
Definition: xmlstorage.h:181