-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathldrfuncs.h
147 lines (122 loc) · 2.4 KB
/
ldrfuncs.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
/*++ NDK Version: 0098
Copyright (c) Alex Ionescu. All rights reserved.
Header Name:
ldrfuncs.h
Abstract:
Functions definitions for the Loader.
Author:
Alex Ionescu ([email protected]) - Updated - 27-Feb-2006
--*/
#ifndef _LDRFUNCS_H
#define _LDRFUNCS_H
//
// Dependencies
//
#include <..\ndk\umtypes.h>
#include <..\ndk\ldrtypes.h>
#if defined(_MSC_VER) && !defined(NTOS_MODE_USER)
#include <ntimage.h>
#endif
//
// Resource Functions
//
NTSTATUS
NTAPI
LdrAccessResource(
_In_ PVOID BaseAddress,
_In_ PIMAGE_RESOURCE_DATA_ENTRY ResourceDataEntry,
_Out_opt_ PVOID *Resource,
_Out_opt_ PULONG Size
);
NTSTATUS
NTAPI
LdrFindResource_U(
_In_ PVOID BaseAddress,
_In_ PLDR_RESOURCE_INFO ResourceInfo,
_In_ ULONG Level,
_Out_ PIMAGE_RESOURCE_DATA_ENTRY *ResourceDataEntry
);
NTSTATUS
NTAPI
LdrEnumResources(
_In_ PVOID BaseAddress,
_In_ PLDR_RESOURCE_INFO ResourceInfo,
_In_ ULONG Level,
_Inout_ ULONG *ResourceCount,
_Out_writes_to_(*ResourceCount,*ResourceCount) LDR_ENUM_RESOURCE_INFO *Resources
);
NTSTATUS
NTAPI
LdrFindResourceDirectory_U(
_In_ PVOID BaseAddress,
_In_ PLDR_RESOURCE_INFO ResourceInfo,
_In_ ULONG Level,
_Out_ PIMAGE_RESOURCE_DIRECTORY *ResourceDirectory
);
NTSTATUS
NTAPI
LdrLoadAlternateResourceModule(
_In_ PVOID Module,
_In_ PWSTR Buffer
);
BOOLEAN
NTAPI
LdrUnloadAlternateResourceModule(
_In_ PVOID BaseAddress
);
//
// Misc. Functions
//
NTSTATUS
NTAPI
LdrGetProcedureAddress(
_In_ PVOID BaseAddress,
_In_ PANSI_STRING Name,
_In_ ULONG Ordinal,
_Out_ FARPROC* ProcedureAddress
);
ULONG
NTAPI
LdrRelocateImage(
_In_ PVOID NewBase,
_In_ PUCHAR LoaderName,
_In_ ULONG Success,
_In_ ULONG Conflict,
_In_ ULONG Invalid
);
NTSTATUS
NTAPI
LdrLockLoaderLock(
_In_ ULONG Flags,
_Out_opt_ PULONG Disposition,
_Out_opt_ PULONG Cookie
);
NTSTATUS
NTAPI
LdrUnlockLoaderLock(
_In_ ULONG Flags,
_In_opt_ ULONG Cookie
);
BOOLEAN
NTAPI
LdrVerifyMappedImageMatchesChecksum(
_In_ PVOID BaseAddress,
_In_ SIZE_T NumberOfBytes,
_In_ ULONG FileLength
);
PIMAGE_BASE_RELOCATION
NTAPI
LdrProcessRelocationBlockLongLong(
_In_ ULONG_PTR Address,
_In_ ULONG Count,
_In_ PUSHORT TypeOffset,
_In_ LONGLONG Delta
);
NTSTATUS
NTAPI
LdrEnumerateLoadedModules(
_In_ BOOLEAN ReservedFlag,
_In_ PLDR_ENUM_CALLBACK EnumProc,
_In_ PVOID Context
);
#endif