| 1340 | namespace Stuff |
| 1341 | { |
| 1342 | BOOL WINAPI KbGetKernelProcAddress(LPCWSTR RoutineName, WdkTypes::PVOID* KernelAddress) |
| 1343 | { |
| 1344 | if (!RoutineName || !KernelAddress) return FALSE; |
| 1345 | SIZE_T NameLength = 0; |
| 1346 | __try { |
| 1347 | NameLength = wcslen(RoutineName); |
| 1348 | } __except(EXCEPTION_EXECUTE_HANDLER) { |
| 1349 | return FALSE; |
| 1350 | } |
| 1351 | if (NameLength > 64) { |
| 1352 | SetLastError(ERROR_INVALID_NAME); |
| 1353 | return FALSE; // Very long name, seems like invalid data buffer |
| 1354 | } |
| 1355 | KB_GET_KERNEL_PROC_ADDRESS_IN Input = {}; |
| 1356 | KB_GET_KERNEL_PROC_ADDRESS_OUT Output = {}; |
| 1357 | Input.RoutineName = reinterpret_cast<WdkTypes::LPCWSTR>(RoutineName); |
| 1358 | Input.SizeOfBufferInBytes = static_cast<ULONG>(NameLength) * sizeof(WCHAR); // We're sure that Length <= 64 |
| 1359 | BOOL Status = KbSendRequest(Ctls::KbGetKernelProcAddress, &Input, sizeof(Input), &Output, sizeof(Output)); |
| 1360 | *KernelAddress = Output.Address; |
| 1361 | return Status; |
| 1362 | } |
| 1363 | |
| 1364 | BOOL WINAPI KbStallExecutionProcessor(ULONG Microseconds) |
| 1365 | { |
no test coverage detected