summaryrefslogtreecommitdiff
path: root/audio/sysvad/common.cpp
diff options
context:
space:
mode:
authorWei Mao <[email protected]>2017-08-04 07:15:57 -0700
committerWei Mao <[email protected]>2017-08-16 14:38:20 -0700
commit562f9f003d163470eaab98517f0770dc328f292b (patch)
tree8eacf37685ac75433d80495315990f0a5504b08c /audio/sysvad/common.cpp
parentbf93ae3e9d74d8863e23e10482da04d01c9fa947 (diff)
Build clean SysVad sample w/ RS2 WDK
Diffstat (limited to 'audio/sysvad/common.cpp')
-rw-r--r--audio/sysvad/common.cpp1309
1 files changed, 722 insertions, 587 deletions
diff --git a/audio/sysvad/common.cpp b/audio/sysvad/common.cpp
index d046d336..2aadb5e6 100644
--- a/audio/sysvad/common.cpp
+++ b/audio/sysvad/common.cpp
@@ -8,7 +8,7 @@ Module Name:
Abstract:
- Implementation of the AdapterCommon class.
+ Implementation of the AdapterCommon class.
--*/
@@ -29,7 +29,7 @@ Abstract:
#include "bthhfpminipairs.h"
// # of sec before sync request is cancelled.
-#define BTH_HFP_SYNC_REQ_TIMEOUT_IN_SEC 60
+#define BTH_HFP_SYNC_REQ_TIMEOUT_IN_SEC 60
#define BTH_HFP_NOTIFICATION_MAX_ERROR_COUNT 5
#endif // SYSVAD_BTH_BYPASS
@@ -50,18 +50,18 @@ class BthHfpDevice; // Forward declaration.
///////////////////////////////////////////////////////////////////////////////
// CAdapterCommon
-//
-class CAdapterCommon :
+//
+class CAdapterCommon :
public IAdapterCommon,
public IAdapterPowerManagement,
- public CUnknown
+ public CUnknown
{
private:
PSERVICEGROUP m_pServiceGroupWave;
PDEVICE_OBJECT m_pDeviceObject;
PDEVICE_OBJECT m_pPhysicalDeviceObject;
- WDFDEVICE m_WdfDevice; // Wdf device.
- DEVICE_POWER_STATE m_PowerState;
+ WDFDEVICE m_WdfDevice; // Wdf device.
+ DEVICE_POWER_STATE m_PowerState;
PCSYSVADHW m_pHW; // Virtual SYSVAD HW object
PPORTCLSETWHELPER m_pPortClsEtwHelper;
@@ -82,21 +82,21 @@ class CAdapterCommon :
IMP_IAdapterPowerManagement;
//=====================================================================
- // IAdapterCommon methods
+ // IAdapterCommon methods
STDMETHODIMP_(NTSTATUS) Init
- (
+ (
_In_ PDEVICE_OBJECT DeviceObject
);
STDMETHODIMP_(PDEVICE_OBJECT) GetDeviceObject(void);
-
+
STDMETHODIMP_(PDEVICE_OBJECT) GetPhysicalDeviceObject(void);
-
+
STDMETHODIMP_(WDFDEVICE) GetWdfDevice(void);
STDMETHODIMP_(void) SetWaveServiceGroup
- (
+ (
_In_ PSERVICEGROUP ServiceGroup
);
@@ -142,26 +142,26 @@ class CAdapterCommon :
STDMETHODIMP_(void) MixerReset(void);
STDMETHODIMP_(LONG) MixerVolumeRead
- (
+ (
_In_ ULONG Index,
_In_ ULONG Channel
);
STDMETHODIMP_(void) MixerVolumeWrite
- (
+ (
_In_ ULONG Index,
_In_ ULONG Channel,
- _In_ LONG Value
+ _In_ LONG Value
);
STDMETHODIMP_(LONG) MixerPeakMeterRead
- (
+ (
_In_ ULONG Index,
_In_ ULONG Channel
);
- STDMETHODIMP_(NTSTATUS) WriteEtwEvent
- (
+ STDMETHODIMP_(NTSTATUS) WriteEtwEvent
+ (
_In_ EPcMiniportEngineEvent miniportEventType,
_In_ ULONGLONG ullData1,
_In_ ULONGLONG ullData2,
@@ -169,13 +169,13 @@ class CAdapterCommon :
_In_ ULONGLONG ullData4
);
- STDMETHODIMP_(VOID) SetEtwHelper
- (
+ STDMETHODIMP_(VOID) SetEtwHelper
+ (
PPORTCLSETWHELPER _pPortClsEtwHelper
);
-
+
STDMETHODIMP_(NTSTATUS) InstallSubdevice
- (
+ (
_In_opt_ PIRP Irp,
_In_ PWSTR Name,
_In_ REFGUID PortClassId,
@@ -191,12 +191,12 @@ class CAdapterCommon :
_Out_opt_ PUNKNOWN * OutPortUnknown,
_Out_opt_ PUNKNOWN * OutMiniportUnknown
);
-
+
STDMETHODIMP_(NTSTATUS) UnregisterSubdevice
(
_In_opt_ PUNKNOWN UnknownPort
);
-
+
STDMETHODIMP_(NTSTATUS) ConnectTopologies
(
_In_ PUNKNOWN UnknownTopology,
@@ -204,7 +204,7 @@ class CAdapterCommon :
_In_ PHYSICALCONNECTIONTABLE* PhysicalConnections,
_In_ ULONG PhysicalConnectionCount
);
-
+
STDMETHODIMP_(NTSTATUS) DisconnectTopologies
(
_In_ PUNKNOWN UnknownTopology,
@@ -212,10 +212,10 @@ class CAdapterCommon :
_In_ PHYSICALCONNECTIONTABLE* PhysicalConnections,
_In_ ULONG PhysicalConnectionCount
);
-
+
STDMETHODIMP_(NTSTATUS) InstallEndpointFilters
(
- _In_opt_ PIRP Irp,
+ _In_opt_ PIRP Irp,
_In_ PENDPOINT_MINIPAIR MiniportPair,
_In_opt_ PVOID DeviceContext,
_Out_opt_ PUNKNOWN * UnknownTopology,
@@ -223,7 +223,7 @@ class CAdapterCommon :
_Out_opt_ PUNKNOWN * UnknownMiniportTopology,
_Out_opt_ PUNKNOWN * UnknownMiniportWave
);
-
+
STDMETHODIMP_(NTSTATUS) RemoveEndpointFilters
(
_In_ PENDPOINT_MINIPAIR MiniportPair,
@@ -248,23 +248,23 @@ class CAdapterCommon :
#ifdef SYSVAD_BTH_BYPASS
STDMETHODIMP_(NTSTATUS) InitBthScoBypass();
-
+
STDMETHODIMP_(VOID) CleanupBthScoBypass();
#endif // SYSVAD_BTH_BYPASS
STDMETHODIMP_(VOID) Cleanup();
-
+
//=====================================================================
// friends
friend NTSTATUS NewAdapterCommon
- (
+ (
_Out_ PUNKNOWN * Unknown,
_In_ REFCLSID,
_In_opt_ PUNKNOWN UnknownOuter,
_When_((PoolType & NonPagedPoolMustSucceed) != 0,
__drv_reportError("Must succeed pool allocations are forbidden. "
"Allocation failures cause a system crash"))
- _In_ POOL_TYPE PoolType
+ _In_ POOL_TYPE PoolType
);
#ifdef SYSVAD_BTH_BYPASS
@@ -282,12 +282,12 @@ class CAdapterCommon :
BOOL m_BthHfpEnableCleanup; // Do cleanup if true.
private:
- static
+ static
DRIVER_NOTIFICATION_CALLBACK_ROUTINE EvtBthHfpScoBypassInterfaceChange;
-
- static
+
+ static
EVT_WDF_WORKITEM EvtBthHfpScoBypassInterfaceWorkItem;
-
+
protected:
BthHfpDevice * BthHfpDeviceFind
(
@@ -323,7 +323,7 @@ class CAdapterCommon :
_In_ PUNKNOWN UnknownPort,
_In_ PUNKNOWN UnknownMiniport
);
-
+
NTSTATUS RemoveCachedSubdevice
(
_In_ PWSTR Name
@@ -450,33 +450,33 @@ struct BthHfpEventCallback
// This class represents a the Bluetooth Hands-Free Profile SCO Bypass device.
// There is one class for each interface (id = symbolic-link-name).
//
-class BthHfpDevice :
+class BthHfpDevice :
IBthHfpDeviceCommon,
- public CUnknown
+ public CUnknown
{
private:
eBthHfpState m_State;
-
+
CAdapterCommon * m_Adapter;
WDFIOTARGET m_WdfIoTarget;
-
+
LIST_ENTRY m_ListEntry;
UNICODE_STRING m_SymbolicLinkName;
-
+
//
// The Topo Filter Desc and Topo Pins structures referenced from
- // the Miniports structure are deep copies: they start as copies of the
- // static structures and are modified to allow per-SCO-Device pin
- // categories based on the info obtained from
+ // the Miniports structure are deep copies: they start as copies of the
+ // static structures and are modified to allow per-SCO-Device pin
+ // categories based on the info obtained from
// IOCTL_BTHHFP_DEVICE_GET_DESCRIPTOR2
//
PENDPOINT_MINIPAIR m_SpeakerMiniports;
PENDPOINT_MINIPAIR m_MicMiniports;
-
+
PUNKNOWN m_UnknownSpeakerTopology;
PUNKNOWN m_UnknownSpeakerWave;
PUNKNOWN m_UnknownMicTopology;
- PUNKNOWN m_UnknownMicWave;
+ PUNKNOWN m_UnknownMicWave;
PBTHHFP_DESCRIPTOR2 m_Descriptor;
PKSPROPERTY_VALUES m_VolumePropValues;
@@ -486,7 +486,7 @@ class BthHfpDevice :
BOOL m_ConnectionStatus;
LONG m_ConnectionStatusLong;
}; // unnamed.
-
+
union{
NTSTATUS m_StreamStatus;
LONG m_StreamStatusLong;
@@ -495,11 +495,11 @@ class BthHfpDevice :
KEVENT m_StreamStatusEvent;
//
- // Set to TRUE when the HF (remote device) wants to disable the
+ // Set to TRUE when the HF (remote device) wants to disable the
// NR + EC of the AG (local system).
//
LONG m_NRECDisableStatusLong;
-
+
WDFREQUEST m_StreamReq;
WDFREQUEST m_SpeakerVolumeReq;
WDFREQUEST m_MicVolumeReq;
@@ -525,7 +525,7 @@ class BthHfpDevice :
NTSTATUS Init
(
- _In_ CAdapterCommon * Adapter,
+ _In_ CAdapterCommon * Adapter,
_In_ PUNICODE_STRING SymbolicLinkName
);
@@ -548,7 +548,7 @@ class BthHfpDevice :
}
static
- BthHfpDevice *
+ BthHfpDevice *
GetBthHfpDevice
(
_In_ PLIST_ENTRY le
@@ -560,69 +560,69 @@ class BthHfpDevice :
public:
//=====================================================================
//
- // IBthHfpDeviceCommon functions.
+ // IBthHfpDeviceCommon functions.
//
STDMETHODIMP_(BOOL) IsVolumeSupported();
-
+
STDMETHODIMP_(PKSPROPERTY_VALUES) GetVolumeSettings
(
- _Out_ PULONG Size
+ _Out_ PULONG Size
);
-
+
STDMETHODIMP_(LONG) GetSpeakerVolume();
-
+
STDMETHODIMP_(NTSTATUS) SetSpeakerVolume
(
_In_ ULONG Volume
);
-
+
STDMETHODIMP_(LONG) GetMicVolume();
-
+
STDMETHODIMP_(NTSTATUS) SetMicVolume
(
_In_ ULONG Volume
);
-
+
STDMETHODIMP_(BOOL) GetConnectionStatus();
-
+
STDMETHODIMP_(NTSTATUS) Connect();
-
+
STDMETHODIMP_(NTSTATUS) Disconnect();
-
+
STDMETHODIMP_(BOOL) GetStreamStatus();
-
+
STDMETHODIMP_(NTSTATUS) StreamOpen();
-
+
STDMETHODIMP_(NTSTATUS) StreamClose();
-
+
STDMETHODIMP_(GUID) GetContainerId();
-
+
STDMETHODIMP_(VOID) SetSpeakerVolumeHandler
(
_In_opt_ PFNEVENTNOTIFICATION EventHandler,
_In_opt_ PVOID EventHandlerContext
);
-
+
STDMETHODIMP_(VOID) SetSpeakerConnectionStatusHandler
(
_In_opt_ PFNEVENTNOTIFICATION EventHandler,
_In_opt_ PVOID EventHandlerContext
);
-
+
STDMETHODIMP_(VOID) SetMicVolumeHandler
(
_In_opt_ PFNEVENTNOTIFICATION EventHandler,
_In_opt_ PVOID EventHandlerContext
);
-
+
STDMETHODIMP_(VOID) SetMicConnectionStatusHandler
(
_In_opt_ PFNEVENTNOTIFICATION EventHandler,
_In_opt_ PVOID EventHandlerContext
);
-
+
STDMETHODIMP_(BOOL) IsNRECSupported();
-
+
STDMETHODIMP_(BOOL) GetNRECDisableStatus();
private:
@@ -640,7 +640,7 @@ class BthHfpDevice :
_When_(InLength == 0 && OutLength == 0, _In_opt_)
PVOID Buffer
);
-
+
NTSTATUS SendIoCtrlAsynchronously
(
_In_ WDFREQUEST Request,
@@ -650,51 +650,51 @@ class BthHfpDevice :
_In_ PFN_WDF_REQUEST_COMPLETION_ROUTINE CompletionRoutine,
_In_ WDFCONTEXT Context
);
-
+
NTSTATUS GetBthHfpDescriptor
(
_Out_ PBTHHFP_DESCRIPTOR2 * Descriptor
);
-
+
NTSTATUS EnableBthHfpNrecDisableStatusNotification();
-
+
NTSTATUS GetBthHfpVolumePropertyValues
(
_In_ ULONG Length,
_Out_ PKSPROPERTY_VALUES * PropValues
);
-
+
NTSTATUS SetBthHfpSpeakerVolume
(
- _In_ LONG Volume
+ _In_ LONG Volume
);
-
+
NTSTATUS GetBthHfpSpeakerVolume
(
- _Out_ LONG * Volume
+ _Out_ LONG * Volume
);
-
+
NTSTATUS EnableBthHfpSpeakerVolumeStatusNotification();
-
+
NTSTATUS SetBthHfpMicVolume
(
- _In_ LONG Volume
+ _In_ LONG Volume
);
-
+
NTSTATUS GetBthHfpMicVolume
(
- _Out_ LONG * Volume
+ _Out_ LONG * Volume
);
-
+
NTSTATUS EnableBthHfpMicVolumeStatusNotification();
-
+
NTSTATUS GetBthHfpConnectionStatus
(
- _Out_ BOOL * ConnectionStatus
+ _Out_ BOOL * ConnectionStatus
);
-
+
NTSTATUS EnableBthHfpConnectionStatusNotification();
-
+
static
NTSTATUS CreateCustomEndpointMinipair
(
@@ -717,24 +717,24 @@ class BthHfpDevice :
(
_In_ PENDPOINT_MINIPAIR CustomMinipair
);
-
+
NTSTATUS GetBthHfpCodecId
(
_Out_ UCHAR * CodecId
);
NTSTATUS SetBthHfpConnect();
-
+
NTSTATUS SetBthHfpDisconnect();
NTSTATUS SetBthHfpStreamOpen();
NTSTATUS SetBthHfpStreamClose();
-
+
NTSTATUS EnableBthHfpStreamStatusNotification();
-
+
NTSTATUS StopBthHfpStreamStatusNotification();
-
+
//
// WDF I/O Target callback.
//
@@ -750,12 +750,12 @@ class BthHfpDevice :
//
// Status notifications callbacks.
//
- static
+ static
EVT_WDF_REQUEST_COMPLETION_ROUTINE EvtBthHfpDeviceStreamStatusCompletion;
- static
+ static
EVT_WDF_REQUEST_COMPLETION_ROUTINE EvtBthHfpDeviceNotificationStatusCompletion;
-
+
static
EVT_WDF_WORKITEM EvtBthHfpDeviceNotificationStatusWorkItem;
};
@@ -805,14 +805,14 @@ NTSTATUS SysvadIoSetDeviceInterfacePropertyDataMultiple
#pragma code_seg("PAGE")
NTSTATUS
NewAdapterCommon
-(
+(
_Out_ PUNKNOWN * Unknown,
_In_ REFCLSID,
_In_opt_ PUNKNOWN UnknownOuter,
_When_((PoolType & NonPagedPoolMustSucceed) != 0,
__drv_reportError("Must succeed pool allocations are forbidden. "
"Allocation failures cause a system crash"))
- _In_ POOL_TYPE PoolType
+ _In_ POOL_TYPE PoolType
)
/*++
@@ -822,7 +822,7 @@ Routine Description:
Arguments:
- Unknown -
+ Unknown -
UnknownOuter -
@@ -842,7 +842,7 @@ Return Value:
//
// This sample supports only one instance of this object.
- // (b/c of CSaveData's static members and Bluetooth HFP logic).
+ // (b/c of CSaveData's static members and Bluetooth HFP logic).
//
if (InterlockedCompareExchange(&CAdapterCommon::m_AdapterInstances, 1, 0) != 0)
{
@@ -850,7 +850,7 @@ Return Value:
DPF(D_ERROR, ("NewAdapterCommon failed, only one instance is allowed"));
goto Done;
}
-
+
//
// Allocate an adapter object.
//
@@ -862,22 +862,22 @@ Return Value:
goto Done;
}
- //
+ //
// Success.
//
*Unknown = PUNKNOWN((PADAPTERCOMMON)(p));
- (*Unknown)->AddRef();
- ntStatus = STATUS_SUCCESS;
+ (*Unknown)->AddRef();
+ ntStatus = STATUS_SUCCESS;
-Done:
+Done:
return ntStatus;
} // NewAdapterCommon
//=============================================================================
#pragma code_seg("PAGE")
CAdapterCommon::~CAdapterCommon
-(
- void
+(
+ void
)
/*++
@@ -901,12 +901,12 @@ Return Value:
delete m_pHW;
m_pHW = NULL;
}
-
+
CSaveData::DestroyWorkItems();
SAFE_RELEASE(m_pPortClsEtwHelper);
SAFE_RELEASE(m_pServiceGroupWave);
-
+
if (m_WdfDevice)
{
WdfObjectDelete(m_WdfDevice);
@@ -915,11 +915,11 @@ Return Value:
InterlockedDecrement(&CAdapterCommon::m_AdapterInstances);
ASSERT(CAdapterCommon::m_AdapterInstances == 0);
-} // ~CAdapterCommon
+} // ~CAdapterCommon
//=============================================================================
#pragma code_seg("PAGE")
-STDMETHODIMP_(PDEVICE_OBJECT)
+STDMETHODIMP_(PDEVICE_OBJECT)
CAdapterCommon::GetDeviceObject
(
void
@@ -939,13 +939,13 @@ Return Value:
--*/
{
PAGED_CODE();
-
+
return m_pDeviceObject;
} // GetDeviceObject
//=============================================================================
#pragma code_seg("PAGE")
-STDMETHODIMP_(PDEVICE_OBJECT)
+STDMETHODIMP_(PDEVICE_OBJECT)
CAdapterCommon::GetPhysicalDeviceObject
(
void
@@ -965,13 +965,13 @@ Return Value:
--*/
{
PAGED_CODE();
-
+
return m_pPhysicalDeviceObject;
} // GetPhysicalDeviceObject
//=============================================================================
#pragma code_seg("PAGE")
-STDMETHODIMP_(WDFDEVICE)
+STDMETHODIMP_(WDFDEVICE)
CAdapterCommon::GetWdfDevice
(
void
@@ -993,7 +993,7 @@ Return Value:
--*/
{
PAGED_CODE();
-
+
return m_WdfDevice;
} // GetWdfDevice
@@ -1001,8 +1001,8 @@ Return Value:
#pragma code_seg("PAGE")
NTSTATUS
CAdapterCommon::Init
-(
- _In_ PDEVICE_OBJECT DeviceObject
+(
+ _In_ PDEVICE_OBJECT DeviceObject
)
/*++
@@ -1053,7 +1053,7 @@ Return Value:
Done);
//
- // Create a WDF miniport to represent the adapter. Note that WDF miniports
+ // Create a WDF miniport to represent the adapter. Note that WDF miniports
// are NOT audio miniports. An audio adapter is associated with a single WDF
// miniport. This driver uses WDF to simplify the handling of the Bluetooth
// SCO HFP Bypass interface.
@@ -1070,7 +1070,7 @@ Return Value:
Done);
// Initialize HW.
- //
+ //
m_pHW = new (NonPagedPoolNx, SYSVAD_POOLTAG) CSYSVADHW;
if (!m_pHW)
{
@@ -1078,7 +1078,7 @@ Return Value:
ntStatus = STATUS_INSUFFICIENT_RESOURCES;
}
IF_FAILED_JUMP(ntStatus, Done);
-
+
m_pHW->MixerReset();
//
@@ -1097,8 +1097,8 @@ Done:
#pragma code_seg("PAGE")
STDMETHODIMP_(void)
CAdapterCommon::MixerReset
-(
- void
+(
+ void
)
/*++
@@ -1115,7 +1115,7 @@ Return Value:
--*/
{
PAGED_CODE();
-
+
if (m_pHW)
{
m_pHW->MixerReset();
@@ -1125,60 +1125,60 @@ Return Value:
//=============================================================================
/* Here are the definitions of the standard miniport events.
-Event type : eMINIPORT_IHV_DEFINED
+Event type : eMINIPORT_IHV_DEFINED
Parameter 1 : Defined and used by IHVs
Parameter 2 : Defined and used by IHVs
Parameter 3 :Defined and used by IHVs
Parameter 4 :Defined and used by IHVs
Event type: eMINIPORT_BUFFER_COMPLETE
-Parameter 1: Current linear buffer position
-Parameter 2: the previous WaveRtBufferWritePosition that the drive received
+Parameter 1: Current linear buffer position
+Parameter 2: the previous WaveRtBufferWritePosition that the drive received
Parameter 3: Data length completed
Parameter 4:0
Event type: eMINIPORT_PIN_STATE
-Parameter 1: Current linear buffer position
-Parameter 2: the previous WaveRtBufferWritePosition that the drive received
-Parameter 3: Pin State 0->KS_STOP, 1->KS_ACQUIRE, 2->KS_PAUSE, 3->KS_RUN
+Parameter 1: Current linear buffer position
+Parameter 2: the previous WaveRtBufferWritePosition that the drive received
+Parameter 3: Pin State 0->KS_STOP, 1->KS_ACQUIRE, 2->KS_PAUSE, 3->KS_RUN
Parameter 4:0
Event type: eMINIPORT_GET_STREAM_POS
-Parameter 1: Current linear buffer position
-Parameter 2: the previous WaveRtBufferWritePosition that the drive received
+Parameter 1: Current linear buffer position
+Parameter 2: the previous WaveRtBufferWritePosition that the drive received
Parameter 3: 0
Parameter 4:0
Event type: eMINIPORT_SET_WAVERT_BUFFER_WRITE_POS
-Parameter 1: Current linear buffer position
-Parameter 2: the previous WaveRtBufferWritePosition that the drive received
+Parameter 1: Current linear buffer position
+Parameter 2: the previous WaveRtBufferWritePosition that the drive received
Parameter 3: the arget WaveRtBufferWritePosition received from portcls
Parameter 4:0
Event type: eMINIPORT_GET_PRESENTATION_POS
-Parameter 1: Current linear buffer position
-Parameter 2: the previous WaveRtBufferWritePosition that the drive received
+Parameter 1: Current linear buffer position
+Parameter 2: the previous WaveRtBufferWritePosition that the drive received
Parameter 3: Presentation position
Parameter 4:0
-Event type: eMINIPORT_PROGRAM_DMA
-Parameter 1: Current linear buffer position
-Parameter 2: the previous WaveRtBufferWritePosition that the drive received
+Event type: eMINIPORT_PROGRAM_DMA
+Parameter 1: Current linear buffer position
+Parameter 2: the previous WaveRtBufferWritePosition that the drive received
Parameter 3: Starting WaveRt buffer offset
Parameter 4: Data length
Event type: eMINIPORT_GLITCH_REPORT
-Parameter 1: Current linear buffer position
-Parameter 2: the previous WaveRtBufferWritePosition that the drive received
-Parameter 3: major glitch code: 1:WaveRT buffer is underrun,
- 2:decoder errors,
+Parameter 1: Current linear buffer position
+Parameter 2: the previous WaveRtBufferWritePosition that the drive received
+Parameter 3: major glitch code: 1:WaveRT buffer is underrun,
+ 2:decoder errors,
3:receive the same wavert buffer two in a row in event driven mode
Parameter 4: minor code for the glitch cause
Event type: eMINIPORT_LAST_BUFFER_RENDERED
-Parameter 1: Current linear buffer position
-Parameter 2: the very last WaveRtBufferWritePosition that the driver received
+Parameter 1: Current linear buffer position
+Parameter 2: the very last WaveRtBufferWritePosition that the driver received
Parameter 3: 0
Parameter 4: 0
@@ -1186,7 +1186,7 @@ Parameter 4: 0
#pragma code_seg()
STDMETHODIMP
CAdapterCommon::WriteEtwEvent
-(
+(
_In_ EPcMiniportEngineEvent miniportEventType,
_In_ ULONGLONG ullData1,
_In_ ULONGLONG ullData2,
@@ -1207,12 +1207,12 @@ CAdapterCommon::WriteEtwEvent
#pragma code_seg("PAGE")
STDMETHODIMP_(void)
CAdapterCommon::SetEtwHelper
-(
+(
PPORTCLSETWHELPER _pPortClsEtwHelper
)
{
PAGED_CODE();
-
+
SAFE_RELEASE(m_pPortClsEtwHelper);
m_pPortClsEtwHelper = _pPortClsEtwHelper;
@@ -1227,9 +1227,9 @@ CAdapterCommon::SetEtwHelper
#pragma code_seg("PAGE")
STDMETHODIMP
CAdapterCommon::NonDelegatingQueryInterface
-(
+(
_In_ REFIID Interface,
- _COM_Outptr_ PVOID * Object
+ _COM_Outptr_ PVOID * Object
)
/*++
@@ -1239,7 +1239,7 @@ Routine Description:
Arguments:
- Interface -
+ Interface -
Object -
@@ -1283,8 +1283,8 @@ Return Value:
#pragma code_seg("PAGE")
STDMETHODIMP_(void)
CAdapterCommon::SetWaveServiceGroup
-(
- _In_ PSERVICEGROUP ServiceGroup
+(
+ _In_ PSERVICEGROUP ServiceGroup
)
/*++
@@ -1301,7 +1301,7 @@ Return Value:
{
PAGED_CODE();
DPF_ENTER(("[CAdapterCommon::SetWaveServiceGroup]"));
-
+
SAFE_RELEASE(m_pServiceGroupWave);
m_pServiceGroupWave = ServiceGroup;
@@ -1551,7 +1551,7 @@ Return Value:
//=============================================================================
#pragma code_seg()
STDMETHODIMP_(ULONG)
-CAdapterCommon::MixerMuxRead()
+CAdapterCommon::MixerMuxRead()
/*++
Routine Description:
@@ -1613,7 +1613,7 @@ Return Value:
#pragma code_seg()
STDMETHODIMP_(LONG)
CAdapterCommon::MixerVolumeRead
-(
+(
_In_ ULONG Index,
_In_ ULONG Channel
)
@@ -1647,7 +1647,7 @@ Return Value:
#pragma code_seg()
STDMETHODIMP_(void)
CAdapterCommon::MixerVolumeWrite
-(
+(
_In_ ULONG Index,
_In_ ULONG Channel,
_In_ LONG Value
@@ -1682,7 +1682,7 @@ Return Value:
#pragma code_seg()
STDMETHODIMP_(LONG)
CAdapterCommon::MixerPeakMeterRead
-(
+(
_In_ ULONG Index,
_In_ ULONG Channel
)
@@ -1716,8 +1716,8 @@ Return Value:
#pragma code_seg()
STDMETHODIMP_(void)
CAdapterCommon::PowerChangeState
-(
- _In_ POWER_STATE NewState
+(
+ _In_ POWER_STATE NewState
)
/*++
@@ -1726,7 +1726,7 @@ Routine Description:
Arguments:
- NewState - The requested, new power state for the device.
+ NewState - The requested, new power state for the device.
Return Value:
@@ -1737,29 +1737,29 @@ Note:
To assist the driver, PortCls will pause any active audio streams prior to calling
this method to place the device in a sleep state. After calling this method, PortCls
- will unpause active audio streams, to wake the device up. Miniports can opt for
+ will unpause active audio streams, to wake the device up. Miniports can opt for
additional notification by utilizing the IPowerNotify interface.
- The miniport driver must perform the requested change to the device's power state
- before it returns from the PowerChangeState call. If the miniport driver needs to
- save or restore any device state before a power-state change, the miniport driver
+ The miniport driver must perform the requested change to the device's power state
+ before it returns from the PowerChangeState call. If the miniport driver needs to
+ save or restore any device state before a power-state change, the miniport driver
should support the IPowerNotify interface, which allows it to receive advance warning
- of any such change. Before returning from a successful PowerChangeState call, the
+ of any such change. Before returning from a successful PowerChangeState call, the
miniport driver should cache the new power state.
- While the miniport driver is in one of the sleep states (any state other than
+ While the miniport driver is in one of the sleep states (any state other than
PowerDeviceD0), it must avoid writing to the hardware. The miniport driver must cache
any hardware accesses that need to be deferred until the device powers up again. If
- the power state is changing from one of the sleep states to PowerDeviceD0, the
+ the power state is changing from one of the sleep states to PowerDeviceD0, the
miniport driver should perform any deferred hardware accesses after it has powered up
- the device. If the power state is changing from PowerDeviceD0 to a sleep state, the
+ the device. If the power state is changing from PowerDeviceD0 to a sleep state, the
miniport driver can perform any necessary hardware accesses during the PowerChangeState
call before it powers down the device.
While powered down, a miniport driver is never asked to create a miniport driver object
or stream object. PortCls always places the device in the PowerDeviceD0 state before
calling the miniport driver's NewStream method.
-
+
--*/
{
DPF_ENTER(("[CAdapterCommon::PowerChangeState]"));
@@ -1791,15 +1791,15 @@ Note:
m_PowerState = NewState.DeviceState;
DPF
- (
- D_VERBOSE,
- ("Entering D%u", ULONG(m_PowerState) - ULONG(PowerDeviceD0))
+ (
+ D_VERBOSE,
+ ("Entering D%u", ULONG(m_PowerState) - ULONG(PowerDeviceD0))
);
break;
-
+
default:
-
+
DPF(D_VERBOSE, ("Unknown Device Power State"));
break;
}
@@ -1810,20 +1810,20 @@ Note:
#pragma code_seg()
STDMETHODIMP_(NTSTATUS)
CAdapterCommon::QueryDeviceCapabilities
-(
- _Inout_updates_bytes_(sizeof(DEVICE_CAPABILITIES)) PDEVICE_CAPABILITIES PowerDeviceCaps
+(
+ _Inout_updates_bytes_(sizeof(DEVICE_CAPABILITIES)) PDEVICE_CAPABILITIES PowerDeviceCaps
)
/*++
Routine Description:
- Called at startup to get the caps for the device. This structure provides
- the system with the mappings between system power state and device power
- state. This typically will not need modification by the driver.
+ Called at startup to get the caps for the device. This structure provides
+ the system with the mappings between system power state and device power
+ state. This typically will not need modification by the driver.
Arguments:
- PowerDeviceCaps - The device's capabilities.
+ PowerDeviceCaps - The device's capabilities.
Return Value:
@@ -1842,14 +1842,14 @@ Return Value:
#pragma code_seg()
STDMETHODIMP_(NTSTATUS)
CAdapterCommon::QueryPowerChangeState
-(
- _In_ POWER_STATE NewStateQuery
+(
+ _In_ POWER_STATE NewStateQuery
)
/*++
Routine Description:
- Query to see if the device can change to this power state
+ Query to see if the device can change to this power state
Arguments:
@@ -1954,7 +1954,7 @@ Done:
#pragma code_seg("PAGE")
STDMETHODIMP_(NTSTATUS)
CAdapterCommon::InstallSubdevice
-(
+(
_In_opt_ PIRP Irp,
_In_ PWSTR Name,
_In_ REFGUID PortClassId,
@@ -1975,34 +1975,34 @@ CAdapterCommon::InstallSubdevice
Routine Description:
- This function creates and registers a subdevice consisting of a port
- driver, a minport driver and a set of resources bound together. It will
- also optionally place a pointer to an interface on the port driver in a
- specified location before initializing the port driver. This is done so
- that a common ISR can have access to the port driver during
- initialization, when the ISR might fire.
+ This function creates and registers a subdevice consisting of a port
+ driver, a minport driver and a set of resources bound together. It will
+ also optionally place a pointer to an interface on the port driver in a
+ specified location before initializing the port driver. This is done so
+ that a common ISR can have access to the port driver during
+ initialization, when the ISR might fire.
Arguments:
Irp - pointer to the irp object.
Name - name of the miniport. Passes to PcRegisterSubDevice
-
+
PortClassId - port class id. Passed to PcNewPort.
MiniportClassId - miniport class id. Passed to PcNewMiniport.
- MiniportCreate - pointer to a miniport creation function. If NULL,
+ MiniportCreate - pointer to a miniport creation function. If NULL,
PcNewMiniport is used.
-
+
DeviceContext - deviceType specific.
- MiniportPair - endpoint configuration info.
+ MiniportPair - endpoint configuration info.
ResourceList - pointer to the resource list.
PortInterfaceId - GUID that represents the port interface.
-
+
OutPortInterface - pointer to store the port interface
OutPortUnknown - pointer to store the unknown port interface.
@@ -2045,9 +2045,9 @@ Return Value:
{
if (MiniportCreate)
{
- ntStatus =
+ ntStatus =
MiniportCreate
- (
+ (
&miniport,
MiniportClassId,
NULL,
@@ -2059,10 +2059,10 @@ Return Value:
}
else
{
- ntStatus =
+ ntStatus =
PcNewMiniport
(
- (PMINIPORT *) &miniport,
+ (PMINIPORT *) &miniport,
MiniportClassId
);
}
@@ -2078,14 +2078,14 @@ Return Value:
// still succeed.
//
#pragma warning(disable:6387)
- ntStatus =
+ ntStatus =
port->Init
- (
+ (
m_pDeviceObject,
Irp,
miniport,
adapterCommon,
- ResourceList
+ ResourceList
);
#pragma warning (pop)
@@ -2093,12 +2093,12 @@ Return Value:
{
// Register the subdevice (port/miniport combination).
//
- ntStatus =
+ ntStatus =
PcRegisterSubdevice
- (
+ (
m_pDeviceObject,
Name,
- port
+ port
);
}
}
@@ -2109,31 +2109,31 @@ Return Value:
{
if (OutPortUnknown)
{
- ntStatus =
+ ntStatus =
port->QueryInterface
- (
+ (
IID_IUnknown,
- (PVOID *)OutPortUnknown
+ (PVOID *)OutPortUnknown
);
}
if (OutPortInterface)
{
- ntStatus =
+ ntStatus =
port->QueryInterface
- (
+ (
PortInterfaceId,
- (PVOID *) OutPortInterface
+ (PVOID *) OutPortInterface
);
}
if (OutMiniportUnknown)
{
- ntStatus =
+ ntStatus =
miniport->QueryInterface
- (
+ (
IID_IUnknown,
- (PVOID *)OutMiniportUnknown
+ (PVOID *)OutMiniportUnknown
);
}
@@ -2179,10 +2179,10 @@ Return Value:
DPF_ENTER(("[CAdapterCommon::UnregisterSubdevice]"));
ASSERT(m_pDeviceObject != NULL);
-
+
NTSTATUS ntStatus = STATUS_SUCCESS;
PUNREGISTERSUBDEVICE unregisterSubdevice = NULL;
-
+
if (NULL == UnknownPort)
{
return ntStatus;
@@ -2191,7 +2191,7 @@ Return Value:
//
// Get the IUnregisterSubdevice interface.
//
- ntStatus = UnknownPort->QueryInterface(
+ ntStatus = UnknownPort->QueryInterface(
IID_IUnregisterSubdevice,
(PVOID *)&unregisterSubdevice);
@@ -2209,7 +2209,7 @@ Return Value:
//
unregisterSubdevice->Release();
}
-
+
return ntStatus;
}
@@ -2239,9 +2239,9 @@ Return Value:
{
PAGED_CODE();
DPF_ENTER(("[CAdapterCommon::ConnectTopologies]"));
-
+
ASSERT(m_pDeviceObject != NULL);
-
+
NTSTATUS ntStatus = STATUS_SUCCESS;
//
@@ -2251,13 +2251,13 @@ Return Value:
//
for (ULONG i = 0; i < PhysicalConnectionCount && NT_SUCCESS(ntStatus); i++)
{
-
+
switch(PhysicalConnections[i].eType)
{
case CONNECTIONTYPE_TOPOLOGY_OUTPUT:
ntStatus =
PcRegisterPhysicalConnection
- (
+ (
m_pDeviceObject,
UnknownTopology,
PhysicalConnections[i].ulTopology,
@@ -2272,7 +2272,7 @@ Return Value:
case CONNECTIONTYPE_WAVE_OUTPUT:
ntStatus =
PcRegisterPhysicalConnection
- (
+ (
m_pDeviceObject,
UnknownWave,
PhysicalConnections[i].ulWave,
@@ -2285,7 +2285,7 @@ Return Value:
}
break;
}
- }
+ }
//
// Cleanup in case of error.
@@ -2326,9 +2326,9 @@ Return Value:
{
PAGED_CODE();
DPF_ENTER(("[CAdapterCommon::DisconnectTopologies]"));
-
+
ASSERT(m_pDeviceObject != NULL);
-
+
NTSTATUS ntStatus = STATUS_SUCCESS;
NTSTATUS ntStatus2 = STATUS_SUCCESS;
PUNREGISTERPHYSICALCONNECTION unregisterPhysicalConnection = NULL;
@@ -2336,12 +2336,12 @@ Return Value:
//
// Get the IUnregisterPhysicalConnection interface
//
- ntStatus = UnknownTopology->QueryInterface(
+ ntStatus = UnknownTopology->QueryInterface(
IID_IUnregisterPhysicalConnection,
(PVOID *)&unregisterPhysicalConnection);
-
+
if (NT_SUCCESS(ntStatus))
- {
+ {
for (ULONG i = 0; i < PhysicalConnectionCount; i++)
{
switch(PhysicalConnections[i].eType)
@@ -2382,9 +2382,9 @@ Return Value:
{
ntStatus = ntStatus2;
}
- }
+ }
}
-
+
//
// Release the IUnregisterPhysicalConnection interface.
//
@@ -2576,7 +2576,7 @@ CAdapterCommon::Cleanup()
STDMETHODIMP_(NTSTATUS)
CAdapterCommon::InstallEndpointFilters
(
- _In_opt_ PIRP Irp,
+ _In_opt_ PIRP Irp,
_In_ PENDPOINT_MINIPAIR MiniportPair,
_In_opt_ PVOID DeviceContext,
_Out_opt_ PUNKNOWN * UnknownTopology,
@@ -2587,7 +2587,7 @@ CAdapterCommon::InstallEndpointFilters
{
PAGED_CODE();
DPF_ENTER(("[CAdapterCommon::InstallEndpointFilters]"));
-
+
NTSTATUS ntStatus = STATUS_SUCCESS;
PUNKNOWN unknownTopology = NULL;
PUNKNOWN unknownWave = NULL;
@@ -2606,7 +2606,7 @@ CAdapterCommon::InstallEndpointFilters
{
*UnknownWave = NULL;
}
-
+
if (UnknownMiniportTopology)
{
*UnknownMiniportTopology = NULL;
@@ -2627,7 +2627,7 @@ CAdapterCommon::InstallEndpointFilters
ntStatus = InstallSubdevice(Irp,
MiniportPair->TopoName, // make sure this name matches with SYSVAD.<TopoName>.szPname in the inf's [Strings] section
CLSID_PortTopology,
- CLSID_PortTopology,
+ CLSID_PortTopology,
MiniportPair->TopoCreateCallback,
MiniportPair->TopoInterfacePropertyCount,
MiniportPair->TopoInterfaceProperties,
@@ -2655,7 +2655,7 @@ CAdapterCommon::InstallEndpointFilters
ntStatus = InstallSubdevice(Irp,
MiniportPair->WaveName, // make sure this name matches with SYSVAD.<WaveName>.szPname in the inf's [Strings] section
CLSID_PortWaveRT,
- CLSID_PortWaveRT,
+ CLSID_PortWaveRT,
MiniportPair->WaveCreateCallback,
MiniportPair->WaveInterfacePropertyCount,
MiniportPair->WaveInterfaceProperties,
@@ -2663,7 +2663,7 @@ CAdapterCommon::InstallEndpointFilters
MiniportPair,
NULL,
IID_IPortWaveRT,
- NULL,
+ NULL,
&unknownWave,
&unknownMiniWave
);
@@ -2698,7 +2698,7 @@ CAdapterCommon::InstallEndpointFilters
unknownTopology->AddRef();
*UnknownTopology = unknownTopology;
}
-
+
if (UnknownWave != NULL && unknownWave != NULL)
{
unknownWave->AddRef();
@@ -2724,14 +2724,14 @@ CAdapterCommon::InstallEndpointFilters
UnregisterSubdevice(unknownTopology);
RemoveCachedSubdevice(MiniportPair->TopoName);
}
-
+
if (bWaveCreated && unknownWave != NULL)
{
UnregisterSubdevice(unknownWave);
RemoveCachedSubdevice(MiniportPair->WaveName);
}
}
-
+
SAFE_RELEASE(unknownMiniTopo);
SAFE_RELEASE(unknownTopology);
SAFE_RELEASE(unknownMiniWave);
@@ -2752,9 +2752,9 @@ CAdapterCommon::RemoveEndpointFilters
{
PAGED_CODE();
DPF_ENTER(("[CAdapterCommon::RemoveEndpointFilters]"));
-
+
NTSTATUS ntStatus = STATUS_SUCCESS;
-
+
if (UnknownTopology != NULL && UnknownWave != NULL)
{
ntStatus = DisconnectTopologies(
@@ -2769,7 +2769,7 @@ CAdapterCommon::RemoveEndpointFilters
}
}
-
+
RemoveCachedSubdevice(MiniportPair->WaveName);
ntStatus = UnregisterSubdevice(UnknownWave);
@@ -2790,7 +2790,7 @@ CAdapterCommon::RemoveEndpointFilters
// All Done.
//
ntStatus = STATUS_SUCCESS;
-
+
return ntStatus;
}
@@ -2808,8 +2808,8 @@ CAdapterCommon::GetFilters
{
PAGED_CODE();
DPF_ENTER(("[CAdapterCommon::GetFilters]"));
-
- NTSTATUS ntStatus = STATUS_SUCCESS;
+
+ NTSTATUS ntStatus = STATUS_SUCCESS;
PUNKNOWN unknownTopologyPort = NULL;
PUNKNOWN unknownTopologyMiniport = NULL;
PUNKNOWN unknownWavePort = NULL;
@@ -2866,7 +2866,7 @@ CAdapterCommon::SetIdlePowerManagement
PAGED_CODE();
DPF_ENTER(("[CAdapterCommon::SetIdlePowerManagement]"));
- NTSTATUS ntStatus = STATUS_SUCCESS;
+ NTSTATUS ntStatus = STATUS_SUCCESS;
IUnknown *pUnknown = NULL;
PPORTCLSPOWER pPortClsPower = NULL;
// refcounting disable requests. Each miniport is responsible for calling this in pairs,
@@ -2878,7 +2878,7 @@ CAdapterCommon::SetIdlePowerManagement
ntStatus = GetFilters(MiniportPair, NULL, NULL, &pUnknown, NULL);
if (NT_SUCCESS(ntStatus))
{
- ntStatus =
+ ntStatus =
pUnknown->QueryInterface
(
IID_IPortClsPower,
@@ -2935,15 +2935,15 @@ Routine Description:
Arguments:
WorkItem - WDF work-item object.
-
+
--*/
{
PAGED_CODE();
DPF_ENTER(("[EvtBthHfpScoBypassInterfaceWorkItem]"));
CAdapterCommon * This;
-
- if (WorkItem == NULL)
+
+ if (WorkItem == NULL)
{
return;
}
@@ -2955,7 +2955,7 @@ Arguments:
{
PLIST_ENTRY le = NULL;
BthHfpWorkTask * task = NULL;
-
+
//
// Retrieve a taask.
//
@@ -2967,7 +2967,7 @@ Arguments:
InitializeListHead(le);
}
ExReleaseFastMutex(&This->m_BthHfpFastMutex);
-
+
if (task == NULL)
{
break;
@@ -2975,7 +2975,7 @@ Arguments:
ASSERT(task->Device != NULL);
_Analysis_assume_(task->Device != NULL);
-
+
//
// Process the task.
//
@@ -3023,7 +3023,7 @@ Routine Description:
Arguments:
SymbolicLinkName - interface's symbolic link.
-
+
Return Value:
BthHfpDevice pointer or NULL.
@@ -3032,17 +3032,17 @@ Return Value:
{
PAGED_CODE();
DPF_ENTER(("[CAdapterCommon::BthHfpDeviceFind]"));
-
+
PLIST_ENTRY le = NULL;
BthHfpDevice * bthDevice = NULL;
ExAcquireFastMutex(&m_BthHfpFastMutex);
-
+
for (le = m_BthHfpDevices.Flink; le != &m_BthHfpDevices; le = le->Flink)
{
BthHfpDevice * tmpBthDevice = BthHfpDevice::GetBthHfpDevice(le);
ASSERT(tmpBthDevice != NULL);
-
+
PUNICODE_STRING unicodeStr = tmpBthDevice->GetSymbolicLinkName();
ASSERT(unicodeStr != NULL);
@@ -3055,7 +3055,7 @@ Return Value:
break;
}
}
-
+
ExReleaseFastMutex(&m_BthHfpFastMutex);
return bthDevice;
@@ -3077,7 +3077,7 @@ Routine Description:
Arguments:
SymbolicLinkName - new interface's symbolic link.
-
+
Return Value:
NT status code.
@@ -3090,7 +3090,7 @@ Return Value:
NTSTATUS ntStatus = STATUS_SUCCESS;
BthHfpDevice * bthDevice = NULL;
BthHfpWorkTask * bthWorkTask = NULL;
-
+
DPF(D_VERBOSE, ("BthHfpScoInterfaceArrival: SymbolicLinkName %wZ", SymbolicLinkName));
//
@@ -3106,7 +3106,7 @@ Return Value:
ntStatus = STATUS_SUCCESS;
goto Done;
}
-
+
//
// Alloc a new structure for this Bluetooth hands-free device.
//
@@ -3117,9 +3117,9 @@ Return Value:
ntStatus = STATUS_INSUFFICIENT_RESOURCES;
goto Done;
}
-
+
DPF(D_VERBOSE, ("BthHfpScoInterfaceArrival: created BthHfpDevice 0x%p ", bthDevice));
-
+
//
// Basic initialization of the Bluetooth Hands-Free Profile interface.
// The audio miniport creation is done later by the BthHfpDevice.Start()
@@ -3139,7 +3139,7 @@ Return Value:
ntStatus = STATUS_INSUFFICIENT_RESOURCES;
goto Done;
}
-
+
// bthWorkTask->L.Size is set to sizeof(BthHfpWorkTask) in the Look Aside List configuration
#pragma warning(suppress: 6386)
RtlZeroMemory(bthWorkTask, sizeof(*bthWorkTask));
@@ -3147,9 +3147,9 @@ Return Value:
InitializeListHead(&bthWorkTask->ListEntry);
// Note that bthDevice has one reference at this point.
bthWorkTask->Device = bthDevice;
-
+
ExAcquireFastMutex(&m_BthHfpFastMutex);
-
+
//
// Insert this new Bluetooth HFP device in our list.
//
@@ -3165,13 +3165,13 @@ Return Value:
// Schedule a work-item if not already running.
//
WdfWorkItemEnqueue(m_BthHfpWorkItem);
-
+
ExReleaseFastMutex(&m_BthHfpFastMutex);
Done:
if (!NT_SUCCESS(ntStatus))
{
- // Release the last ref, this will delete the BthHfpDevice
+ // Release the last ref, this will delete the BthHfpDevice
SAFE_RELEASE(bthDevice);
if (bthWorkTask != NULL)
@@ -3180,7 +3180,7 @@ Done:
bthWorkTask = NULL;
}
}
-
+
return ntStatus;
}
@@ -3200,7 +3200,7 @@ Routine Description:
Arguments:
SymbolicLinkName - interface's symbolic link to remove.
-
+
Return Value:
NT status code.
@@ -3213,7 +3213,7 @@ Return Value:
NTSTATUS ntStatus = STATUS_SUCCESS;
BthHfpDevice * bthDevice = NULL;
BthHfpWorkTask * bthWorkTask = NULL;
-
+
DPF(D_VERBOSE, ("BthHfpScoInterfaceRemoval: SymbolicLinkName %wZ", SymbolicLinkName));
//
@@ -3227,7 +3227,7 @@ Return Value:
ntStatus = STATUS_SUCCESS;
goto Done;
}
-
+
//
// Init a work task.
//
@@ -3238,7 +3238,7 @@ Return Value:
ntStatus = STATUS_INSUFFICIENT_RESOURCES;
goto Done;
}
-
+
// bthWorkTask->L.Size is set to sizeof(BthHfpWorkTask) in the Look Aside List configuration
#pragma warning(suppress: 6386)
RtlZeroMemory(bthWorkTask, sizeof(*bthWorkTask));
@@ -3248,7 +3248,7 @@ Return Value:
bthWorkTask->Device = bthDevice;
ExAcquireFastMutex(&m_BthHfpFastMutex);
-
+
//
// Remove this Bluetooth device from our list and release the associated reference.
//
@@ -3265,7 +3265,7 @@ Return Value:
// Schedule a work-item if not already running.
//
WdfWorkItemEnqueue(m_BthHfpWorkItem);
-
+
ExReleaseFastMutex(&m_BthHfpFastMutex);
//
@@ -3280,7 +3280,7 @@ Done:
// Release the ref we got in find.
SAFE_RELEASE(bthDevice);
}
-
+
return ntStatus;
}
@@ -3298,9 +3298,9 @@ Routine Description:
This callback is invoked when a new HFP SCO Bypass interface is added or removed.
Arguments:
- NotificationPointer - Interface change notification
+ NotificationPointer - Interface change notification
Context - CAdapterCommon ptr.
-
+
Return Value:
NT status code.
@@ -3309,32 +3309,32 @@ Return Value:
{
PAGED_CODE();
DPF_ENTER(("[EvtBthHfpScoBypassInterfaceChange]"));
-
+
NTSTATUS ntStatus = STATUS_SUCCESS;
CAdapterCommon * This = NULL;
PDEVICE_INTERFACE_CHANGE_NOTIFICATION Notification = (PDEVICE_INTERFACE_CHANGE_NOTIFICATION) NotificationPointer;
-
+
//
// Make sure this is the interface class we extect. Any other class guid
// is an error, but let it go since it is not fatal to the machine.
//
- if (!IsEqualGUID(Notification->InterfaceClassGuid, GUID_DEVINTERFACE_BLUETOOTH_HFP_SCO_HCIBYPASS))
+ if (!IsEqualGUID(Notification->InterfaceClassGuid, GUID_DEVINTERFACE_BLUETOOTH_HFP_SCO_HCIBYPASS))
{
DPF(D_VERBOSE, ("EvtBthHfpScoBypassInterfaceChange: bad interface ClassGuid"));
ASSERTMSG("EvtBthHfpScoBypassInterfaceChange: bad interface ClassGuid ", FALSE);
-
+
goto Done;
}
This = (CAdapterCommon *)Context;
ASSERT(This != NULL);
_Analysis_assume_(This != NULL);
-
+
//
- // Take action based on the event. Any other event type is an error,
+ // Take action based on the event. Any other event type is an error,
// but let it go since it is not fatal to the machine.
//
- if (IsEqualGUID(Notification->Event, GUID_DEVICE_INTERFACE_ARRIVAL))
+ if (IsEqualGUID(Notification->Event, GUID_DEVICE_INTERFACE_ARRIVAL))
{
ntStatus = This->BthHfpScoInterfaceArrival(Notification->SymbolicLinkName);
}
@@ -3342,13 +3342,13 @@ Return Value:
{
ntStatus = This->BthHfpScoInterfaceRemoval(Notification->SymbolicLinkName);
}
- else
+ else
{
DPF(D_VERBOSE, ("EvtBthHfpScoBypassInterfaceChange: bad "
"GUID_DEVINTERFACE_BLUETOOTH_HFP_SCO_HCIBYPASS event"));
ASSERTMSG("EvtBthHfpScoBypassInterfaceChange: bad "
"GUID_DEVINTERFACE_BLUETOOTH_HFP_SCO_HCIBYPASS event ", FALSE);
-
+
goto Done;
}
@@ -3379,7 +3379,7 @@ Return Value:
WDF_WORKITEM_CONFIG wiConfig;
WDF_OBJECT_ATTRIBUTES attributes;
BthHfpWorkItemContext * wiContext;
-
+
//
// Init spin-lock, linked lists, work-item, event, etc.
// Init all members to default values. This basic init should not fail.
@@ -3396,7 +3396,7 @@ Return Value:
POOL_NX_ALLOCATION,
m_BhtHfpWorkTaskPoolElementSize,
MINADAPTER_POOLTAG,
- 0);
+ 0);
//
// Enable Bluetooth HFP SCO-Bypass Cleanup.
// Do any allocation/initialization that can fail after this point.
@@ -3421,7 +3421,7 @@ Return Value:
wiContext = GetBthHfpWorkItemContext(m_BthHfpWorkItem);
wiContext->Adapter = this; // weak ref.
-
+
//
// Register for bluetooth heandsfree profile interface changes.
//
@@ -3470,7 +3470,7 @@ Routine Description:
{
return;
}
-
+
//
// Unregister for bluetooth heandsfree profile interface changes.
//
@@ -3489,20 +3489,20 @@ Routine Description:
WdfObjectDelete(m_BthHfpWorkItem);
m_BthHfpWorkItem = NULL;
}
-
+
ASSERT(IsListEmpty(&m_BthHfpWorkTasks));
-
+
//
- // Stop and delete all BthHfpDevices. We are the only thread accessing this list,
+ // Stop and delete all BthHfpDevices. We are the only thread accessing this list,
// so there is no need to acquire the mutex.
//
while (!IsListEmpty(&m_BthHfpDevices))
{
BthHfpDevice * bthDevice = NULL;
PLIST_ENTRY le = NULL;
-
+
le = RemoveHeadList(&m_BthHfpDevices);
-
+
bthDevice = BthHfpDevice::GetBthHfpDevice(le);
InitializeListHead(le);
@@ -3512,9 +3512,9 @@ Routine Description:
// This should be the last reference.
bthDevice->Release();
}
-
+
ASSERT(IsListEmpty(&m_BthHfpDevices));
-
+
//
// General cleanup.
//
@@ -3531,9 +3531,9 @@ Routine Description:
#pragma code_seg("PAGE")
STDMETHODIMP
BthHfpDevice::NonDelegatingQueryInterface
-(
+(
_In_ REFIID Interface,
- _COM_Outptr_ PVOID * Object
+ _COM_Outptr_ PVOID * Object
)
/*++
@@ -3543,7 +3543,7 @@ Routine Description:
Arguments:
- Interface -
+ Interface -
Object -
@@ -3580,7 +3580,7 @@ Return Value:
} // NonDelegatingQueryInterface
//=============================================================================
-// Dummy stubs to override the default WDF behavior of closing the target
+// Dummy stubs to override the default WDF behavior of closing the target
// on query remove. This driver closes and deletes the supporting objects
// when the target removes the BTH HFP SCO Bypass interface.
//
@@ -3588,13 +3588,13 @@ Return Value:
#pragma code_seg("PAGE")
NTSTATUS
BthHfpDevice::EvtBthHfpTargetQueryRemove
-(
+(
_In_ WDFIOTARGET IoTarget
)
{
PAGED_CODE();
DPF_ENTER(("[BthHfpDevice::EvtBthHfpTargetQueryRemove]"));
-
+
UNREFERENCED_PARAMETER(IoTarget);
return STATUS_SUCCESS;
}
@@ -3602,25 +3602,25 @@ BthHfpDevice::EvtBthHfpTargetQueryRemove
#pragma code_seg("PAGE")
VOID
BthHfpDevice::EvtBthHfpTargetRemoveCanceled
-(
+(
_In_ WDFIOTARGET IoTarget
)
{
PAGED_CODE();
DPF_ENTER(("[BthHfpDevice::EvtBthHfpTargetRemoveCanceled]"));
-
+
UNREFERENCED_PARAMETER(IoTarget);
}
#pragma code_seg("PAGE")
VOID
BthHfpDevice::EvtBthHfpTargetRemoveComplete
-(
+(
_In_ WDFIOTARGET IoTarget
)
{
PAGED_CODE();
DPF_ENTER(("[BthHfpDevice::EvtBthHfpTargetRemoveComplete]"));
-
+
UNREFERENCED_PARAMETER(IoTarget);
}
@@ -3629,7 +3629,7 @@ BthHfpDevice::EvtBthHfpTargetRemoveComplete
NTSTATUS
BthHfpDevice::Init
(
- _In_ CAdapterCommon * Adapter,
+ _In_ CAdapterCommon * Adapter,
_In_ PUNICODE_STRING SymbolicLinkName
)
{
@@ -3644,7 +3644,7 @@ BthHfpDevice::Init
WDF_WORKITEM_CONFIG wiConfig;
AddRef(); // first ref.
-
+
//
// Basic init of all the class' members.
//
@@ -3662,13 +3662,13 @@ BthHfpDevice::Init
m_Descriptor = NULL;
m_VolumePropValues = NULL;
- // Notification updates.
+ // Notification updates.
m_SpeakerVolumeLevel = 0;
m_MicVolumeLevel = 0;
m_ConnectionStatusLong = FALSE;
m_StreamStatusLong = STATUS_INVALID_DEVICE_STATE; // Sco stream is not open.
m_NRECDisableStatusLong = FALSE;
-
+
m_StreamReq = NULL;
m_SpeakerVolumeReq = NULL;
m_MicVolumeReq = NULL;
@@ -3677,21 +3677,21 @@ BthHfpDevice::Init
m_WorkItem = NULL;
m_ReqCollection = NULL;
-
+
m_nStreams = 0;
KeInitializeEvent(&m_StreamStatusEvent, NotificationEvent, TRUE);
InitializeListHead(&m_ListEntry);
KeInitializeSpinLock(&m_Lock);
-
+
RtlZeroMemory(&m_SymbolicLinkName, sizeof(m_SymbolicLinkName));
-
+
RtlZeroMemory(&m_SpeakerVolumeCallback, sizeof(m_SpeakerVolumeCallback));
RtlZeroMemory(&m_SpeakerConnectionStatusCallback, sizeof(m_SpeakerConnectionStatusCallback));
RtlZeroMemory(&m_MicVolumeCallback, sizeof(m_MicVolumeCallback));
RtlZeroMemory(&m_MicConnectionStatusCallback, sizeof(m_MicConnectionStatusCallback));
-
+
//
// Allocate a notification WDF work-item.
//
@@ -3719,12 +3719,12 @@ BthHfpDevice::Init
ntStatus = WdfCollectionCreate(
&attributes,
&m_ReqCollection);
-
+
IF_FAILED_ACTION_JUMP(
ntStatus,
DPF(D_ERROR, ("Init: WdfCollectionCreate failed: 0x%x", ntStatus)),
Done);
-
+
//
// Open the target interface.
//
@@ -3741,18 +3741,18 @@ BthHfpDevice::Init
WDF_IO_TARGET_OPEN_PARAMS_INIT_OPEN_BY_NAME(
&openParams,
SymbolicLinkName,
- STANDARD_RIGHTS_ALL);
-
+ STANDARD_RIGHTS_ALL);
+
openParams.EvtIoTargetQueryRemove = EvtBthHfpTargetQueryRemove;
openParams.EvtIoTargetRemoveCanceled = EvtBthHfpTargetRemoveCanceled;
openParams.EvtIoTargetRemoveComplete = EvtBthHfpTargetRemoveComplete;
-
+
ntStatus = WdfIoTargetOpen(m_WdfIoTarget, &openParams);
IF_FAILED_ACTION_JUMP(
ntStatus,
DPF(D_ERROR, ("Init: WdfIoTargetOpen(%wZ) failed: 0x%x", SymbolicLinkName, ntStatus)),
Done);
-
+
//
// Make a copy of the symbolic link name.
//
@@ -3765,20 +3765,20 @@ BthHfpDevice::Init
{
ntStatus = STATUS_INSUFFICIENT_RESOURCES;
}
-
+
IF_FAILED_ACTION_JUMP(
ntStatus,
DPF(D_ERROR, ("Init: ExAllocatePoolWithTag failed, out of memory")),
Done);
-
+
RtlCopyUnicodeString(&m_SymbolicLinkName, SymbolicLinkName);
//
// Allocate the WDF requests for status notifications.
//
-
+
//
- // IOCTL_BTHHFP_DEVICE_GET_NRECDISABLE_STATUS_UPDATE
+ // IOCTL_BTHHFP_DEVICE_GET_NRECDISABLE_STATUS_UPDATE
//
WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, BthHfpDeviceNotificationReqContext);
attributes.ParentObject = m_Adapter->GetWdfDevice();
@@ -3794,7 +3794,7 @@ BthHfpDevice::Init
// Init context.
reqCtx = GetBthHfpDeviceNotificationReqContext(m_NRECDisableStatusReq);
reqCtx->BthHfpDevice = this; // weak ref.
-
+
ntStatus = WdfMemoryCreatePreallocated(
WDF_NO_OBJECT_ATTRIBUTES,
&reqCtx->Buffer,
@@ -3804,7 +3804,7 @@ BthHfpDevice::Init
ntStatus,
DPF(D_ERROR, ("Init: WdfMemoryCreatePreallocated failed, 0x%x", ntStatus)),
Done);
-
+
ntStatus = WdfMemoryCreatePreallocated(
WDF_NO_OBJECT_ATTRIBUTES,
&reqCtx->Buffer,
@@ -3814,9 +3814,9 @@ BthHfpDevice::Init
ntStatus,
DPF(D_ERROR, ("Init: WdfMemoryCreatePreallocated failed, 0x%x", ntStatus)),
Done);
-
+
//
- // IOCTL_BTHHFP_SPEAKER_GET_VOLUME_STATUS_UPDATE
+ // IOCTL_BTHHFP_SPEAKER_GET_VOLUME_STATUS_UPDATE
//
WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, BthHfpDeviceNotificationReqContext);
attributes.ParentObject = m_Adapter->GetWdfDevice();
@@ -3832,7 +3832,7 @@ BthHfpDevice::Init
// Init context.
reqCtx = GetBthHfpDeviceNotificationReqContext(m_SpeakerVolumeReq);
reqCtx->BthHfpDevice = this; // weak ref.
-
+
ntStatus = WdfMemoryCreatePreallocated(
WDF_NO_OBJECT_ATTRIBUTES,
&reqCtx->Buffer,
@@ -3842,7 +3842,7 @@ BthHfpDevice::Init
ntStatus,
DPF(D_ERROR, ("Init: WdfMemoryCreatePreallocated failed, 0x%x", ntStatus)),
Done);
-
+
ntStatus = WdfMemoryCreatePreallocated(
WDF_NO_OBJECT_ATTRIBUTES,
&reqCtx->Buffer,
@@ -3852,7 +3852,7 @@ BthHfpDevice::Init
ntStatus,
DPF(D_ERROR, ("Init: WdfMemoryCreatePreallocated failed, 0x%x", ntStatus)),
Done);
-
+
//
// IOCTL_BTHHFP_MIC_GET_VOLUME_STATUS_UPDATE
//
@@ -3866,11 +3866,11 @@ BthHfpDevice::Init
ntStatus,
DPF(D_ERROR, ("Init: WdfRequestCreate(Mic-Volume) failed, 0x%x", ntStatus)),
Done);
-
+
// Init context.
reqCtx = GetBthHfpDeviceNotificationReqContext(m_MicVolumeReq);
reqCtx->BthHfpDevice = this; // weak ref.
-
+
ntStatus = WdfMemoryCreatePreallocated(
WDF_NO_OBJECT_ATTRIBUTES,
&reqCtx->Buffer,
@@ -3880,7 +3880,7 @@ BthHfpDevice::Init
ntStatus,
DPF(D_ERROR, ("Init: WdfMemoryCreatePreallocated failed, 0x%x", ntStatus)),
Done);
-
+
ntStatus = WdfMemoryCreatePreallocated(
WDF_NO_OBJECT_ATTRIBUTES,
&reqCtx->Buffer,
@@ -3890,7 +3890,7 @@ BthHfpDevice::Init
ntStatus,
DPF(D_ERROR, ("Init: WdfMemoryCreatePreallocated failed, 0x%x", ntStatus)),
Done);
-
+
//
// IOCTL_BTHHFP_DEVICE_GET_CONNECTION_STATUS_UPDATE
//
@@ -3904,11 +3904,11 @@ BthHfpDevice::Init
ntStatus,
DPF(D_ERROR, ("Init: WdfRequestCreate(Connection-Status) failed, 0x%x", ntStatus)),
Done);
-
+
// Init context.
reqCtx = GetBthHfpDeviceNotificationReqContext(m_ConnectionReq);
reqCtx->BthHfpDevice = this; // weak ref.
-
+
ntStatus = WdfMemoryCreatePreallocated(
WDF_NO_OBJECT_ATTRIBUTES,
&reqCtx->Buffer,
@@ -3918,7 +3918,7 @@ BthHfpDevice::Init
ntStatus,
DPF(D_ERROR, ("Init: WdfMemoryCreatePreallocated failed, 0x%x", ntStatus)),
Done);
-
+
ntStatus = WdfMemoryCreatePreallocated(
WDF_NO_OBJECT_ATTRIBUTES,
&reqCtx->Buffer,
@@ -3928,7 +3928,7 @@ BthHfpDevice::Init
ntStatus,
DPF(D_ERROR, ("Init: WdfMemoryCreatePreallocated failed, 0x%x", ntStatus)),
Done);
-
+
//
// IOCTL_BTHHFP_STREAM_GET_STATUS_UPDATE
//
@@ -3942,11 +3942,11 @@ BthHfpDevice::Init
ntStatus,
DPF(D_ERROR, ("Init: WdfRequestCreate(Stream-Status) failed, 0x%x", ntStatus)),
Done);
-
+
// Init context.
reqCtx = GetBthHfpDeviceNotificationReqContext(m_StreamReq);
reqCtx->BthHfpDevice = this; // weak ref.
-
+
ntStatus = WdfMemoryCreatePreallocated(
WDF_NO_OBJECT_ATTRIBUTES,
&reqCtx->Buffer,
@@ -3956,7 +3956,7 @@ BthHfpDevice::Init
ntStatus,
DPF(D_ERROR, ("Init: WdfMemoryCreatePreallocated failed, 0x%x", ntStatus)),
Done);
-
+
ntStatus = WdfMemoryCreatePreallocated(
WDF_NO_OBJECT_ATTRIBUTES,
&reqCtx->Buffer,
@@ -3965,14 +3965,14 @@ BthHfpDevice::Init
IF_FAILED_ACTION_JUMP(
ntStatus,
DPF(D_ERROR, ("Init: WdfMemoryCreatePreallocated failed, 0x%x", ntStatus)),
- Done);
-
+ Done);
+
//
// This remote device is now in running state. No need to use interlock operations
// b/c at this time this is the only thread accessing this info.
//
m_State = eBthHfpStateRunning;
-
+
//
// Init successful.
//
@@ -3985,8 +3985,8 @@ Done:
//=============================================================================
#pragma code_seg("PAGE")
BthHfpDevice::~BthHfpDevice
-(
- void
+(
+ void
)
/*++
@@ -4007,7 +4007,7 @@ Return Value:
ASSERT(m_State != eBthHfpStateRunning);
ASSERT(IsListEmpty(&m_ListEntry));
-
+
//
// Release ref to remote stack.
//
@@ -4058,7 +4058,7 @@ Return Value:
WdfObjectDelete(ctx->MemIn);
ctx->MemIn = NULL;
}
-
+
if (ctx->MemOut != NULL)
{
WdfObjectDelete(ctx->MemOut);
@@ -4069,7 +4069,7 @@ Return Value:
WdfObjectDelete(m_SpeakerVolumeReq);
m_SpeakerVolumeReq = NULL;
}
-
+
if (m_MicVolumeReq != NULL)
{
BthHfpDeviceNotificationReqContext * ctx;
@@ -4081,7 +4081,7 @@ Return Value:
WdfObjectDelete(ctx->MemIn);
ctx->MemIn = NULL;
}
-
+
if (ctx->MemOut != NULL)
{
WdfObjectDelete(ctx->MemOut);
@@ -4092,7 +4092,7 @@ Return Value:
WdfObjectDelete(m_MicVolumeReq);
m_MicVolumeReq = NULL;
}
-
+
if (m_ConnectionReq != NULL)
{
BthHfpDeviceNotificationReqContext * ctx;
@@ -4104,7 +4104,7 @@ Return Value:
WdfObjectDelete(ctx->MemIn);
ctx->MemIn = NULL;
}
-
+
if (ctx->MemOut != NULL)
{
WdfObjectDelete(ctx->MemOut);
@@ -4115,7 +4115,7 @@ Return Value:
WdfObjectDelete(m_ConnectionReq);
m_ConnectionReq = NULL;
}
-
+
if (m_StreamReq != NULL)
{
BthHfpDeviceNotificationReqContext * ctx;
@@ -4127,7 +4127,7 @@ Return Value:
WdfObjectDelete(ctx->MemIn);
ctx->MemIn = NULL;
}
-
+
if (ctx->MemOut != NULL)
{
WdfObjectDelete(ctx->MemOut);
@@ -4159,13 +4159,13 @@ Return Value:
ASSERT(m_UnknownSpeakerTopology == NULL);
SAFE_RELEASE(m_UnknownSpeakerTopology);
-
+
ASSERT(m_UnknownSpeakerWave == NULL);
SAFE_RELEASE(m_UnknownSpeakerWave);
-
+
ASSERT(m_UnknownMicTopology == NULL);
SAFE_RELEASE(m_UnknownMicTopology);
-
+
ASSERT(m_UnknownMicWave == NULL);
SAFE_RELEASE(m_UnknownMicWave);
@@ -4175,10 +4175,10 @@ Return Value:
ASSERT(m_SpeakerConnectionStatusCallback.Handler == NULL);
ASSERT(m_MicVolumeCallback.Handler == NULL);
ASSERT(m_MicConnectionStatusCallback.Handler == NULL);
-} // ~CAdapterCommon
+} // ~CAdapterCommon
//
-// IBthHfpDeviceCommon implementation.
+// IBthHfpDeviceCommon implementation.
//
//=============================================================================
@@ -4188,7 +4188,7 @@ BthHfpDevice::IsVolumeSupported()
{
PAGED_CODE();
DPF_ENTER(("[BthHfpDevice::IsVolumeSupported]"));
-
+
return m_Descriptor->SupportsVolume;
}
@@ -4197,16 +4197,16 @@ BthHfpDevice::IsVolumeSupported()
PKSPROPERTY_VALUES
BthHfpDevice::GetVolumeSettings
(
- _Out_ PULONG Size
+ _Out_ PULONG Size
)
{
PAGED_CODE();
DPF_ENTER(("[BthHfpDevice::GetVolumeSettings]"));
ASSERT(Size != NULL);
-
+
*Size = m_Descriptor->VolumePropertyValuesSize;
-
+
return m_VolumePropValues;
}
@@ -4217,7 +4217,7 @@ BthHfpDevice::GetSpeakerVolume()
{
PAGED_CODE();
DPF_ENTER(("[BthHfpDevice::GetSpeakerVolume]"));
-
+
return InterlockedCompareExchange(&m_SpeakerVolumeLevel, 0, 0);
}
@@ -4231,7 +4231,7 @@ BthHfpDevice::SetSpeakerVolume
{
PAGED_CODE();
DPF_ENTER(("[BthHfpDevice::SetSpeakerVolume]"));
-
+
return SetBthHfpSpeakerVolume(Volume);
}
@@ -4242,7 +4242,7 @@ BthHfpDevice::GetMicVolume()
{
PAGED_CODE();
DPF_ENTER(("[BthHfpDevice::GetMicVolume]"));
-
+
return InterlockedCompareExchange(&m_MicVolumeLevel, 0, 0);
}
@@ -4256,7 +4256,7 @@ BthHfpDevice::SetMicVolume
{
PAGED_CODE();
DPF_ENTER(("[BthHfpDevice::SetMicVolume]"));
-
+
return SetBthHfpMicVolume(Volume);
}
@@ -4267,7 +4267,7 @@ BthHfpDevice::GetConnectionStatus()
{
PAGED_CODE();
DPF_ENTER(("[BthHfpDevice::GetConnectionStatus]"));
-
+
return (BOOL)InterlockedCompareExchange(&m_ConnectionStatusLong, 0, 0);
}
@@ -4333,7 +4333,7 @@ BthHfpDevice::Connect()
{
PAGED_CODE();
DPF_ENTER(("[BthHfpDevice::Connect]"));
-
+
return SetBthHfpConnect();
}
@@ -4344,7 +4344,7 @@ BthHfpDevice::Disconnect()
{
PAGED_CODE();
DPF_ENTER(("[BthHfpDevice::Disconnect]"));
-
+
return SetBthHfpDisconnect();
}
@@ -4374,12 +4374,12 @@ BthHfpDevice::StreamOpen()
LONG nStreams = 0;
ASSERT(m_nStreams >= 0);
-
+
nStreams = InterlockedIncrement(&m_nStreams);
if (nStreams == 1)
{
BOOLEAN streamOpen = FALSE;
-
+
ntStatus = SetBthHfpStreamOpen();
if (NT_SUCCESS(ntStatus))
{
@@ -4416,19 +4416,19 @@ BthHfpDevice::StreamClose()
{
PAGED_CODE();
DPF_ENTER(("[BthHfpDevice::StreamClose]"));
-
+
NTSTATUS ntStatus = STATUS_SUCCESS;
LONG nStreams = 0;
ASSERT(m_nStreams > 0);
-
+
nStreams = InterlockedDecrement(&m_nStreams);
if (nStreams == 0)
{
ntStatus = SetBthHfpStreamClose();
-
+
StopBthHfpStreamStatusNotification();
-
+
m_StreamStatus = STATUS_INVALID_DEVICE_STATE;
}
@@ -4442,7 +4442,7 @@ BthHfpDevice::GetContainerId()
{
PAGED_CODE();
DPF_ENTER(("[BthHfpDevice::GetContainerId]"));
-
+
return m_Descriptor->ContainerId;
}
@@ -4459,7 +4459,7 @@ BthHfpDevice::SetSpeakerVolumeHandler
DPF_ENTER(("[BthHfpDevice::SetSpeakerVolumeHandler]"));
ASSERT(EventHandler == NULL || m_SpeakerVolumeCallback.Handler == NULL);
-
+
m_SpeakerVolumeCallback.Handler = EventHandler; // weak ref.
m_SpeakerVolumeCallback.Context = EventHandlerContext;
}
@@ -4475,9 +4475,9 @@ BthHfpDevice::SetSpeakerConnectionStatusHandler
{
PAGED_CODE();
DPF_ENTER(("[BthHfpDevice::SetSpeakerConnectionStatusHandler]"));
-
+
ASSERT(EventHandler == NULL || m_SpeakerConnectionStatusCallback.Handler == NULL);
-
+
m_SpeakerConnectionStatusCallback.Handler = EventHandler; // weak ref.
m_SpeakerConnectionStatusCallback.Context = EventHandlerContext;
}
@@ -4493,9 +4493,9 @@ BthHfpDevice::SetMicVolumeHandler
{
PAGED_CODE();
DPF_ENTER(("[BthHfpDevice::SetMicVolumeHandler]"));
-
+
ASSERT(EventHandler == NULL || m_MicVolumeCallback.Handler == NULL);
-
+
m_MicVolumeCallback.Handler = EventHandler; // weak ref.
m_MicVolumeCallback.Context = EventHandlerContext;
}
@@ -4511,9 +4511,9 @@ BthHfpDevice::SetMicConnectionStatusHandler
{
PAGED_CODE();
DPF_ENTER(("[BthHfpDevice::SetMicConnectionStatusHandler]"));
-
+
ASSERT(EventHandler == NULL || m_MicConnectionStatusCallback.Handler == NULL);
-
+
m_MicConnectionStatusCallback.Handler = EventHandler; // weak ref.
m_MicConnectionStatusCallback.Context = EventHandlerContext;
}
@@ -4525,7 +4525,7 @@ BthHfpDevice::IsNRECSupported()
{
PAGED_CODE();
DPF_ENTER(("[BthHfpDevice::IsNRECSupported]"));
-
+
return m_Descriptor->SupportsNREC;
}
@@ -4547,7 +4547,7 @@ BthHfpDevice::GetNRECDisableStatus()
//=============================================================================
#pragma code_seg()
-NTSTATUS
+NTSTATUS
BthHfpDevice::SendIoCtrlAsynchronously
(
_In_ WDFREQUEST Request,
@@ -4567,7 +4567,7 @@ Routine Description:
--*/
{
DPF_ENTER(("[BthHfpDevice::SendIoCtrlAsynchronously]"));
-
+
NTSTATUS ntStatus = STATUS_SUCCESS;
BOOLEAN fSent = FALSE;
@@ -4601,7 +4601,7 @@ Routine Description:
{
ntStatus = STATUS_INVALID_DEVICE_STATE;
}
-
+
DPF(D_ERROR, ("SendIoCtrlAsynchronously: WdfRequestSend(0x%x) failed, 0x%x", IoControlCode, ntStatus));
goto Done;
}
@@ -4618,7 +4618,7 @@ Done:
//=============================================================================
#pragma code_seg("PAGE")
-NTSTATUS
+NTSTATUS
BthHfpDevice::SendIoCtrlSynchronously
(
_In_opt_ WDFREQUEST Request,
@@ -4640,7 +4640,7 @@ Routine Description:
{
PAGED_CODE();
DPF_ENTER(("[BthHfpDevice::SendIoCtrlSynchronously]"));
-
+
NTSTATUS ntStatus = STATUS_SUCCESS;
PWDF_MEMORY_DESCRIPTOR memInPtr = NULL;
PWDF_MEMORY_DESCRIPTOR memOutPtr = NULL;
@@ -4662,14 +4662,14 @@ Routine Description:
WDF_MEMORY_DESCRIPTOR_INIT_BUFFER(&memOut, Buffer, OutLength);
memOutPtr = &memOut;
}
-
+
WDF_REQUEST_SEND_OPTIONS_INIT(
- &reqOpts,
- WDF_REQUEST_SEND_OPTION_TIMEOUT |
+ &reqOpts,
+ WDF_REQUEST_SEND_OPTION_TIMEOUT |
WDF_REQUEST_SEND_OPTION_SYNCHRONOUS);
reqOpts.Timeout = WDF_REL_TIMEOUT_IN_SEC(BTH_HFP_SYNC_REQ_TIMEOUT_IN_SEC);
-
+
ntStatus = WdfIoTargetSendIoctlSynchronously(
m_WdfIoTarget,
Request,
@@ -4678,7 +4678,7 @@ Routine Description:
memOutPtr,
&reqOpts,
NULL); // bytes returned.
-
+
IF_FAILED_ACTION_JUMP(
ntStatus,
DPF(D_VERBOSE, ("SendIoCtrlSynchronously: WdfIoTargetSendIoctlSynchronously(0x%x) failed, 0x%x", IoControlCode, ntStatus)),
@@ -4705,7 +4705,7 @@ Routine Description:
Arguments:
WorkItem - WDF work-item object.
-
+
--*/
{
DPF_ENTER(("[BthHfpDevice::EvtBthHfpDeviceNotificationStatusWorkItem]"));
@@ -4713,8 +4713,8 @@ Arguments:
NTSTATUS ntStatus = STATUS_SUCCESS;
BthHfpDevice * This;
KIRQL oldIrql;
-
- if (WorkItem == NULL)
+
+ if (WorkItem == NULL)
{
return;
}
@@ -4724,11 +4724,11 @@ Arguments:
for (;;)
{
- BOOL resend = TRUE;
+ BOOL resend = TRUE;
WDFREQUEST req = NULL;
BthHfpDeviceNotificationReqContext * reqCtx;
WDF_REQUEST_COMPLETION_PARAMS params;
-
+
//
// Retrieve a task.
//
@@ -4750,10 +4750,10 @@ Arguments:
//
WDF_REQUEST_COMPLETION_PARAMS_INIT(&params);
WdfRequestGetCompletionParams(req, &params);
-
+
reqCtx = GetBthHfpDeviceNotificationReqContext(req);
ASSERT(reqCtx != NULL);
-
+
//
// Handle this notification.
//
@@ -4766,7 +4766,7 @@ Arguments:
InterlockedExchange(&This->m_NRECDisableStatusLong, (LONG)reqCtx->Buffer.BoolStatus);
}
break;
-
+
case IOCTL_BTHHFP_SPEAKER_GET_VOLUME_STATUS_UPDATE:
{
LONG oldVolume;
@@ -4783,7 +4783,7 @@ Arguments:
}
}
break;
-
+
case IOCTL_BTHHFP_MIC_GET_VOLUME_STATUS_UPDATE:
{
LONG oldVolume;
@@ -4814,7 +4814,7 @@ Arguments:
This->m_SpeakerConnectionStatusCallback.Handler(
This->m_SpeakerConnectionStatusCallback.Context);
}
-
+
if (This->m_MicConnectionStatusCallback.Handler != NULL)
{
This->m_MicConnectionStatusCallback.Handler(
@@ -4827,7 +4827,7 @@ Arguments:
default:
// This should never happen.
resend = FALSE;
- DPF(D_ERROR, ("EvtBthHfpDeviceNotificationStatusWorkItem: invalid request ctrl 0x%x",
+ DPF(D_ERROR, ("EvtBthHfpDeviceNotificationStatusWorkItem: invalid request ctrl 0x%x",
params.Parameters.Ioctl.IoControlCode));
break;
}
@@ -4836,19 +4836,19 @@ Arguments:
if (resend)
{
WDF_REQUEST_REUSE_PARAMS reuseParams;
-
+
WDF_REQUEST_REUSE_PARAMS_INIT(
- &reuseParams,
+ &reuseParams,
WDF_REQUEST_REUSE_NO_FLAGS,
STATUS_SUCCESS);
-
+
ntStatus = WdfRequestReuse(req, &reuseParams);
if (!NT_SUCCESS(ntStatus))
{
DPF(D_ERROR, ("EvtBthHfpDeviceNotificationStatusWorkItem: WdfRequestReuse failed, 0x%x", ntStatus));
break;
}
-
+
// Resend status notification request.
reqCtx->Buffer.bImmediate = FALSE;
@@ -4859,11 +4859,11 @@ Arguments:
reqCtx->MemOut,
EvtBthHfpDeviceNotificationStatusCompletion,
This);
-
+
if (!NT_SUCCESS(ntStatus))
{
DPF(D_ERROR, ("EvtBthHfpDeviceNotificationStatusWorkItem: SendIoCtrlAsynchronously"
- "(0x%x) failed, 0x%x",
+ "(0x%x) failed, 0x%x",
params.Parameters.Ioctl.IoControlCode, ntStatus));
break;
}
@@ -4873,7 +4873,7 @@ Arguments:
//=============================================================================
#pragma code_seg()
-void
+void
BthHfpDevice::EvtBthHfpDeviceNotificationStatusCompletion
(
_In_ WDFREQUEST Request,
@@ -4883,15 +4883,15 @@ BthHfpDevice::EvtBthHfpDeviceNotificationStatusCompletion
)
{
DPF_ENTER(("[BthHfpDevice::EvtBthHfpDeviceNotificationStatusCompletion]"));
-
+
NTSTATUS ntStatus = STATUS_SUCCESS;
BthHfpDeviceNotificationReqContext * ctx = NULL;
BthHfpDevice * This = NULL;
KIRQL oldIrql;
-
+
UNREFERENCED_PARAMETER(Target);
UNREFERENCED_PARAMETER(Context);
-
+
ctx = GetBthHfpDeviceNotificationReqContext(Request);
This = ctx->BthHfpDevice;
ASSERT(This != NULL);
@@ -4920,7 +4920,7 @@ BthHfpDevice::EvtBthHfpDeviceNotificationStatusCompletion
ctx->Errors = 0;
}
- //
+ //
// Let the work-item thread process this request.
//
KeAcquireSpinLock(&This->m_Lock, &oldIrql);
@@ -4938,7 +4938,7 @@ Done:;
//=============================================================================
#pragma code_seg("PAGE")
-NTSTATUS
+NTSTATUS
BthHfpDevice::GetBthHfpDescriptor
(
_Out_ PBTHHFP_DESCRIPTOR2 * Descriptor
@@ -4954,15 +4954,15 @@ Routine Description:
{
PAGED_CODE();
DPF_ENTER(("[BthHfpDevice::GetBthHfpDescriptor]"));
-
+
NTSTATUS ntStatus = STATUS_SUCCESS;
WDFREQUEST req = NULL;
PBTHHFP_DESCRIPTOR2 descriptor = NULL;
ULONG length = 0;
ULONG_PTR information = 0;
- WDF_REQUEST_REUSE_PARAMS reuseParams;
+ WDF_REQUEST_REUSE_PARAMS reuseParams;
WDF_OBJECT_ATTRIBUTES attributes;
-
+
*Descriptor = NULL;
//
@@ -4988,30 +4988,30 @@ Routine Description:
NULL,
NULL,
NULL);
-
+
if (ntStatus != STATUS_BUFFER_TOO_SMALL)
{
if (NT_SUCCESS(ntStatus))
{
ntStatus = STATUS_INVALID_DEVICE_STATE;
}
-
+
DPF(D_ERROR, ("GetBthHfpDescriptor: SendIoCtrlSynchronously(IOCTL_BTHHFP_DEVICE_GET_DESCRIPTOR2): failed, 0x%x", ntStatus));
goto Done;
}
-
+
ntStatus = STATUS_SUCCESS;
information = WdfRequestGetInformation(req);
if (information == 0 || information > ULONG_MAX)
{
- ntStatus = STATUS_INVALID_DEVICE_STATE;
+ ntStatus = STATUS_INVALID_DEVICE_STATE;
DPF(D_ERROR, ("GetBthHfpDescriptor: IOCTL_BTHHFP_DEVICE_GET_DESCRIPTOR2 buffer too big (%Id): 0x%x", information, ntStatus));
goto Done;
}
length = (ULONG)information;
-
+
//
// Allocate memory needed to hold the info.
//
@@ -5029,16 +5029,16 @@ Routine Description:
// Get the Bth HFP SCO Bypass descriptor.
//
WDF_REQUEST_REUSE_PARAMS_INIT(
- &reuseParams,
+ &reuseParams,
WDF_REQUEST_REUSE_NO_FLAGS,
STATUS_SUCCESS);
-
+
ntStatus = WdfRequestReuse(req, &reuseParams);
IF_FAILED_ACTION_JUMP(
ntStatus,
DPF(D_ERROR, ("GetBthHfpDescriptor: WdfRequestReuse failed, 0x%x", ntStatus)),
Done);
-
+
ntStatus = SendIoCtrlSynchronously(
req,
IOCTL_BTHHFP_DEVICE_GET_DESCRIPTOR2,
@@ -5055,14 +5055,14 @@ Routine Description:
//
*Descriptor = descriptor;
ntStatus = STATUS_SUCCESS;
-
+
Done:
if (!NT_SUCCESS(ntStatus))
{
if (descriptor != NULL)
{
ExFreePoolWithTag(descriptor, MINADAPTER_POOLTAG);
- }
+ }
}
if (req != NULL)
@@ -5070,25 +5070,25 @@ Done:
WdfObjectDelete(req);
req = NULL;
}
-
+
return ntStatus;
}
//=============================================================================
#pragma code_seg()
-NTSTATUS
+NTSTATUS
BthHfpDevice::EnableBthHfpNrecDisableStatusNotification()
/*++
Routine Description:
- This function registers for Bluetooth Hands-Free Profile SCO Bypass NREC-Disable
- status change notification.
+ This function registers for Bluetooth Hands-Free Profile SCO Bypass NREC-Disable
+ status change notification.
--*/
{
DPF_ENTER(("[BthHfpDevice::EnableBthHfpNrecDisableStatusNotification]"));
-
+
NTSTATUS ntStatus = STATUS_SUCCESS;
BthHfpDeviceNotificationReqContext * ctx = NULL;
@@ -5097,8 +5097,8 @@ Routine Description:
//
// This is a notification request.
//
- ctx->Buffer.bImmediate = FALSE;
-
+ ctx->Buffer.bImmediate = FALSE;
+
//
// Get the Bth HFP SCO Bypass NREC-Disable status (async).
//
@@ -5109,7 +5109,7 @@ Routine Description:
ctx->MemOut,
EvtBthHfpDeviceNotificationStatusCompletion,
this);
-
+
IF_FAILED_ACTION_JUMP(
ntStatus,
DPF(D_ERROR, ("EnableBthHfpNrecDisableStatusNotification: SendIoCtrlAsynchronously(IOCTL_BTHHFP_DEVICE_GET_NRECDISABLE_STATUS_UPDATE) failed, 0x%x", ntStatus)),
@@ -5119,7 +5119,7 @@ Routine Description:
// All done.
//
ntStatus = STATUS_SUCCESS;
-
+
Done:
return ntStatus;
@@ -5127,7 +5127,7 @@ Done:
//=============================================================================
#pragma code_seg("PAGE")
-NTSTATUS
+NTSTATUS
BthHfpDevice::GetBthHfpVolumePropertyValues
(
_In_ ULONG Length,
@@ -5144,10 +5144,10 @@ Routine Description:
{
PAGED_CODE();
DPF_ENTER(("[BthHfpDevice::GetBthHfpVolumePropertyValues]"));
-
+
NTSTATUS ntStatus = STATUS_SUCCESS;
PKSPROPERTY_VALUES propValues = NULL;
-
+
*PropValues = NULL;
//
@@ -5168,11 +5168,11 @@ Routine Description:
//
ntStatus = SendIoCtrlSynchronously(
NULL,
- IOCTL_BTHHFP_DEVICE_GET_VOLUMEPROPERTYVALUES,
- 0,
- Length,
+ IOCTL_BTHHFP_DEVICE_GET_VOLUMEPROPERTYVALUES,
+ 0,
+ Length,
propValues);
-
+
IF_FAILED_ACTION_JUMP(
ntStatus,
DPF(D_ERROR, ("GetBthHfpVolumePropertyValues: SendIoCtrlSynchronously(IOCTL_BTHHFP_DEVICE_GET_VOLUMEPROPERTYVALUES) failed, 0x%x", ntStatus)),
@@ -5183,25 +5183,25 @@ Routine Description:
//
*PropValues = propValues;
ntStatus = STATUS_SUCCESS;
-
+
Done:
if (!NT_SUCCESS(ntStatus))
{
if (propValues != NULL)
{
ExFreePoolWithTag(propValues, MINADAPTER_POOLTAG);
- }
+ }
}
-
+
return ntStatus;
}
//=============================================================================
#pragma code_seg("PAGE")
-NTSTATUS
+NTSTATUS
BthHfpDevice::SetBthHfpSpeakerVolume
(
- _In_ LONG Volume
+ _In_ LONG Volume
)
/*++
@@ -5214,9 +5214,9 @@ Routine Description:
{
PAGED_CODE();
DPF_ENTER(("[BthHfpDevice::SetBthHfpSpeakerVolume]"));
-
+
NTSTATUS ntStatus = STATUS_SUCCESS;
-
+
//
// Get the Bth HFP SCO Bypass speaker volume.
//
@@ -5226,7 +5226,7 @@ Routine Description:
sizeof(Volume),
0,
&Volume);
-
+
IF_FAILED_ACTION_JUMP(
ntStatus,
DPF(D_ERROR, ("SetBthHfpSpeakerVolume: SendIoCtrlSynchronously(IOCTL_BTHHFP_SPEAKER_SET_VOLUME) failed, 0x%x", ntStatus)),
@@ -5236,7 +5236,7 @@ Routine Description:
// All done.
//
ntStatus = STATUS_SUCCESS;
-
+
Done:
return ntStatus;
@@ -5244,10 +5244,10 @@ Done:
//=============================================================================
#pragma code_seg("PAGE")
-NTSTATUS
+NTSTATUS
BthHfpDevice::GetBthHfpSpeakerVolume
(
- _Out_ LONG * Volume
+ _Out_ LONG * Volume
)
/*++
@@ -5260,14 +5260,14 @@ Routine Description:
{
PAGED_CODE();
DPF_ENTER(("[BthHfpDevice::GetBthHfpSpeakerVolume]"));
-
+
NTSTATUS ntStatus = STATUS_SUCCESS;
BthHfpDeviceNotificationBuffer buffer = {0};
*Volume = 0;
-
+
buffer.bImmediate = TRUE;
-
+
//
// Get the Bth HFP SCO Bypass speaker volume.
//
@@ -5277,7 +5277,7 @@ Routine Description:
sizeof(buffer.bImmediate),
sizeof(buffer.Volume),
&buffer);
-
+
IF_FAILED_ACTION_JUMP(
ntStatus,
DPF(D_ERROR, ("GetBthHfpSpeakerVolume: SendIoCtrlSynchronously(IOCTL_BTHHFP_SPEAKER_GET_VOLUME_STATUS_UPDATE) failed, 0x%x", ntStatus)),
@@ -5288,7 +5288,7 @@ Routine Description:
//
*Volume = buffer.Volume;
ntStatus = STATUS_SUCCESS;
-
+
Done:
return ntStatus;
@@ -5296,19 +5296,19 @@ Done:
//=============================================================================
#pragma code_seg()
-NTSTATUS
+NTSTATUS
BthHfpDevice::EnableBthHfpSpeakerVolumeStatusNotification()
/*++
Routine Description:
- This function registers for Bluetooth Hands-Free Profile SCO Bypass speaker
- volume change notification.
+ This function registers for Bluetooth Hands-Free Profile SCO Bypass speaker
+ volume change notification.
--*/
{
DPF_ENTER(("[BthHfpDevice::EnableBthHfpSpeakerVolumeStatusNotification]"));
-
+
NTSTATUS ntStatus = STATUS_SUCCESS;
BthHfpDeviceNotificationReqContext * ctx = NULL;
@@ -5317,8 +5317,8 @@ Routine Description:
//
// This is a notification request.
//
- ctx->Buffer.bImmediate = FALSE;
-
+ ctx->Buffer.bImmediate = FALSE;
+
//
// Register for speaker volume updates.
//
@@ -5329,7 +5329,7 @@ Routine Description:
ctx->MemOut,
EvtBthHfpDeviceNotificationStatusCompletion,
this);
-
+
IF_FAILED_ACTION_JUMP(
ntStatus,
DPF(D_ERROR, ("EnableBthHfpSpeakerVolumeStatusNotification: SendIoCtrlAsynchronously(IOCTL_BTHHFP_SPEAKER_GET_VOLUME_STATUS_UPDATE) failed, 0x%x", ntStatus)),
@@ -5339,7 +5339,7 @@ Routine Description:
// All done.
//
ntStatus = STATUS_SUCCESS;
-
+
Done:
return ntStatus;
@@ -5347,10 +5347,10 @@ Done:
//=============================================================================
#pragma code_seg("PAGE")
-NTSTATUS
+NTSTATUS
BthHfpDevice::SetBthHfpMicVolume
(
- _In_ LONG Volume
+ _In_ LONG Volume
)
/*++
@@ -5363,9 +5363,9 @@ Routine Description:
{
PAGED_CODE();
DPF_ENTER(("[BthHfpDevice::SetBthHfpMicVolume]"));
-
+
NTSTATUS ntStatus = STATUS_SUCCESS;
-
+
//
// Get the Bth HFP SCO Bypass mic volume.
//
@@ -5375,7 +5375,7 @@ Routine Description:
sizeof(Volume),
0,
&Volume);
-
+
IF_FAILED_ACTION_JUMP(
ntStatus,
DPF(D_ERROR, ("SetBthHfpMicVolume: SendIoCtrlSynchronously(IOCTL_BTHHFP_MIC_SET_VOLUME) failed, 0x%x", ntStatus)),
@@ -5385,7 +5385,7 @@ Routine Description:
// All done.
//
ntStatus = STATUS_SUCCESS;
-
+
Done:
return ntStatus;
@@ -5393,10 +5393,10 @@ Done:
//=============================================================================
#pragma code_seg("PAGE")
-NTSTATUS
+NTSTATUS
BthHfpDevice::GetBthHfpMicVolume
(
- _Out_ LONG * Volume
+ _Out_ LONG * Volume
)
/*++
@@ -5409,14 +5409,14 @@ Routine Description:
{
PAGED_CODE();
DPF_ENTER(("[BthHfpDevice::GetBthHfpMicVolume]"));
-
+
NTSTATUS ntStatus = STATUS_SUCCESS;
BthHfpDeviceNotificationBuffer buffer = {0};
-
+
*Volume = 0;
-
+
buffer.bImmediate = TRUE;
-
+
//
// Get the Bth HFP SCO Bypass mic volume.
//
@@ -5426,7 +5426,7 @@ Routine Description:
sizeof(buffer.bImmediate),
sizeof(buffer.Volume),
&buffer);
-
+
IF_FAILED_ACTION_JUMP(
ntStatus,
DPF(D_ERROR, ("GetBthHfpMicVolume: SendIoCtrlSynchronously(IOCTL_BTHHFP_MIC_GET_VOLUME_STATUS_UPDATE) failed, 0x%x", ntStatus)),
@@ -5437,7 +5437,7 @@ Routine Description:
//
*Volume = buffer.Volume;
ntStatus = STATUS_SUCCESS;
-
+
Done:
return ntStatus;
@@ -5445,29 +5445,29 @@ Done:
//=============================================================================
#pragma code_seg()
-NTSTATUS
+NTSTATUS
BthHfpDevice::EnableBthHfpMicVolumeStatusNotification()
/*++
Routine Description:
- This function registers for Bluetooth Hands-Free Profile SCO Bypass mic
- volume change notification.
+ This function registers for Bluetooth Hands-Free Profile SCO Bypass mic
+ volume change notification.
--*/
{
DPF_ENTER(("[BthHfpDevice::EnableBthHfpMicVolumeStatusNotification]"));
-
+
NTSTATUS ntStatus = STATUS_SUCCESS;
BthHfpDeviceNotificationReqContext * ctx = NULL;
ctx = GetBthHfpDeviceNotificationReqContext(m_MicVolumeReq);
-
+
//
// This is a notification request.
//
- ctx->Buffer.bImmediate = FALSE;
-
+ ctx->Buffer.bImmediate = FALSE;
+
//
// Register for mic volume updates.
//
@@ -5478,7 +5478,7 @@ Routine Description:
ctx->MemOut,
EvtBthHfpDeviceNotificationStatusCompletion,
this);
-
+
IF_FAILED_ACTION_JUMP(
ntStatus,
DPF(D_ERROR, ("EnableBthHfpMicVolumeStatusNotification: SendIoCtrlAsynchronously(IOCTL_BTHHFP_MIC_GET_VOLUME_STATUS_UPDATE) failed, 0x%x", ntStatus)),
@@ -5488,7 +5488,7 @@ Routine Description:
// All done.
//
ntStatus = STATUS_SUCCESS;
-
+
Done:
return ntStatus;
@@ -5496,10 +5496,10 @@ Done:
//=============================================================================
#pragma code_seg("PAGE")
-NTSTATUS
+NTSTATUS
BthHfpDevice::GetBthHfpConnectionStatus
(
- _Out_ BOOL * ConnectionStatus
+ _Out_ BOOL * ConnectionStatus
)
/*++
@@ -5512,12 +5512,12 @@ Routine Description:
{
PAGED_CODE();
DPF_ENTER(("[BthHfpDevice::GetBthHfpConnectionStatus]"));
-
+
NTSTATUS ntStatus = STATUS_SUCCESS;
BOOL bValue = TRUE; // In: bImmediate, Out: value.
-
+
*ConnectionStatus = 0;
-
+
//
// Get the Bth HFP SCO Bypass connection status.
//
@@ -5527,7 +5527,7 @@ Routine Description:
sizeof(bValue),
sizeof(bValue),
&bValue);
-
+
IF_FAILED_ACTION_JUMP(
ntStatus,
DPF(D_ERROR, ("GetBthHfpConnectionStatus: SendIoCtrlSynchronously(IOCTL_BTHHFP_DEVICE_GET_CONNECTION_STATUS_UPDATE) failed, 0x%x", ntStatus)),
@@ -5538,7 +5538,7 @@ Routine Description:
//
*ConnectionStatus = bValue;
ntStatus = STATUS_SUCCESS;
-
+
Done:
return ntStatus;
@@ -5546,29 +5546,29 @@ Done:
//=============================================================================
#pragma code_seg()
-NTSTATUS
+NTSTATUS
BthHfpDevice::EnableBthHfpConnectionStatusNotification()
/*++
Routine Description:
- This function registers for Bluetooth Hands-Free Profile SCO Bypass
- connection status notification.
+ This function registers for Bluetooth Hands-Free Profile SCO Bypass
+ connection status notification.
--*/
{
DPF_ENTER(("[BthHfpDevice::EnableBthHfpConnectionStatusNotification]"));
-
+
NTSTATUS ntStatus = STATUS_SUCCESS;
BthHfpDeviceNotificationReqContext * ctx = NULL;
ctx = GetBthHfpDeviceNotificationReqContext(m_ConnectionReq);
-
+
//
// Make sure this obj is alive while the IRP is active.
//
- ctx->Buffer.bImmediate = FALSE;
-
+ ctx->Buffer.bImmediate = FALSE;
+
//
// Get the Bth HFP SCO Bypass connection status.
//
@@ -5579,7 +5579,7 @@ Routine Description:
ctx->MemOut,
EvtBthHfpDeviceNotificationStatusCompletion,
this);
-
+
IF_FAILED_ACTION_JUMP(
ntStatus,
DPF(D_ERROR, ("EnableBthHfpConnectionStatusNotification: SendIoCtrlAsynchronously(IOCTL_BTHHFP_DEVICE_GET_CONNECTION_STATUS_UPDATE) failed, 0x%x", ntStatus)),
@@ -5589,7 +5589,7 @@ Routine Description:
// All done.
//
ntStatus = STATUS_SUCCESS;
-
+
Done:
return ntStatus;
@@ -5597,7 +5597,7 @@ Done:
//=============================================================================
#pragma code_seg("PAGE")
-NTSTATUS
+NTSTATUS
BthHfpDevice::SetBthHfpConnect()
/*++
@@ -5605,18 +5605,18 @@ Routine Description:
This function synchronously requests a Bluetooth Hands-Free Profile level
connection to the paired Bluetooth device.
-
- This request initiates the Service Level Connection establishment procedure
- and completes without waiting for the connection procedure to complete.
+
+ This request initiates the Service Level Connection establishment procedure
+ and completes without waiting for the connection procedure to complete.
Connection status can be determined using IOCTL_BTHHFP_GET_CONNECTION_STATUS_UPDATE.
--*/
{
PAGED_CODE();
DPF_ENTER(("[BthHfpDevice::SetBthHfpConnect]"));
-
+
NTSTATUS ntStatus = STATUS_SUCCESS;
-
+
ntStatus = SendIoCtrlSynchronously(
NULL,
IOCTL_BTHHFP_DEVICE_REQUEST_CONNECT,
@@ -5633,7 +5633,7 @@ Routine Description:
// All done.
//
ntStatus = STATUS_SUCCESS;
-
+
Done:
return ntStatus;
@@ -5641,7 +5641,7 @@ Done:
//=============================================================================
#pragma code_seg("PAGE")
-NTSTATUS
+NTSTATUS
BthHfpDevice::SetBthHfpDisconnect()
/*++
@@ -5650,17 +5650,17 @@ Routine Description:
This function synchronously requests a Bluetooth Hands-Free Profile level
connection to the paired Bluetooth device.
- This request initiates disconnection of the Service Level Connection and
- completes without waiting for the disconnection to complete. Connection
+ This request initiates disconnection of the Service Level Connection and
+ completes without waiting for the disconnection to complete. Connection
status can be determined using IOCTL_BTHHFP_GET_CONNECTION_STATUS_UPDATE.
--*/
{
PAGED_CODE();
DPF_ENTER(("[BthHfpDevice::SetBthHfpDisconnect]"));
-
+
NTSTATUS ntStatus = STATUS_SUCCESS;
-
+
ntStatus = SendIoCtrlSynchronously(
NULL,
IOCTL_BTHHFP_DEVICE_REQUEST_DISCONNECT,
@@ -5677,7 +5677,7 @@ Routine Description:
// All done.
//
ntStatus = STATUS_SUCCESS;
-
+
Done:
return ntStatus;
@@ -5685,7 +5685,7 @@ Done:
//=============================================================================
#pragma code_seg()
-void
+void
BthHfpDevice::EvtBthHfpDeviceStreamStatusCompletion
(
_In_ WDFREQUEST Request,
@@ -5697,18 +5697,18 @@ BthHfpDevice::EvtBthHfpDeviceStreamStatusCompletion
Routine Description:
- Completion callback for the Bluetooth Hands-Free Profile SCO Bypass
- stream status notification.
+ Completion callback for the Bluetooth Hands-Free Profile SCO Bypass
+ stream status notification.
--*/
{
DPF_ENTER(("[BthHfpDevice::EvtBthHfpDeviceStreamStatusCompletion]"));
-
+
NTSTATUS ntStatus = STATUS_SUCCESS;
BthHfpDeviceNotificationReqContext * reqCtx = NULL;
BthHfpDevice * This = NULL;
NTSTATUS ntResult = STATUS_SUCCESS;
-
+
UNREFERENCED_PARAMETER(Target);
UNREFERENCED_PARAMETER(Context);
@@ -5724,15 +5724,15 @@ Routine Description:
{
ntResult = STATUS_INVALID_DEVICE_STATE;
}
- else
+ else
{
ntResult = reqCtx->Buffer.NtStatus;
}
InterlockedExchange(&This->m_StreamStatusLong, (LONG)ntResult);
-
+
//
- // Let the stop routine know we are done. Stop routine will
+ // Let the stop routine know we are done. Stop routine will
// re-init the request.
//
KeSetEvent(&This->m_StreamStatusEvent, IO_NO_INCREMENT, FALSE);
@@ -5740,29 +5740,29 @@ Routine Description:
//=============================================================================
#pragma code_seg()
-NTSTATUS
+NTSTATUS
BthHfpDevice::EnableBthHfpStreamStatusNotification()
/*++
Routine Description:
- This function registers for Bluetooth Hands-Free Profile SCO Bypass
- stream status notification.
+ This function registers for Bluetooth Hands-Free Profile SCO Bypass
+ stream status notification.
--*/
{
DPF_ENTER(("[BthHfpDevice::EnableBthHfpStreamStatusNotification]"));
-
+
NTSTATUS ntStatus = STATUS_SUCCESS;
BthHfpDeviceNotificationReqContext * ctx = NULL;
ASSERT(m_nStreams > 0);
-
+
ctx = GetBthHfpDeviceNotificationReqContext(m_StreamReq);
- ctx->Buffer.bImmediate = FALSE;
+ ctx->Buffer.bImmediate = FALSE;
KeClearEvent(&m_StreamStatusEvent);
-
+
//
// Get the Bth HFP SCO Bypass connection status.
//
@@ -5773,7 +5773,7 @@ Routine Description:
ctx->MemOut,
EvtBthHfpDeviceStreamStatusCompletion,
this);
-
+
if (!NT_SUCCESS(ntStatus))
{
KeSetEvent(&m_StreamStatusEvent, IO_NO_INCREMENT, FALSE);
@@ -5785,7 +5785,7 @@ Routine Description:
// All done.
//
ntStatus = STATUS_SUCCESS;
-
+
Done:
return ntStatus;
@@ -5793,13 +5793,13 @@ Done:
//=============================================================================
#pragma code_seg("PAGE")
-NTSTATUS
+NTSTATUS
BthHfpDevice::StopBthHfpStreamStatusNotification()
/*++
Routine Description:
- This function stops the Bluetooth Hands-Free Profile SCO Bypass
+ This function stops the Bluetooth Hands-Free Profile SCO Bypass
connection status notification.
The function waits for the request to be done before returning.
@@ -5807,26 +5807,26 @@ Routine Description:
{
PAGED_CODE();
DPF_ENTER(("[BthHfpDevice::StopBthHfpStreamStatusNotification]"));
-
+
NTSTATUS ntStatus = STATUS_SUCCESS;
BthHfpDeviceNotificationReqContext * reqCtx = NULL;
- WDF_REQUEST_REUSE_PARAMS reuseParams;
-
+ WDF_REQUEST_REUSE_PARAMS reuseParams;
+
WdfRequestCancelSentRequest(m_StreamReq);
KeWaitForSingleObject(&m_StreamStatusEvent, Executive, KernelMode, FALSE, NULL);
reqCtx = GetBthHfpDeviceNotificationReqContext(m_StreamReq);
ASSERT(reqCtx != NULL);
UNREFERENCED_VAR(reqCtx);
-
- //
+
+ //
// Re-init the request for later.
//
WDF_REQUEST_REUSE_PARAMS_INIT(
- &reuseParams,
+ &reuseParams,
WDF_REQUEST_REUSE_NO_FLAGS,
STATUS_SUCCESS);
-
+
ntStatus = WdfRequestReuse(m_StreamReq, &reuseParams);
if (!NT_SUCCESS(ntStatus))
{
@@ -5838,7 +5838,7 @@ Routine Description:
//=============================================================================
#pragma code_seg("PAGE")
-NTSTATUS
+NTSTATUS
BthHfpDevice::SetBthHfpStreamOpen()
/*++
@@ -5851,9 +5851,9 @@ Routine Description:
{
PAGED_CODE();
DPF_ENTER(("[BthHfpDevice::SetBthHfpStreamOpen]"));
-
+
NTSTATUS ntStatus = STATUS_SUCCESS;
-
+
ntStatus = SendIoCtrlSynchronously(
NULL,
IOCTL_BTHHFP_STREAM_OPEN,
@@ -5867,7 +5867,7 @@ Routine Description:
DPF(D_VERBOSE, ("SetBthHfpStreamOpen: the stream channel is already open"));
ntStatus = STATUS_SUCCESS;
}
-
+
IF_FAILED_ACTION_JUMP(
ntStatus,
DPF(D_ERROR, ("SetBthHfpStreamOpen: SendIoCtrlSynchronously(IOCTL_BTHHFP_STREAM_OPEN) failed, 0x%x", ntStatus)),
@@ -5877,7 +5877,7 @@ Routine Description:
// All done.
//
ntStatus = STATUS_SUCCESS;
-
+
Done:
return ntStatus;
@@ -5885,7 +5885,7 @@ Done:
//=============================================================================
#pragma code_seg("PAGE")
-NTSTATUS
+NTSTATUS
BthHfpDevice::SetBthHfpStreamClose()
/*++
@@ -5897,9 +5897,9 @@ Routine Description:
{
PAGED_CODE();
DPF_ENTER(("[BthHfpDevice::SetBthHfpStreamClose]"));
-
+
NTSTATUS ntStatus = STATUS_SUCCESS;
-
+
ntStatus = SendIoCtrlSynchronously(
NULL,
IOCTL_BTHHFP_STREAM_CLOSE,
@@ -5916,7 +5916,7 @@ Routine Description:
// All done.
//
ntStatus = STATUS_SUCCESS;
-
+
Done:
return ntStatus;
@@ -5924,7 +5924,7 @@ Done:
//=============================================================================
#pragma code_seg("PAGE")
-VOID
+VOID
BthHfpDevice::Start()
/*++
@@ -5966,9 +5966,9 @@ Routine Description:
// Volume settings.
ntStatus = GetBthHfpVolumePropertyValues(
- m_Descriptor->VolumePropertyValuesSize,
+ m_Descriptor->VolumePropertyValuesSize,
&volumePropValues);
-
+
IF_FAILED_ACTION_JUMP(
ntStatus,
DPF(D_ERROR, ("Start: GetBthHfpVolumePropertyValues: failed to retrieve KSPROPERTY_VALUES, 0x%x", ntStatus)),
@@ -5991,9 +5991,9 @@ Routine Description:
ntStatus,
DPF(D_ERROR, ("Start: GetBthHfpMicVolume: failed, 0x%x", ntStatus)),
Done);
-
+
m_MicVolumeLevel = volume;
- }
+ }
//
// Get connection status.
@@ -6031,8 +6031,8 @@ Routine Description:
// Customize the topology/wave descriptors for this instance
//
ntStatus = CreateCustomEndpointMinipair(
- g_BthHfpRenderEndpoints[bthMiniportsIndex],
- &m_Descriptor->FriendlyName,
+ g_BthHfpRenderEndpoints[bthMiniportsIndex],
+ &m_Descriptor->FriendlyName,
&m_Descriptor->OutputPinCategory,
&m_SpeakerMiniports);
IF_FAILED_ACTION_JUMP(
@@ -6041,7 +6041,7 @@ Routine Description:
Done);
ntStatus = CreateCustomEndpointMinipair(
- g_BthHfpCaptureEndpoints[bthMiniportsIndex],
+ g_BthHfpCaptureEndpoints[bthMiniportsIndex],
&m_Descriptor->FriendlyName,
&m_Descriptor->InputPinCategory,
&m_MicMiniports);
@@ -6065,7 +6065,7 @@ Routine Description:
&m_UnknownSpeakerTopology,
&m_UnknownSpeakerWave, NULL, NULL
);
-
+
IF_FAILED_ACTION_JUMP(
ntStatus,
DPF(D_ERROR, ("Start: InstallEndpointRenderFilters (Bth HFP SCO-Bypass): failed, 0x%x", ntStatus)),
@@ -6078,7 +6078,7 @@ Routine Description:
&m_UnknownMicTopology,
&m_UnknownMicWave, NULL, NULL
);
-
+
IF_FAILED_ACTION_JUMP(
ntStatus,
DPF(D_ERROR, ("Start: InstallEndpointCaptureFilters (Bth HFP SCO-Bypass): failed, 0x%x", ntStatus)),
@@ -6087,28 +6087,28 @@ Routine Description:
//
// Pend status notifications.
//
-
+
// NREC disable AudioGateway (AG) status.
ntStatus = EnableBthHfpNrecDisableStatusNotification();
IF_FAILED_ACTION_JUMP(
ntStatus,
DPF(D_ERROR, ("Start: EnableBthHfpNrecDisableStatusNotification: failed, 0x%x", ntStatus)),
Done);
-
+
// Volume speaker status.
ntStatus = EnableBthHfpSpeakerVolumeStatusNotification();
IF_FAILED_ACTION_JUMP(
ntStatus,
DPF(D_ERROR, ("Start: EnableBthHfpSpeakerVolumeStatusNotification: failed, 0x%x", ntStatus)),
Done);
-
+
// Volume mic status.
ntStatus = EnableBthHfpMicVolumeStatusNotification();
IF_FAILED_ACTION_JUMP(
ntStatus,
DPF(D_ERROR, ("Start: EnableBthHfpMicVolumeStatusNotification: failed, 0x%x", ntStatus)),
Done);
-
+
// Connection status.
ntStatus = EnableBthHfpConnectionStatusNotification();
IF_FAILED_ACTION_JUMP(
@@ -6120,7 +6120,7 @@ Routine Description:
// All done.
//
ntStatus = STATUS_SUCCESS;
-
+
Done:;
if (!NT_SUCCESS(ntStatus))
{
@@ -6314,10 +6314,10 @@ BthHfpDevice::DeleteCustomEndpointMinipair
ExFreePoolWithTag(pCustomMinipair, SYSVAD_POOLTAG);
}
}
-
+
//=============================================================================
#pragma code_seg("PAGE")
-VOID
+VOID
BthHfpDevice::Stop()
/*++
@@ -6326,7 +6326,7 @@ Routine Description:
Asynchronously called to stop the audio device.
After returning from this function, there are no more async notifications
pending (volume, connection, etc.).
-
+
--*/
{
PAGED_CODE();
@@ -6338,7 +6338,7 @@ Routine Description:
state = (eBthHfpState) InterlockedExchange((PLONG)&m_State, eBthHfpStateStopping);
ASSERT(state == eBthHfpStateRunning || state == eBthHfpStateFailed);
UNREFERENCED_VAR(state);
-
+
//
// Stop async notifications.
//
@@ -6348,7 +6348,7 @@ Routine Description:
// Wait for work-item.
//
WdfWorkItemFlush(m_WorkItem);
-
+
//
// Remove the topology and wave render filters.
//
@@ -6358,7 +6358,7 @@ Routine Description:
m_SpeakerMiniports,
m_UnknownSpeakerTopology,
m_UnknownSpeakerWave);
-
+
if (!NT_SUCCESS(ntStatus))
{
DPF(D_ERROR, ("RemoveEndpointFilters (Bth HFP SCO-Bypass Speaker): failed, 0x%x", ntStatus));
@@ -6374,7 +6374,7 @@ Routine Description:
m_MicMiniports,
m_UnknownMicTopology,
m_UnknownMicWave);
-
+
if (!NT_SUCCESS(ntStatus))
{
DPF(D_ERROR, ("RemoveEndpointFilters (Bth HFP SCO-Bypass Capture): failed, 0x%x", ntStatus));
@@ -6404,4 +6404,139 @@ Routine Description:
#endif // SYSVAD_BTH_BYPASS
+//
+// The following are copied from:
+// \Program Files\Windows Kits\10\Include\10.0.15063.0\km\stdunk.h
+//
+
+#ifdef _NEW_DELETE_OPERATORS_
+
+// Note: Since VS2015 Update 2 overloaded operator new and operator delete may not
+// be declared inline (Level 1 (/W1) on-by-default, warning C4595).
+// See https://msdn.microsoft.com/en-us/library/mt656697.aspx
+//
+// To mitigate this issue, add "#define _NEW_DELETE_OPERATORS_" before "#include <stdunk.h>"
+// and implement non-inline operator new and operator delete locally.
+
+/*****************************************************************************
+ * ::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,'wNcP');
+//
+// 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,
+ ULONG tag
+)
+{
+ PVOID result = ExAllocatePoolWithTag(poolType,iSize,tag);
+
+ if (result)
+ {
+ RtlZeroMemory(result,iSize);
+ }
+
+ return result;
+}
+
+/*****************************************************************************
+ * ::delete()
+ *****************************************************************************
+ * Delete function.
+ */
+// void __cdecl operator delete
+// (
+// PVOID pVoid
+// )
+// {
+// if (pVoid)
+// {
+// ExFreePool(pVoid);
+// }
+// }
+
+/*****************************************************************************
+ * ::delete()
+ *****************************************************************************
+ * Delete function.
+ */
+// void __cdecl operator delete
+// (
+// PVOID pVoid,
+// ULONG tag
+// )
+// {
+// if (pVoid)
+// {
+// ExFreePoolWithTag(pVoid,tag);
+// }
+// }
+
+void __cdecl operator delete
+(
+ _Pre_maybenull_ __drv_freesMem(Mem) PVOID pVoid,
+ _In_ size_t cbSize
+)
+{
+ UNREFERENCED_PARAMETER(cbSize);
+
+ if (pVoid)
+ {
+ ExFreePool(pVoid);
+ }
+}
+
+void __cdecl operator delete[]
+(
+ _Pre_maybenull_ __drv_freesMem(Mem) PVOID pVoid
+)
+{
+ if (pVoid)
+ {
+ ExFreePool(pVoid);
+ }
+}
+
+// void __cdecl operator delete[]
+// (
+// _Pre_maybenull_ __drv_freesMem(Mem) PVOID pVoid,
+// _In_ size_t cbSize
+// )
+// {
+// UNREFERENCED_PARAMETER(cbSize);
+
+// if (pVoid)
+// {
+// ExFreePool(pVoid);
+// }
+// }
+#endif //!_NEW_DELETE_OPERATORS_