diff options
| author | amlal <amlal@el-mahrouss-logic.com> | 2024-03-21 00:38:52 +0100 |
|---|---|---|
| committer | amlal <amlal@el-mahrouss-logic.com> | 2024-03-21 00:38:52 +0100 |
| commit | 333fed96b7ccd3ee4f5f097445408dde34d330db (patch) | |
| tree | a1c9894b26bd81c2e762b5487e04601b357682f2 /Public/Kits/System.Core/HeapRuntime.cxx | |
| parent | f48c5b2cda43241919d3ea1b263bef01e014c537 (diff) | |
Kernel: See below.
- Fix kernel heap, made it better.
- Fix System.Core, made it better.
Signed-off-by: amlal <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'Public/Kits/System.Core/HeapRuntime.cxx')
| -rw-r--r-- | Public/Kits/System.Core/HeapRuntime.cxx | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/Public/Kits/System.Core/HeapRuntime.cxx b/Public/Kits/System.Core/HeapRuntime.cxx new file mode 100644 index 00000000..c2f1f0e9 --- /dev/null +++ b/Public/Kits/System.Core/HeapRuntime.cxx @@ -0,0 +1,44 @@ +/** =========================================== + (C) Mahrouss Logic + ===========================================*/ + +#include <System.Core/Heap.hxx> + +/// @brief Allocate from the user's heap. +/// @param refObj Process object. +/// @param sz size of object. +/// @param flags flags. +/// @return +CA_EXTERN_C PVOID HcAllocateProcessHeap(ObjectPtr refObj, QWORD sz, + DWORD flags) { + CA_MUST_PASS(sz); + CA_MUST_PASS(flags); + + return (PVOID)refObj->Invoke(refObj, kProcessCallAllocPtr, sz, flags); +} + +/// @brief Free pointer from the user's heap. +/// @param refObj Process object. +/// @param ptr the pointer to free. +CA_EXTERN_C VOID HcFreeProcessHeap(ObjectPtr refObj, PVOID ptr) { + CA_MUST_PASS(ptr); + CA_UNREFERENCED_PARAMETER(refObj->Invoke(refObj, kProcessCallFreePtr, ptr)); +} + +/// @brief Get pointer size. +/// @param refObj Process object. +/// @param ptr the pointer to find. +/// @return the size. +CA_EXTERN_C QWORD HcProcessHeapSize(ObjectPtr refObj, PVOID ptr) { + CA_MUST_PASS(ptr); + return refObj->Invoke(refObj, kProcessCallSizePtr, ptr); +} + +/// @brief Check if the pointer exists. +/// @param refObj Process object. +/// @param ptr the pointer to check. +/// @return if it exists +CA_EXTERN_C BOOL HcProcessHeapExists(ObjectPtr refObj, PVOID ptr) { + CA_MUST_PASS(ptr); + return refObj->Invoke(refObj, kProcessCallCheckPtr, ptr); +} |
