[CSRSRV]: Fix two DPRINTs.
[reactos.git] / reactos / dll / ntdll / include / ntdllp.h
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS System Libraries
4 * FILE: dll/ntdll/include/ntdllp.h
5 * PURPOSE: Native Libary Internal Header
6 * PROGRAMMER: Alex Ionescu (alex@relsoft.net)
7 */
8
9 /* INCLUDES ******************************************************************/
10
11 #define LDR_HASH_TABLE_ENTRIES 32
12 #define LDR_GET_HASH_ENTRY(x) (RtlUpcaseUnicodeChar((x)) & (LDR_HASH_TABLE_ENTRIES - 1))
13
14 /* LdrpUpdateLoadCount2 flags */
15 #define LDRP_UPDATE_REFCOUNT 0x01
16 #define LDRP_UPDATE_DEREFCOUNT 0x02
17 #define LDRP_UPDATE_PIN 0x03
18
19 /* Loader flags */
20 #define IMAGE_LOADER_FLAGS_COMPLUS 0x00000001
21 #define IMAGE_LOADER_FLAGS_SYSTEM_GLOBAL 0x01000000
22
23 /* Page heap flags */
24 #define DPH_FLAG_DLL_NOTIFY 0x40
25
26 typedef struct _LDRP_TLS_DATA
27 {
28 LIST_ENTRY TlsLinks;
29 IMAGE_TLS_DIRECTORY TlsDirectory;
30 } LDRP_TLS_DATA, *PLDRP_TLS_DATA;
31
32 /* Global data */
33 extern RTL_CRITICAL_SECTION LdrpLoaderLock;
34 extern BOOLEAN LdrpInLdrInit;
35 extern LIST_ENTRY LdrpHashTable[LDR_HASH_TABLE_ENTRIES];
36 extern BOOLEAN ShowSnaps;
37 extern UNICODE_STRING LdrpDefaultPath;
38 extern HANDLE LdrpKnownDllObjectDirectory;
39 extern ULONG LdrpNumberOfProcessors;
40 extern ULONG LdrpFatalHardErrorCount;
41 extern PUNICODE_STRING LdrpTopLevelDllBeingLoaded;
42 extern PLDR_DATA_TABLE_ENTRY LdrpCurrentDllInitializer;
43 extern UNICODE_STRING LdrApiDefaultExtension;
44 extern BOOLEAN LdrpLdrDatabaseIsSetup;
45 extern ULONG LdrpActiveUnloadCount;
46 extern BOOLEAN LdrpShutdownInProgress;
47 extern UNICODE_STRING LdrpKnownDllPath;
48 extern PLDR_DATA_TABLE_ENTRY LdrpGetModuleHandleCache, LdrpLoadedDllHandleCache;
49 extern ULONG RtlpDphGlobalFlags;
50
51 /* ldrinit.c */
52 NTSTATUS NTAPI LdrpRunInitializeRoutines(IN PCONTEXT Context OPTIONAL);
53 VOID NTAPI LdrpInitializeThread(IN PCONTEXT Context);
54 NTSTATUS NTAPI LdrpInitializeTls(VOID);
55 NTSTATUS NTAPI LdrpAllocateTls(VOID);
56 VOID NTAPI LdrpFreeTls(VOID);
57 VOID NTAPI LdrpCallTlsInitializers(PVOID BaseAddress, ULONG Reason);
58 BOOLEAN NTAPI LdrpCallInitRoutine(PDLL_INIT_ROUTINE EntryPoint, PVOID BaseAddress, ULONG Reason, PVOID Context);
59 NTSTATUS NTAPI LdrpInitializeProcess(PCONTEXT Context, PVOID SystemArgument1);
60 VOID NTAPI LdrpInitFailure(NTSTATUS Status);
61 VOID NTAPI LdrpValidateImageForMp(IN PLDR_DATA_TABLE_ENTRY LdrDataTableEntry);
62 VOID NTAPI LdrpEnsureLoaderLockIsHeld();
63
64 /* ldrpe.c */
65 NTSTATUS
66 NTAPI
67 LdrpSnapThunk(IN PVOID ExportBase,
68 IN PVOID ImportBase,
69 IN PIMAGE_THUNK_DATA OriginalThunk,
70 IN OUT PIMAGE_THUNK_DATA Thunk,
71 IN PIMAGE_EXPORT_DIRECTORY ExportEntry,
72 IN ULONG ExportSize,
73 IN BOOLEAN Static,
74 IN LPSTR DllName);
75
76 NTSTATUS NTAPI
77 LdrpWalkImportDescriptor(IN LPWSTR DllPath OPTIONAL,
78 IN PLDR_DATA_TABLE_ENTRY LdrEntry);
79
80
81 /* ldrutils.c */
82 NTSTATUS NTAPI
83 LdrpGetProcedureAddress(IN PVOID BaseAddress,
84 IN PANSI_STRING Name,
85 IN ULONG Ordinal,
86 OUT PVOID *ProcedureAddress,
87 IN BOOLEAN ExecuteInit);
88
89 PLDR_DATA_TABLE_ENTRY NTAPI
90 LdrpAllocateDataTableEntry(IN PVOID BaseAddress);
91
92 VOID NTAPI
93 LdrpInsertMemoryTableEntry(IN PLDR_DATA_TABLE_ENTRY LdrEntry);
94
95 NTSTATUS NTAPI
96 LdrpLoadDll(IN BOOLEAN Redirected,
97 IN PWSTR DllPath OPTIONAL,
98 IN PULONG DllCharacteristics OPTIONAL,
99 IN PUNICODE_STRING DllName,
100 OUT PVOID *BaseAddress,
101 IN BOOLEAN CallInit);
102
103 VOID NTAPI
104 LdrpUpdateLoadCount2(IN PLDR_DATA_TABLE_ENTRY LdrEntry,
105 IN ULONG Flags);
106
107 ULONG NTAPI
108 LdrpClearLoadInProgress();
109
110 NTSTATUS
111 NTAPI
112 LdrpSetProtection(PVOID ViewBase,
113 BOOLEAN Restore);
114
115 BOOLEAN
116 NTAPI
117 LdrpCheckForLoadedDllHandle(IN PVOID Base,
118 OUT PLDR_DATA_TABLE_ENTRY *LdrEntry);
119
120 BOOLEAN NTAPI
121 LdrpCheckForLoadedDll(IN PWSTR DllPath,
122 IN PUNICODE_STRING DllName,
123 IN BOOLEAN Flag,
124 IN BOOLEAN RedirectedDll,
125 OUT PLDR_DATA_TABLE_ENTRY *LdrEntry);
126
127 NTSTATUS NTAPI
128 LdrpMapDll(IN PWSTR SearchPath OPTIONAL,
129 IN PWSTR DllPath2,
130 IN PWSTR DllName OPTIONAL,
131 IN PULONG DllCharacteristics,
132 IN BOOLEAN Static,
133 IN BOOLEAN Redirect,
134 OUT PLDR_DATA_TABLE_ENTRY *DataTableEntry);
135
136 PVOID NTAPI
137 LdrpFetchAddressOfEntryPoint(PVOID ImageBase);
138
139 VOID NTAPI
140 LdrpFreeUnicodeString(PUNICODE_STRING String);
141
142
143 /* FIXME: Cleanup this mess */
144 typedef NTSTATUS (NTAPI *PEPFUNC)(PPEB);
145 NTSTATUS LdrMapSections(HANDLE ProcessHandle,
146 PVOID ImageBase,
147 HANDLE SectionHandle,
148 PIMAGE_NT_HEADERS NTHeaders);
149 NTSTATUS LdrMapNTDllForProcess(HANDLE ProcessHandle,
150 PHANDLE NTDllSectionHandle);
151 ULONG
152 LdrpGetResidentSize(PIMAGE_NT_HEADERS NTHeaders);
153
154 NTSTATUS
155 NTAPI
156 LdrpLoadImportModule(IN PWSTR DllPath OPTIONAL,
157 IN LPSTR ImportName,
158 IN PVOID DllBase,
159 OUT PLDR_DATA_TABLE_ENTRY *DataTableEntry,
160 OUT PBOOLEAN Existing);
161
162 VOID
163 NTAPI
164 LdrpFinalizeAndDeallocateDataTableEntry(IN PLDR_DATA_TABLE_ENTRY Entry);
165
166 /* EOF */