Update README.md

merge-requests/1/head
_xeroxz 4 years ago
parent c600b30d4b
commit 62cf173199

@ -33,4 +33,28 @@ drv::kalloc_t _kalloc = [&](std::size_t size) -> void*
return vdm.syscall<ex_alloc_pool_t>(ex_alloc_pool, NULL, size); return vdm.syscall<ex_alloc_pool_t>(ex_alloc_pool, NULL, size);
}; };
```
###### kalloc - MSREXEC
`NOTE: When using MSREXEC be aware that `vdm::msrexec_ctx::exec` returns void. This requires a programmer to make a nested lambda in order to obtain a result.`
```cpp
vdm::msrexec_ctx msrexec(_write_msr);
drv::kalloc_t _kalloc = [&](std::size_t size) -> void*
{
void* alloc_base;
msrexec.exec([&](void* krnl_base, get_system_routine_t get_kroutine) -> void
{
using ex_alloc_pool_t =
void* (*)(std::uint32_t, std::size_t);
const auto ex_alloc_pool =
reinterpret_cast<ex_alloc_pool_t>(
get_kroutine(krnl_base, "ExAllocatePool"));
alloc_base = ex_alloc_pool(NULL, size);
});
return alloc_base;
};
``` ```
Loading…
Cancel
Save