summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGirish Pattabiraman <[email protected]>2017-02-08 15:02:51 -0800
committerGirish Pattabiraman <[email protected]>2017-02-08 15:02:51 -0800
commit42cd81689c12568ae4451fe956da6bb5e453e058 (patch)
treeaf655861274bc4ca6c8c7404caec4cd86aa18ef9
parent27fa3e21b807201a69146d1d16bf297c7e1fe880 (diff)
Add NewDelete operators locally as recommeded in C4595 warning and "stdunk.h"
-rw-r--r--audio/sysvad/EndpointsCommon/EndpointsCommon.vcxproj15
-rw-r--r--audio/sysvad/EndpointsCommon/MiniportStreamAudioEngineNode.cpp8
-rw-r--r--audio/sysvad/EndpointsCommon/NewDelete.cpp174
-rw-r--r--audio/sysvad/EndpointsCommon/NewDelete.h117
-rw-r--r--audio/sysvad/EndpointsCommon/minwavert.cpp16
-rw-r--r--audio/sysvad/EndpointsCommon/minwavert.h6
-rw-r--r--audio/sysvad/EndpointsCommon/minwavertstream.cpp9
-rw-r--r--audio/sysvad/EndpointsCommon/minwavertstream.h6
-rw-r--r--audio/sysvad/PhoneAudioSample/PhoneAudioSample.vcxproj10
-rw-r--r--audio/sysvad/TabletAudioSample/TabletAudioSample.vcxproj15
-rw-r--r--audio/sysvad/adapter.cpp3
-rw-r--r--audio/sysvad/common.cpp39
-rw-r--r--audio/sysvad/sysvad.h1
13 files changed, 362 insertions, 57 deletions
diff --git a/audio/sysvad/EndpointsCommon/EndpointsCommon.vcxproj b/audio/sysvad/EndpointsCommon/EndpointsCommon.vcxproj
index 1956d106..a0c0e157 100644
--- a/audio/sysvad/EndpointsCommon/EndpointsCommon.vcxproj
+++ b/audio/sysvad/EndpointsCommon/EndpointsCommon.vcxproj
@@ -95,10 +95,9 @@
</ResourceCompile>
<ClCompile>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS</PreprocessorDefinitions>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS;_NEW_DELETE_OPERATORS_</PreprocessorDefinitions>
<ExceptionHandling>
</ExceptionHandling>
- <DisableSpecificWarnings>4595;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Midl>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..</AdditionalIncludeDirectories>
@@ -112,10 +111,9 @@
</ResourceCompile>
<ClCompile>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS</PreprocessorDefinitions>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS;_NEW_DELETE_OPERATORS_</PreprocessorDefinitions>
<ExceptionHandling>
</ExceptionHandling>
- <DisableSpecificWarnings>4595;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Midl>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..</AdditionalIncludeDirectories>
@@ -129,10 +127,9 @@
</ResourceCompile>
<ClCompile>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS</PreprocessorDefinitions>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS;_NEW_DELETE_OPERATORS_</PreprocessorDefinitions>
<ExceptionHandling>
</ExceptionHandling>
- <DisableSpecificWarnings>4595;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Midl>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..</AdditionalIncludeDirectories>
@@ -146,10 +143,9 @@
</ResourceCompile>
<ClCompile>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS</PreprocessorDefinitions>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS;_NEW_DELETE_OPERATORS_</PreprocessorDefinitions>
<ExceptionHandling>
</ExceptionHandling>
- <DisableSpecificWarnings>4595;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Midl>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..</AdditionalIncludeDirectories>
@@ -167,6 +163,7 @@
<ClCompile Include="mintopo.cpp" />
<ClCompile Include="minwavert.cpp" />
<ClCompile Include="minwavertstream.cpp" />
+ <ClCompile Include="NewDelete.cpp" />
<ClCompile Include="speakerhptopo.cpp" />
<ClCompile Include="speakertopo.cpp" />
</ItemGroup>
@@ -183,4 +180,4 @@
<ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-</Project> \ No newline at end of file
+</Project>
diff --git a/audio/sysvad/EndpointsCommon/MiniportStreamAudioEngineNode.cpp b/audio/sysvad/EndpointsCommon/MiniportStreamAudioEngineNode.cpp
index deba14f2..a210f77b 100644
--- a/audio/sysvad/EndpointsCommon/MiniportStreamAudioEngineNode.cpp
+++ b/audio/sysvad/EndpointsCommon/MiniportStreamAudioEngineNode.cpp
@@ -855,9 +855,12 @@ NTSTATUS CMiniportWaveRTStream::SetCurrentWritePositionInternal(_In_ ULONG _ulC
//linear and presentation positions
#pragma code_seg()
-NTSTATUS CMiniportWaveRTStream::GetPositions(_Out_ ULONGLONG *_pullLinearBufferPosition, _Out_ ULONGLONG *_pullPresentationPosition, LARGE_INTEGER *_pliQPCTime)
+NTSTATUS CMiniportWaveRTStream::GetPositions(
+ _Out_opt_ ULONGLONG * _pullLinearBufferPosition,
+ _Out_opt_ ULONGLONG * _pullPresentationPosition,
+ _Out_opt_ LARGE_INTEGER * _pliQPCTime
+ )
{
- ASSERT (_pullLinearBufferPosition);
DPF_ENTER(("[CMiniportWaveRTStream::GetPositions]"));
NTSTATUS ntStatus;
@@ -993,4 +996,3 @@ NTSTATUS CMiniportWaveRTStream::SetStreamCurrentWritePositionForLastBuffer(_In_
return ntStatus;
}
-
diff --git a/audio/sysvad/EndpointsCommon/NewDelete.cpp b/audio/sysvad/EndpointsCommon/NewDelete.cpp
new file mode 100644
index 00000000..584d28e8
--- /dev/null
+++ b/audio/sysvad/EndpointsCommon/NewDelete.cpp
@@ -0,0 +1,174 @@
+/*****************************************************************************
+ * NewDelete.cpp - CPP placement new and delete operators implementation
+ *****************************************************************************
+ * Copyright (c) Microsoft Corporation All Rights Reserved
+ *
+ * Module Name:
+ *
+ * NewDelete.cpp
+ *
+ * Abstract:
+ *
+ * Definition of placement new and delete operators.
+ *
+ */
+
+#ifdef _NEW_DELETE_OPERATORS_
+#ifdef __cplusplus
+extern "C" {
+#include <wdm.h>
+}
+#else
+#include <wdm.h>
+#endif
+
+#include "newDelete.h"
+#include "sysvad.h"
+
+#pragma code_seg()
+/*****************************************************************************
+ * Functions
+ */
+
+/*****************************************************************************
+ * ::new()
+ *****************************************************************************
+ * New function for creating objects with a specified allocation tag.
+ */
+PVOID operator new
+(
+ size_t iSize,
+ _When_((poolType & NonPagedPoolMustSucceed) != 0,
+ __drv_reportError("Must succeed pool allocations are forbidden. "
+ "Allocation failures cause a system crash"))
+ POOL_TYPE poolType,
+ ULONG tag
+)
+{
+ PVOID result = ExAllocatePoolWithTag(poolType, iSize, tag);
+
+ if (result)
+ {
+ RtlZeroMemory(result,iSize);
+ }
+
+ return result;
+}
+
+
+/*****************************************************************************
+ * ::new()
+ *****************************************************************************
+ * New function for creating objects with a specified allocation tag.
+ */
+PVOID operator new
+(
+ size_t iSize,
+ _When_((poolType & NonPagedPoolMustSucceed) != 0,
+ __drv_reportError("Must succeed pool allocations are forbidden. "
+ "Allocation failures cause a system crash"))
+ POOL_TYPE poolType
+)
+{
+ PVOID result = ExAllocatePoolWithTag(poolType, iSize, SYSVAD_POOLTAG);
+
+ if (result)
+ {
+ RtlZeroMemory(result,iSize);
+ }
+
+ return result;
+}
+
+
+/*****************************************************************************
+ * ::delete()
+ *****************************************************************************
+ * Delete with tag function.
+ */
+void __cdecl operator delete
+(
+ PVOID pVoid,
+ ULONG tag
+)
+{
+ if (pVoid)
+ {
+ ExFreePoolWithTag(pVoid, tag);
+ }
+}
+
+
+/*****************************************************************************
+ * ::delete()
+ *****************************************************************************
+ * Sized Delete function.
+ */
+void __cdecl operator delete
+(
+ _Pre_maybenull_ __drv_freesMem(Mem) PVOID pVoid,
+ _In_ size_t cbSize
+)
+{
+ UNREFERENCED_PARAMETER(cbSize);
+
+ if (pVoid)
+ {
+ ExFreePoolWithTag(pVoid, SYSVAD_POOLTAG);
+ }
+}
+
+
+/*****************************************************************************
+ * ::delete()
+ *****************************************************************************
+ * Basic Delete function.
+ */
+void __cdecl operator delete
+(
+ PVOID pVoid
+)
+{
+ if (pVoid)
+ {
+ ExFreePoolWithTag(pVoid, SYSVAD_POOLTAG);
+ }
+}
+
+
+/*****************************************************************************
+ * ::delete()
+ *****************************************************************************
+ * Sized Array Delete function.
+ */
+void __cdecl operator delete[]
+(
+ _Pre_maybenull_ __drv_freesMem(Mem) PVOID pVoid,
+ _In_ size_t cbSize
+)
+{
+ UNREFERENCED_PARAMETER(cbSize);
+
+ if (pVoid)
+ {
+ ExFreePoolWithTag(pVoid, SYSVAD_POOLTAG);
+ }
+}
+
+
+/*****************************************************************************
+ * ::delete()
+ *****************************************************************************
+ * Array Delete function.
+ */
+void __cdecl operator delete[]
+(
+ _Pre_maybenull_ __drv_freesMem(Mem) PVOID pVoid
+)
+{
+ if (pVoid)
+ {
+ ExFreePoolWithTag(pVoid, SYSVAD_POOLTAG);
+ }
+}
+
diff --git a/audio/sysvad/EndpointsCommon/NewDelete.h b/audio/sysvad/EndpointsCommon/NewDelete.h
new file mode 100644
index 00000000..53765939
--- /dev/null
+++ b/audio/sysvad/EndpointsCommon/NewDelete.h
@@ -0,0 +1,117 @@
+/*++
+
+Copyright (c) Microsoft Corporation All Rights Reserved
+
+Module Name:
+
+ NewDelete.h
+
+Abstract:
+
+ Declaration of placement new and delete operators.
+
+//@@BEGIN_DDKSPLIT
+Revision History:
+
+//@@END_DDKSPLIT
+
+--*/
+#pragma once
+
+#ifdef _NEW_DELETE_OPERATORS_
+
+/*****************************************************************************
+ * Functions
+ */
+
+/*****************************************************************************
+ * ::new()
+ *****************************************************************************
+ * New function for creating objects with a specified allocation tag and
+ * pool type
+ */
+PVOID operator new
+(
+ size_t iSize,
+ _When_((poolType & NonPagedPoolMustSucceed) != 0,
+ __drv_reportError("Must succeed pool allocations are forbidden. "
+ "Allocation failures cause a system crash"))
+ POOL_TYPE poolType,
+ ULONG tag
+);
+
+
+/*****************************************************************************
+ * ::new()
+ *****************************************************************************
+ * New function for creating objects with a specified pool type.
+ */
+PVOID operator new
+(
+ size_t iSize,
+ _When_((poolType & NonPagedPoolMustSucceed) != 0,
+ __drv_reportError("Must succeed pool allocations are forbidden. "
+ "Allocation failures cause a system crash"))
+ POOL_TYPE poolType
+);
+
+
+/*****************************************************************************
+ * ::delete()
+ *****************************************************************************
+ * Delete with tag function.
+ */
+void __cdecl operator delete
+(
+ PVOID pVoid,
+ ULONG tag
+);
+
+
+/*****************************************************************************
+ * ::delete()
+ *****************************************************************************
+ * Sized Delete function.
+ */
+void __cdecl operator delete
+(
+ _Pre_maybenull_ __drv_freesMem(Mem) PVOID pVoid,
+ _In_ size_t cbSize
+);
+
+
+/*****************************************************************************
+ * ::delete()
+ *****************************************************************************
+ * Basic Delete function.
+ */
+void __cdecl operator delete
+(
+ PVOID pVoid
+);
+
+
+/*****************************************************************************
+ * ::delete()
+ *****************************************************************************
+ * Sized Array Delete function.
+ */
+void __cdecl operator delete[]
+(
+ _Pre_maybenull_ __drv_freesMem(Mem) PVOID pVoid,
+ _In_ size_t cbSize
+);
+
+
+/*****************************************************************************
+ * ::delete()
+ *****************************************************************************
+ * Array Delete function.
+ */
+void __cdecl operator delete[]
+(
+ _Pre_maybenull_ __drv_freesMem(Mem) PVOID pVoid
+);
+
+#endif//_NEW_DELETE_OPERATORS_
+
diff --git a/audio/sysvad/EndpointsCommon/minwavert.cpp b/audio/sysvad/EndpointsCommon/minwavert.cpp
index 7d021767..53fcfac2 100644
--- a/audio/sysvad/EndpointsCommon/minwavert.cpp
+++ b/audio/sysvad/EndpointsCommon/minwavert.cpp
@@ -2081,6 +2081,7 @@ CKeywordDetector::CKeywordDetector()
}
#pragma code_seg("PAGE")
+_IRQL_requires_max_(PASSIVE_LEVEL)
VOID CKeywordDetector::ResetDetector()
{
PAGED_CODE();
@@ -2089,7 +2090,8 @@ VOID CKeywordDetector::ResetDetector()
}
#pragma code_seg("PAGE")
-VOID CKeywordDetector::DownloadDetectorData(LONGLONG Data)
+_IRQL_requires_max_(PASSIVE_LEVEL)
+VOID CKeywordDetector::DownloadDetectorData(_In_ LONGLONG Data)
{
PAGED_CODE();
@@ -2097,6 +2099,7 @@ VOID CKeywordDetector::DownloadDetectorData(LONGLONG Data)
}
#pragma code_seg("PAGE")
+_IRQL_requires_max_(PASSIVE_LEVEL)
LONGLONG CKeywordDetector::GetDetectorData()
{
PAGED_CODE();
@@ -2105,6 +2108,7 @@ LONGLONG CKeywordDetector::GetDetectorData()
}
#pragma code_seg("PAGE")
+_IRQL_requires_max_(PASSIVE_LEVEL)
VOID CKeywordDetector::ResetFifo()
{
PAGED_CODE();
@@ -2122,7 +2126,8 @@ VOID CKeywordDetector::ResetFifo()
}
#pragma code_seg("PAGE")
-NTSTATUS CKeywordDetector::SetArmed(BOOL Arm)
+_IRQL_requires_max_(PASSIVE_LEVEL)
+NTSTATUS CKeywordDetector::SetArmed(_In_ BOOL Arm)
{
PAGED_CODE();
@@ -2138,6 +2143,7 @@ NTSTATUS CKeywordDetector::SetArmed(BOOL Arm)
}
#pragma code_seg("PAGE")
+_IRQL_requires_max_(PASSIVE_LEVEL)
BOOL CKeywordDetector::GetArmed()
{
PAGED_CODE();
@@ -2146,6 +2152,7 @@ BOOL CKeywordDetector::GetArmed()
}
#pragma code_seg("PAGE")
+_IRQL_requires_max_(PASSIVE_LEVEL)
VOID CKeywordDetector::Run()
{
PAGED_CODE();
@@ -2157,6 +2164,7 @@ VOID CKeywordDetector::Run()
}
#pragma code_seg("PAGE")
+_IRQL_requires_max_(PASSIVE_LEVEL)
VOID CKeywordDetector::Stop()
{
PAGED_CODE();
@@ -2165,6 +2173,7 @@ VOID CKeywordDetector::Stop()
}
#pragma code_seg("PAGE")
+_IRQL_requires_max_(PASSIVE_LEVEL)
VOID CKeywordDetector::StartBufferingStream()
{
LARGE_INTEGER qpc;
@@ -2182,7 +2191,8 @@ VOID CKeywordDetector::StartBufferingStream()
}
#pragma code_seg()
-VOID CKeywordDetector::DpcRoutine(LONGLONG PerformanceCounter, LONGLONG PerformanceFrequency)
+_IRQL_requires_min_(DISPATCH_LEVEL)
+VOID CKeywordDetector::DpcRoutine(_In_ LONGLONG PerformanceCounter, _In_ LONGLONG PerformanceFrequency)
{
LONGLONG currentPacket;
LONGLONG packetsToQueue;
diff --git a/audio/sysvad/EndpointsCommon/minwavert.h b/audio/sysvad/EndpointsCommon/minwavert.h
index aea83095..4660cfa1 100644
--- a/audio/sysvad/EndpointsCommon/minwavert.h
+++ b/audio/sysvad/EndpointsCommon/minwavert.h
@@ -58,7 +58,7 @@ public:
VOID Stop();
_IRQL_requires_min_(DISPATCH_LEVEL)
- VOID DpcRoutine(_In_ LONGLONG PeformanceCounter, _In_ LONGLONG PerformanceFrequency);
+ VOID DpcRoutine(_In_ LONGLONG PerformanceCounter, _In_ LONGLONG PerformanceFrequency);
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS GetReadPacket(_In_ ULONG PacketsPerWaveRtBuffer, _In_ ULONG WaveRtBufferSize, _Out_writes_(WaveRtBufferSize) BYTE *WaveRtBuffer, _Out_ ULONG *PacketNumber, _Out_ ULONGLONG *PerformanceCount, _Out_ BOOL *MoreData);
@@ -297,9 +297,9 @@ public:
);
public:
- VOID DpcRoutine(LONGLONG PeformanceCounter, LONGLONG PerformanceFrequency)
+ VOID DpcRoutine(LONGLONG PerformanceCounter, LONGLONG PerformanceFrequency)
{
- m_KeywordDetector.DpcRoutine(PeformanceCounter, PerformanceFrequency);
+ m_KeywordDetector.DpcRoutine(PerformanceCounter, PerformanceFrequency);
}
NTSTATUS PropertyHandlerEffectListRequest
diff --git a/audio/sysvad/EndpointsCommon/minwavertstream.cpp b/audio/sysvad/EndpointsCommon/minwavertstream.cpp
index 86d373da..58382639 100644
--- a/audio/sysvad/EndpointsCommon/minwavertstream.cpp
+++ b/audio/sysvad/EndpointsCommon/minwavertstream.cpp
@@ -784,7 +784,6 @@ Done:
//
// ISSUE-2014/10/4 Will this work correctly across pause/play?
#pragma code_seg()
-_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS CMiniportWaveRTStream::GetReadPacket
(
_Out_ ULONG *PacketNumber,
@@ -896,7 +895,6 @@ NTSTATUS CMiniportWaveRTStream::GetReadPacket
}
#pragma code_seg()
-_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS CMiniportWaveRTStream::SetWritePacket
(
_In_ ULONG PacketNumber,
@@ -989,7 +987,6 @@ NTSTATUS CMiniportWaveRTStream::SetWritePacket
//=============================================================================
#pragma code_seg()
-_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS CMiniportWaveRTStream::GetOutputStreamPresentationPosition
(
_Out_ KSAUDIO_PRESENTATION_POSITION *pPresentationPosition
@@ -1008,7 +1005,6 @@ NTSTATUS CMiniportWaveRTStream::GetOutputStreamPresentationPosition
//=============================================================================
#pragma code_seg()
-_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS CMiniportWaveRTStream::GetPacketCount
(
_Out_ ULONG *pPacketCount
@@ -1529,8 +1525,6 @@ TimerNotifyRT
_IRQL_limited_to_(DISPATCH_LEVEL);
- qpc = KeQueryPerformanceCounter(&qpcFrequency);
-
CMiniportWaveRTStream* _this = (CMiniportWaveRTStream*)DeferredContext;
if (NULL == _this)
@@ -1540,6 +1534,9 @@ TimerNotifyRT
KIRQL oldIrql;
KeAcquireSpinLock(&_this->m_PositionSpinLock, &oldIrql);
+
+ qpc = KeQueryPerformanceCounter(&qpcFrequency);
+
// Convert ticks to 100ns units.
LONGLONG hnsCurrentTime = KSCONVERT_PERFORMANCE_TIME(_this->m_ullPerformanceCounterFrequency.QuadPart, qpc);
diff --git a/audio/sysvad/EndpointsCommon/minwavertstream.h b/audio/sysvad/EndpointsCommon/minwavertstream.h
index c429956d..405ae35e 100644
--- a/audio/sysvad/EndpointsCommon/minwavertstream.h
+++ b/audio/sysvad/EndpointsCommon/minwavertstream.h
@@ -253,9 +253,9 @@ private:
NTSTATUS GetPositions
(
- _Out_ ULONGLONG *pullLinearBufferPosition,
- _Out_ ULONGLONG *pullPresentationPosition,
- _Out_ LARGE_INTEGER *_pliQPCTime
+ _Out_opt_ ULONGLONG * _pullLinearBufferPosition,
+ _Out_opt_ ULONGLONG * _pullPresentationPosition,
+ _Out_opt_ LARGE_INTEGER * _pliQPCTime
);
#ifdef SYSVAD_BTH_BYPASS
diff --git a/audio/sysvad/PhoneAudioSample/PhoneAudioSample.vcxproj b/audio/sysvad/PhoneAudioSample/PhoneAudioSample.vcxproj
index df7d46c0..32676f56 100644
--- a/audio/sysvad/PhoneAudioSample/PhoneAudioSample.vcxproj
+++ b/audio/sysvad/PhoneAudioSample/PhoneAudioSample.vcxproj
@@ -111,7 +111,7 @@
</ResourceCompile>
<ClCompile>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..</AdditionalIncludeDirectories>
- <TreatWarningAsError>false</TreatWarningAsError>
+ <TreatWarningAsError>true</TreatWarningAsError>
<WarningLevel>Level4</WarningLevel>
<PreprocessorDefinitions>%(PreprocessorDefinitions);_WIN32;UNICODE;_UNICODE;PC_IMPLEMENTATION</PreprocessorDefinitions>
<PreprocessorDefinitions>%(PreprocessorDefinitions);DEBUG_LEVEL=DEBUGLVL_TERSE</PreprocessorDefinitions>
@@ -184,7 +184,7 @@
</Link>
<ClCompile>
<PreprocessorDefinitions>%(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS</PreprocessorDefinitions>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_USE_IPortClsRuntimePower</PreprocessorDefinitions>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);_USE_IPortClsRuntimePower;_NEW_DELETE_OPERATORS_</PreprocessorDefinitions>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\EndpointsCommon</AdditionalIncludeDirectories>
<ExceptionHandling>
</ExceptionHandling>
@@ -206,7 +206,7 @@
</Link>
<ClCompile>
<PreprocessorDefinitions>%(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS</PreprocessorDefinitions>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_USE_IPortClsRuntimePower</PreprocessorDefinitions>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);_USE_IPortClsRuntimePower;_NEW_DELETE_OPERATORS_</PreprocessorDefinitions>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\EndpointsCommon</AdditionalIncludeDirectories>
<ExceptionHandling>
</ExceptionHandling>
@@ -228,7 +228,7 @@
</Link>
<ClCompile>
<PreprocessorDefinitions>%(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS</PreprocessorDefinitions>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_USE_IPortClsRuntimePower</PreprocessorDefinitions>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);_USE_IPortClsRuntimePower;_NEW_DELETE_OPERATORS_</PreprocessorDefinitions>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\EndpointsCommon</AdditionalIncludeDirectories>
<ExceptionHandling>
</ExceptionHandling>
@@ -250,7 +250,7 @@
</Link>
<ClCompile>
<PreprocessorDefinitions>%(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS</PreprocessorDefinitions>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_USE_IPortClsRuntimePower</PreprocessorDefinitions>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);_USE_IPortClsRuntimePower;_NEW_DELETE_OPERATORS_</PreprocessorDefinitions>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\EndpointsCommon</AdditionalIncludeDirectories>
<ExceptionHandling>
</ExceptionHandling>
diff --git a/audio/sysvad/TabletAudioSample/TabletAudioSample.vcxproj b/audio/sysvad/TabletAudioSample/TabletAudioSample.vcxproj
index 924bb0a5..dd4a8037 100644
--- a/audio/sysvad/TabletAudioSample/TabletAudioSample.vcxproj
+++ b/audio/sysvad/TabletAudioSample/TabletAudioSample.vcxproj
@@ -111,7 +111,7 @@
</ResourceCompile>
<ClCompile>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);..</AdditionalIncludeDirectories>
- <TreatWarningAsError>false</TreatWarningAsError>
+ <TreatWarningAsError>true</TreatWarningAsError>
<WarningLevel>Level4</WarningLevel>
<PreprocessorDefinitions>%(PreprocessorDefinitions);_WIN32;UNICODE;_UNICODE;PC_IMPLEMENTATION</PreprocessorDefinitions>
<PreprocessorDefinitions>%(PreprocessorDefinitions);DEBUG_LEVEL=DEBUGLVL_TERSE</PreprocessorDefinitions>
@@ -184,11 +184,10 @@
</Link>
<ClCompile>
<PreprocessorDefinitions>%(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS</PreprocessorDefinitions>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_USE_SingleComponentMultiFxStates</PreprocessorDefinitions>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);_USE_SingleComponentMultiFxStates;_NEW_DELETE_OPERATORS_</PreprocessorDefinitions>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\EndpointsCommon</AdditionalIncludeDirectories>
<ExceptionHandling>
</ExceptionHandling>
- <DisableSpecificWarnings>4595;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Midl>
<PreprocessorDefinitions>%(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS</PreprocessorDefinitions>
@@ -207,11 +206,10 @@
</Link>
<ClCompile>
<PreprocessorDefinitions>%(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS</PreprocessorDefinitions>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_USE_SingleComponentMultiFxStates</PreprocessorDefinitions>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);_USE_SingleComponentMultiFxStates;_NEW_DELETE_OPERATORS_</PreprocessorDefinitions>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\EndpointsCommon</AdditionalIncludeDirectories>
<ExceptionHandling>
</ExceptionHandling>
- <DisableSpecificWarnings>4595;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Midl>
<PreprocessorDefinitions>%(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS</PreprocessorDefinitions>
@@ -230,7 +228,7 @@
</Link>
<ClCompile>
<PreprocessorDefinitions>%(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS</PreprocessorDefinitions>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_USE_SingleComponentMultiFxStates</PreprocessorDefinitions>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);_USE_SingleComponentMultiFxStates;_NEW_DELETE_OPERATORS_</PreprocessorDefinitions>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\EndpointsCommon</AdditionalIncludeDirectories>
<ExceptionHandling>
</ExceptionHandling>
@@ -252,11 +250,10 @@
</Link>
<ClCompile>
<PreprocessorDefinitions>%(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS</PreprocessorDefinitions>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_USE_SingleComponentMultiFxStates</PreprocessorDefinitions>
+ <PreprocessorDefinitions>%(PreprocessorDefinitions);_USE_SingleComponentMultiFxStates;_NEW_DELETE_OPERATORS_</PreprocessorDefinitions>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);..\EndpointsCommon</AdditionalIncludeDirectories>
<ExceptionHandling>
</ExceptionHandling>
- <DisableSpecificWarnings>4595;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Midl>
<PreprocessorDefinitions>%(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS</PreprocessorDefinitions>
@@ -295,4 +292,4 @@
<ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-</Project> \ No newline at end of file
+</Project>
diff --git a/audio/sysvad/adapter.cpp b/audio/sysvad/adapter.cpp
index 12e57156..83c72f9b 100644
--- a/audio/sysvad/adapter.cpp
+++ b/audio/sysvad/adapter.cpp
@@ -1059,6 +1059,9 @@ Return Value:
IO_STACK_LOCATION *stack;
PortClassDeviceContext *ext;
+ // Documented https://msdn.microsoft.com/en-us/library/windows/hardware/ff544039(v=vs.85).aspx
+ // This method will be called in IRQL PASSIVE_LEVEL
+#pragma warning(suppress: 28118)
PAGED_CODE();
ASSERT(_DeviceObject);
diff --git a/audio/sysvad/common.cpp b/audio/sysvad/common.cpp
index e4af55e4..5b63d228 100644
--- a/audio/sysvad/common.cpp
+++ b/audio/sysvad/common.cpp
@@ -335,7 +335,7 @@ class CAdapterCommon :
(
_In_ PCWSTR ReferenceString,
_In_ ULONG cPropertyCount,
- _In_reads_(cPropertyCount) const SYSVAD_DEVPROPERTY *pProperties,
+ _In_reads_opt_(cPropertyCount) const SYSVAD_DEVPROPERTY *pProperties,
_Out_ _At_(AudioSymbolicLinkName->Buffer, __drv_allocatesMem(Mem)) PUNICODE_STRING AudioSymbolicLinkName
);
};
@@ -771,27 +771,30 @@ NTSTATUS SysvadIoSetDeviceInterfacePropertyDataMultiple
(
_In_ PUNICODE_STRING SymbolicLinkName,
_In_ ULONG cPropertyCount,
- _In_reads_(cPropertyCount) const SYSVAD_DEVPROPERTY *pProperties
+ _In_reads_opt_(cPropertyCount) const SYSVAD_DEVPROPERTY *pProperties
)
{
NTSTATUS ntStatus;
PAGED_CODE();
- for (ULONG i = 0; i < cPropertyCount; i++)
+ if (pProperties)
{
- ntStatus = IoSetDeviceInterfacePropertyData(
- SymbolicLinkName,
- pProperties[i].PropertyKey,
- LOCALE_NEUTRAL,
- PLUGPLAY_PROPERTY_PERSISTENT,
- pProperties[i].Type,
- pProperties[i].BufferSize,
- pProperties[i].Buffer);
-
- if (!NT_SUCCESS(ntStatus))
+ for (ULONG i = 0; i < cPropertyCount; i++)
{
- return ntStatus;
+ ntStatus = IoSetDeviceInterfacePropertyData(
+ SymbolicLinkName,
+ pProperties[i].PropertyKey,
+ LOCALE_NEUTRAL,
+ PLUGPLAY_PROPERTY_PERSISTENT,
+ pProperties[i].Type,
+ pProperties[i].BufferSize,
+ pProperties[i].Buffer);
+
+ if (!NT_SUCCESS(ntStatus))
+ {
+ return ntStatus;
+ }
}
}
@@ -1885,7 +1888,7 @@ CAdapterCommon::CreateAudioInterfaceWithProperties
(
_In_ PCWSTR ReferenceString,
_In_ ULONG cPropertyCount,
- _In_reads_(cPropertyCount) const SYSVAD_DEVPROPERTY *pProperties,
+ _In_reads_opt_(cPropertyCount) const SYSVAD_DEVPROPERTY *pProperties,
_Out_ _At_(AudioSymbolicLinkName->Buffer, __drv_allocatesMem(Mem)) PUNICODE_STRING AudioSymbolicLinkName
)
/*++
@@ -3137,6 +3140,8 @@ Return Value:
goto Done;
}
+ // bthWorkTask->L.Size is set to sizeof(BthHfpWorkTask) in the Look Aside List configuration
+#pragma warning(suppress: 6386)
RtlZeroMemory(bthWorkTask, sizeof(*bthWorkTask));
bthWorkTask->Action = eBthHfpTaskStart;
InitializeListHead(&bthWorkTask->ListEntry);
@@ -3234,6 +3239,8 @@ Return Value:
goto Done;
}
+ // bthWorkTask->L.Size is set to sizeof(BthHfpWorkTask) in the Look Aside List configuration
+#pragma warning(suppress: 6386)
RtlZeroMemory(bthWorkTask, sizeof(*bthWorkTask));
bthWorkTask->Action = eBthHfpTaskStop;
InitializeListHead(&bthWorkTask->ListEntry);
@@ -6160,7 +6167,7 @@ BthHfpDevice::CreateCustomEndpointMinipair
// Copy base minipair properties to new property list
if (pBaseMinipair->TopoInterfacePropertyCount > 0)
{
- RtlCopyMemory(pProperties, pBaseMinipair->TopoInterfaceProperties, pBaseMinipair->TopoInterfacePropertyCount * sizeof(SYSVAD_DEVPROPERTY));
+ RtlCopyMemory(pProperties, pBaseMinipair->TopoInterfaceProperties, (cProperties - 1) * sizeof(SYSVAD_DEVPROPERTY));
}
// Add friendly name property to the list
diff --git a/audio/sysvad/sysvad.h b/audio/sysvad/sysvad.h
index 0e35aebd..1dfaea0a 100644
--- a/audio/sysvad/sysvad.h
+++ b/audio/sysvad/sysvad.h
@@ -23,6 +23,7 @@ Abstract:
#include <wdfminiport.h>
#include <MsApoFxProxy.h>
#include <Ntstrsafe.h>
+#include "NewDelete.h"
//=============================================================================
// Defines