Sample Code
Windows Driver Samples/ Windows Biometric Driver Samples (UMDF Version 1)/ C++/ adapters/ engine_adapter/ EngineAdapter.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: EngineAdapter.cpp Abstract: This module contains a stub implementation of an Engine 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 "EngineAdapter.h" /////////////////////////////////////////////////////////////////////////////// // // Forward declarations for the Engine Adapter's interface routines... // /////////////////////////////////////////////////////////////////////////////// static HRESULT WINAPI EngineAdapterAttach( _Inout_ PWINBIO_PIPELINE Pipeline ); static HRESULT WINAPI EngineAdapterDetach( _Inout_ PWINBIO_PIPELINE Pipeline ); static HRESULT WINAPI EngineAdapterClearContext( _Inout_ PWINBIO_PIPELINE Pipeline ); static HRESULT WINAPI EngineAdapterEndOperation( _Inout_ PWINBIO_PIPELINE Pipeline ); static HRESULT WINAPI EngineAdapterQueryPreferredFormat( _Inout_ PWINBIO_PIPELINE Pipeline, _Out_ PWINBIO_REGISTERED_FORMAT StandardFormat, _Out_ PWINBIO_UUID VendorFormat ); static HRESULT WINAPI EngineAdapterQueryIndexVectorSize( _Inout_ PWINBIO_PIPELINE Pipeline, _Out_ PSIZE_T IndexElementCount ); static HRESULT WINAPI EngineAdapterQueryHashAlgorithms( _Inout_ PWINBIO_PIPELINE Pipeline, _Out_ PSIZE_T AlgorithmCount, _Out_ PSIZE_T AlgorithmBufferSize, _Out_ PUCHAR *AlgorithmBuffer ); static HRESULT WINAPI EngineAdapterSetHashAlgorithm( _Inout_ PWINBIO_PIPELINE Pipeline, _In_ SIZE_T AlgorithmBufferSize, _In_ PUCHAR AlgorithmBuffer ); static HRESULT WINAPI EngineAdapterAcceptSampleHint( _Inout_ PWINBIO_PIPELINE Pipeline, _Out_ PSIZE_T SampleHint ); static HRESULT WINAPI EngineAdapterAcceptSampleData( _Inout_ PWINBIO_PIPELINE Pipeline, _In_ PWINBIO_BIR SampleBuffer, _In_ SIZE_T SampleSize, _In_ WINBIO_BIR_PURPOSE Purpose, _Out_ PWINBIO_REJECT_DETAIL RejectDetail ); static HRESULT WINAPI EngineAdapterExportEngineData( _Inout_ PWINBIO_PIPELINE Pipeline, _In_ WINBIO_BIR_DATA_FLAGS Flags, _Out_ PWINBIO_BIR *SampleBuffer, _Out_ PSIZE_T SampleSize ); static HRESULT WINAPI EngineAdapterVerifyFeatureSet( _Inout_ PWINBIO_PIPELINE Pipeline, _In_ PWINBIO_IDENTITY Identity, _In_ WINBIO_BIOMETRIC_SUBTYPE SubFactor, _Out_ PBOOLEAN Match, _Out_ PUCHAR *PayloadBlob, _Out_ PSIZE_T PayloadBlobSize, _Out_ PUCHAR *HashValue, _Out_ PSIZE_T HashSize, _Out_ PWINBIO_REJECT_DETAIL RejectDetail ); static HRESULT WINAPI EngineAdapterIdentifyFeatureSet( _Inout_ PWINBIO_PIPELINE Pipeline, _Out_ PWINBIO_IDENTITY Identity, _Out_ PWINBIO_BIOMETRIC_SUBTYPE SubFactor, _Out_ PUCHAR *PayloadBlob, _Out_ PSIZE_T PayloadBlobSize, _Out_ PUCHAR *HashValue, _Out_ PSIZE_T HashSize, _Out_ PWINBIO_REJECT_DETAIL RejectDetail ); static HRESULT WINAPI EngineAdapterCreateEnrollment( _Inout_ PWINBIO_PIPELINE Pipeline ); static HRESULT WINAPI EngineAdapterUpdateEnrollment( _Inout_ PWINBIO_PIPELINE Pipeline, _Out_ PWINBIO_REJECT_DETAIL RejectDetail ); static HRESULT WINAPI EngineAdapterGetEnrollmentStatus( _Inout_ PWINBIO_PIPELINE Pipeline, _Out_ PWINBIO_REJECT_DETAIL RejectDetail ); static HRESULT WINAPI EngineAdapterGetEnrollmentHash( _Inout_ PWINBIO_PIPELINE Pipeline, _Out_ PUCHAR *HashValue, _Out_ PSIZE_T HashSize ); static HRESULT WINAPI EngineAdapterCheckForDuplicate( _Inout_ PWINBIO_PIPELINE Pipeline, _Out_ PWINBIO_IDENTITY Identity, _Out_ PWINBIO_BIOMETRIC_SUBTYPE SubFactor, _Out_ PBOOLEAN Duplicate ); static HRESULT WINAPI EngineAdapterCommitEnrollment( _Inout_ PWINBIO_PIPELINE Pipeline, _In_ PWINBIO_IDENTITY Identity, _In_ WINBIO_BIOMETRIC_SUBTYPE SubFactor, _In_ PUCHAR PayloadBlob, _In_ SIZE_T PayloadBlobSize ); static HRESULT WINAPI EngineAdapterDiscardEnrollment( _Inout_ PWINBIO_PIPELINE Pipeline ); static HRESULT WINAPI EngineAdapterControlUnit( _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 EngineAdapterControlUnitPrivileged( _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_ENGINE_INTERFACE g_EngineInterface = { WINBIO_ENGINE_INTERFACE_VERSION_1, WINBIO_ADAPTER_TYPE_ENGINE, sizeof(WINBIO_ENGINE_INTERFACE), {0xb876fdc8, 0x34e7, 0x471a, {0x82, 0xc8, 0x9c, 0xba, 0x6a, 0x35, 0x38, 0xec}}, EngineAdapterAttach, EngineAdapterDetach, EngineAdapterClearContext, EngineAdapterQueryPreferredFormat, EngineAdapterQueryIndexVectorSize, EngineAdapterQueryHashAlgorithms, EngineAdapterSetHashAlgorithm, EngineAdapterAcceptSampleHint, EngineAdapterAcceptSampleData, EngineAdapterExportEngineData, EngineAdapterVerifyFeatureSet, EngineAdapterIdentifyFeatureSet, EngineAdapterCreateEnrollment, EngineAdapterUpdateEnrollment, EngineAdapterGetEnrollmentStatus, EngineAdapterGetEnrollmentHash, EngineAdapterCheckForDuplicate, EngineAdapterCommitEnrollment, EngineAdapterDiscardEnrollment, EngineAdapterControlUnit, EngineAdapterControlUnitPrivileged }; //----------------------------------------------------------------------------- /////////////////////////////////////////////////////////////////////////////// // // 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 Engine Adapter // /////////////////////////////////////////////////////////////////////////////// HRESULT WINAPI WbioQueryEngineInterface( _Out_ PWINBIO_ENGINE_INTERFACE *EngineInterface ) { *EngineInterface = &g_EngineInterface; return S_OK; } //----------------------------------------------------------------------------- /////////////////////////////////////////////////////////////////////////////// // // Engine Adapter action routines // /////////////////////////////////////////////////////////////////////////////// static HRESULT WINAPI EngineAdapterAttach( _Inout_ PWINBIO_PIPELINE Pipeline ) { UNREFERENCED_PARAMETER(Pipeline); return E_NOTIMPL; } //----------------------------------------------------------------------------- static HRESULT WINAPI EngineAdapterDetach( _Inout_ PWINBIO_PIPELINE Pipeline ) { UNREFERENCED_PARAMETER(Pipeline); return E_NOTIMPL; } //----------------------------------------------------------------------------- static HRESULT WINAPI EngineAdapterClearContext( _Inout_ PWINBIO_PIPELINE Pipeline ) { UNREFERENCED_PARAMETER(Pipeline); return E_NOTIMPL; } //----------------------------------------------------------------------------- static HRESULT WINAPI EngineAdapterQueryPreferredFormat( _Inout_ PWINBIO_PIPELINE Pipeline, _Out_ PWINBIO_REGISTERED_FORMAT StandardFormat, _Out_ PWINBIO_UUID VendorFormat ) { UNREFERENCED_PARAMETER(Pipeline); UNREFERENCED_PARAMETER(StandardFormat); UNREFERENCED_PARAMETER(VendorFormat); return E_NOTIMPL; } //----------------------------------------------------------------------------- static HRESULT WINAPI EngineAdapterQueryIndexVectorSize( _Inout_ PWINBIO_PIPELINE Pipeline, _Out_ PSIZE_T IndexElementCount ) { UNREFERENCED_PARAMETER(Pipeline); UNREFERENCED_PARAMETER(IndexElementCount); return E_NOTIMPL; } //----------------------------------------------------------------------------- static HRESULT WINAPI EngineAdapterQueryHashAlgorithms( _Inout_ PWINBIO_PIPELINE Pipeline, _Out_ PSIZE_T AlgorithmCount, _Out_ PSIZE_T AlgorithmBufferSize, _Out_ PUCHAR *AlgorithmBuffer ) { UNREFERENCED_PARAMETER(Pipeline); UNREFERENCED_PARAMETER(AlgorithmCount); UNREFERENCED_PARAMETER(AlgorithmBufferSize); UNREFERENCED_PARAMETER(AlgorithmBuffer); return E_NOTIMPL; } //----------------------------------------------------------------------------- static HRESULT WINAPI EngineAdapterSetHashAlgorithm( _Inout_ PWINBIO_PIPELINE Pipeline, _In_ SIZE_T AlgorithmBufferSize, _In_ PUCHAR AlgorithmBuffer ) { UNREFERENCED_PARAMETER(Pipeline); UNREFERENCED_PARAMETER(AlgorithmBufferSize); UNREFERENCED_PARAMETER(AlgorithmBuffer); return E_NOTIMPL; } //----------------------------------------------------------------------------- static HRESULT WINAPI EngineAdapterAcceptSampleHint( _Inout_ PWINBIO_PIPELINE Pipeline, _Out_ PSIZE_T SampleHint ) { UNREFERENCED_PARAMETER(Pipeline); UNREFERENCED_PARAMETER(SampleHint); return E_NOTIMPL; } //----------------------------------------------------------------------------- static HRESULT WINAPI EngineAdapterAcceptSampleData( _Inout_ PWINBIO_PIPELINE Pipeline, _In_ PWINBIO_BIR SampleBuffer, _In_ SIZE_T SampleSize, _In_ WINBIO_BIR_PURPOSE Purpose, _Out_ PWINBIO_REJECT_DETAIL RejectDetail ) { UNREFERENCED_PARAMETER(Pipeline); UNREFERENCED_PARAMETER(SampleBuffer); UNREFERENCED_PARAMETER(SampleSize); UNREFERENCED_PARAMETER(Purpose); UNREFERENCED_PARAMETER(RejectDetail); return E_NOTIMPL; } //----------------------------------------------------------------------------- static HRESULT WINAPI EngineAdapterExportEngineData( _Inout_ PWINBIO_PIPELINE Pipeline, _In_ WINBIO_BIR_DATA_FLAGS Flags, _Out_ PWINBIO_BIR *SampleBuffer, _Out_ PSIZE_T SampleSize ) { UNREFERENCED_PARAMETER(Pipeline); UNREFERENCED_PARAMETER(Flags); UNREFERENCED_PARAMETER(SampleBuffer); UNREFERENCED_PARAMETER(SampleSize); return E_NOTIMPL; } //----------------------------------------------------------------------------- static HRESULT WINAPI EngineAdapterVerifyFeatureSet( _Inout_ PWINBIO_PIPELINE Pipeline, _In_ PWINBIO_IDENTITY Identity, _In_ WINBIO_BIOMETRIC_SUBTYPE SubFactor, _Out_ PBOOLEAN Match, _Out_ PUCHAR *PayloadBlob, _Out_ PSIZE_T PayloadBlobSize, _Out_ PUCHAR *HashValue, _Out_ PSIZE_T HashSize, _Out_ PWINBIO_REJECT_DETAIL RejectDetail ) { UNREFERENCED_PARAMETER(Pipeline); UNREFERENCED_PARAMETER(Identity); UNREFERENCED_PARAMETER(SubFactor); UNREFERENCED_PARAMETER(Match); UNREFERENCED_PARAMETER(PayloadBlob); UNREFERENCED_PARAMETER(PayloadBlobSize); UNREFERENCED_PARAMETER(HashValue); UNREFERENCED_PARAMETER(HashSize); UNREFERENCED_PARAMETER(RejectDetail); return E_NOTIMPL; } //----------------------------------------------------------------------------- static HRESULT WINAPI EngineAdapterIdentifyFeatureSet( _Inout_ PWINBIO_PIPELINE Pipeline, _Out_ PWINBIO_IDENTITY Identity, _Out_ PWINBIO_BIOMETRIC_SUBTYPE SubFactor, _Out_ PUCHAR *PayloadBlob, _Out_ PSIZE_T PayloadBlobSize, _Out_ PUCHAR *HashValue, _Out_ PSIZE_T HashSize, _Out_ PWINBIO_REJECT_DETAIL RejectDetail ) { UNREFERENCED_PARAMETER(Pipeline); UNREFERENCED_PARAMETER(Identity); UNREFERENCED_PARAMETER(SubFactor); UNREFERENCED_PARAMETER(PayloadBlob); UNREFERENCED_PARAMETER(PayloadBlobSize); UNREFERENCED_PARAMETER(HashValue); UNREFERENCED_PARAMETER(HashSize); UNREFERENCED_PARAMETER(RejectDetail); return E_NOTIMPL; } //----------------------------------------------------------------------------- static HRESULT WINAPI EngineAdapterCreateEnrollment( _Inout_ PWINBIO_PIPELINE Pipeline ) { UNREFERENCED_PARAMETER(Pipeline); return E_NOTIMPL; } //----------------------------------------------------------------------------- static HRESULT WINAPI EngineAdapterUpdateEnrollment( _Inout_ PWINBIO_PIPELINE Pipeline, _Out_ PWINBIO_REJECT_DETAIL RejectDetail ) { UNREFERENCED_PARAMETER(Pipeline); UNREFERENCED_PARAMETER(RejectDetail); return E_NOTIMPL; } //----------------------------------------------------------------------------- static HRESULT WINAPI EngineAdapterGetEnrollmentStatus( _Inout_ PWINBIO_PIPELINE Pipeline, _Out_ PWINBIO_REJECT_DETAIL RejectDetail ) { UNREFERENCED_PARAMETER(Pipeline); UNREFERENCED_PARAMETER(RejectDetail); return E_NOTIMPL; } //----------------------------------------------------------------------------- static HRESULT WINAPI EngineAdapterGetEnrollmentHash( _Inout_ PWINBIO_PIPELINE Pipeline, _Out_ PUCHAR *HashValue, _Out_ PSIZE_T HashSize ) { UNREFERENCED_PARAMETER(Pipeline); UNREFERENCED_PARAMETER(HashValue); UNREFERENCED_PARAMETER(HashSize); return E_NOTIMPL; } //----------------------------------------------------------------------------- static HRESULT WINAPI EngineAdapterCheckForDuplicate( _Inout_ PWINBIO_PIPELINE Pipeline, _Out_ PWINBIO_IDENTITY Identity, _Out_ PWINBIO_BIOMETRIC_SUBTYPE SubFactor, _Out_ PBOOLEAN Duplicate ) { UNREFERENCED_PARAMETER(Pipeline); UNREFERENCED_PARAMETER(Identity); UNREFERENCED_PARAMETER(SubFactor); UNREFERENCED_PARAMETER(Duplicate); return E_NOTIMPL; } //----------------------------------------------------------------------------- static HRESULT WINAPI EngineAdapterCommitEnrollment( _Inout_ PWINBIO_PIPELINE Pipeline, _In_ PWINBIO_IDENTITY Identity, _In_ WINBIO_BIOMETRIC_SUBTYPE SubFactor, _In_ PUCHAR PayloadBlob, _In_ SIZE_T PayloadBlobSize ) { UNREFERENCED_PARAMETER(Pipeline); UNREFERENCED_PARAMETER(Identity); UNREFERENCED_PARAMETER(SubFactor); UNREFERENCED_PARAMETER(PayloadBlob); UNREFERENCED_PARAMETER(PayloadBlobSize); return E_NOTIMPL; } //----------------------------------------------------------------------------- static HRESULT WINAPI EngineAdapterDiscardEnrollment( _Inout_ PWINBIO_PIPELINE Pipeline ) { UNREFERENCED_PARAMETER(Pipeline); return E_NOTIMPL; } //----------------------------------------------------------------------------- static HRESULT WINAPI EngineAdapterControlUnit( _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 EngineAdapterControlUnitPrivileged( _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