summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Maczugowski <[email protected]>2021-01-14 14:55:41 -0500
committerGitHub <[email protected]>2021-01-14 11:55:41 -0800
commit9e91095440410c63626e7e2eaf3ce341780edf82 (patch)
tree9470b26095fbfe41466712e8d5c704f7bf3a7bce
parent31ef0db3ef36b4d1949ae9c8e2760a7f499d1113 (diff)
Replace ExAllocatePoolWithTag with new API ExAllocatePoolZero. (#486)
Co-authored-by: Drew Maczugowski <[email protected]>
-rw-r--r--storage/msdsm/src/SampleDSM.infbin5354 -> 5388 bytes
-rw-r--r--storage/msdsm/src/intrface.c5
-rw-r--r--storage/msdsm/src/precomp.h1
-rw-r--r--storage/msdsm/src/prototypes.h4
-rw-r--r--storage/msdsm/src/utils.c8
5 files changed, 10 insertions, 8 deletions
diff --git a/storage/msdsm/src/SampleDSM.inf b/storage/msdsm/src/SampleDSM.inf
index f632f6e5..5617fa4e 100644
--- a/storage/msdsm/src/SampleDSM.inf
+++ b/storage/msdsm/src/SampleDSM.inf
Binary files differ
diff --git a/storage/msdsm/src/intrface.c b/storage/msdsm/src/intrface.c
index 925252be..b282600f 100644
--- a/storage/msdsm/src/intrface.c
+++ b/storage/msdsm/src/intrface.c
@@ -101,6 +101,11 @@ Return Value:
//
+ // Must call this function before using pool allocation functions.
+ //
+ ExInitializeDriverRuntime(0);
+
+ //
// Initialize the tracing subsystem.
// Any failure is handled by ETW itself.
//
diff --git a/storage/msdsm/src/precomp.h b/storage/msdsm/src/precomp.h
index c199724e..12f1a7aa 100644
--- a/storage/msdsm/src/precomp.h
+++ b/storage/msdsm/src/precomp.h
@@ -18,6 +18,7 @@ Revision History:
#pragma once
#define DEBUG_MAIN_SOURCE 1
+#define POOL_ZERO_DOWN_LEVEL_SUPPORT
#include <stdio.h>
#include <stdarg.h>
diff --git a/storage/msdsm/src/prototypes.h b/storage/msdsm/src/prototypes.h
index 1df58197..371315ba 100644
--- a/storage/msdsm/src/prototypes.h
+++ b/storage/msdsm/src/prototypes.h
@@ -1336,8 +1336,8 @@ Description:
Arguments:
Srb - A pointer to either a STORAGE_REQUEST_BLOCK or a SCSI_REQUEST_BLOCK.
- PoolType - The pool type to use. See documentation for ExAllocatePoolWithTag().
- Tag - The allocation tag to use. See documentation for ExAllocatePoolWithTag().
+ PoolType - The pool type to use. See documentation for ExAllocatePoolZero().
+ Tag - The allocation tag to use. See documentation for ExAllocatePoolZero().
Returns:
NULL, if the copy could not be allocated; or
diff --git a/storage/msdsm/src/utils.c b/storage/msdsm/src/utils.c
index 2f1bcbe1..1d966fd5 100644
--- a/storage/msdsm/src/utils.c
+++ b/storage/msdsm/src/utils.c
@@ -93,10 +93,7 @@ Return Value:
Tag));
#pragma warning(suppress: 28118) // False-positive; PoolType is simply passed through
- Block = ExAllocatePoolWithTag(PoolType, NumberOfBytes, Tag);
- if (Block) {
- RtlZeroMemory(Block, NumberOfBytes);
- }
+ Block = ExAllocatePoolZero(PoolType, NumberOfBytes, Tag);
TracePrint((TRACE_LEVEL_VERBOSE,
TRACE_FLAG_GENERAL,
@@ -176,7 +173,7 @@ Return Value:
if (NT_SUCCESS(status)) {
#pragma warning(suppress: 6014 28118) // Block isn't leaked, this function is marked as an allocator; PoolType is simply passed through
- Block = ExAllocatePoolWithTag(PoolType, totalSize, Tag);
+ Block = ExAllocatePoolZero(PoolType, totalSize, Tag);
if (Block != NULL) {
@@ -194,7 +191,6 @@ __Exit:
if (NT_SUCCESS(status)) {
- RtlZeroMemory(Block, totalSize);
*BytesAllocated = totalSize;
}