Sample Code
Windows Driver Samples/ Windows Biometric Driver Samples (UMDF Version 1)/ C++/ adapters/ sensor_adapter/ SensorAdapter.cpp/
/*++ THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. Copyright (c) Microsoft Corporation. All rights reserved Module Name: SensorAdapter.cpp Abstract: This module contains a stub implementation of a Sensor Adapter plug-in for the Windows Biometric service. Author: - Environment: Win32, user mode only. Revision History: NOTES: (None) --*/ /////////////////////////////////////////////////////////////////////////////// // // Header files... // /////////////////////////////////////////////////////////////////////////////// #include "precomp.h" #include "winbio_adapter.h" #include "SensorAdapter.h" /////////////////////////////////////////////////////////////////////////////// // // Forward declarations for the Engine Adapter's interface routines... // /////////////////////////////////////////////////////////////////////////////// static HRESULT WINAPI SensorAdapterAttach( _Inout_ PWINBIO_PIPELINE Pipeline ); static HRESULT WINAPI SensorAdapterDetach( _Inout_ PWINBIO_PIPELINE Pipeline ); static HRESULT WINAPI SensorAdapterClearContext( _Inout_ PWINBIO_PIPELINE Pipeline ); static HRESULT WINAPI SensorAdapterQueryStatus( _Inout_ PWINBIO_PIPELINE Pipeline, _Out_ PWINBIO_SENSOR_STATUS Status ); static HRESULT WINAPI SensorAdapterReset( _Inout_ PWINBIO_PIPELINE Pipeline ); static HRESULT WINAPI SensorAdapterSetMode( _Inout_ PWINBIO_PIPELINE Pipeline, _In_ WINBIO_SENSOR_MODE Mode ); static HRESULT WINAPI SensorAdapterSetIndicatorStatus( _Inout_ PWINBIO_PIPELINE Pipeline, _In_ WINBIO_INDICATOR_STATUS IndicatorStatus ); static HRESULT WINAPI SensorAdapterGetIndicatorStatus( _Inout_ PWINBIO_PIPELINE Pipeline, _Out_ PWINBIO_INDICATOR_STATUS IndicatorStatus ); static HRESULT WINAPI SensorAdapterStartCapture( _Inout_ PWINBIO_PIPELINE Pipeline, _In_ WINBIO_BIR_PURPOSE Purpose, _Out_ LPOVERLAPPED *Overlapped ); static HRESULT WINAPI SensorAdapterFinishCapture( _Inout_ PWINBIO_PIPELINE Pipeline, _Out_ PWINBIO_REJECT_DETAIL RejectDetail ); static HRESULT WINAPI SensorAdapterClearCaptureBuffer( _Inout_ PWINBIO_PIPELINE Pipeline ); static HRESULT WINAPI SensorAdapterExportSensorData( _Inout_ PWINBIO_PIPELINE Pipeline, _Out_ PWINBIO_BIR *SampleBuffer, _Out_ PSIZE_T SampleSize ); static HRESULT WINAPI SensorAdapterCancel( _Inout_ PWINBIO_PIPELINE Pipeline ); static HRESULT WINAPI SensorAdapterPushDataToEngine( _Inout_ PWINBIO_PIPELINE Pipeline, _In_ WINBIO_BIR_PURPOSE Purpose, _In_ WINBIO_BIR_DATA_FLAGS Flags, _Out_ PWINBIO_REJECT_DETAIL RejectDetail ); static HRESULT WINAPI SensorAdapterControlUnit( _Inout_ PWINBIO_PIPELINE Pipeline, _In_ ULONG ControlCode, _In_ PUCHAR SendBuffer, _In_ SIZE_T SendBufferSize, _In_ PUCHAR ReceiveBuffer, _In_ SIZE_T ReceiveBufferSize, _Out_ PSIZE_T ReceiveDataSize, _Out_ PULONG OperationStatus ); static HRESULT WINAPI SensorAdapterControlUnitPrivileged( _Inout_ PWINBIO_PIPELINE Pipeline, _In_ ULONG ControlCode, _In_ PUCHAR SendBuffer, _In_ SIZE_T SendBufferSize, _In_ PUCHAR ReceiveBuffer, _In_ SIZE_T ReceiveBufferSize, _Out_ PSIZE_T ReceiveDataSize, _Out_ PULONG OperationStatus ); //----------------------------------------------------------------------------- /////////////////////////////////////////////////////////////////////////////// // // Interface dispatch table // /////////////////////////////////////////////////////////////////////////////// static WINBIO_SENSOR_INTERFACE g_SensorInterface = { WINBIO_STORAGE_INTERFACE_VERSION_1, WINBIO_ADAPTER_TYPE_SENSOR, sizeof(WINBIO_SENSOR_INTERFACE), {0xa545298c, 0xec34, 0x4306, {0x84, 0x12, 0x83, 0x12, 0x5d, 0xca, 0xfa, 0xe1}}, SensorAdapterAttach, SensorAdapterDetach, SensorAdapterClearContext, SensorAdapterQueryStatus, SensorAdapterReset, SensorAdapterSetMode, SensorAdapterSetIndicatorStatus, SensorAdapterGetIndicatorStatus, SensorAdapterStartCapture, SensorAdapterFinishCapture, SensorAdapterExportSensorData, SensorAdapterCancel, SensorAdapterPushDataToEngine, SensorAdapterControlUnit, SensorAdapterControlUnitPrivileged }; //----------------------------------------------------------------------------- /////////////////////////////////////////////////////////////////////////////// // // Mandatory DLL entrypoint function. // /////////////////////////////////////////////////////////////////////////////// BOOL APIENTRY DllMain( HANDLE ModuleHandle, DWORD ReasonForCall, LPVOID Reserved ) { UNREFERENCED_PARAMETER(ModuleHandle); UNREFERENCED_PARAMETER(ReasonForCall); UNREFERENCED_PARAMETER(Reserved); return TRUE; } //----------------------------------------------------------------------------- /////////////////////////////////////////////////////////////////////////////// // // Well-known interface-discovery function exported by the Sensor Adapter // /////////////////////////////////////////////////////////////////////////////// HRESULT WINAPI WbioQuerySensorInterface( _Out_ PWINBIO_SENSOR_INTERFACE *SensorInterface ) { *SensorInterface = &g_SensorInterface; return S_OK; } //----------------------------------------------------------------------------- /////////////////////////////////////////////////////////////////////////////// // // Storage Adapter action routines // /////////////////////////////////////////////////////////////////////////////// static HRESULT WINAPI SensorAdapterAttach( _Inout_ PWINBIO_PIPELINE Pipeline ) { UNREFERENCED_PARAMETER(Pipeline); return E_NOTIMPL; } /////////////////////////////////////////////////////////////////////////////// static HRESULT WINAPI SensorAdapterDetach( _Inout_ PWINBIO_PIPELINE Pipeline ) { UNREFERENCED_PARAMETER(Pipeline); return E_NOTIMPL; } /////////////////////////////////////////////////////////////////////////////// static HRESULT WINAPI SensorAdapterClearContext( _Inout_ PWINBIO_PIPELINE Pipeline ) { UNREFERENCED_PARAMETER(Pipeline); return E_NOTIMPL; } /////////////////////////////////////////////////////////////////////////////// static HRESULT WINAPI SensorAdapterQueryStatus( _Inout_ PWINBIO_PIPELINE Pipeline, _Out_ PWINBIO_SENSOR_STATUS Status ) { UNREFERENCED_PARAMETER(Pipeline); UNREFERENCED_PARAMETER(Status); return E_NOTIMPL; } /////////////////////////////////////////////////////////////////////////////// static HRESULT WINAPI SensorAdapterReset( _Inout_ PWINBIO_PIPELINE Pipeline ) { UNREFERENCED_PARAMETER(Pipeline); return E_NOTIMPL; } /////////////////////////////////////////////////////////////////////////////// static HRESULT WINAPI SensorAdapterSetMode( _Inout_ PWINBIO_PIPELINE Pipeline, _In_ WINBIO_SENSOR_MODE Mode ) { UNREFERENCED_PARAMETER(Pipeline); UNREFERENCED_PARAMETER(Mode); return E_NOTIMPL; } /////////////////////////////////////////////////////////////////////////////// static HRESULT WINAPI SensorAdapterSetIndicatorStatus( _Inout_ PWINBIO_PIPELINE Pipeline, _In_ WINBIO_INDICATOR_STATUS IndicatorStatus ) { UNREFERENCED_PARAMETER(Pipeline); UNREFERENCED_PARAMETER(IndicatorStatus); return E_NOTIMPL; } /////////////////////////////////////////////////////////////////////////////// static HRESULT WINAPI SensorAdapterGetIndicatorStatus( _Inout_ PWINBIO_PIPELINE Pipeline, _Out_ PWINBIO_INDICATOR_STATUS IndicatorStatus ) { UNREFERENCED_PARAMETER(Pipeline); UNREFERENCED_PARAMETER(IndicatorStatus); return E_NOTIMPL; } /////////////////////////////////////////////////////////////////////////////// static HRESULT WINAPI SensorAdapterStartCapture( _Inout_ PWINBIO_PIPELINE Pipeline, _In_ WINBIO_BIR_PURPOSE Purpose, _Out_ LPOVERLAPPED *Overlapped ) { UNREFERENCED_PARAMETER(Pipeline); UNREFERENCED_PARAMETER(Purpose); UNREFERENCED_PARAMETER(Overlapped); return E_NOTIMPL; } /////////////////////////////////////////////////////////////////////////////// static HRESULT WINAPI SensorAdapterFinishCapture( _Inout_ PWINBIO_PIPELINE Pipeline, _Out_ PWINBIO_REJECT_DETAIL RejectDetail ) { UNREFERENCED_PARAMETER(Pipeline); UNREFERENCED_PARAMETER(RejectDetail); return E_NOTIMPL; } /////////////////////////////////////////////////////////////////////////////// // // Export raw capture buffer // static HRESULT WINAPI SensorAdapterExportSensorData( _Inout_ PWINBIO_PIPELINE Pipeline, _Out_ PWINBIO_BIR *SampleBuffer, _Out_ PSIZE_T SampleSize ) { UNREFERENCED_PARAMETER(Pipeline); UNREFERENCED_PARAMETER(SampleBuffer); UNREFERENCED_PARAMETER(SampleSize); return E_NOTIMPL; } /////////////////////////////////////////////////////////////////////////////// static HRESULT WINAPI SensorAdapterCancel( _Inout_ PWINBIO_PIPELINE Pipeline ) { UNREFERENCED_PARAMETER(Pipeline); return E_NOTIMPL; } /////////////////////////////////////////////////////////////////////////////// // // Push current sample into the Engine and // convert it into a feature set for use in // additional processing. // static HRESULT WINAPI SensorAdapterPushDataToEngine( _Inout_ PWINBIO_PIPELINE Pipeline, _In_ WINBIO_BIR_PURPOSE Purpose, _In_ WINBIO_BIR_DATA_FLAGS Flags, _Out_ PWINBIO_REJECT_DETAIL RejectDetail ) { UNREFERENCED_PARAMETER(Pipeline); UNREFERENCED_PARAMETER(Purpose); UNREFERENCED_PARAMETER(Flags); UNREFERENCED_PARAMETER(RejectDetail); return E_NOTIMPL; } /////////////////////////////////////////////////////////////////////////////// static HRESULT WINAPI SensorAdapterControlUnit( _Inout_ PWINBIO_PIPELINE Pipeline, _In_ ULONG ControlCode, _In_ PUCHAR SendBuffer, _In_ SIZE_T SendBufferSize, _In_ PUCHAR ReceiveBuffer, _In_ SIZE_T ReceiveBufferSize, _Out_ PSIZE_T ReceiveDataSize, _Out_ PULONG OperationStatus ) { UNREFERENCED_PARAMETER(Pipeline); UNREFERENCED_PARAMETER(ControlCode); UNREFERENCED_PARAMETER(SendBuffer); UNREFERENCED_PARAMETER(SendBufferSize); UNREFERENCED_PARAMETER(ReceiveBuffer); UNREFERENCED_PARAMETER(ReceiveBufferSize); UNREFERENCED_PARAMETER(ReceiveDataSize); UNREFERENCED_PARAMETER(OperationStatus); return E_NOTIMPL; } /////////////////////////////////////////////////////////////////////////////// static HRESULT WINAPI SensorAdapterControlUnitPrivileged( _Inout_ PWINBIO_PIPELINE Pipeline, _In_ ULONG ControlCode, _In_ PUCHAR SendBuffer, _In_ SIZE_T SendBufferSize, _In_ PUCHAR ReceiveBuffer, _In_ SIZE_T ReceiveBufferSize, _Out_ PSIZE_T ReceiveDataSize, _Out_ PULONG OperationStatus ) { UNREFERENCED_PARAMETER(Pipeline); UNREFERENCED_PARAMETER(ControlCode); UNREFERENCED_PARAMETER(SendBuffer); UNREFERENCED_PARAMETER(SendBufferSize); UNREFERENCED_PARAMETER(ReceiveBuffer); UNREFERENCED_PARAMETER(ReceiveBufferSize); UNREFERENCED_PARAMETER(ReceiveDataSize); UNREFERENCED_PARAMETER(OperationStatus); return E_NOTIMPL; } ///////////////////////////////////////////////////////////////////////////////
Our Services
-
What our customers say about us?
Read our customer testimonials to find out why our clients keep returning for their projects.
View Testimonials