| 1014 | namespace MemoryManagement |
| 1015 | { |
| 1016 | BOOL WINAPI KbAllocUserMemory(ULONG ProcessId, ULONG Protect, ULONG Size, OUT WdkTypes::PVOID* BaseAddress) |
| 1017 | { |
| 1018 | if (!ProcessId || !Size || !BaseAddress) return FALSE; |
| 1019 | KB_ALLOC_USER_MEMORY_IN Input = {}; |
| 1020 | KB_ALLOC_USER_MEMORY_OUT Output = {}; |
| 1021 | Input.ProcessId = ProcessId; |
| 1022 | Input.Protect = Protect; |
| 1023 | Input.Size = Size; |
| 1024 | BOOL Status = KbSendRequest(Ctls::KbAllocUserMemory, &Input, sizeof(Input), &Output, sizeof(Output)); |
| 1025 | *BaseAddress = Output.BaseAddress; |
| 1026 | return Status; |
| 1027 | } |
| 1028 | |
| 1029 | BOOL WINAPI KbFreeUserMemory(ULONG ProcessId, WdkTypes::PVOID BaseAddress) |
| 1030 | { |