Skip to content

Commit

Permalink
Replaced ExAllocatePoolWithTag with ExAllocatePoolZero in avsstream s…
Browse files Browse the repository at this point in the history
…amples
  • Loading branch information
strongstrongyiwen committed Apr 6, 2020
1 parent 43e90d0 commit 60dab78
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 69 deletions.
25 changes: 3 additions & 22 deletions avstream/avscamera/sys/AvsCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,7 @@ PVOID operator new
POOL_TYPE poolType
)
{
PVOID result = ExAllocatePoolWithTag(poolType,iSize,'wNCK');

if (result) {
RtlZeroMemory(result,iSize);
}

return result;
return ExAllocatePoolZero(poolType,iSize,'wNCK');
}

PVOID operator new
Expand All @@ -48,13 +42,7 @@ PVOID operator new
ULONG tag
)
{
PVOID result = ExAllocatePoolWithTag(poolType,iSize,tag);

if (result) {
RtlZeroMemory(result,iSize);
}

return result;
return ExAllocatePoolZero(poolType,iSize,tag);
}

PVOID
Expand All @@ -67,14 +55,7 @@ operator new[](
ULONG tag
)
{
PVOID result = ExAllocatePoolWithTag(poolType, iSize, tag);

if (result)
{
RtlZeroMemory(result, iSize);
}

return result;
return ExAllocatePoolZero(poolType, iSize, tag);
}

