1 /*++ NDK Version: 0098 2 3 Copyright (c) Alex Ionescu. All rights reserved. 4 5 Header Name: 6 7 umfuncs.h 8 9 Abstract: 10 11 Function definitions for Native DLL (ntdll) APIs exclusive to User Mode. 12 13 Author: 14 15 Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006 16 17 --*/ 18 19 #ifndef _UMFUNCS_H 20 #define _UMFUNCS_H 21 22 // 23 // Dependencies 24 // 25 #include <umtypes.h> 26 #include <dbgktypes.h> 27 28 // 29 // Debug Functions 30 // 31 __analysis_noreturn 32 NTSYSAPI 33 VOID 34 NTAPI 35 DbgBreakPointWithStatus( 36 _In_ ULONG Status 37 ); 38 39 NTSTATUS 40 NTAPI 41 DbgUiConnectToDbg( 42 VOID 43 ); 44 45 NTSTATUS 46 NTAPI 47 DbgUiContinue( 48 _In_ PCLIENT_ID ClientId, 49 _In_ NTSTATUS ContinueStatus 50 ); 51 52 NTSTATUS 53 NTAPI 54 DbgUiDebugActiveProcess( 55 _In_ HANDLE Process 56 ); 57 58 NTSTATUS 59 NTAPI 60 DbgUiStopDebugging( 61 _In_ HANDLE Process 62 ); 63 64 NTSYSAPI 65 NTSTATUS 66 NTAPI 67 DbgUiWaitStateChange( 68 _In_ PDBGUI_WAIT_STATE_CHANGE DbgUiWaitStateCange, 69 _In_ PLARGE_INTEGER TimeOut 70 ); 71 72 NTSTATUS 73 NTAPI 74 DbgUiConvertStateChangeStructure( 75 _In_ PDBGUI_WAIT_STATE_CHANGE WaitStateChange, 76 _In_ PVOID DebugEvent 77 ); 78 79 VOID 80 NTAPI 81 DbgUiRemoteBreakin( 82 VOID 83 ); 84 85 NTSTATUS 86 NTAPI 87 DbgUiIssueRemoteBreakin( 88 _In_ HANDLE Process 89 ); 90 91 HANDLE 92 NTAPI 93 DbgUiGetThreadDebugObject( 94 VOID 95 ); 96 97 // 98 // Loader Functions 99 // 100 101 NTSTATUS 102 NTAPI 103 LdrAddRefDll( 104 _In_ ULONG Flags, 105 _In_ PVOID BaseAddress 106 ); 107 108 NTSTATUS 109 NTAPI 110 LdrDisableThreadCalloutsForDll( 111 _In_ PVOID BaseAddress 112 ); 113 114 NTSTATUS 115 NTAPI 116 LdrGetDllHandle( 117 _In_opt_ PWSTR DllPath, 118 _In_opt_ PULONG DllCharacteristics, 119 _In_ PUNICODE_STRING DllName, 120 _Out_ PVOID *DllHandle 121 ); 122 123 NTSTATUS 124 NTAPI 125 LdrGetDllHandleEx( 126 _In_ ULONG Flags, 127 _In_opt_ PWSTR DllPath, 128 _In_opt_ PULONG DllCharacteristics, 129 _In_ PUNICODE_STRING DllName, 130 _Out_opt_ PVOID *DllHandle); 131 132 NTSTATUS 133 NTAPI 134 LdrFindEntryForAddress( 135 _In_ PVOID Address, 136 _Out_ PLDR_DATA_TABLE_ENTRY *Module 137 ); 138 139 NTSTATUS 140 NTAPI 141 LdrGetProcedureAddress( 142 _In_ PVOID BaseAddress, 143 _In_opt_ _When_(Ordinal == 0, _Notnull_) PANSI_STRING Name, 144 _In_opt_ _When_(Name == NULL, _In_range_(>, 0)) ULONG Ordinal, 145 _Out_ PVOID *ProcedureAddress 146 ); 147 148 VOID 149 NTAPI 150 LdrInitializeThunk( 151 ULONG Unknown1, 152 ULONG Unknown2, 153 ULONG Unknown3, 154 ULONG Unknown4 155 ); 156 157 NTSTATUS 158 NTAPI 159 LdrLoadDll( 160 _In_opt_ PWSTR SearchPath, 161 _In_opt_ PULONG DllCharacteristics, 162 _In_ PUNICODE_STRING DllName, 163 _Out_ PVOID *BaseAddress 164 ); 165 166 PIMAGE_BASE_RELOCATION 167 NTAPI 168 LdrProcessRelocationBlock( 169 _In_ ULONG_PTR Address, 170 _In_ ULONG Count, 171 _In_ PUSHORT TypeOffset, 172 _In_ LONG_PTR Delta 173 ); 174 175 NTSTATUS 176 NTAPI 177 LdrQueryImageFileExecutionOptions( 178 _In_ PUNICODE_STRING SubKey, 179 _In_ PCWSTR ValueName, 180 _In_ ULONG Type, 181 _Out_ PVOID Buffer, 182 _In_ ULONG BufferSize, 183 _Out_opt_ PULONG ReturnedLength 184 ); 185 186 NTSTATUS 187 NTAPI 188 LdrQueryProcessModuleInformation( 189 _Out_writes_bytes_to_(Size, *ReturnedSize) PRTL_PROCESS_MODULES ModuleInformation, 190 _In_ ULONG Size, 191 _Out_opt_ PULONG ReturnedSize 192 ); 193 194 VOID 195 NTAPI 196 LdrSetDllManifestProber( 197 _In_ PLDR_MANIFEST_PROBER_ROUTINE Routine); 198 199 NTSTATUS 200 NTAPI 201 LdrShutdownProcess( 202 VOID 203 ); 204 205 NTSTATUS 206 NTAPI 207 LdrShutdownThread( 208 VOID 209 ); 210 211 NTSTATUS 212 NTAPI 213 LdrUnloadDll( 214 _In_ PVOID BaseAddress 215 ); 216 217 typedef VOID (NTAPI *PLDR_CALLBACK)(PVOID CallbackContext, PCHAR Name); 218 NTSTATUS 219 NTAPI 220 LdrVerifyImageMatchesChecksum( 221 _In_ HANDLE FileHandle, 222 _In_ PLDR_CALLBACK Callback, 223 _In_ PVOID CallbackContext, 224 _Out_ PUSHORT ImageCharacteristics 225 ); 226 227 NTSTATUS 228 NTAPI 229 LdrOpenImageFileOptionsKey( 230 _In_ PUNICODE_STRING SubKey, 231 _In_ BOOLEAN Wow64, 232 _Out_ PHANDLE NewKeyHandle 233 ); 234 235 NTSTATUS 236 NTAPI 237 LdrQueryImageFileKeyOption( 238 _In_ HANDLE KeyHandle, 239 _In_ PCWSTR ValueName, 240 _In_ ULONG Type, 241 _Out_ PVOID Buffer, 242 _In_ ULONG BufferSize, 243 _Out_opt_ PULONG ReturnedLength 244 ); 245 246 #endif 247