HyperDbg/hyperdbg/include/platform/kernel/header/PlatformMem.h
Max Raulea a02a0a25fd Port hyperlog to the Linux kernel module
Logging.c and UnloadDll.c compile and link into HyperDbg.ko, along with
the two components that were waiting on the logging layer (BinarySearch,
OptimizationsExamples).

- new PlatformStr.{h,c}: PlatformVsnprintf/Sprintf/Strnlen replace
  vsprintf_s/sprintf_s/strnlen_s; PlatformSprintf moved here out of
  PlatformMem so both spellings return -1 on truncation
- BasicTypes.h: IRP/IO_STACK_LOCATION/IO_STATUS_BLOCK/UNICODE_STRING
  grow the members shared code touches, plus the NT status and access
  constants the notify path needs
- Environment.h: RTL_NUMBER_OF, _Analysis_assume_, ASSERT -> WARN_ON
- PlatformEvent: ExEventObjectType placeholder token
- HyperLogCallback.c stays out of the module: it defines the same
  LogCallback* entry points as Logging.c (it is the per-DLL forwarding
  shim on Windows), so in one link unit it is a duplicate symbol
2026-08-14 16:25:37 +02:00

71 lines
1.6 KiB
C

/**
* @file PlatformMem.h
* @author Behrooz Abbassi (BehroozAbbassi@hyperdbg.org)
* @author Sina Karvandi (sina@hyperdbg.org)
* @author Alirez Moradi (alish014)
* @brief Cross platform APIs for memory allocation
* @details
* @version 0.1
* @date 2022-01-17
*
* @copyright This project is released under the GNU Public License v3.
*
*/
#pragma once
#if defined(__linux__)
// # include "../../general/header/GeneralTypes.h"
# include "../../../../include/SDK/HyperDbgSdk.h"
#endif // defined(__linux__)
//////////////////////////////////////////////////
// Functions //
//////////////////////////////////////////////////
VOID
PlatformFreeMemory(PVOID Memory);
VOID
PlatformWriteMemory(PVOID Address, PVOID Buffer, SIZE_T Size);
VOID
PlatformSetMemory(PVOID Destination, int Value, SIZE_T Size);
VOID
PlatformZeroMemory(PVOID Destination, SIZE_T Size);
VOID
PlatformFreeMemory(PVOID Memory);
PVOID
PlatformAllocateMemory(SIZE_T Size);
PVOID
PlatformMemAllocateContiguousZeroedMemory(SIZE_T NumberOfBytes);
PVOID
PlatformMemAllocateNonPagedPool(SIZE_T NumberOfBytes);
PVOID
PlatformMemAllocateNonPagedPoolWithQuota(SIZE_T NumberOfBytes);
PVOID
PlatformMemAllocateZeroedNonPagedPool(SIZE_T NumberOfBytes);
PVOID
PlatformMemFreePool(PVOID BufferAddress);
PVOID
PlatformMemAllocateContiguousZeroedMemory(SIZE_T NumberOfBytes);
PVOID
PlatformMemAllocateNonPagedPool(SIZE_T NumberOfBytes);
PVOID
PlatformMemAllocateNonPagedPoolWithQuota(SIZE_T NumberOfBytes);
PVOID
PlatformMemAllocateZeroedNonPagedPool(SIZE_T NumberOfBytes);
PVOID
PlatformMemFreePool(PVOID BufferAddress);