/*++
Expand Down
6 changes: 3 additions & 3 deletions avstream/avscamera/sys/Capture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ Return Value:
(m_Pin->ConnectionFormat))->ImageInfoHeader);

m_VideoInfoHeader = reinterpret_cast <PKS_VIDEOINFOHEADER> (
ExAllocatePoolWithTag (
ExAllocatePoolZero (
NonPagedPoolNx,
max(sizeof(KS_VIDEOINFOHEADER), ConnectionHeader->biSize + KS_SIZE_PREHEADER),
AVSHWS_POOLTAG
Expand Down Expand Up @@ -308,7 +308,7 @@ Return Value:
VideoInfoHeader);

m_VideoInfoHeader = reinterpret_cast <PKS_VIDEOINFOHEADER> (
ExAllocatePoolWithTag (
ExAllocatePoolZero (
NonPagedPoolNx,
max(sizeof(KS_VIDEOINFOHEADER), KS_SIZE_VIDEOHEADER (ConnectionHeader)),
AVSHWS_POOLTAG
Expand Down Expand Up @@ -339,7 +339,7 @@ Return Value:
VideoInfoHeader2);

m_VideoInfoHeader = reinterpret_cast <PKS_VIDEOINFOHEADER> (
ExAllocatePoolWithTag(
ExAllocatePoolZero(
NonPagedPoolNx,
max(sizeof(KS_VIDEOINFOHEADER), ConnectionHeader->bmiHeader.biSize + KS_SIZE_PREHEADER),
AVSHWS_POOLTAG
Expand Down
2 changes: 1 addition & 1 deletion avstream/avshws/capture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ Return Value:
VideoInfoHeader);

m_VideoInfoHeader = reinterpret_cast <PKS_VIDEOINFOHEADER> (
ExAllocatePoolWithTag (
ExAllocatePoolZero (
NonPagedPoolNx,
KS_SIZE_VIDEOHEADER (ConnectionHeader),
AVSHWS_POOLTAG
Expand Down
25 changes: 3 additions & 22 deletions avstream/avshws/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,7 @@ PVOID operator new
POOL_TYPE poolType
)
{
PVOID result = ExAllocatePoolWithTag(poolType,iSize,'wNCK');

if (result) {
RtlZeroMemory(result,iSize);
}

return result;
return ExAllocatePoolZero(poolType,iSize,'wNCK');
}

PVOID operator new
Expand All @@ -50,13 +44,7 @@ PVOID operator new
ULONG tag
)
{
PVOID result = ExAllocatePoolWithTag(poolType,iSize,tag);

if (result) {
RtlZeroMemory(result,iSize);
}

return result;
return ExAllocatePoolZero(poolType,iSize,tag);
}

PVOID
Expand All @@ -69,14 +57,7 @@ operator new[](
ULONG tag
)
{
PVOID result = ExAllocatePoolWithTag(poolType, iSize, tag);

if (result)
{
RtlZeroMemory(result, iSize);
}

return result;
return ExAllocatePoolWZero(poolType, iSize, tag);
}

/*++
Expand Down
2 changes: 1 addition & 1 deletion avstream/avshws/hwsim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ Return Value:
// Allocate a scratch buffer for the synthesizer.
//
m_SynthesisBuffer = reinterpret_cast <PUCHAR> (
ExAllocatePoolWithTag (
ExAllocatePoolZero (
NonPagedPoolNx,
m_ImageSize,
AVSHWS_POOLTAG
Expand Down
6 changes: 3 additions & 3 deletions avstream/avssamp/Filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,17 +268,17 @@ Return Value:
//
PKSDATARANGE_AUDIO DataRangeAudio =
reinterpret_cast <PKSDATARANGE_AUDIO> (
ExAllocatePoolWithTag (PagedPool, sizeof (KSDATARANGE_AUDIO), AVSSMP_POOLTAG)
ExAllocatePoolZero (PagedPool, sizeof (KSDATARANGE_AUDIO), AVSSMP_POOLTAG)
);

PKSDATARANGE_AUDIO *DataRanges =
reinterpret_cast <PKSDATARANGE_AUDIO *> (
ExAllocatePoolWithTag (PagedPool, sizeof (PKSDATARANGE_AUDIO), AVSSMP_POOLTAG)
ExAllocatePoolZero (PagedPool, sizeof (PKSDATARANGE_AUDIO), AVSSMP_POOLTAG)
);

PKSALLOCATOR_FRAMING_EX Framing =
reinterpret_cast <PKSALLOCATOR_FRAMING_EX> (
ExAllocatePoolWithTag (PagedPool, sizeof (KSALLOCATOR_FRAMING_EX), AVSSMP_POOLTAG)
ExAllocatePoolZero (PagedPool, sizeof (KSALLOCATOR_FRAMING_EX), AVSSMP_POOLTAG)
);

if (DataRangeAudio && DataRanges && Framing) {
Expand Down
16 changes: 2 additions & 14 deletions avstream/avssamp/avssamp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,7 @@ PVOID operator new
POOL_TYPE poolType
)
{
PVOID result = ExAllocatePoolWithTag(poolType,iSize,'wNCK');

if (result) {
RtlZeroMemory(result,iSize);
}

return result;
return ExAllocatePoolZero(poolType,iSize,'wNCK');
}

PVOID operator new
Expand All @@ -57,13 +51,7 @@ PVOID operator new
ULONG tag
)
{
PVOID result = ExAllocatePoolWithTag(poolType,iSize,tag);

if (result) {
RtlZeroMemory(result,iSize);
}

return result;
return ExAllocatePoolZero(poolType,iSize,tag);
}

/*++
Expand Down
4 changes: 2 additions & 2 deletions avstream/avssamp/video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ Return Value:
VideoInfoHeader);

m_VideoInfoHeader = reinterpret_cast <PKS_VIDEOINFOHEADER> (
ExAllocatePoolWithTag (
ExAllocatePoolZero (
NonPagedPool,
KS_SIZE_VIDEOHEADER (ConnectionHeader),
AVSSMP_POOLTAG
Expand Down Expand Up @@ -864,7 +864,7 @@ Return Value:
if (FromState == KSSTATE_STOP) {

m_SynthesisBuffer = reinterpret_cast <PUCHAR> (
ExAllocatePoolWithTag (
ExAllocatePoolZero (
NonPagedPool,
m_VideoInfoHeader -> bmiHeader.biSizeImage,
AVSSMP_POOLTAG
Expand Down
2 changes: 1 addition & 1 deletion avstream/avssamp/wave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ Return Value:
//
if (NT_SUCCESS (Status)) {
m_WaveData = reinterpret_cast <PUCHAR> (
ExAllocatePoolWithTag (NonPagedPool, DataBlockSize, AVSSMP_POOLTAG)
ExAllocatePoolZero (NonPagedPool, DataBlockSize, AVSSMP_POOLTAG)
);

if (!m_WaveData) {
Expand Down

0 comments on commit 60dab78

Please sign in to comment.