*nix newlines throughout file fixed.
[reactos.git] / reactos / include / ntdll / ldr.h
1 #ifndef __NTOSKRNL_INCLUDE_INTERNAL_LDR_H
2 #define __NTOSKRNL_INCLUDE_INTERNAL_LDR_H
3
4 #include <ntos/kdbgsyms.h>
5 #include <roscfg.h>
6 #include <napi/teb.h>
7
8 typedef NTSTATUS STDCALL (*PEPFUNC)(PPEB);
9
10 /* Type for a DLL's entry point */
11 typedef BOOL STDCALL
12 (* PDLLMAIN_FUNC)(HANDLE hInst,
13 ULONG ul_reason_for_call,
14 LPVOID lpReserved);
15
16 typedef struct _LDR_MODULE
17 {
18 LIST_ENTRY InLoadOrderModuleList;
19 LIST_ENTRY InMemoryOrderModuleList; // not used
20 LIST_ENTRY InInitializationOrderModuleList; // not used
21 PVOID BaseAddress;
22 ULONG EntryPoint;
23 ULONG SizeOfImage;
24 UNICODE_STRING FullDllName;
25 UNICODE_STRING BaseDllName;
26 ULONG Flags;
27 SHORT LoadCount;
28 SHORT TlsIndex;
29 HANDLE SectionHandle;
30 ULONG CheckSum;
31 ULONG TimeDateStamp;
32 #ifdef KDBG
33 IMAGE_SYMBOL_INFO SymbolInfo;
34 #endif /* KDBG */
35 } LDR_MODULE, *PLDR_MODULE;
36
37 typedef struct _LDR_SYMBOL_INFO {
38 PLDR_MODULE ModuleObject;
39 ULONG_PTR ImageBase;
40 PVOID SymbolsBuffer;
41 ULONG SymbolsBufferLength;
42 PVOID SymbolStringsBuffer;
43 ULONG SymbolStringsBufferLength;
44 } LDR_SYMBOL_INFO, *PLDR_SYMBOL_INFO;
45
46
47 #define RVA(m, b) ((ULONG)b + m)
48
49
50 typedef struct _MODULE_ENTRY
51 {
52 ULONG Unknown0;
53 ULONG Unknown1;
54 PVOID BaseAddress;
55 ULONG SizeOfImage;
56 ULONG Flags;
57 USHORT Unknown2;
58 USHORT Unknown3;
59 SHORT LoadCount;
60 USHORT PathLength;
61 CHAR ModuleName[256];
62 } MODULE_ENTRY, *PMODULE_ENTRY;
63
64 typedef struct _MODULE_INFORMATION
65 {
66 ULONG ModuleCount;
67 MODULE_ENTRY ModuleEntry[1];
68 } MODULE_INFORMATION, *PMODULE_INFORMATION;
69
70 #ifdef KDBG
71
72 VOID
73 LdrpLoadUserModuleSymbols(PLDR_MODULE LdrModule);
74
75 #endif
76
77 PEPFUNC LdrPEStartup (PVOID ImageBase,
78 HANDLE SectionHandle,
79 PLDR_MODULE* Module,
80 PWSTR FullDosName);
81 NTSTATUS LdrMapSections(HANDLE ProcessHandle,
82 PVOID ImageBase,
83 HANDLE SectionHandle,
84 PIMAGE_NT_HEADERS NTHeaders);
85 NTSTATUS LdrMapNTDllForProcess(HANDLE ProcessHandle,
86 PHANDLE NTDllSectionHandle);
87
88
89 NTSTATUS STDCALL
90 LdrDisableThreadCalloutsForDll(IN PVOID BaseAddress);
91
92 NTSTATUS STDCALL
93 LdrGetDllHandle(IN ULONG Unknown1,
94 IN ULONG Unknown2,
95 IN PUNICODE_STRING DllName,
96 OUT PVOID *BaseAddress);
97
98 NTSTATUS STDCALL
99 LdrFindEntryForAddress(PVOID Address,
100 PLDR_MODULE *Module);
101
102 NTSTATUS STDCALL
103 LdrGetProcedureAddress(IN PVOID BaseAddress,
104 IN PANSI_STRING Name,
105 IN ULONG Ordinal,
106 OUT PVOID *ProcedureAddress);
107
108 VOID STDCALL
109 LdrInitializeThunk(ULONG Unknown1,
110 ULONG Unknown2,
111 ULONG Unknown3,
112 ULONG Unknown4);
113
114 NTSTATUS STDCALL
115 LdrLoadDll(IN PWSTR SearchPath OPTIONAL,
116 IN ULONG LoadFlags,
117 IN PUNICODE_STRING Name,
118 OUT PVOID *BaseAddress OPTIONAL);
119
120 NTSTATUS STDCALL
121 LdrQueryProcessModuleInformation(IN PMODULE_INFORMATION ModuleInformation OPTIONAL,
122 IN ULONG Size OPTIONAL,
123 OUT PULONG ReturnedSize);
124
125 NTSTATUS STDCALL
126 LdrShutdownProcess(VOID);
127
128 NTSTATUS STDCALL
129 LdrShutdownThread(VOID);
130
131 NTSTATUS STDCALL
132 LdrUnloadDll(IN PVOID BaseAddress);
133
134 #endif /* __NTOSKRNL_INCLUDE_INTERNAL_LDR_H */
135
136 /* EOF */