summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Spruill <[email protected]>2026-01-08 17:39:13 -0500
committerDavid Spruill <[email protected]>2026-01-08 17:39:13 -0500
commit5778c65af08b68ef4cce309212926dfcebc73d89 (patch)
tree713a4656274bb6a88468448a3969238d41ea801f
parentae267d0928bc42ec90dc7e5bf03267f237c12585 (diff)
Correct a buggy sample
-rw-r--r--video/KMDOD/bdd.hxx12
-rw-r--r--video/KMDOD/bdd_ddi.cxx2
-rw-r--r--video/KMDOD/blthw.cxx2
-rw-r--r--video/KMDOD/memory.cxx14
4 files changed, 9 insertions, 21 deletions
diff --git a/video/KMDOD/bdd.hxx b/video/KMDOD/bdd.hxx
index 61c40e03..7ea38b34 100644
--- a/video/KMDOD/bdd.hxx
+++ b/video/KMDOD/bdd.hxx
@@ -626,18 +626,12 @@ IsEdidChecksumValid(_In_reads_bytes_(EDID_V1_BLOCK_SIZE) const BYTE* pEdid);
// Memory handling
//
-// Defaulting the value of PoolType means that any call to new Foo()
+// Requiring POOL_FLAGS means that any call to new Foo()
// will raise a compiler error for being ambiguous. This is to help keep
// any calls to allocate memory from accidentally NOT going through
// these functions.
-_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 = PagedPool);
-_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 = PagedPool);
+void* __cdecl operator new(size_t Size, POOL_FLAGS Flags);
+void* __cdecl operator new[](size_t Size, POOL_FLAGS Flags);
void __cdecl operator delete(void* pObject);
void __cdecl operator delete(void* pObject, size_t s);
void __cdecl operator delete[](void* pObject);
diff --git a/video/KMDOD/bdd_ddi.cxx b/video/KMDOD/bdd_ddi.cxx
index 5a53a3be..924758c5 100644
--- a/video/KMDOD/bdd_ddi.cxx
+++ b/video/KMDOD/bdd_ddi.cxx
@@ -103,7 +103,7 @@ BddDdiAddDevice(
}
*ppDeviceContext = NULL;
- BASIC_DISPLAY_DRIVER* pBDD = new(NonPagedPoolNx) BASIC_DISPLAY_DRIVER(pPhysicalDeviceObject);
+ BASIC_DISPLAY_DRIVER* pBDD = new(POOL_FLAG_NON_PAGED) BASIC_DISPLAY_DRIVER(pPhysicalDeviceObject);
if (pBDD == NULL)
{
BDD_LOG_LOW_RESOURCE0("pBDD failed to be allocated");
diff --git a/video/KMDOD/blthw.cxx b/video/KMDOD/blthw.cxx
index 2e6d2e5d..b2f82492 100644
--- a/video/KMDOD/blthw.cxx
+++ b/video/KMDOD/blthw.cxx
@@ -282,7 +282,7 @@ BDD_HWBLT::ExecutePresentDisplayOnly(
SIZE_T size = sizeof(DoPresentMemory) + sizeMoves + sizeRects;
DoPresentMemory* ctx = reinterpret_cast<DoPresentMemory*>
- (new (PagedPool) BYTE[size]);
+ (new (POOL_FLAG_PAGED) BYTE[size]);
if (!ctx)
{
diff --git a/video/KMDOD/memory.cxx b/video/KMDOD/memory.cxx
index aae795df..73dabcf8 100644
--- a/video/KMDOD/memory.cxx
+++ b/video/KMDOD/memory.cxx
@@ -14,16 +14,13 @@
//
// New and delete operators
//
-_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)
+void* __cdecl operator new(size_t Size, POOL_FLAGS Flags)
{
PAGED_CODE();
Size = (Size != 0) ? Size : 1;
- void* pObject = ExAllocatePoolWithTag(PoolType, Size, BDDTAG);
+ void* pObject = ExAllocatePool2(Flags, Size, BDDTAG);
#if DBG
if (pObject != NULL)
@@ -35,16 +32,13 @@ void* __cdecl operator new(size_t Size, POOL_TYPE PoolType)
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)
+void* __cdecl operator new[](size_t Size, POOL_FLAGS Flags)
{
PAGED_CODE();
Size = (Size != 0) ? Size : 1;
- void* pObject = ExAllocatePoolWithTag(PoolType, Size, BDDTAG);
+ void* pObject = ExAllocatePool2(Flags, Size, BDDTAG);
#if DBG
if (pObject != NULL)