xref: /reactos/sdk/include/ndk/ldrfuncs.h (revision 1734f297)
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 //
32 // Resource Functions
33 //
34 NTSTATUS
35 NTAPI
36 LdrAccessResource(
37     _In_ PVOID BaseAddress,
38     _In_ PIMAGE_RESOURCE_DATA_ENTRY ResourceDataEntry,
39     _Out_opt_ PVOID *Resource,
40     _Out_opt_ PULONG Size
41 );
42 
43 NTSTATUS
44 NTAPI
45 LdrFindResource_U(
46     _In_ PVOID BaseAddress,
47     _In_ PLDR_RESOURCE_INFO ResourceInfo,
48     _In_ ULONG Level,
49     _Out_ PIMAGE_RESOURCE_DATA_ENTRY *ResourceDataEntry
50 );
51 
52 NTSTATUS
53 NTAPI
54 LdrEnumResources(
55     _In_ PVOID BaseAddress,
56     _In_ PLDR_RESOURCE_INFO ResourceInfo,
57     _In_ ULONG Level,
58     _Inout_ ULONG *ResourceCount,
59     _Out_writes_to_(*ResourceCount,*ResourceCount) LDR_ENUM_RESOURCE_INFO *Resources
60 );
61 
62 
63 NTSTATUS
64 NTAPI
65 LdrFindResourceDirectory_U(
66     _In_ PVOID BaseAddress,
67     _In_ PLDR_RESOURCE_INFO ResourceInfo,
68     _In_ ULONG Level,
69     _Out_ PIMAGE_RESOURCE_DIRECTORY *ResourceDirectory
70 );
71 
72 NTSTATUS
73 NTAPI
74 LdrLoadAlternateResourceModule(
75     _In_ PVOID Module,
76     _In_ PWSTR Buffer
77 );
78 
79 BOOLEAN
80 NTAPI
81 LdrUnloadAlternateResourceModule(
82     _In_ PVOID BaseAddress
83 );
84 
85 //
86 // Misc. Functions
87 //
88 NTSTATUS
89 NTAPI
90 LdrGetProcedureAddress(
91     _In_ PVOID BaseAddress,
92     _In_ PANSI_STRING Name,
93     _In_ ULONG Ordinal,
94     _Out_ PVOID *ProcedureAddress
95 );
96 
97 ULONG
98 NTAPI
99 LdrRelocateImage(
100     _In_ PVOID NewBase,
101     _In_ PCCH LoaderName,
102     _In_ ULONG Success,
103     _In_ ULONG Conflict,
104     _In_ ULONG Invalid
105 );
106 
107 NTSTATUS
108 NTAPI
109 LdrLockLoaderLock(
110     _In_ ULONG Flags,
111     _Out_opt_ PULONG Disposition,
112     _Out_opt_ PULONG_PTR Cookie
113 );
114 
115 NTSTATUS
116 NTAPI
117 LdrUnlockLoaderLock(
118     _In_ ULONG Flags,
119     _In_opt_ ULONG Cookie
120 );
121 
122 BOOLEAN
123 NTAPI
124 LdrVerifyMappedImageMatchesChecksum(
125     _In_ PVOID BaseAddress,
126     _In_ SIZE_T NumberOfBytes,
127     _In_ ULONG FileLength
128 );
129 
130 PIMAGE_BASE_RELOCATION
131 NTAPI
132 LdrProcessRelocationBlockLongLong(
133     _In_ ULONG_PTR Address,
134     _In_ ULONG Count,
135     _In_ PUSHORT TypeOffset,
136     _In_ LONGLONG Delta
137 );
138 
139 NTSTATUS
140 NTAPI
141 LdrEnumerateLoadedModules(
142     _In_ BOOLEAN ReservedFlag,
143     _In_ PLDR_ENUM_CALLBACK EnumProc,
144     _In_ PVOID Context
145 );
146 
147 #endif
148