forked from pig4210/xlib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xlib_base.cc
44 lines (35 loc) · 880 Bytes
/
xlib_base.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "xlib_base.h"
#if defined(_WIN32) && defined(FOR_RING0)
// 注意#undef POOL_TAGGING无效,并不能还原API定义
#ifdef POOL_TAGGING
# undef ExAllocatePool
# undef ExAllocatePoolWithQuota
# undef ExFreePool
#endif
void* __cdecl operator new(size_t size)
{
return ExAllocatePool(NonPagedPool, size);
}
void* __cdecl operator new(size_t size, POOL_TYPE pooltype)
{
return ExAllocatePool(pooltype, size);
}
void* __cdecl operator new[](size_t size)
{
return ExAllocatePool(NonPagedPool, size);
}
void* __cdecl operator new[](size_t size, POOL_TYPE pooltype)
{
return ExAllocatePool(pooltype, size);
}
void __cdecl operator delete(void* mem)
{
if(mem == nullptr) return;
ExFreePool(mem);
}
void __cdecl operator delete[](void* mem)
{
if(mem == nullptr) return;
ExFreePool(mem);
}
#endif // _WIN32 && FOR_RING0