mirror of
https://github.com/arehnman/yttrium-virtio-gpu.git
synced 2026-10-31 02:05:04 +00:00
ExAllocatePoolWithTag has been deprecated in Windows 10 version 2004. Starting with EWDK 11 22H2, using ExAllocatePoolWithTag causes a warning, which is treated as an error. EWDK suggests replacing ExAllocatePoolWithTag on ExAllocatePool2, but ExAllocatePool2 only works on Windows 10 2004 and above. This commit replaced this function with ExAllocatePoolUninitialized to support Windows 10 2004 and below. All of these features first appeared in WDK 2004. Fixes for https://bugzilla.redhat.com/show_bug.cgi?id=2138115 Signed-off-by: Kostiantyn Kostiuk <[email protected]>
68 lines
1.4 KiB
C++
Executable File
68 lines
1.4 KiB
C++
Executable File
#include "baseobj.h"
|
|
|
|
_When_((PoolType & NonPagedPoolMustSucceed) != 0,
|
|
__drv_reportError("Must succeed pool allocations are forbidden. "
|
|
"Allocation failures cause a system crash"))
|
|
void* __cdecl operator new(size_t Size, POOL_TYPE PoolType)
|
|
{
|
|
Size = (Size != 0) ? Size : 1;
|
|
|
|
void* pObject = ExAllocatePoolUninitialized(PoolType, Size, VIOGPUTAG);
|
|
|
|
if (pObject != NULL)
|
|
{
|
|
#if DBG
|
|
RtlFillMemory(pObject, Size, 0xCD);
|
|
#else
|
|
RtlZeroMemory(pObject, Size);
|
|
#endif // DBG
|
|
}
|
|
return pObject;
|
|
}
|
|
|
|
_When_((PoolType & NonPagedPoolMustSucceed) != 0,
|
|
__drv_reportError("Must succeed pool allocations are forbidden. "
|
|
"Allocation failures cause a system crash"))
|
|
void* __cdecl operator new[](size_t Size, POOL_TYPE PoolType)
|
|
{
|
|
|
|
Size = (Size != 0) ? Size : 1;
|
|
|
|
void* pObject = ExAllocatePoolUninitialized(PoolType, Size, VIOGPUTAG);
|
|
|
|
if (pObject != NULL)
|
|
{
|
|
#if DBG
|
|
RtlFillMemory(pObject, Size, 0xCD);
|
|
#else
|
|
RtlZeroMemory(pObject, Size);
|
|
#endif
|
|
}
|
|
return pObject;
|
|
}
|
|
|
|
void __cdecl operator delete(void* pObject)
|
|
{
|
|
|
|
if (pObject != NULL)
|
|
{
|
|
ExFreePoolWithTag(pObject, VIOGPUTAG);
|
|
}
|
|
}
|
|
|
|
void __cdecl operator delete[](void* pObject)
|
|
{
|
|
|
|
if (pObject != NULL)
|
|
{
|
|
ExFreePoolWithTag(pObject, VIOGPUTAG);
|
|
}
|
|
}
|
|
|
|
void __cdecl operator delete(void *pObject, size_t Size)
|
|
{
|
|
|
|
UNREFERENCED_PARAMETER(Size);
|
|
::operator delete (pObject);
|
|
}
|