mirror of
https://github.com/tnodir/fort
synced 2024-11-15 08:25:20 +00:00
Driver: Util: Add fort_mem_alloc/free_notag() macros
This commit is contained in:
parent
5c889a0eed
commit
52f68b3cbe
@ -25,6 +25,9 @@
|
|||||||
#endif
|
#endif
|
||||||
#define fort_mem_free(p, tag) ExFreePoolWithTag((p), (tag))
|
#define fort_mem_free(p, tag) ExFreePoolWithTag((p), (tag))
|
||||||
|
|
||||||
|
#define fort_mem_alloc_notag(size) ExAllocatePool(NonPagedPoolNx, (size))
|
||||||
|
#define fort_mem_free_notag(p) ExFreePool((p))
|
||||||
|
|
||||||
#define fort_request_complete_info(irp, status, info) \
|
#define fort_request_complete_info(irp, status, info) \
|
||||||
do { \
|
do { \
|
||||||
(irp)->IoStatus.Status = (status); \
|
(irp)->IoStatus.Status = (status); \
|
||||||
|
@ -12,7 +12,7 @@ static UNICODE_STRING g_system32Path;
|
|||||||
|
|
||||||
static NTSTATUS fort_string_new(ULONG len, PCWSTR src, PUNICODE_STRING outData)
|
static NTSTATUS fort_string_new(ULONG len, PCWSTR src, PUNICODE_STRING outData)
|
||||||
{
|
{
|
||||||
PWSTR buf = ExAllocatePool(NonPagedPool, len);
|
PWSTR buf = fort_mem_alloc_notag(len);
|
||||||
if (buf == NULL)
|
if (buf == NULL)
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
|
||||||
@ -140,7 +140,7 @@ FORT_API NTSTATUS fort_system32_path_init(PDRIVER_OBJECT driver, PUNICODE_STRING
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Free the allocated driver path */
|
/* Free the allocated driver path */
|
||||||
ExFreePool(driverPath.Buffer);
|
fort_mem_free_notag(driverPath.Buffer);
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ PEPROCESS IoGetCurrentProcess()
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
PVOID ExAllocatePoolWithTag(PVOID type, SIZE_T size, ULONG tag)
|
PVOID ExAllocatePoolWithTag(DWORD type, SIZE_T size, ULONG tag)
|
||||||
{
|
{
|
||||||
UNUSED(type);
|
UNUSED(type);
|
||||||
UNUSED(tag);
|
UNUSED(tag);
|
||||||
@ -26,7 +26,7 @@ void ExFreePoolWithTag(PVOID p, ULONG tag)
|
|||||||
HeapFree(GetProcessHeap(), 0, p);
|
HeapFree(GetProcessHeap(), 0, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
PVOID ExAllocatePool(PVOID flags, SIZE_T size)
|
PVOID ExAllocatePool(DWORD flags, SIZE_T size)
|
||||||
{
|
{
|
||||||
UNUSED(flags);
|
UNUSED(flags);
|
||||||
return HeapAlloc(GetProcessHeap(), 0, size);
|
return HeapAlloc(GetProcessHeap(), 0, size);
|
||||||
|
@ -224,9 +224,10 @@ FORT_API PEPROCESS IoGetCurrentProcess(VOID);
|
|||||||
|
|
||||||
#define NonPagedPool 0
|
#define NonPagedPool 0
|
||||||
#define NonPagedPoolExecute NonPagedPool
|
#define NonPagedPoolExecute NonPagedPool
|
||||||
FORT_API PVOID ExAllocatePoolWithTag(PVOID type, SIZE_T size, ULONG tag);
|
#define NonPagedPoolNx 512
|
||||||
|
FORT_API PVOID ExAllocatePoolWithTag(DWORD type, SIZE_T size, ULONG tag);
|
||||||
FORT_API void ExFreePoolWithTag(PVOID p, ULONG tag);
|
FORT_API void ExFreePoolWithTag(PVOID p, ULONG tag);
|
||||||
FORT_API PVOID ExAllocatePool(PVOID type, SIZE_T size);
|
FORT_API PVOID ExAllocatePool(DWORD type, SIZE_T size);
|
||||||
FORT_API void ExFreePool(PVOID p);
|
FORT_API void ExFreePool(PVOID p);
|
||||||
|
|
||||||
typedef ULONG64 POOL_FLAGS;
|
typedef ULONG64 POOL_FLAGS;
|
||||||
|
Loading…
Reference in New Issue
Block a user