From 5d4e0d88ceba97ec2f6f5751b8ff10917f173459 Mon Sep 17 00:00:00 2001 From: Girish Pattabiraman Date: Sat, 21 Jan 2017 21:07:31 -0800 Subject: Resolve SAL annotations --- .../KeywordDetectorContosoAdapter.vcxproj | 18 ++++---- audio/sysvad/KeywordDetectorAdapter/dllmain.cpp | 6 ++- audio/sysvad/SwapAPO/APO/SwapAPODll.cpp | 6 ++- audio/sysvad/SwapAPO/APO/swapapomfx.cpp | 1 + audio/sysvad/SwapAPO/PropPageExtensions/CplExt.cpp | 6 ++- audio/sysvad/sysvad.VC.db | Bin 0 -> 89546752 bytes audio/sysvad/sysvad.sln | 47 ++++++++------------- 7 files changed, 41 insertions(+), 43 deletions(-) create mode 100644 audio/sysvad/sysvad.VC.db diff --git a/audio/sysvad/KeywordDetectorAdapter/KeywordDetectorContosoAdapter.vcxproj b/audio/sysvad/KeywordDetectorAdapter/KeywordDetectorContosoAdapter.vcxproj index 84595128..fdf37a5d 100644 --- a/audio/sysvad/KeywordDetectorAdapter/KeywordDetectorContosoAdapter.vcxproj +++ b/audio/sysvad/KeywordDetectorAdapter/KeywordDetectorContosoAdapter.vcxproj @@ -115,8 +115,8 @@ - MultiThreaded - MultiThreadedDebug + MultiThreadedDLL + MultiThreadedDebugDLL true Level4 %(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE @@ -139,8 +139,8 @@ - MultiThreaded - MultiThreadedDebug + MultiThreadedDLL + MultiThreadedDebugDLL true Level4 %(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE @@ -163,8 +163,8 @@ - MultiThreaded - MultiThreadedDebug + MultiThreadedDLL + MultiThreadedDebugDLL true Level4 %(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE @@ -187,8 +187,8 @@ - MultiThreaded - MultiThreadedDebug + MultiThreadedDLL + MultiThreadedDebugDLL true Level4 %(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE @@ -229,4 +229,4 @@ - \ No newline at end of file + diff --git a/audio/sysvad/KeywordDetectorAdapter/dllmain.cpp b/audio/sysvad/KeywordDetectorAdapter/dllmain.cpp index c29f4464..ac412859 100644 --- a/audio/sysvad/KeywordDetectorAdapter/dllmain.cpp +++ b/audio/sysvad/KeywordDetectorAdapter/dllmain.cpp @@ -12,18 +12,20 @@ STDAPI DllGetActivationFactory(_In_ HSTRING activatibleClassId, _COM_Outptr_ IAc #endif #if !defined(__WRL_WINRT_STRICT__) -STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, _COM_Outptr_ void** ppv) +_Check_return_ +STDAPI DllGetClassObject(_In_ REFCLSID rclsid, _In_ REFIID riid, _Outptr_ LPVOID FAR* ppv) { return Module::GetModule().GetClassObject(rclsid, riid, ppv); } #endif +__control_entrypoint(DllExport) STDAPI DllCanUnloadNow() { return Module::GetModule().Terminate() ? S_OK : S_FALSE; } -STDAPI_(BOOL) DllMain(_In_opt_ HINSTANCE hinst, DWORD reason, _In_opt_ void*) +STDAPI_(BOOL) DllMain(_In_ HINSTANCE hinst, DWORD reason, _In_opt_ void*) { if (reason == DLL_PROCESS_ATTACH) { diff --git a/audio/sysvad/SwapAPO/APO/SwapAPODll.cpp b/audio/sysvad/SwapAPO/APO/SwapAPODll.cpp index 4792b344..e9a04889 100644 --- a/audio/sysvad/SwapAPO/APO/SwapAPODll.cpp +++ b/audio/sysvad/SwapAPO/APO/SwapAPODll.cpp @@ -118,6 +118,7 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD dwReason, LPVOID // {secret} +__control_entrypoint(DllExport) STDAPI DllCanUnloadNow(void) { return _AtlModule.DllCanUnloadNow(); @@ -125,13 +126,15 @@ STDAPI DllCanUnloadNow(void) // {secret} -STDAPI DllGetClassObject(_In_ REFCLSID rclsid,_In_ REFIID riid, _Outptr_ LPVOID* ppv) +_Check_return_ +STDAPI DllGetClassObject(_In_ REFCLSID rclsid, _In_ REFIID riid, _Outptr_ LPVOID FAR* ppv) { return _AtlModule.DllGetClassObject(rclsid, riid, ppv); } // {secret} +__control_entrypoint(DllExport) STDAPI DllRegisterServer(void) { // registers object, typelib and all interfaces in typelib @@ -141,6 +144,7 @@ STDAPI DllRegisterServer(void) // {secret} +__control_entrypoint(DllExport) STDAPI DllUnregisterServer(void) { HRESULT hr = _AtlModule.DllUnregisterServer(); diff --git a/audio/sysvad/SwapAPO/APO/swapapomfx.cpp b/audio/sysvad/SwapAPO/APO/swapapomfx.cpp index 113e0aa4..99677425 100644 --- a/audio/sysvad/SwapAPO/APO/swapapomfx.cpp +++ b/audio/sysvad/SwapAPO/APO/swapapomfx.cpp @@ -881,6 +881,7 @@ HRESULT CSwapAPOMFX::ValidateAndCacheConnectionInfo(UINT32 u32NumInputConnection f32InverseChannelCount = 1.0f/m_u32SamplesPerFrame; for (UINT16 u16Index=0; u16Index Date: Sat, 21 Jan 2017 22:25:36 -0800 Subject: Ignoring 4595 and removing the project DB auto-generated file --- audio/sysvad/EndpointsCommon/EndpointsCommon.vcxproj | 4 ++++ .../TabletAudioSample/TabletAudioSample.vcxproj | 3 +++ audio/sysvad/sysvad.VC.db | Bin 89546752 -> 0 bytes 3 files changed, 7 insertions(+) delete mode 100644 audio/sysvad/sysvad.VC.db diff --git a/audio/sysvad/EndpointsCommon/EndpointsCommon.vcxproj b/audio/sysvad/EndpointsCommon/EndpointsCommon.vcxproj index 725d3237..1956d106 100644 --- a/audio/sysvad/EndpointsCommon/EndpointsCommon.vcxproj +++ b/audio/sysvad/EndpointsCommon/EndpointsCommon.vcxproj @@ -98,6 +98,7 @@ %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS + 4595;%(DisableSpecificWarnings) %(AdditionalIncludeDirectories);$(DDK_INC_PATH);.. @@ -114,6 +115,7 @@ %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS + 4595;%(DisableSpecificWarnings) %(AdditionalIncludeDirectories);$(DDK_INC_PATH);.. @@ -130,6 +132,7 @@ %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS + 4595;%(DisableSpecificWarnings) %(AdditionalIncludeDirectories);$(DDK_INC_PATH);.. @@ -146,6 +149,7 @@ %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS + 4595;%(DisableSpecificWarnings) %(AdditionalIncludeDirectories);$(DDK_INC_PATH);.. diff --git a/audio/sysvad/TabletAudioSample/TabletAudioSample.vcxproj b/audio/sysvad/TabletAudioSample/TabletAudioSample.vcxproj index e42f0ce2..924bb0a5 100644 --- a/audio/sysvad/TabletAudioSample/TabletAudioSample.vcxproj +++ b/audio/sysvad/TabletAudioSample/TabletAudioSample.vcxproj @@ -188,6 +188,7 @@ %(AdditionalIncludeDirectories);..\EndpointsCommon + 4595;%(DisableSpecificWarnings) %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS @@ -210,6 +211,7 @@ %(AdditionalIncludeDirectories);..\EndpointsCommon + 4595;%(DisableSpecificWarnings) %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS @@ -254,6 +256,7 @@ %(AdditionalIncludeDirectories);..\EndpointsCommon + 4595;%(DisableSpecificWarnings) %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS diff --git a/audio/sysvad/sysvad.VC.db b/audio/sysvad/sysvad.VC.db deleted file mode 100644 index 474af2b8..00000000 Binary files a/audio/sysvad/sysvad.VC.db and /dev/null differ -- cgit v1.3.1 From 27fa3e21b807201a69146d1d16bf297c7e1fe880 Mon Sep 17 00:00:00 2001 From: Girish Pattabiraman Date: Sat, 21 Jan 2017 22:29:20 -0800 Subject: Ignore DB and opendb files. --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 7f8fa260..f227925f 100644 --- a/.gitignore +++ b/.gitignore @@ -192,3 +192,5 @@ FakesAssemblies/ # Visual Studio 6 workspace options file *.opt +*.db +*.opendb -- cgit v1.3.1 From 42cd81689c12568ae4451fe956da6bb5e453e058 Mon Sep 17 00:00:00 2001 From: Girish Pattabiraman Date: Wed, 8 Feb 2017 15:02:51 -0800 Subject: Add NewDelete operators locally as recommeded in C4595 warning and "stdunk.h" --- .../sysvad/EndpointsCommon/EndpointsCommon.vcxproj | 15 +- .../MiniportStreamAudioEngineNode.cpp | 8 +- audio/sysvad/EndpointsCommon/NewDelete.cpp | 174 +++++++++++++++++++++ audio/sysvad/EndpointsCommon/NewDelete.h | 117 ++++++++++++++ audio/sysvad/EndpointsCommon/minwavert.cpp | 16 +- audio/sysvad/EndpointsCommon/minwavert.h | 6 +- audio/sysvad/EndpointsCommon/minwavertstream.cpp | 9 +- audio/sysvad/EndpointsCommon/minwavertstream.h | 6 +- .../PhoneAudioSample/PhoneAudioSample.vcxproj | 10 +- .../TabletAudioSample/TabletAudioSample.vcxproj | 15 +- audio/sysvad/adapter.cpp | 3 + audio/sysvad/common.cpp | 39 +++-- audio/sysvad/sysvad.h | 1 + 13 files changed, 362 insertions(+), 57 deletions(-) create mode 100644 audio/sysvad/EndpointsCommon/NewDelete.cpp create mode 100644 audio/sysvad/EndpointsCommon/NewDelete.h 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 @@ %(AdditionalIncludeDirectories);$(DDK_INC_PATH);.. - %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS + %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS;_NEW_DELETE_OPERATORS_ - 4595;%(DisableSpecificWarnings) %(AdditionalIncludeDirectories);$(DDK_INC_PATH);.. @@ -112,10 +111,9 @@ %(AdditionalIncludeDirectories);$(DDK_INC_PATH);.. - %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS + %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS;_NEW_DELETE_OPERATORS_ - 4595;%(DisableSpecificWarnings) %(AdditionalIncludeDirectories);$(DDK_INC_PATH);.. @@ -129,10 +127,9 @@ %(AdditionalIncludeDirectories);$(DDK_INC_PATH);.. - %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS + %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS;_NEW_DELETE_OPERATORS_ - 4595;%(DisableSpecificWarnings) %(AdditionalIncludeDirectories);$(DDK_INC_PATH);.. @@ -146,10 +143,9 @@ %(AdditionalIncludeDirectories);$(DDK_INC_PATH);.. - %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS + %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS;_NEW_DELETE_OPERATORS_ - 4595;%(DisableSpecificWarnings) %(AdditionalIncludeDirectories);$(DDK_INC_PATH);.. @@ -167,6 +163,7 @@ + @@ -183,4 +180,4 @@ - \ No newline at end of file + 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 +} +#else +#include +#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 @@ %(AdditionalIncludeDirectories);$(DDK_INC_PATH);.. - false + true Level4 %(PreprocessorDefinitions);_WIN32;UNICODE;_UNICODE;PC_IMPLEMENTATION %(PreprocessorDefinitions);DEBUG_LEVEL=DEBUGLVL_TERSE @@ -184,7 +184,7 @@ %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS - %(PreprocessorDefinitions);_USE_IPortClsRuntimePower + %(PreprocessorDefinitions);_USE_IPortClsRuntimePower;_NEW_DELETE_OPERATORS_ %(AdditionalIncludeDirectories);..\EndpointsCommon @@ -206,7 +206,7 @@ %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS - %(PreprocessorDefinitions);_USE_IPortClsRuntimePower + %(PreprocessorDefinitions);_USE_IPortClsRuntimePower;_NEW_DELETE_OPERATORS_ %(AdditionalIncludeDirectories);..\EndpointsCommon @@ -228,7 +228,7 @@ %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS - %(PreprocessorDefinitions);_USE_IPortClsRuntimePower + %(PreprocessorDefinitions);_USE_IPortClsRuntimePower;_NEW_DELETE_OPERATORS_ %(AdditionalIncludeDirectories);..\EndpointsCommon @@ -250,7 +250,7 @@ %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS - %(PreprocessorDefinitions);_USE_IPortClsRuntimePower + %(PreprocessorDefinitions);_USE_IPortClsRuntimePower;_NEW_DELETE_OPERATORS_ %(AdditionalIncludeDirectories);..\EndpointsCommon 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 @@ %(AdditionalIncludeDirectories);$(DDK_INC_PATH);.. - false + true Level4 %(PreprocessorDefinitions);_WIN32;UNICODE;_UNICODE;PC_IMPLEMENTATION %(PreprocessorDefinitions);DEBUG_LEVEL=DEBUGLVL_TERSE @@ -184,11 +184,10 @@ %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS - %(PreprocessorDefinitions);_USE_SingleComponentMultiFxStates + %(PreprocessorDefinitions);_USE_SingleComponentMultiFxStates;_NEW_DELETE_OPERATORS_ %(AdditionalIncludeDirectories);..\EndpointsCommon - 4595;%(DisableSpecificWarnings) %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS @@ -207,11 +206,10 @@ %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS - %(PreprocessorDefinitions);_USE_SingleComponentMultiFxStates + %(PreprocessorDefinitions);_USE_SingleComponentMultiFxStates;_NEW_DELETE_OPERATORS_ %(AdditionalIncludeDirectories);..\EndpointsCommon - 4595;%(DisableSpecificWarnings) %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS @@ -230,7 +228,7 @@ %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS - %(PreprocessorDefinitions);_USE_SingleComponentMultiFxStates + %(PreprocessorDefinitions);_USE_SingleComponentMultiFxStates;_NEW_DELETE_OPERATORS_ %(AdditionalIncludeDirectories);..\EndpointsCommon @@ -252,11 +250,10 @@ %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS - %(PreprocessorDefinitions);_USE_SingleComponentMultiFxStates + %(PreprocessorDefinitions);_USE_SingleComponentMultiFxStates;_NEW_DELETE_OPERATORS_ %(AdditionalIncludeDirectories);..\EndpointsCommon - 4595;%(DisableSpecificWarnings) %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS @@ -295,4 +292,4 @@ - \ No newline at end of file + 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 #include #include +#include "NewDelete.h" //============================================================================= // Defines -- cgit v1.3.1 From fe0b6f422c742f5c97f33cfe89022cbd238c5774 Mon Sep 17 00:00:00 2001 From: Girish Pattabiraman Date: Wed, 8 Feb 2017 15:17:24 -0800 Subject: Removed definition of "void __cdecl operator delete(void *)" to avoid linker error with stdunk.lib --- audio/sysvad/EndpointsCommon/NewDelete.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/audio/sysvad/EndpointsCommon/NewDelete.cpp b/audio/sysvad/EndpointsCommon/NewDelete.cpp index 584d28e8..406b4245 100644 --- a/audio/sysvad/EndpointsCommon/NewDelete.cpp +++ b/audio/sysvad/EndpointsCommon/NewDelete.cpp @@ -124,16 +124,19 @@ void __cdecl operator delete ***************************************************************************** * Basic Delete function. */ -void __cdecl operator delete -( - PVOID pVoid -) -{ - if (pVoid) - { - ExFreePoolWithTag(pVoid, SYSVAD_POOLTAG); - } -} +/* Commented out as "void __cdecl operator delete(void *) is already defined + * in stdunk.lib + */ +// void __cdecl operator delete +// ( +// PVOID pVoid +// ) +// { +// if (pVoid) +// { +// ExFreePoolWithTag(pVoid, SYSVAD_POOLTAG); +// } +// } /***************************************************************************** @@ -172,3 +175,4 @@ void __cdecl operator delete[] } } +#endif _NEW_DELETE_OPERATORS_ -- cgit v1.3.1 From a982f7e243ac4cb584e7fa89265dc6ccd4404880 Mon Sep 17 00:00:00 2001 From: Girish Pattabiraman Date: Wed, 8 Feb 2017 15:43:47 -0800 Subject: Removing local "new and delete operators" and suppressing warning 4595 --- .../sysvad/EndpointsCommon/EndpointsCommon.vcxproj | 15 +- audio/sysvad/EndpointsCommon/NewDelete.cpp | 178 --------------------- audio/sysvad/EndpointsCommon/NewDelete.h | 117 -------------- .../PhoneAudioSample/PhoneAudioSample.vcxproj | 12 +- .../TabletAudioSample/TabletAudioSample.vcxproj | 14 +- audio/sysvad/sysvad.h | 1 - 6 files changed, 26 insertions(+), 311 deletions(-) delete mode 100644 audio/sysvad/EndpointsCommon/NewDelete.cpp delete mode 100644 audio/sysvad/EndpointsCommon/NewDelete.h diff --git a/audio/sysvad/EndpointsCommon/EndpointsCommon.vcxproj b/audio/sysvad/EndpointsCommon/EndpointsCommon.vcxproj index a0c0e157..1956d106 100644 --- a/audio/sysvad/EndpointsCommon/EndpointsCommon.vcxproj +++ b/audio/sysvad/EndpointsCommon/EndpointsCommon.vcxproj @@ -95,9 +95,10 @@ %(AdditionalIncludeDirectories);$(DDK_INC_PATH);.. - %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS;_NEW_DELETE_OPERATORS_ + %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS + 4595;%(DisableSpecificWarnings) %(AdditionalIncludeDirectories);$(DDK_INC_PATH);.. @@ -111,9 +112,10 @@ %(AdditionalIncludeDirectories);$(DDK_INC_PATH);.. - %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS;_NEW_DELETE_OPERATORS_ + %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS + 4595;%(DisableSpecificWarnings) %(AdditionalIncludeDirectories);$(DDK_INC_PATH);.. @@ -127,9 +129,10 @@ %(AdditionalIncludeDirectories);$(DDK_INC_PATH);.. - %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS;_NEW_DELETE_OPERATORS_ + %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS + 4595;%(DisableSpecificWarnings) %(AdditionalIncludeDirectories);$(DDK_INC_PATH);.. @@ -143,9 +146,10 @@ %(AdditionalIncludeDirectories);$(DDK_INC_PATH);.. - %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS;_NEW_DELETE_OPERATORS_ + %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS + 4595;%(DisableSpecificWarnings) %(AdditionalIncludeDirectories);$(DDK_INC_PATH);.. @@ -163,7 +167,6 @@ - @@ -180,4 +183,4 @@ - + \ No newline at end of file diff --git a/audio/sysvad/EndpointsCommon/NewDelete.cpp b/audio/sysvad/EndpointsCommon/NewDelete.cpp deleted file mode 100644 index 406b4245..00000000 --- a/audio/sysvad/EndpointsCommon/NewDelete.cpp +++ /dev/null @@ -1,178 +0,0 @@ -/***************************************************************************** - * 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 -} -#else -#include -#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. - */ -/* Commented out as "void __cdecl operator delete(void *) is already defined - * in stdunk.lib - */ -// 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); - } -} - -#endif _NEW_DELETE_OPERATORS_ diff --git a/audio/sysvad/EndpointsCommon/NewDelete.h b/audio/sysvad/EndpointsCommon/NewDelete.h deleted file mode 100644 index 53765939..00000000 --- a/audio/sysvad/EndpointsCommon/NewDelete.h +++ /dev/null @@ -1,117 +0,0 @@ -/*++ - -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/PhoneAudioSample/PhoneAudioSample.vcxproj b/audio/sysvad/PhoneAudioSample/PhoneAudioSample.vcxproj index 32676f56..f140a088 100644 --- a/audio/sysvad/PhoneAudioSample/PhoneAudioSample.vcxproj +++ b/audio/sysvad/PhoneAudioSample/PhoneAudioSample.vcxproj @@ -184,10 +184,11 @@ %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS - %(PreprocessorDefinitions);_USE_IPortClsRuntimePower;_NEW_DELETE_OPERATORS_ + %(PreprocessorDefinitions);_USE_IPortClsRuntimePower %(AdditionalIncludeDirectories);..\EndpointsCommon + 4595;%(DisableSpecificWarnings) %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS @@ -206,10 +207,11 @@ %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS - %(PreprocessorDefinitions);_USE_IPortClsRuntimePower;_NEW_DELETE_OPERATORS_ + %(PreprocessorDefinitions);_USE_IPortClsRuntimePower %(AdditionalIncludeDirectories);..\EndpointsCommon + 4595;%(DisableSpecificWarnings) %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS @@ -228,10 +230,11 @@ %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS - %(PreprocessorDefinitions);_USE_IPortClsRuntimePower;_NEW_DELETE_OPERATORS_ + %(PreprocessorDefinitions);_USE_IPortClsRuntimePower %(AdditionalIncludeDirectories);..\EndpointsCommon + 4595;%(DisableSpecificWarnings) %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS @@ -250,10 +253,11 @@ %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS - %(PreprocessorDefinitions);_USE_IPortClsRuntimePower;_NEW_DELETE_OPERATORS_ + %(PreprocessorDefinitions);_USE_IPortClsRuntimePower %(AdditionalIncludeDirectories);..\EndpointsCommon + 4595;%(DisableSpecificWarnings) %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS diff --git a/audio/sysvad/TabletAudioSample/TabletAudioSample.vcxproj b/audio/sysvad/TabletAudioSample/TabletAudioSample.vcxproj index dd4a8037..272a3b97 100644 --- a/audio/sysvad/TabletAudioSample/TabletAudioSample.vcxproj +++ b/audio/sysvad/TabletAudioSample/TabletAudioSample.vcxproj @@ -184,10 +184,11 @@ %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS - %(PreprocessorDefinitions);_USE_SingleComponentMultiFxStates;_NEW_DELETE_OPERATORS_ + %(PreprocessorDefinitions);_USE_SingleComponentMultiFxStates %(AdditionalIncludeDirectories);..\EndpointsCommon + 4595;%(DisableSpecificWarnings) %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS @@ -206,10 +207,11 @@ %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS - %(PreprocessorDefinitions);_USE_SingleComponentMultiFxStates;_NEW_DELETE_OPERATORS_ + %(PreprocessorDefinitions);_USE_SingleComponentMultiFxStates %(AdditionalIncludeDirectories);..\EndpointsCommon + 4595;%(DisableSpecificWarnings) %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS @@ -228,10 +230,11 @@ %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS - %(PreprocessorDefinitions);_USE_SingleComponentMultiFxStates;_NEW_DELETE_OPERATORS_ + %(PreprocessorDefinitions);_USE_SingleComponentMultiFxStates %(AdditionalIncludeDirectories);..\EndpointsCommon + 4595;%(DisableSpecificWarnings) %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS @@ -250,10 +253,11 @@ %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS - %(PreprocessorDefinitions);_USE_SingleComponentMultiFxStates;_NEW_DELETE_OPERATORS_ + %(PreprocessorDefinitions);_USE_SingleComponentMultiFxStates %(AdditionalIncludeDirectories);..\EndpointsCommon + 4595;%(DisableSpecificWarnings) %(PreprocessorDefinitions);_USE_WAVERT_;SYSVAD_BTH_BYPASS @@ -292,4 +296,4 @@ - + \ No newline at end of file diff --git a/audio/sysvad/sysvad.h b/audio/sysvad/sysvad.h index 1dfaea0a..0e35aebd 100644 --- a/audio/sysvad/sysvad.h +++ b/audio/sysvad/sysvad.h @@ -23,7 +23,6 @@ Abstract: #include #include #include -#include "NewDelete.h" //============================================================================= // Defines -- cgit v1.3.1 From ab9a793f9b908506d38964ce433c23ccde922a16 Mon Sep 17 00:00:00 2001 From: Girish Pattabiraman Date: Thu, 16 Feb 2017 15:00:10 -0800 Subject: Resolve SAL issues for floating point hardware state. Comment explaining warning 6386 --- audio/sysvad/EndpointsCommon/micarraytopo.cpp | 21 +++++++++++++++++---- audio/sysvad/SwapAPO/APO/swapapomfx.cpp | 1 + 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/audio/sysvad/EndpointsCommon/micarraytopo.cpp b/audio/sysvad/EndpointsCommon/micarraytopo.cpp index 3316ee84..a8125a08 100644 --- a/audio/sysvad/EndpointsCommon/micarraytopo.cpp +++ b/audio/sysvad/EndpointsCommon/micarraytopo.cpp @@ -535,6 +535,8 @@ NT status code. NTSTATUS ntStatus = STATUS_INVALID_DEVICE_REQUEST; ULONG nPinId = (ULONG)-1; + KFLOATING_SAVE saveData; + NTSTATUS fstatus; if (PropertyRequest->InstanceSize >= sizeof(ULONG)) { @@ -569,16 +571,27 @@ NT status code. if (PropertyRequest->PropertyItem->Id == KSPROPERTY_AUDIO_MIC_SENSITIVITY) { LONG* micSensitivity = (LONG*)PropertyRequest->Value; - // Return microphone sensitivity information. - *micSensitivity = FloatToFixedPoint16_16(MICARRAY_SENSITIVITY); // convert float dBFS to fixed point arithmetic + + fstatus = KeSaveFloatingPointState(&saveData); + if (NT_SUCCESS(fstatus)) + { + // Return microphone sensitivity information. + *micSensitivity = FloatToFixedPoint16_16(MICARRAY_SENSITIVITY); // convert float dBFS to fixed point arithmetic + KeRestoreFloatingPointState(&saveData); + } PropertyRequest->ValueSize = sizeof(LONG); ntStatus = STATUS_SUCCESS; } else if (PropertyRequest->PropertyItem->Id == KSPROPERTY_AUDIO_MIC_SNR) { LONG* micSNR = (LONG*)PropertyRequest->Value; - // Return microphone SNR information. - *micSNR = FloatToFixedPoint16_16(MICARRAY_SNR); // convert float dB to fixed point arithmetic + fstatus = KeSaveFloatingPointState(&saveData); + if (NT_SUCCESS(fstatus)) + { + // Return microphone SNR information. + *micSNR = FloatToFixedPoint16_16(MICARRAY_SNR); // convert float dB to fixed point arithmetic + KeRestoreFloatingPointState(&saveData); + } ntStatus = STATUS_SUCCESS; } } diff --git a/audio/sysvad/SwapAPO/APO/swapapomfx.cpp b/audio/sysvad/SwapAPO/APO/swapapomfx.cpp index 99677425..43cd78fb 100644 --- a/audio/sysvad/SwapAPO/APO/swapapomfx.cpp +++ b/audio/sysvad/SwapAPO/APO/swapapomfx.cpp @@ -881,6 +881,7 @@ HRESULT CSwapAPOMFX::ValidateAndCacheConnectionInfo(UINT32 u32NumInputConnection f32InverseChannelCount = 1.0f/m_u32SamplesPerFrame; for (UINT16 u16Index=0; u16Index Date: Wed, 1 Mar 2017 16:36:47 -0800 Subject: Visual Studio will default to linking with VC Runtime DLL if is not specified. This Tag needs to be explicitly emptied out. SwapAPO DLL doesn't need the CRT because the CRT is included in "AudioBaseProcessingObjectV140.lib". Have to specifically ignore the Linker error 4217 because vsprintfxxx is being included locally through AudioBaseProcessingObjectV140.lib. --- audio/sysvad/SwapAPO/APO/SwapAPO.vcxproj | 8 ++++++++ audio/sysvad/common.cpp | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/audio/sysvad/SwapAPO/APO/SwapAPO.vcxproj b/audio/sysvad/SwapAPO/APO/SwapAPO.vcxproj index ecb64ad2..082e64ae 100644 --- a/audio/sysvad/SwapAPO/APO/SwapAPO.vcxproj +++ b/audio/sysvad/SwapAPO/APO/SwapAPO.vcxproj @@ -137,6 +137,7 @@ %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\ + %(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE @@ -149,6 +150,7 @@ %(AdditionalDependencies);Kernel32.lib;ole32.lib;oleaut32.lib;advapi32.lib;user32.lib;uuid.lib;AudioBaseProcessingObjectV140.lib;audiomediatypecrt.lib;AudioEng.lib SwapAPODll.def + /ignore:4217 %(AdditionalOptions) @@ -159,6 +161,7 @@ %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\ + %(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE @@ -171,6 +174,7 @@ %(AdditionalDependencies);Kernel32.lib;ole32.lib;oleaut32.lib;advapi32.lib;user32.lib;uuid.lib;AudioBaseProcessingObjectV140.lib;audiomediatypecrt.lib;AudioEng.lib SwapAPODll.def + /ignore:4217 %(AdditionalOptions) @@ -181,6 +185,7 @@ %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\ + %(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE @@ -193,6 +198,7 @@ %(AdditionalDependencies);Kernel32.lib;ole32.lib;oleaut32.lib;advapi32.lib;user32.lib;uuid.lib;AudioBaseProcessingObjectV140.lib;audiomediatypecrt.lib;AudioEng.lib SwapAPODll.def + /ignore:4217 %(AdditionalOptions) @@ -203,6 +209,7 @@ %(AdditionalIncludeDirectories);$(DDK_INC_PATH);..\inc;..\..\ + %(PreprocessorDefinitions);_WINDLL;_USRDLL;UNICODE;_UNICODE @@ -215,6 +222,7 @@ %(AdditionalDependencies);Kernel32.lib;ole32.lib;oleaut32.lib;advapi32.lib;user32.lib;uuid.lib;AudioBaseProcessingObjectV140.lib;audiomediatypecrt.lib;AudioEng.lib SwapAPODll.def + /ignore:4217 %(AdditionalOptions) diff --git a/audio/sysvad/common.cpp b/audio/sysvad/common.cpp index 5b63d228..d046d336 100644 --- a/audio/sysvad/common.cpp +++ b/audio/sysvad/common.cpp @@ -3754,7 +3754,7 @@ BthHfpDevice::Init Done); // - // Make a copy of the symbolic link list. + // Make a copy of the symbolic link name. // m_SymbolicLinkName.MaximumLength = SymbolicLinkName->MaximumLength; m_SymbolicLinkName.Length = SymbolicLinkName->Length; -- cgit v1.3.1