xref: /reactos/sdk/include/ndk/ldrfuncs.h (revision 9ecf552f)
1 /*++ NDK Version: 0098
2 
3 Copyright (c) Alex Ionescu.  All rights reserved.
4 
5 Header Name:
6 
7     ldrfuncs.h
8 
9 Abstract:
10 
11     Functions definitions for the Loader.
12 
13 Author:
14 
15     Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
16 
17 --*/
18 
19 #ifndef _LDRFUNCS_H
20 #define _LDRFUNCS_H
21 
22 //
23 // Dependencies
24 //
25 #include <umtypes.h>
26 #include <ldrtypes.h>
27 #if defined(_MSC_VER) && !defined(NTOS_MODE_USER)
28 #include <ntimage.h>
29 #endif
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 //
36 // Resource Functions
37 //
38 NTSTATUS
39 NTAPI
40 LdrAccessResource(
41     _In_ PVOID BaseAddress,
42     _In_ PIMAGE_RESOURCE_DATA_ENTRY ResourceDataEntry,
43     _Out_opt_ PVOID *Resource,
44     _Out_opt_ PULONG Size
45 );
46 
47 NTSTATUS
48 NTAPI
49 LdrFindResource_U(
50     _In_ PVOID BaseAddress,
51     _In_ PLDR_RESOURCE_INFO ResourceInfo,
52     _In_ ULONG Level,
53     _Out_ PIMAGE_RESOURCE_DATA_ENTRY *ResourceDataEntry
54 );
55 
56 NTSTATUS
57 NTAPI
58 LdrEnumResources(
59     _In_ PVOID BaseAddress,
60     _In_ PLDR_RESOURCE_INFO ResourceInfo,
61     _In_ ULONG Level,
62     _Inout_ ULONG *ResourceCount,
63     _Out_writes_to_(*ResourceCount,*ResourceCount) LDR_ENUM_RESOURCE_INFO *Resources
64 );
65 
66 NTSTATUS
67 NTAPI
68 LdrFindResourceDirectory_U(
69     _In_ PVOID BaseAddress,
70     _In_ PLDR_RESOURCE_INFO ResourceInfo,
71     _In_ ULONG Level,
72     _Out_ PIMAGE_RESOURCE_DIRECTORY *ResourceDirectory
73 );
74 
75 NTSTATUS
76 NTAPI
77 LdrLoadAlternateResourceModule(
78     _In_ PVOID Module,
79     _In_ PWSTR Buffer
80 );
81 
82 BOOLEAN
83 NTAPI
84 LdrUnloadAlternateResourceModule(
85     _In_ PVOID BaseAddress
86 );
87 
88 //
89 // Misc. Functions
90 //
91 NTSTATUS
92 NTAPI
93 LdrGetProcedureAddress(
94     _In_ PVOID BaseAddress,
95     _In_opt_ _When_(Ordinal == 0, _Notnull_) PANSI_STRING Name,
96     _In_opt_ _When_(Name == NULL, _In_range_(>, 0)) ULONG Ordinal,
97     _Out_ PVOID *ProcedureAddress
98 );
99 
100 ULONG
101 NTAPI
102 LdrRelocateImage(
103     _In_ PVOID BaseAddress,
104     _In_opt_ PCSTR LoaderName,
105     _In_ ULONG Success,
106     _In_ ULONG Conflict,
107     _In_ ULONG Invalid
108 );
109 
110 NTSTATUS
111 NTAPI
112 LdrLockLoaderLock(
113     _In_ ULONG Flags,
114     _Out_opt_ PULONG Disposition,
115     _Out_opt_ PULONG_PTR Cookie
116 );
117 
118 NTSTATUS
119 NTAPI
120 LdrUnlockLoaderLock(
121     _In_ ULONG Flags,
122     _In_opt_ ULONG Cookie
123 );
124 
125 BOOLEAN
126 NTAPI
127 LdrVerifyMappedImageMatchesChecksum(
128     _In_ PVOID BaseAddress,
129     _In_ SIZE_T NumberOfBytes,
130     _In_ ULONG FileLength
131 );
132 
133 PIMAGE_BASE_RELOCATION
134 NTAPI
135 LdrProcessRelocationBlockLongLong(
136     _In_ ULONG_PTR Address,
137     _In_ ULONG Count,
138     _In_ PUSHORT TypeOffset,
139     _In_ LONGLONG Delta
140 );
141 
142 NTSTATUS
143 NTAPI
144 LdrEnumerateLoadedModules(
145     _Reserved_ ULONG ReservedFlag,
146     _In_ PLDR_ENUM_CALLBACK EnumProc,
147     _In_opt_ PVOID Context
148 );
149 
150 #ifdef NTOS_MODE_USER
151 NTSYSAPI
152 BOOLEAN
153 NTAPI
154 RtlDllShutdownInProgress(
155     VOID
156 );
157 #endif
158 
159 #ifdef __cplusplus
160 }
161 #endif
162 
163 #endif
164