summaryrefslogtreecommitdiff
path: root/biometrics/driver
diff options
context:
space:
mode:
authorDavid Spruill <[email protected]>2026-01-08 17:51:47 -0500
committerGitHub <[email protected]>2026-01-08 17:51:47 -0500
commitc5fc3ca1fd0e00a7e085ef48abfeff9c0c39817e (patch)
tree0e650a0fee8027816bbea82ca1fd9b8e3e6ee24a /biometrics/driver
parentf88e4fbbd4d2671e5cd77e4f60be7a235326797e (diff)
parented3dbe56378117a15105099870f2397671ad99ab (diff)
Merge branch 'develop' into user/daspr/kmodsamplefix
Diffstat (limited to 'biometrics/driver')
-rw-r--r--biometrics/driver/BioUsbSample.ctl1
-rw-r--r--biometrics/driver/BioUsbSample.rc26
-rw-r--r--biometrics/driver/Device.cpp1834
-rw-r--r--biometrics/driver/Device.h360
-rw-r--r--biometrics/driver/Driver.cpp77
-rw-r--r--biometrics/driver/Driver.h95
-rw-r--r--biometrics/driver/Internalsrc.cpp1
-rw-r--r--biometrics/driver/IoQueue.cpp297
-rw-r--r--biometrics/driver/IoQueue.h123
-rw-r--r--biometrics/driver/RequestHelper.h89
-rw-r--r--biometrics/driver/WudfBioUsbSample.inxbin9820 -> 0 bytes
-rw-r--r--biometrics/driver/WudfBioUsbSample.vcxproj327
-rw-r--r--biometrics/driver/WudfBioUsbSample.vcxproj.Filters73
-rw-r--r--biometrics/driver/dllsup.cpp87
-rw-r--r--biometrics/driver/exports.def10
-rw-r--r--biometrics/driver/inc/public.h42
-rw-r--r--biometrics/driver/inc/usb_hw.h238
-rw-r--r--biometrics/driver/internal.h164
-rw-r--r--biometrics/driver/resource.h4
19 files changed, 0 insertions, 3848 deletions
diff --git a/biometrics/driver/BioUsbSample.ctl b/biometrics/driver/BioUsbSample.ctl
deleted file mode 100644
index bcec77c1..00000000
--- a/biometrics/driver/BioUsbSample.ctl
+++ /dev/null
@@ -1 +0,0 @@
-864936A6-DB79-451e-B764-E720D61A9361 WudfBioUsbSampleTraceGuid \ No newline at end of file
diff --git a/biometrics/driver/BioUsbSample.rc b/biometrics/driver/BioUsbSample.rc
deleted file mode 100644
index 36f83c5a..00000000
--- a/biometrics/driver/BioUsbSample.rc
+++ /dev/null
@@ -1,26 +0,0 @@
-// 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
-//
-// BioUsbSample.rc
-//
-
-
-#include <windows.h>
-#include <ntverp.h>
-#include "resource.h"
-
-//
-// TODO: Change the file description and file names to match your binary.
-//
-
-#define VER_FILETYPE VFT_DLL
-#define VER_FILESUBTYPE VFT_UNKNOWN
-#define VER_FILEDESCRIPTION_STR "WUDF: Biometric Sample"
-#define VER_INTERNALNAME_STR "WudfBioUsbSample"
-#define VER_ORIGINALFILENAME_STR "WudfBioUsbSample.dll"
-
-#include "common.ver"
diff --git a/biometrics/driver/Device.cpp b/biometrics/driver/Device.cpp
deleted file mode 100644
index 8f8dd6b4..00000000
--- a/biometrics/driver/Device.cpp
+++ /dev/null
@@ -1,1834 +0,0 @@
-/*++
-
- 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:
-
- Device.cpp
-
-Abstract:
-
- This module contains the implementation of the Biometric
- device driver.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-#include "internal.h"
-#include "device.tmh"
-
-#pragma warning(disable : 4189)
-
-DWORD WINAPI
-CaptureSleepThread(
- LPVOID lpParam
- )
-{
- CBiometricDevice *device = (CBiometricDevice *) lpParam;
- PCAPTURE_SLEEP_PARAMS sleepParams = device->GetCaptureSleepParams();
-
- //
- // Make sure it is less than or equal to 1 minute.
- //
- if (sleepParams->SleepValue > 60)
- {
- sleepParams->SleepValue = 60;
- }
-
- Sleep(sleepParams->SleepValue * 1000);
-
- device->CompletePendingRequest(sleepParams->Hr, sleepParams->Information);
-
- return 0;
-}
-
-
-HRESULT
-CBiometricDevice::CreateInstanceAndInitialize(
- _In_ IWDFDriver *FxDriver,
- _In_ IWDFDeviceInitialize * FxDeviceInit,
- _Out_ CBiometricDevice **Device
- )
-/*++
-
- Routine Description:
-
- This method creates and initializs an instance of the skeleton driver's
- device callback object.
-
- Arguments:
-
- FxDeviceInit - the settings for the device.
-
- Device - a location to store the referenced pointer to the device object.
-
- Return Value:
-
- Status
-
---*/
-{
- //
- // Create a new instance of the device class
- //
- CComObject<CBiometricDevice> *pMyDevice = NULL;
- HRESULT hr = CComObject<CBiometricDevice>::CreateInstance( &pMyDevice );
-
- if (SUCCEEDED(hr))
- {
-
- //
- // Initialize the instance. This calls the WUDF framework,
- // which keeps a reference to the device interface for the lifespan
- // of the device.
- //
- if (NULL != pMyDevice)
- {
- hr = pMyDevice->Initialize(FxDriver, FxDeviceInit);
-
- if (FAILED(hr))
- {
- BiometricSafeRelease(pMyDevice);
- }
-
- }
-
- *Device = pMyDevice;
-
- }
-
- return hr;
-}
-
-HRESULT
-CBiometricDevice::Initialize(
- _In_ IWDFDriver * FxDriver,
- _In_ IWDFDeviceInitialize * FxDeviceInit
- )
-/*++
-
- Routine Description:
-
- This method initializes the device callback object and creates the
- partner device object.
-
- The method should perform any device-specific configuration that:
- * could fail (these can't be done in the constructor)
- * must be done before the partner object is created -or-
- * can be done after the partner object is created and which aren't
- influenced by any device-level parameters the parent (the driver
- in this case) might set.
-
- Arguments:
-
- FxDeviceInit - the settings for this device.
-
- Return Value:
-
- status.
-
---*/
-{
- IWDFDevice *fxDevice = NULL;
- HRESULT hr = S_OK;
- IUnknown *unknown = NULL;
-
- //
- // Configure things like the locking model before we go to create our
- // partner device.
- //
-
- //
- // Set the locking model.
- //
-
- FxDeviceInit->SetLockingConstraint(WdfDeviceLevel);
-
- //
- // Any per-device initialization which must be done before
- // creating the partner object.
- //
-
- //
- // Create a new FX device object and assign the new callback object to
- // handle any device level events that occur.
- //
-
- //
- // We pass an IUnknown reference to CreateDevice, which takes its own
- // reference if everything works.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = this->QueryInterface(__uuidof(IUnknown), (void **)&unknown);
-
- }
-
- if (SUCCEEDED(hr))
- {
-
- hr = FxDriver->CreateDevice(FxDeviceInit, unknown, &fxDevice);
- BiometricSafeRelease(unknown);
- }
-
- //
- // If that succeeded then set our FxDevice member variable.
- //
-
- if (SUCCEEDED(hr))
- {
- m_FxDevice = fxDevice;
-
- //
- // Drop the reference we got from CreateDevice. Since this object
- // is partnered with the framework object they have the same
- // lifespan - there is no need for an additional reference.
- //
-
- BiometricSafeRelease(fxDevice);
- }
-
- return hr;
-}
-
-HRESULT
-CBiometricDevice::Configure(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method is called after the device callback object has been initialized
- and returned to the driver. It would setup the device's queues and their
- corresponding callback objects.
-
- Arguments:
-
- FxDevice - the framework device object for which we're handling events.
-
- Return Value:
-
- status
-
---*/
-{
-
- HRESULT hr = S_OK;
-
- //
- // Create the I/O queue
- //
-
- if (SUCCEEDED(hr))
- {
- hr = CBiometricIoQueue::CreateInstanceAndInitialize(m_FxDevice, this, &m_IoQueue);
-
- if (SUCCEEDED(hr))
- {
- hr = m_IoQueue->Configure();
- }
- }
-
- //
- // Create Device Interface
- //
-
- if (SUCCEEDED(hr))
- {
- hr = m_FxDevice->CreateDeviceInterface(&GUID_DEVINTERFACE_BIOMETRIC_READER,
- NULL);
- }
-
- if (SUCCEEDED(hr))
- {
- hr = m_FxDevice->AssignDeviceInterfaceState(&GUID_DEVINTERFACE_BIOMETRIC_READER,
- NULL,
- TRUE);
- }
-
- //
- // TODO - this is where additional interfaces can be exposed.
- //
-
- return hr;
-}
-
-HRESULT
-CBiometricDevice::OnPrepareHardware(
- _In_ IWDFDevice * /* FxDevice */
- )
-/*++
-
-Routine Description:
-
- This routine is invoked to ready the driver
- to talk to hardware. It opens the handle to the
- device and talks to it using the WINUSB interface.
- It invokes WINUSB to discver the interfaces and stores
- the information related to bulk endpoints.
-
-Arguments:
-
- FxDevice : Pointer to the WDF device interface
-
-Return Value:
-
- HRESULT
-
---*/
-{
- PWSTR deviceName = NULL;
- DWORD deviceNameCch = 0;
-
- HRESULT hr;
-
- //
- // Get the device name.
- // Get the length to allocate first
- //
-
- hr = m_FxDevice->RetrieveDeviceName(NULL, &deviceNameCch);
-
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- BIOMETRIC_TRACE_DEVICE,
- "%!FUNC! Cannot get device name %!hresult!",
- hr
- );
- }
-
- //
- // Allocate the buffer
- //
-
- if (SUCCEEDED(hr))
- {
- deviceName = (PWSTR) malloc(deviceNameCch * sizeof (WCHAR));
-
- if (deviceName == NULL)
- {
- hr = E_OUTOFMEMORY;
- }
- }
-
- //
- // Get the actual name
- //
-
- if (SUCCEEDED(hr))
- {
- hr = m_FxDevice->RetrieveDeviceName(deviceName, &deviceNameCch);
-
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- BIOMETRIC_TRACE_DEVICE,
- "%!FUNC! Cannot get device name %!hresult!",
- hr
- );
- }
- }
-
- if (SUCCEEDED(hr))
- {
- TraceEvents(TRACE_LEVEL_INFORMATION,
- BIOMETRIC_TRACE_DEVICE,
- "%!FUNC! Device name %S",
- deviceName
- );
- }
-
- //
- // Create USB I/O Targets and configure them
- //
-
- if (SUCCEEDED(hr))
- {
- hr = CreateUsbIoTargets();
- }
-
- if (SUCCEEDED(hr))
- {
- ULONG length = sizeof(m_Speed);
-
- hr = m_pIUsbTargetDevice->RetrieveDeviceInformation(DEVICE_SPEED,
- &length,
- &m_Speed);
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- BIOMETRIC_TRACE_DEVICE,
- "%!FUNC! Cannot get usb device speed information %!HRESULT!",
- hr
- );
- }
- }
-
- if (SUCCEEDED(hr))
- {
- TraceEvents(TRACE_LEVEL_INFORMATION,
- BIOMETRIC_TRACE_DEVICE,
- "%!FUNC! Speed - %x\n",
- m_Speed
- );
- }
-
- //
- // Setup power-management settings on the device.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = SetPowerManagement();
- }
-
- //
- // We have non-power managed queues so we Stop them in OnReleaseHardware
- // and start them in OnPrepareHardware
- //
-
- if (SUCCEEDED(hr))
- {
- m_IoQueue->Start();
- }
-
- if (SUCCEEDED(hr))
- {
- //
- // If the device stack allows read to remain pending across power-down
- // and up, it can be initiated during OnPrepareHardware
- //
- // If the device stack doesn't allow the read to remain pending (i.e. it
- // cancels the pending read during power transition) driver will have to
- // stop sending pending read during D0Exit and re-initiate it during
- // D0Entry
- //
- // USB core actually doesn't allow read to remain pending across power
- // transition but WinUSB does. Since we are layered above WinUSB we don't
- // need to manage pending read across power transitions.
- //
-
- hr = InitiatePendingRead();
- }
-
- if (deviceName)
- {
- free(deviceName);
- deviceName = NULL;
- }
-
- return hr;
-}
-
-HRESULT
-CBiometricDevice::OnReleaseHardware(
- _In_ IWDFDevice * /* FxDevice */
- )
-/*++
-
-Routine Description:
-
- This routine is invoked when the device is being removed or stopped
- It releases all resources allocated for this device.
-
-Arguments:
-
- FxDevice - Pointer to the Device object.
-
-Return Value:
-
- HRESULT - Always succeeds.
-
---*/
-{
- //
- // Cancel the pending data collection I/O, if one exists.
- //
- CompletePendingRequest(HRESULT_FROM_WIN32(ERROR_CANCELLED), 0);
-
- //
- // Since we have non-power managed queues, we need to Stop them
- // explicitly
- //
- // We need to stop them before deleting I/O targets otherwise we
- // will continue to get I/O and our I/O processing will try to access
- // freed I/O targets
- //
- // We initialize queues in CMyDevice::Initialize so we can't get
- // here with queues being NULL and don't need to guard against that
- //
-
- m_IoQueue->StopSynchronously();
-
- //
- // Delete USB Target Device WDF Object, this will in turn
- // delete all the children - interface and the pipe objects
- //
- // This makes sure that
- // 1. We drain the I/O before releasing the targets
- // a. We always need to do that for the pending read which does
- // not come from an I/O queue
- // b. We need to do this even for I/O coming from I/O queues because
- // we set them to non-power managed queues (to leverage wait/wake
- // from WinUsb.sys)
- // 2. We remove USB target objects from object tree (and thereby free them)
- // before any potential subsequent OnPrepareHardware creates new ones
- //
- // m_pIUsbTargetDevice could be NULL if OnPrepareHardware failed so we need
- // to guard against that
- //
-
- if (m_pIUsbTargetDevice)
- {
- m_pIUsbTargetDevice->DeleteWdfObject();
- }
-
- //
- // This sample has a thread that will sleep for 5 seconds before
- // completing a capture request.
- //
- if (m_SleepThread != INVALID_HANDLE_VALUE)
- {
- WaitForSingleObject(m_SleepThread, INFINITE);
- CloseHandle(m_SleepThread);
- m_SleepThread = INVALID_HANDLE_VALUE;
- }
-
- return S_OK;
-}
-
-HRESULT
-CBiometricDevice::CreateUsbIoTargets(
- )
-/*++
-
-Routine Description:
-
- This routine creates Usb device, interface and pipe objects
-
-Arguments:
-
- None
-
-Return Value:
-
- HRESULT
---*/
-{
- HRESULT hr;
- UCHAR NumEndPoints = 0;
- IWDFUsbTargetFactory * pIUsbTargetFactory = NULL;
- IWDFUsbTargetDevice * pIUsbTargetDevice = NULL;
- IWDFUsbInterface * pIUsbInterface = NULL;
- IWDFUsbTargetPipe * pIUsbPipe = NULL;
-
- hr = m_FxDevice->QueryInterface(IID_PPV_ARGS(&pIUsbTargetFactory));
-
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- BIOMETRIC_TRACE_DEVICE,
- "%!FUNC! Cannot get usb target factory %!HRESULT!",
- hr
- );
- }
-
- if (SUCCEEDED(hr))
- {
- hr = pIUsbTargetFactory->CreateUsbTargetDevice(
- &pIUsbTargetDevice);
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- BIOMETRIC_TRACE_DEVICE,
- "%!FUNC! Unable to create USB Device I/O Target %!HRESULT!",
- hr
- );
- }
- else
- {
- m_pIUsbTargetDevice = pIUsbTargetDevice;
-
- //
- // Release the creation reference as object tree will maintain a reference
- //
-
- BiometricSafeRelease(pIUsbTargetDevice);
- }
- }
-
- if (SUCCEEDED(hr))
- {
- UCHAR NumInterfaces = pIUsbTargetDevice->GetNumInterfaces();
- TraceEvents(TRACE_LEVEL_INFORMATION,
- BIOMETRIC_TRACE_DEVICE,
- "%!FUNC! Found %u interfaces",
- NumInterfaces
- );
-
- hr = pIUsbTargetDevice->RetrieveUsbInterface(0, &pIUsbInterface);
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- BIOMETRIC_TRACE_DEVICE,
- "%!FUNC! Unable to retrieve USB interface from USB Device I/O Target %!HRESULT!",
- hr
- );
- }
- else
- {
- m_pIUsbInterface = pIUsbInterface;
-
- BiometricSafeRelease(pIUsbInterface); // release creation reference
- }
- }
-
- if (SUCCEEDED(hr))
- {
- NumEndPoints = pIUsbInterface->GetNumEndPoints();
-
- if (NumEndPoints != NUM_WBDI_ENDPOINTS)
- {
- hr = E_UNEXPECTED;
- TraceEvents(TRACE_LEVEL_ERROR,
- BIOMETRIC_TRACE_DEVICE,
- "%!FUNC! Has %d endpoints, expected %d, returning %!HRESULT! ",
- NumEndPoints,
- NUM_WBDI_ENDPOINTS,
- hr
- );
- }
- }
-
- if (SUCCEEDED(hr))
- {
- for (UCHAR PipeIndex = 0; PipeIndex < NumEndPoints; PipeIndex++)
- {
- hr = pIUsbInterface->RetrieveUsbPipeObject(PipeIndex,
- &pIUsbPipe);
-
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- BIOMETRIC_TRACE_DEVICE,
- "%!FUNC! Unable to retrieve USB Pipe for PipeIndex %d, %!HRESULT!",
- PipeIndex,
- hr
- );
- }
- else
- {
- if ( pIUsbPipe->IsInEndPoint() )
- {
- if ( UsbdPipeTypeInterrupt == pIUsbPipe->GetType() )
- {
- m_pIUsbInterruptPipe = pIUsbPipe;
- }
- else if ( UsbdPipeTypeBulk == pIUsbPipe->GetType() )
- {
- m_pIUsbInputPipe = pIUsbPipe;
- }
- else
- {
- pIUsbPipe->DeleteWdfObject();
- }
- }
- else if ( pIUsbPipe->IsOutEndPoint() && (UsbdPipeTypeBulk == pIUsbPipe->GetType()) )
- {
- m_pIUsbOutputPipe = pIUsbPipe;
- }
- else
- {
- pIUsbPipe->DeleteWdfObject();
- }
-
- BiometricSafeRelease(pIUsbPipe); //release creation reference
- }
- }
-
- if (NULL == m_pIUsbInputPipe || NULL == m_pIUsbOutputPipe)
- {
- hr = E_UNEXPECTED;
- TraceEvents(TRACE_LEVEL_ERROR,
- BIOMETRIC_TRACE_DEVICE,
- "%!FUNC! Input or output pipe not found, returning %!HRESULT!",
- hr
- );
- }
- }
-
- BiometricSafeRelease(pIUsbTargetFactory);
-
- return hr;
-}
-
-HRESULT
-CBiometricDevice::SetPowerManagement(
- VOID
- )
-/*++
-
- Routine Description:
-
- This method enables the WinUSB driver to power the device down when it is
- idle.
-
- Arguments:
-
- None
-
- Return Value:
-
- Status
-
---*/
-{
-
- HRESULT hr = S_OK;
- ULONG value = WBDI_SUSPEND_DELAY;
-
- hr = m_pIUsbTargetDevice->SetPowerPolicy( SUSPEND_DELAY,
- sizeof(ULONG),
- (PVOID) &value );
-
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- BIOMETRIC_TRACE_DEVICE,
- "%!FUNC! Unable to set power policy (SUSPEND_DELAY) for the device %!HRESULT!",
- hr
- );
- }
-
-
- //
- // Finally enable auto-suspend.
- //
-
- if (SUCCEEDED(hr))
- {
- BOOL AutoSuspsend = TRUE;
-
- hr = m_pIUsbTargetDevice->SetPowerPolicy( AUTO_SUSPEND,
- sizeof(BOOL),
- (PVOID) &AutoSuspsend );
- }
-
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- BIOMETRIC_TRACE_DEVICE,
- "%!FUNC! Unable to set power policy (AUTO_SUSPEND) for the device %!HRESULT!",
- hr
- );
- }
-
- return hr;
-}
-
-HRESULT
-CBiometricDevice::SendControlTransferSynchronously(
- _In_ PWINUSB_SETUP_PACKET SetupPacket,
- _Inout_updates_(BufferLength) PBYTE Buffer,
- _In_ ULONG BufferLength,
- _Out_ PULONG LengthTransferred
- )
-/*++
-
- Routine Description:
-
- This method synchronously sends a control transfer request to
- the USB I/O target.
-
- Arguments:
-
- SetupPacket - The command parameter structure
-
- Buffer - The data to transfer
-
- BufferLength - The size of the data buffer to transfer
-
- LengthTransferred - Contains the actual number of bytes transferred.
-
- Return Value:
-
- HRESULT
-
---*/
-{
- HRESULT hr = S_OK;
- IWDFIoRequest *pWdfRequest = NULL;
- IWDFDriver * FxDriver = NULL;
- IWDFMemory * FxMemory = NULL;
- IWDFRequestCompletionParams * FxComplParams = NULL;
- IWDFUsbRequestCompletionParams * FxUsbComplParams = NULL;
-
- *LengthTransferred = 0;
-
- hr = m_FxDevice->CreateRequest( NULL, //pCallbackInterface
- NULL, //pParentObject
- &pWdfRequest);
-
- if (SUCCEEDED(hr))
- {
- m_FxDevice->GetDriver(&FxDriver);
-
- hr = FxDriver->CreatePreallocatedWdfMemory( Buffer,
- BufferLength,
- NULL, //pCallbackInterface
- pWdfRequest, //pParetObject
- &FxMemory );
- }
-
- if (SUCCEEDED(hr))
- {
- hr = m_pIUsbTargetDevice->FormatRequestForControlTransfer( pWdfRequest,
- SetupPacket,
- FxMemory,
- NULL); //TransferOffset
- }
-
- if (SUCCEEDED(hr))
- {
- hr = pWdfRequest->Send( m_pIUsbTargetDevice,
- WDF_REQUEST_SEND_OPTION_SYNCHRONOUS,
- 0); //Timeout
- }
-
- if (SUCCEEDED(hr))
- {
- pWdfRequest->GetCompletionParams(&FxComplParams);
-
- hr = FxComplParams->GetCompletionStatus();
- }
-
- if (SUCCEEDED(hr))
- {
- HRESULT hrQI = FxComplParams->QueryInterface(IID_PPV_ARGS(&FxUsbComplParams));
- if (SUCCEEDED(hrQI))
- {
- FxUsbComplParams->GetDeviceControlTransferParameters( NULL,
- LengthTransferred,
- NULL,
- NULL );
- }
- }
-
- BiometricSafeRelease(FxUsbComplParams);
- BiometricSafeRelease(FxComplParams);
- BiometricSafeRelease(FxMemory);
-
- pWdfRequest->DeleteWdfObject();
- BiometricSafeRelease(pWdfRequest);
-
- BiometricSafeRelease(FxDriver);
-
- return hr;
-}
-
-WDF_IO_TARGET_STATE
-CBiometricDevice::GetTargetState(
- IWDFIoTarget * pTarget
- )
-/*++
-
- Routine Description:
-
- This method gets the state of the I/O target
-
- Arguments:
-
- pTarget - A pointer to the I/O target
-
- Return Value:
-
- WDF_IO_TARGET_STATE
-
---*/
-{
- IWDFIoTargetStateManagement * pStateMgmt = NULL;
- WDF_IO_TARGET_STATE state = WdfIoTargetStateUndefined;
-
- HRESULT hrQI = pTarget->QueryInterface(IID_PPV_ARGS(&pStateMgmt));
- if (FAILED(hrQI))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- BIOMETRIC_TRACE_DEVICE,
- "%!FUNC! Cannot query interface %!HRESULT!",
- hrQI
- );
-
- return state;
- }
-
- state = pStateMgmt->GetState();
-
- BiometricSafeRelease(pStateMgmt);
-
- return state;
-}
-
-HRESULT
-CBiometricDevice::InitiatePendingRead(
- VOID
- )
-/*++
-
- Routine Description:
-
- This routine starts up a cycling read on the interrupt pipe. As each
- read completes it will start up the next one.
-
- Arguments:
-
- None
-
- Return Value:
-
- Status
-
---*/
-{
- HRESULT hr = S_OK;
- IWDFIoRequest * FxRequest = NULL;
- IWDFMemory * FxMemory = NULL;
- IWDFDriver * FxDriver = NULL;
- IRequestCallbackRequestCompletion * FxComplCallback = NULL;
-
- hr = m_FxDevice->CreateRequest(NULL, NULL, &FxRequest);
-
- if (SUCCEEDED(hr))
- {
- m_FxDevice->GetDriver(&FxDriver);
-
- hr = FxDriver->CreatePreallocatedWdfMemory( (PBYTE) &m_InterruptMessage,
- sizeof(m_InterruptMessage),
- NULL, //pCallbackInterface
- FxRequest, //pParetObject
- &FxMemory );
- }
-
- if (SUCCEEDED(hr))
- {
- hr = m_pIUsbInterruptPipe->FormatRequestForRead(FxRequest,
- NULL, //pFile - IoTarget would apply its file
- FxMemory,
- NULL, //Memory offset
- NULL); //Device offset
- }
-
- if (SUCCEEDED(hr))
- {
- hr = this->QueryInterface(IID_PPV_ARGS(&FxComplCallback));
- if (SUCCEEDED(hr))
- {
- FxRequest->SetCompletionCallback(FxComplCallback, NULL);
-
- hr = FxRequest->Send(m_pIUsbInterruptPipe, 0, 0);
- }
- }
-
- if (FAILED(hr))
- {
- m_InterruptReadProblem = hr;
-
- if (FxRequest)
- {
- FxRequest->DeleteWdfObject();
- }
- }
-
- BiometricSafeRelease(FxRequest);
- BiometricSafeRelease(FxMemory);
- BiometricSafeRelease(FxDriver);
- BiometricSafeRelease(FxComplCallback);
-
- return hr;
-}
-
-VOID
-CBiometricDevice::OnCompletion(
- _In_ IWDFIoRequest* FxRequest,
- _In_ IWDFIoTarget* pIoTarget,
- _In_ IWDFRequestCompletionParams* pParams,
- _In_ PVOID pContext
- )
-/*++
-
- Routine Description:
-
- This method is called when the asynchronous pending
- read on the interrupt pipe completes.
-
- Arguments:
-
- FxRequest - The request object
-
- pIoTarget - The I/O target for the request
-
- pParams - The completion parameters
-
- pContext - Optional context
-
- Return Value:
-
- None
-
---*/
-{
- UNREFERENCED_PARAMETER(pIoTarget);
- UNREFERENCED_PARAMETER(pContext);
-
- IWDFUsbRequestCompletionParams * pUsbComplParams = NULL;
- IWDFMemory * FxMemory = NULL;
- SIZE_T bytesRead = 0;
- HRESULT hrCompletion = pParams->GetCompletionStatus();
-
- TraceEvents(TRACE_LEVEL_INFORMATION,
- BIOMETRIC_TRACE_DEVICE,
- "%!FUNC! Pending read completed with %!hresult!",
- hrCompletion
- );
-
- if (FAILED(hrCompletion))
- {
- m_InterruptReadProblem = hrCompletion;
- }
- else
- {
- //
- // Get the interrupt message
- //
-
- HRESULT hrQI = pParams->QueryInterface(IID_PPV_ARGS(&pUsbComplParams));
- if (SUCCEEDED(hrQI))
- {
- pUsbComplParams->GetPipeReadParameters(&FxMemory, &bytesRead, NULL);
- if (bytesRead == sizeof(INTERRUPT_MESSAGE))
- {
-
- PVOID pBuff = FxMemory->GetDataBuffer(NULL);
- CopyMemory(&m_InterruptMessage, pBuff, sizeof(m_InterruptMessage));
-
- //
- // TODO: Parse m_InterruptMessage
- //
- }
- }
- }
-
- //
- // Don't complete the request since we created it, just delete it.
- //
-
- FxRequest->DeleteWdfObject();
-
- //
- // Re-initiate pending read if I/O Target is not stopped/removed
- //
-
- if (WdfIoTargetStarted == GetTargetState(m_pIUsbInterruptPipe))
- {
- int numRetries = 0;
- HRESULT hr = InitiatePendingRead();
-
- //
- // If we fail here, the device will become unresponsive.
- // Re-issue the request until it succeeds.
- //
- for (numRetries = 0; FAILED(hr) && numRetries < 3; ++numRetries)
- {
- hr = InitiatePendingRead();
- }
- }
-
- BiometricSafeRelease(pUsbComplParams);
- BiometricSafeRelease(FxMemory);
-}
-
-
-//
-// I/O handlers
-//
-
-void
-CBiometricDevice::GetIoRequestParams(
- _In_ IWDFIoRequest *FxRequest,
- _Out_ ULONG *MajorControlCode,
- _Outptr_result_bytebuffer_(*InputBufferSizeInBytes) PUCHAR *InputBuffer,
- _Out_ SIZE_T *InputBufferSizeInBytes,
- _Outptr_result_bytebuffer_(*OutputBufferSizeInBytes) PUCHAR *OutputBuffer,
- _Out_ SIZE_T *OutputBufferSizeInBytes
- )
-/*++
-
- Routine Description:
-
- This method retrieves the input and output buffers associated with the request.
-
- Arguments:
-
- FxRequest - The WDF request oject
-
- MajorControlCode - Contains the control code for the I/O request
-
- InputBuffer - Contains the input buffer pointer
-
- InputBufferSizeInBytes - Contains the size of the input buffer
-
- OutputBuffer - Contains the output buffer pointer
-
- OutputBufferSizeInBytes - Contains the size of the output buffer
-
- Return Value:
-
- None
-
---*/
-{
- //
- // Get main parameters
- //
- FxRequest->GetDeviceIoControlParameters(MajorControlCode,
- InputBufferSizeInBytes,
- OutputBufferSizeInBytes);
-
- // Get pointer to input buffer
- IWDFMemory *fxMemory = NULL;
- FxRequest->GetInputMemory(&fxMemory);
- if (fxMemory)
- {
- *InputBuffer = (PUCHAR) fxMemory->GetDataBuffer(InputBufferSizeInBytes);
- BiometricSafeRelease(fxMemory);
- }
-
- // Save pointer to reply buffer
- fxMemory = NULL;
- FxRequest->GetOutputMemory(&fxMemory);
- if (fxMemory)
- {
- *OutputBuffer = (PUCHAR) fxMemory->GetDataBuffer(OutputBufferSizeInBytes);
- BiometricSafeRelease(fxMemory);
- }
-}
-
-void
-CBiometricDevice::OnGetAttributes(
- _Inout_ IWDFIoRequest *FxRequest
- )
-/*++
-
- Routine Description:
-
- This method is invoked when the IOCTL_BIOMETRIC_GET_ATTRIBUTES command is called.
-
- Arguments:
-
- FxRequest - The output for this request is a PWINBIO_SENSOR_ATTRIBUTES.
-
- Return Value:
-
- None
-
---*/
-{
- CRequestHelper MyRequest(FxRequest); // RAII helper class
- ULONG controlCode = 0;
- PUCHAR inputBuffer= NULL;
- SIZE_T inputBufferSize = 0;
- PWINBIO_SENSOR_ATTRIBUTES sensorAttributes = NULL;
- SIZE_T outputBufferSize;
-
- //
- // Get the request parameters
- //
- GetIoRequestParams(FxRequest,
- &controlCode,
- &inputBuffer,
- &inputBufferSize,
- (PUCHAR *)&sensorAttributes,
- &outputBufferSize);
-
- //
- // Make sure we have an output buffer big enough
- //
- if (sensorAttributes == NULL || outputBufferSize < sizeof(DWORD))
- {
- // We cannot return size information.
- TraceEvents(TRACE_LEVEL_ERROR,
- BIOMETRIC_TRACE_DEVICE,
- "%!FUNC!Output buffer NULL or too small to return size information.");
- MyRequest.SetCompletionHr(E_INVALIDARG);
- return;
- }
-
- // We only have one supported format, so sizeof (WINBIO_SENSOR_ATTRIBUTES) is sufficient.
- if (outputBufferSize < sizeof(WINBIO_SENSOR_ATTRIBUTES))
- {
- // Buffer too small.
- TraceEvents(TRACE_LEVEL_ERROR,
- BIOMETRIC_TRACE_DEVICE,
- "%!FUNC!Buffer too small - return size necessary in PayloadSize - 0x%x.", sizeof(WINBIO_SENSOR_ATTRIBUTES));
- sensorAttributes->PayloadSize = (DWORD) sizeof(WINBIO_SENSOR_ATTRIBUTES);
- MyRequest.SetInformation(sizeof(DWORD));
- MyRequest.SetCompletionHr(S_OK);
- return;
- }
-
- //
- // Fill in the attribute payload structure
- //
- RtlZeroMemory(sensorAttributes, outputBufferSize);
- sensorAttributes->PayloadSize = (DWORD) sizeof(WINBIO_SENSOR_ATTRIBUTES);
- sensorAttributes->WinBioHresult = S_OK;
- sensorAttributes->WinBioVersion.MajorVersion = WINBIO_WBDI_MAJOR_VERSION;
- sensorAttributes->WinBioVersion.MinorVersion = WINBIO_WBDI_MINOR_VERSION;
- sensorAttributes->SensorType = WINBIO_TYPE_FINGERPRINT;
- sensorAttributes->SensorSubType = WINBIO_FP_SENSOR_SUBTYPE_SWIPE;
- sensorAttributes->Capabilities = WINBIO_CAPABILITY_SENSOR;
- sensorAttributes->SupportedFormatEntries = 1;
- sensorAttributes->SupportedFormat[0].Owner = WINBIO_ANSI_381_FORMAT_OWNER;
- sensorAttributes->SupportedFormat[0].Type= WINBIO_ANSI_381_FORMAT_TYPE;
- RtlCopyMemory(sensorAttributes->ManufacturerName, SAMPLE_MANUFACTURER_NAME, (wcslen(SAMPLE_MANUFACTURER_NAME)+1)*sizeof(WCHAR));
- RtlCopyMemory(sensorAttributes->ModelName, SAMPLE_MODEL_NAME, (wcslen(SAMPLE_MODEL_NAME)+1)*sizeof(WCHAR));
- RtlCopyMemory(sensorAttributes->SerialNumber, SAMPLE_SERIAL_NUMBER, (wcslen(SAMPLE_SERIAL_NUMBER)+1)*sizeof(WCHAR));
- sensorAttributes->FirmwareVersion.MajorVersion = 1;
- sensorAttributes->FirmwareVersion.MinorVersion = 0;
-
- MyRequest.SetInformation(sensorAttributes->PayloadSize);
- MyRequest.SetCompletionHr(S_OK);
-}
-
-
-void
-CBiometricDevice::OnReset(
- _Inout_ IWDFIoRequest *FxRequest
- )
-/*++
-
- Routine Description:
-
- This method is invoked when the IOCTL_BIOMETRIC_RESET command is called.
-
- Arguments:
-
- FxRequest -
-
- Return Value:
-
- None
-
---*/
-{
- CRequestHelper MyRequest(FxRequest); // RAII helper class
- ULONG controlCode = 0;
- PUCHAR inputBuffer= NULL;
- SIZE_T inputBufferSize = 0;
- PWINBIO_BLANK_PAYLOAD blankPayload = NULL;
- SIZE_T outputBufferSize;
-
- //
- // Get the request parameters
- //
- GetIoRequestParams(FxRequest,
- &controlCode,
- &inputBuffer,
- &inputBufferSize,
- (PUCHAR *)&blankPayload,
- &outputBufferSize);
-
- //
- // Make sure we have an output buffer big enough
- //
- if (blankPayload== NULL || outputBufferSize < sizeof(DWORD))
- {
- // We cannot return size information.
- TraceEvents(TRACE_LEVEL_ERROR,
- BIOMETRIC_TRACE_DEVICE,
- "%!FUNC!Output buffer NULL or too small to return size information.");
- MyRequest.SetInformation(sizeof(DWORD));
- MyRequest.SetCompletionHr(S_OK);
- MyRequest.SetCompletionHr(E_INVALIDARG);
- return;
- }
-
- if (outputBufferSize < sizeof(WINBIO_BLANK_PAYLOAD))
- {
- // Buffer too small.
- TraceEvents(TRACE_LEVEL_ERROR,
- BIOMETRIC_TRACE_DEVICE,
- "%!FUNC!Buffer too small - return size necessary in PayloadSize - 0x%x.", sizeof(WINBIO_DIAGNOSTICS));
- MyRequest.SetInformation(sizeof(DWORD));
- MyRequest.SetCompletionHr(S_OK);
- return;
- }
-
- //
- // This is a simulated device. Nothing to do here except cancel the pending data
- // collection I/O, if one exists.
- //
- CompletePendingRequest(HRESULT_FROM_WIN32(ERROR_CANCELLED), 0);
-
- //
- // Fill in the OUT payload structure
- //
- RtlZeroMemory(blankPayload, outputBufferSize);
- blankPayload->PayloadSize = (DWORD) sizeof(WINBIO_BLANK_PAYLOAD);
- blankPayload->WinBioHresult = S_OK;
-
- FxRequest->SetInformation(blankPayload->PayloadSize);
- MyRequest.SetCompletionHr(S_OK);
-
-}
-
-void
-CBiometricDevice::OnCalibrate(
- _Inout_ IWDFIoRequest *FxRequest
- )
-/*++
-
- Routine Description:
-
- This method is invoked when the IOCTL_BIOMETRIC_CALIBRATE command is called.
-
- Arguments:
-
- FxRequest -
- IN - blank payload
- OUT - PWINBIO_CALIBRATION_INFO
-
- Return Value:
-
- None
-
---*/
-{
- CRequestHelper MyRequest(FxRequest); // RAII helper class
- ULONG controlCode = 0;
- PUCHAR inputBuffer= NULL;
- SIZE_T inputBufferSize = 0;
- PWINBIO_CALIBRATION_INFO calibrationInfo = NULL;
- SIZE_T outputBufferSize;
-
- //
- // Get the request parameters
- //
- GetIoRequestParams(FxRequest,
- &controlCode,
- &inputBuffer,
- &inputBufferSize,
- (PUCHAR *)&calibrationInfo,
- &outputBufferSize);
-
- //
- // Make sure we have an output buffer big enough
- //
- if (calibrationInfo == NULL || outputBufferSize < sizeof(DWORD))
- {
- // We cannot return size information.
- TraceEvents(TRACE_LEVEL_ERROR,
- BIOMETRIC_TRACE_DEVICE,
- "%!FUNC!Output buffer NULL or too small to return size information.");
- MyRequest.SetCompletionHr(E_INVALIDARG);
- return;
- }
-
- if (outputBufferSize < sizeof(WINBIO_CALIBRATION_INFO))
- {
- // Buffer too small.
- TraceEvents(TRACE_LEVEL_ERROR,
- BIOMETRIC_TRACE_DEVICE,
- "%!FUNC!Buffer too small - return size necessary in PayloadSize - 0x%x.", sizeof(WINBIO_DIAGNOSTICS));
- calibrationInfo->PayloadSize = (DWORD) sizeof(WINBIO_CALIBRATION_INFO);
- MyRequest.SetInformation(sizeof(DWORD));
- MyRequest.SetCompletionHr(S_OK);
- return;
- }
-
- //
- // This is where code to calibrate the device goes.
- //
-
- //
- // Fill in the OUT payload structure
- //
- RtlZeroMemory(calibrationInfo, outputBufferSize);
- calibrationInfo->PayloadSize = (DWORD) sizeof(WINBIO_CALIBRATION_INFO);
- calibrationInfo->WinBioHresult = S_OK;
-
- MyRequest.SetInformation(calibrationInfo->PayloadSize);
- MyRequest.SetCompletionHr(S_OK);
-}
-
-
-void
-CBiometricDevice::OnGetSensorStatus(
- _Inout_ IWDFIoRequest *FxRequest
- )
-/*++
-
- Routine Description:
-
- This method is invoked when the IOCTL_BIOMETRIC_GET_SENSOR_STATUS command is called.
-
- Arguments:
-
- FxRequest -
- IN payload: none
- OUT payload: PWINBIO_DIAGNOSTICS
-
- Return Value:
-
- None
-
---*/
-{
- CRequestHelper MyRequest(FxRequest); // RAII helper class
- ULONG controlCode = 0;
- PUCHAR inputBuffer= NULL;
- SIZE_T inputBufferSize = 0;
- PWINBIO_DIAGNOSTICS diagnostics = NULL;
- SIZE_T outputBufferSize;
-
- //
- // Get the request parameters
- //
- GetIoRequestParams(FxRequest,
- &controlCode,
- &inputBuffer,
- &inputBufferSize,
- (PUCHAR *)&diagnostics,
- &outputBufferSize);
-
- //
- // Make sure we have an output buffer big enough
- //
- if (diagnostics == NULL || outputBufferSize < sizeof(DWORD))
- {
- // We cannot return size information.
- TraceEvents(TRACE_LEVEL_ERROR,
- BIOMETRIC_TRACE_DEVICE,
- "%!FUNC!Output buffer NULL or too small to return size information.");
- MyRequest.SetCompletionHr(E_INVALIDARG);
- return;
- }
-
- if (outputBufferSize < sizeof(WINBIO_DIAGNOSTICS))
- {
- // Buffer too small.
- TraceEvents(TRACE_LEVEL_ERROR,
- BIOMETRIC_TRACE_DEVICE,
- "%!FUNC!Buffer too small - return size necessary in PayloadSize - 0x%x.", sizeof(WINBIO_DIAGNOSTICS));
- diagnostics->PayloadSize = (DWORD) sizeof(WINBIO_DIAGNOSTICS);
- MyRequest.SetInformation(sizeof(DWORD));
- MyRequest.SetCompletionHr(S_OK);
- return;
- }
-
- //
- // Fill in the OUT payload structure
- //
- RtlZeroMemory(diagnostics, outputBufferSize);
- diagnostics->PayloadSize = (DWORD) sizeof(WINBIO_DIAGNOSTICS);
- diagnostics->WinBioHresult = S_OK;
- diagnostics->SensorStatus = WINBIO_SENSOR_READY;
-
- MyRequest.SetInformation(diagnostics->PayloadSize);
- MyRequest.SetCompletionHr(S_OK);
-}
-
-
-void
-CBiometricDevice::OnCaptureData(
- _Inout_ IWDFIoRequest *FxRequest
- )
-/*++
-
- Routine Description:
-
- This method is invoked when the IOCTL_BIOMETRIC_CAPTURE_DATA command is called.
-
- Arguments:
-
- FxRequest -
- IN payload: PWINBIO_CAPTURE_PARAMETERS
- OUT payload: PWINBIO_CAPTURE_DATA
-
- Return Value:
-
- None
-
---*/
-{
- ULONG controlCode = 0;
- PWINBIO_CAPTURE_PARAMETERS captureParams = NULL;
- SIZE_T inputBufferSize = 0;
- PWINBIO_CAPTURE_DATA captureData = NULL;
- SIZE_T outputBufferSize = 0;
-
- //
- // We can only have one outstanding data capture request at a time.
- // Check to see if we have a request pending.
- //
- bool requestPending = false;
-
- EnterCriticalSection(&m_RequestLock);
-
- if (m_PendingRequest == NULL)
- {
- //
- // See if we have an active sleep thread.
- // If so, tell it to exit.
- // Wait for it to exit.
- //
- if (m_SleepThread != INVALID_HANDLE_VALUE)
- {
- LeaveCriticalSection(&m_RequestLock);
-
- // TODO: Add code to signal thread to exit.
-
- // NOTE: Sleeping for INFINITE time is dangerous. A real driver
- // should be able to handle the case where the thread does
- // not exit.
- WaitForSingleObject(m_SleepThread, INFINITE);
- CloseHandle(m_SleepThread);
- m_SleepThread = INVALID_HANDLE_VALUE;
-
- EnterCriticalSection(&m_RequestLock);
- }
-
- //
- // We might have had to leave the CS to wait for the sleep thread.
- // Double check that the pending request is still NULL.
- //
- if (m_PendingRequest == NULL)
- {
- // Save the request.
- m_PendingRequest = FxRequest;
-
- // Mark the request as cancellable.
- m_PendingRequest->MarkCancelable(this);
- }
- else
- {
- requestPending = true;
- }
-
- }
- else
- {
- requestPending = true;
- }
-
- LeaveCriticalSection(&m_RequestLock);
-
- if (requestPending)
- {
- // Complete the request to tell the app that there is already
- // a pending data collection request.
- FxRequest->Complete(WINBIO_E_DATA_COLLECTION_IN_PROGRESS);
- return;
- }
-
- //
- // Get the request parameters
- //
- GetIoRequestParams(FxRequest,
- &controlCode,
- (PUCHAR *)&captureParams,
- &inputBufferSize,
- (PUCHAR *)&captureData,
- &outputBufferSize);
-
- //
- // Check input parameters.
- //
- if (inputBufferSize < sizeof (WINBIO_CAPTURE_PARAMETERS))
- {
- // Invalid arguments
- TraceEvents(TRACE_LEVEL_ERROR,
- BIOMETRIC_TRACE_DEVICE,
- "%!FUNC!Invalid argument(s).");
- CompletePendingRequest(E_INVALIDARG, 0);
- return;
- }
-
- //
- // Make sure we have an output buffer big enough
- //
- if (outputBufferSize < sizeof(DWORD))
- {
- // We cannot return size information.
- TraceEvents(TRACE_LEVEL_ERROR,
- BIOMETRIC_TRACE_DEVICE,
- "%!FUNC!Output buffer NULL or too small to return size information.");
- CompletePendingRequest(E_INVALIDARG, 0);
- return;
- }
-
- //
- // Check output buffer size.
- //
- if (outputBufferSize < sizeof (WINBIO_CAPTURE_DATA))
- {
- // Buffer too small.
- TraceEvents(TRACE_LEVEL_ERROR,
- BIOMETRIC_TRACE_DEVICE,
- "%!FUNC!Buffer too small - must be at least 0x%x.", sizeof (WINBIO_CAPTURE_DATA));
- //
- // NOTE: The output buffer size necessary for this sample is sizeof(WINBIO_CAPTURE_DATA).
- // Real devices will need additional space to handle a typical capture.
- // The value that should be returned here is sizeof(WINBIO_CAPTURE_DATA) + CaptureBufferSize.
- //
- captureData->PayloadSize = (DWORD) sizeof(WINBIO_CAPTURE_DATA);
- CompletePendingRequest(S_OK, sizeof(DWORD));
- return;
- }
-
- //
- // NOTE: This call always fails in this sample since it is not
- // written for a real device.
- //
-
- //
- // Set default values in output buffer.
- //
- captureData->PayloadSize = (DWORD) sizeof (WINBIO_CAPTURE_DATA);
- captureData->WinBioHresult = WINBIO_E_NO_CAPTURE_DATA;
- captureData->SensorStatus = WINBIO_SENSOR_FAILURE;
- captureData->RejectDetail= 0;
- captureData->CaptureData.Size = 0;
-
- //
- // Check purpose, format and type.
- //
- if (captureParams->Purpose == WINBIO_NO_PURPOSE_AVAILABLE)
- {
- captureData->WinBioHresult = WINBIO_E_UNSUPPORTED_PURPOSE;
- }
- else if ((captureParams->Format.Type != WINBIO_ANSI_381_FORMAT_TYPE) ||
- (captureParams->Format.Owner != WINBIO_ANSI_381_FORMAT_OWNER))
- {
- captureData->WinBioHresult = WINBIO_E_UNSUPPORTED_DATA_FORMAT;
- }
- else if (captureParams->Flags != WINBIO_DATA_FLAG_RAW)
- {
- captureData->WinBioHresult = WINBIO_E_UNSUPPORTED_DATA_TYPE;
- }
-
- //
- // NOTE: This sample completes the request after
- // sleeping for 5 seconds. A real driver would
- // program the device for capture mode, and then
- // return from this callback. The request would
- // remain pending until cancelled, or until the
- // driver detects a capture is complete.
- //
- // The construct of m_PendingRequest will allow
- // a driver to have only one pending request at any
- // time, which can be cancelled in a Reset IOCTL, or
- // by calling CancelIoEx.
- //
-
- //
- // Create thread to sleep 5 seconds before completing the request.
- //
- m_SleepParams.SleepValue = 5;
- m_SleepParams.Hr = S_OK;
- m_SleepParams.Information = captureData->PayloadSize;
- m_SleepThread = CreateThread(NULL, // default security attributes
- 0, // use default stack size
- CaptureSleepThread, // thread function name
- this, // argument to thread function
- 0, // use default creation flags
- NULL); // returns the thread identifier
-}
-
-
-void
-CBiometricDevice::OnUpdateFirmware(
- _Inout_ IWDFIoRequest *FxRequest
- )
-/*++
-
- Routine Description:
-
- This method is invoked when the IOCTL_BIOMETRIC_UPDATE_FIRMWARE command is called.
-
- Arguments:
-
- FxRequest -
-
- Return Value:
-
- None
-
---*/
-{
- FxRequest->Complete(E_NOTIMPL);
-}
-
-void
-CBiometricDevice::OnGetSupportedAlgorithms(
- _Inout_ IWDFIoRequest *FxRequest
- )
-/*++
-
- Routine Description:
-
- This method is invoked when the IOCTL_BIOMETRIC_GET_SUPPORTED_ALGORITHMS command is called.
-
- Arguments:
-
- FxRequest -
-
- Return Value:
-
- None
-
---*/
-{
- FxRequest->Complete(E_NOTIMPL);
-}
-
-void
-CBiometricDevice::OnGetIndicator(
- _Inout_ IWDFIoRequest *FxRequest
- )
-/*++
-
- Routine Description:
-
- This method is invoked when the IOCTL_BIOMETRIC_GET_INDICATOR command is called.
-
- Arguments:
-
- FxRequest -
-
- Return Value:
-
- None
-
---*/
-{
- FxRequest->Complete(E_NOTIMPL);
-}
-
-
-void
-CBiometricDevice::OnSetIndicator(
- _Inout_ IWDFIoRequest *FxRequest
- )
-/*++
-
- Routine Description:
-
- This method is invoked when the IOCTL_BIOMETRIC_SET_INDICATOR command is called.
-
- Arguments:
-
- FxRequest -
-
- Return Value:
-
- None
-
---*/
-{
- FxRequest->Complete(E_NOTIMPL);
-}
-
-void
-CBiometricDevice::OnControlUnit(
- _Inout_ IWDFIoRequest *FxRequest
- )
-/*++
-
- Routine Description:
-
- This method is invoked when the IOCTL_BIOMETRIC_CONTROL_UNIT command is called.
-
- Arguments:
-
- FxRequest -
-
- Return Value:
-
- None
-
---*/
-{
- FxRequest->Complete(E_NOTIMPL);
-}
-
-
-VOID
-CBiometricDevice::CompletePendingRequest(
- HRESULT hr,
- DWORD information
- )
-{
- EnterCriticalSection(&m_RequestLock);
-
- if (m_PendingRequest)
- {
- //
- // Only complete the request if we weren't cancelled. Otherwise, the
- // OnCancel callback will complete the request.
- //
- HRESULT hrUnmark = m_PendingRequest->UnmarkCancelable();
- if (HRESULT_FROM_WIN32(ERROR_OPERATION_ABORTED) != hrUnmark)
- {
- m_PendingRequest->SetInformation(information);
- m_PendingRequest->Complete(hr);
- m_PendingRequest = NULL;
- }
- }
-
- LeaveCriticalSection(&m_RequestLock);
-}
-
-VOID
-STDMETHODCALLTYPE
-CBiometricDevice::OnCancel(
- _In_ IWDFIoRequest *pWdfRequest
- )
-{
- EnterCriticalSection(&m_RequestLock);
-
- if (m_PendingRequest != pWdfRequest)
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- BIOMETRIC_TRACE_DEVICE,
- "%!FUNC! Cancelled request does not match pending request.");
- }
-
- //
- // TODO: In a real driver, the device would be reset so that it is no longer in capture mode.
- // Add your code to do so here.
- //
-
- if (m_PendingRequest == NULL)
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- BIOMETRIC_TRACE_DEVICE,
- "%!FUNC! Pending request is NULL.");
- }
- else
- {
- m_PendingRequest->Complete(HRESULT_FROM_WIN32(ERROR_OPERATION_ABORTED));
- m_PendingRequest = NULL;
- }
-
- LeaveCriticalSection(&m_RequestLock);
-}
diff --git a/biometrics/driver/Device.h b/biometrics/driver/Device.h
deleted file mode 100644
index 69094325..00000000
--- a/biometrics/driver/Device.h
+++ /dev/null
@@ -1,360 +0,0 @@
-/*++
-
- 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:
-
- Device.h
-
-Abstract:
-
- This module contains the type definitions of the Biometric
- device driver.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// TODO: Change this to match your device
-//
-#define NUM_WBDI_ENDPOINTS 3
-
-//
-// Power policy suspend delay time. 10 seconds.
-//
-#define WBDI_SUSPEND_DELAY ((ULONG)(10 * 1000))
-
-//
-// Struct for passing parameters for capture request completion.
-//
-typedef struct _CAPTURE_SLEEP_PARAMS
-{
- DWORD SleepValue;
- HRESULT Hr;
- DWORD Information;
-} CAPTURE_SLEEP_PARAMS, *PCAPTURE_SLEEP_PARAMS;
-
-
-//
-// Class for the Biometric driver.
-//
-
-class CBiometricDevice :
- public CComObjectRootEx<CComMultiThreadModel>,
- public IRequestCallbackRequestCompletion,
- public IRequestCallbackCancel,
- public IPnpCallbackHardware
-{
-public:
-
- DECLARE_NOT_AGGREGATABLE(CBiometricDevice)
-
- BEGIN_COM_MAP(CBiometricDevice)
- COM_INTERFACE_ENTRY(IPnpCallbackHardware)
- COM_INTERFACE_ENTRY(IRequestCallbackRequestCompletion)
- COM_INTERFACE_ENTRY(IRequestCallbackCancel)
- END_COM_MAP()
-
- CBiometricDevice() :
- m_FxDevice(NULL),
- m_IoQueue(NULL),
- m_pIUsbTargetDevice(NULL),
- m_pIUsbInterface(NULL),
- m_pIUsbInputPipe(NULL),
- m_pIUsbOutputPipe(NULL),
- m_pIUsbInterruptPipe(NULL),
- m_PendingRequest(NULL),
- m_Speed(0),
- m_InterruptReadProblem(S_OK),
- m_SleepThread(INVALID_HANDLE_VALUE)
- {
- InitializeCriticalSection(&m_RequestLock);
- }
-
- ~CBiometricDevice()
- {
- DeleteCriticalSection(&m_RequestLock);
- }
-
-//
-// Private data members.
-//
-private:
-
- //
- // Weak reference to framework device object.
- //
- IWDFDevice * m_FxDevice;
-
- //
- // Weak reference to I/O queue
- //
- PCBiometricIoQueue m_IoQueue;
-
- //
- // USB Device I/O Target
- //
- IWDFUsbTargetDevice * m_pIUsbTargetDevice;
-
- //
- // USB Interface
- //
- IWDFUsbInterface * m_pIUsbInterface;
-
- //
- // USB Input pipe for Reads
- //
- IWDFUsbTargetPipe * m_pIUsbInputPipe;
-
- //
- // USB Output pipe for writes
- //
- IWDFUsbTargetPipe * m_pIUsbOutputPipe;
-
- //
- // USB interrupt pipe
- //
- IWDFUsbTargetPipe * m_pIUsbInterruptPipe;
-
- //
- // Device Speed (Low, Full, High)
- //
- UCHAR m_Speed;
-
- //
- // If reads stopped because of a transient problem, the error status
- // is stored here.
- //
-
- HRESULT m_InterruptReadProblem;
-
- //
- // Interrupt message buffer
- //
-
- INTERRUPT_MESSAGE m_InterruptMessage;
-
- //
- // Holds a reference to a pending data I/O request.
- //
-
- IWDFIoRequest *m_PendingRequest;
-
- //
- // Synchronization for m_PendingRequest
- //
-
- CRITICAL_SECTION m_RequestLock;
-
- //
- // Handle to a thread that will sleep before completing a request.
- //
- HANDLE m_SleepThread;
- CAPTURE_SLEEP_PARAMS m_SleepParams;
-
-//
-// Private methods.
-//
-private:
-
- HRESULT
- Initialize(
- _In_ IWDFDriver *FxDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit
- );
-
- //
- // Helper methods
- //
-
- HRESULT
- CreateUsbIoTargets(
- VOID
- );
-
- HRESULT
- SetPowerManagement(
- VOID
- );
-
- //
- // Helper functions
- //
-
- HRESULT
- SendControlTransferSynchronously(
- _In_ PWINUSB_SETUP_PACKET SetupPacket,
- _Inout_updates_(BufferLength) PBYTE Buffer,
- _In_ ULONG BufferLength,
- _Out_ PULONG LengthTransferred
- );
-
- static
- WDF_IO_TARGET_STATE
- GetTargetState(
- IWDFIoTarget * pTarget
- );
-
- HRESULT
- InitiatePendingRead(
- );
-
-//
-// Public methods
-//
-public:
-
- //
- // The factory method used to create an instance of this driver.
- //
-
- static
- HRESULT
- CreateInstanceAndInitialize(
- _In_ IWDFDriver *FxDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit,
- _Out_ CBiometricDevice **Device
- );
-
- HRESULT
- Configure(
- VOID
- );
-
-//
-// COM methods
-//
-public:
-
- //
- // IPnpCallbackHardware
- //
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnPrepareHardware(
- _In_ IWDFDevice *FxDevice
- );
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnReleaseHardware(
- _In_ IWDFDevice *FxDevice
- );
-
-
- //
- // IRequestCallbackRequestCompletion
- //
- virtual
- void
- STDMETHODCALLTYPE
- OnCompletion(
- _In_ IWDFIoRequest* FxRequest,
- _In_ IWDFIoTarget* pIoTarget,
- _In_ IWDFRequestCompletionParams* pParams,
- _In_ PVOID pContext
- );
-
- //
- // IRequestCallbackCancel
- //
- virtual
- VOID
- STDMETHODCALLTYPE
- OnCancel(
- _In_ IWDFIoRequest *pWdfRequest
- );
-
-public:
-
- //
- // I/O handlers.
- //
- void
- GetIoRequestParams(
- _In_ IWDFIoRequest *FxRequest,
- _Out_ ULONG *MajorControlCode,
- _Outptr_result_bytebuffer_(*InputBufferSizeInBytes) PUCHAR *InputBuffer,
- _Out_ SIZE_T *InputBufferSizeInBytes,
- _Outptr_result_bytebuffer_(*OutputBufferSizeInBytes) PUCHAR *OutputBuffer,
- _Out_ SIZE_T *OutputBufferSizeInBytes
- );
-
- void
- OnGetAttributes(
- _Inout_ IWDFIoRequest *FxRequest
- );
-
- void
- OnReset(
- _Inout_ IWDFIoRequest *FxRequest
- );
-
- void
- OnCalibrate(
- _Inout_ IWDFIoRequest *FxRequest
- );
-
- void
- OnGetSensorStatus(
- _Inout_ IWDFIoRequest *FxRequest
- );
-
- void
- OnCaptureData(
- _Inout_ IWDFIoRequest *FxRequest
- );
-
- void
- OnUpdateFirmware(
- _Inout_ IWDFIoRequest *FxRequest
- );
-
- void
- OnGetSupportedAlgorithms(
- _Inout_ IWDFIoRequest *FxRequest
- );
-
- void
- OnGetIndicator(
- _Inout_ IWDFIoRequest *FxRequest
- );
-
- void
- OnSetIndicator(
- _Inout_ IWDFIoRequest *FxRequest
- );
-
- void
- OnControlUnit(
- _Inout_ IWDFIoRequest *FxRequest
- );
-
- VOID
- CompletePendingRequest(
- HRESULT hr,
- DWORD information
- );
-
- inline PCAPTURE_SLEEP_PARAMS
- GetCaptureSleepParams()
- {
- return &m_SleepParams;
- }
-
-};
-
-
diff --git a/biometrics/driver/Driver.cpp b/biometrics/driver/Driver.cpp
deleted file mode 100644
index 0d5c0797..00000000
--- a/biometrics/driver/Driver.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/*++
-
- 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:
-
- Driver.cpp
-
-Abstract:
-
- This module contains the implementation of the Biometric
- core driver callback object.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-#include "driver.tmh"
-
-HRESULT
-CBiometricDriver::OnDeviceAdd(
- _In_ IWDFDriver *FxWdfDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit
- )
-/*++
-
- Routine Description:
-
- The FX invokes this method when it wants to install our driver on a device
- stack. This method creates a device callback object, then calls the Fx
- to create an Fx device object and associate the new callback object with
- it.
-
- Arguments:
-
- FxWdfDriver - the Fx driver object.
-
- FxDeviceInit - the initialization information for the device.
-
- Return Value:
-
- status
-
---*/
-{
- HRESULT hr = S_OK;
- CBiometricDevice *device = NULL;
-
- //
- // Create device callback object
- //
-
- hr = CBiometricDevice::CreateInstanceAndInitialize(FxWdfDriver,
- FxDeviceInit,
- &device);
-
- //
- // Call the device's construct method. This
- // allows the device to create any queues or other structures that it
- // needs now that the corresponding fx device object has been created.
- //
-
- if (SUCCEEDED(hr))
- {
- hr = device->Configure();
- }
-
- return hr;
-}
diff --git a/biometrics/driver/Driver.h b/biometrics/driver/Driver.h
deleted file mode 100644
index 0fc2566a..00000000
--- a/biometrics/driver/Driver.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*++
-
- 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:
-
- Driver.h
-
-Abstract:
-
- This module contains the type definitions for the Biometric
- driver callback class.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// This class handles driver events for the skeleton sample. In particular
-// it supports the OnDeviceAdd event, which occurs when the driver is called
-// to setup per-device handlers for a new device stack.
-//
-
-EXTERN_C const CLSID CLSID_BiometricUsbSample;
-
-class CBiometricDriver :
- public CComObjectRootEx<CComMultiThreadModel>,
- public CComCoClass<CBiometricDriver, &CLSID_BiometricUsbSample>,
- public IDriverEntry
-{
-public:
-
- CBiometricDriver()
- {
- }
-
- DECLARE_NO_REGISTRY()
-
- DECLARE_NOT_AGGREGATABLE(CBiometricDriver)
-
- BEGIN_COM_MAP(CBiometricDriver)
- COM_INTERFACE_ENTRY(IDriverEntry)
- END_COM_MAP()
-
-//
-// Public methods
-//
-public:
-
- //
- // IDriverEntry methods
- //
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnInitialize(
- _In_ IWDFDriver *FxWdfDriver
- )
- {
- UNREFERENCED_PARAMETER(FxWdfDriver);
- return S_OK;
- }
-
- virtual
- HRESULT
- STDMETHODCALLTYPE
- OnDeviceAdd(
- _In_ IWDFDriver *FxWdfDriver,
- _In_ IWDFDeviceInitialize *FxDeviceInit
- );
-
- virtual
- VOID
- STDMETHODCALLTYPE
- OnDeinitialize(
- _In_ IWDFDriver *FxWdfDriver
- )
- {
- UNREFERENCED_PARAMETER(FxWdfDriver);
- return;
- }
-
-};
-
-OBJECT_ENTRY_AUTO(CLSID_BiometricUsbSample, CBiometricDriver)
diff --git a/biometrics/driver/Internalsrc.cpp b/biometrics/driver/Internalsrc.cpp
deleted file mode 100644
index 1e8fe6f2..00000000
--- a/biometrics/driver/Internalsrc.cpp
+++ /dev/null
@@ -1 +0,0 @@
-#include "Internal.h" \ No newline at end of file
diff --git a/biometrics/driver/IoQueue.cpp b/biometrics/driver/IoQueue.cpp
deleted file mode 100644
index ce8837d9..00000000
--- a/biometrics/driver/IoQueue.cpp
+++ /dev/null
@@ -1,297 +0,0 @@
-/*++
-
- 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:
-
- IoQueue.cpp
-
-Abstract:
-
- This file implements the I/O queue interface and performs
- the ioctl operations.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-#include "ioqueue.tmh"
-
-
-HRESULT
-CBiometricIoQueue::CreateInstanceAndInitialize(
- _In_ IWDFDevice *FxDevice,
- _In_ CBiometricDevice *BiometricDevice,
- _Out_ CBiometricIoQueue** Queue
- )
-/*++
-
-Routine Description:
-
- CreateInstanceAndInitialize creates an instance of the queue object.
-
-Arguments:
-
-
-Return Value:
-
- HRESULT indicating success or failure
-
---*/
-{
- //
- // Create a new instance of the device class
- //
- CComObject<CBiometricIoQueue> *pMyQueue = NULL;
- HRESULT hr = CComObject<CBiometricIoQueue>::CreateInstance( &pMyQueue );
-
- if (SUCCEEDED(hr)) {
-
- //
- // Initialize the instance.
- //
-
- if (NULL != pMyQueue)
- {
- hr = pMyQueue->Initialize(FxDevice, BiometricDevice);
- }
-
- *Queue = pMyQueue;
-
- }
-
- return hr;
-}
-
-HRESULT
-CBiometricIoQueue::Initialize(
- _In_ IWDFDevice *FxDevice,
- _In_ CBiometricDevice *BiometricDevice
- )
-/*++
-
-Routine Description:
-
- Initialize creates a framework queue and sets up I/O for the queue object.
-
-Arguments:
-
- FxDevice - Framework device associated with this queue.
-
- BiometricDevice - Pointer to the Biometric device class object.
-
-Return Value:
-
- HRESULT indicating success or failure
-
---*/
-{
- IWDFIoQueue *fxQueue = NULL;
- HRESULT hr = S_OK;
- IUnknown *unknown = NULL;
-
- //
- // Make sure we have valid parameters.
- //
- if (FxDevice == NULL) {
- TraceEvents(TRACE_LEVEL_ERROR,
- BIOMETRIC_TRACE_QUEUE,
- "%!FUNC!Pointer to framework device object is NULL.");
- return (E_INVALIDARG);
- }
- if (BiometricDevice == NULL) {
- TraceEvents(TRACE_LEVEL_ERROR,
- BIOMETRIC_TRACE_QUEUE,
- "%!FUNC!Pointer to Biometric device is NULL.");
- return (E_INVALIDARG);
- }
-
- //
- // Create the framework queue
- //
-
- if (SUCCEEDED(hr))
- {
- hr = this->QueryInterface(__uuidof(IUnknown), (void **)&unknown);
-
- }
-
- if (SUCCEEDED(hr))
- {
- hr = FxDevice->CreateIoQueue(unknown,
- FALSE, // Default Queue?
- WdfIoQueueDispatchParallel, // Dispatch type
- FALSE, // Power managed?
- FALSE, // Allow zero-length requests?
- &fxQueue); // I/O queue
- BiometricSafeRelease(unknown);
- }
-
- if (FAILED(hr))
- {
- TraceEvents(TRACE_LEVEL_ERROR,
- BIOMETRIC_TRACE_QUEUE,
- "%!FUNC!Failed to create framework queue.");
- return hr;
- }
-
- //
- // Configure this queue to filter all Device I/O requests.
- //
- hr = FxDevice->ConfigureRequestDispatching(fxQueue,
- WdfRequestDeviceIoControl,
- TRUE);
-
- if (SUCCEEDED(hr))
- {
- m_FxQueue = fxQueue;
- m_BiometricDevice= BiometricDevice;
- }
-
- //
- // Safe to release here. The framework keeps a reference to the Queue
- // for the lifetime of the device.
- //
- BiometricSafeRelease(fxQueue);
-
- return hr;
-}
-
-VOID
-STDMETHODCALLTYPE
-CBiometricIoQueue::OnDeviceIoControl(
- _In_ IWDFIoQueue *FxQueue,
- _In_ IWDFIoRequest *FxRequest,
- _In_ ULONG ControlCode,
- _In_ SIZE_T InputBufferSizeInBytes,
- _In_ SIZE_T OutputBufferSizeInBytes
- )
-/*++
-
-Routine Description:
-
-
- DeviceIoControl dispatch routine
-
-Aruments:
-
- FxQueue - Framework Queue instance
- FxRequest - Framework Request instance
- ControlCode - IO Control Code
- InputBufferSizeInBytes - Lenth of input buffer
- OutputBufferSizeInBytes - Lenth of output buffer
-
- Always succeeds DeviceIoIoctl
-Return Value:
-
- VOID
-
---*/
-{
- UNREFERENCED_PARAMETER(FxQueue);
- UNREFERENCED_PARAMETER(InputBufferSizeInBytes);
- UNREFERENCED_PARAMETER(OutputBufferSizeInBytes);
-
- if (m_BiometricDevice == NULL) {
- // We don't have pointer to device object
- TraceEvents(TRACE_LEVEL_ERROR,
- BIOMETRIC_TRACE_QUEUE,
- "%!FUNC!NULL pointer to device object.");
- FxRequest->Complete(E_POINTER);
- return;
- }
-
- //
- // Process the IOCTLs
- //
-
- switch (ControlCode) {
-
- //
- // Mandatory IOCTLs
- //
- case IOCTL_BIOMETRIC_GET_ATTRIBUTES:
- m_BiometricDevice->OnGetAttributes(FxRequest);
- break;
-
- case IOCTL_BIOMETRIC_RESET:
- m_BiometricDevice->OnReset(FxRequest);
- break;
-
- case IOCTL_BIOMETRIC_CALIBRATE:
- m_BiometricDevice->OnCalibrate(FxRequest);
- break;
-
- case IOCTL_BIOMETRIC_GET_SENSOR_STATUS:
- m_BiometricDevice->OnGetSensorStatus(FxRequest);
- break;
-
- case IOCTL_BIOMETRIC_CAPTURE_DATA:
- m_BiometricDevice->OnCaptureData(FxRequest);
- break;
-
- //
- // Optional IOCTLs
- //
- case IOCTL_BIOMETRIC_UPDATE_FIRMWARE:
- m_BiometricDevice->OnUpdateFirmware(FxRequest);
- break;
-
- case IOCTL_BIOMETRIC_GET_SUPPORTED_ALGORITHMS:
- m_BiometricDevice->OnGetSupportedAlgorithms(FxRequest);
- break;
-
- case IOCTL_BIOMETRIC_GET_INDICATOR:
- m_BiometricDevice->OnGetIndicator(FxRequest);
- break;
-
- case IOCTL_BIOMETRIC_SET_INDICATOR:
- m_BiometricDevice->OnSetIndicator(FxRequest);
- break;
-
- default:
-
- //
- // First check to see if this is for a BIOMETRIC file.
- //
- if ((ControlCode & CTL_CODE(0xFFFFFFFF, 0, 0, 0)) == CTL_CODE(FILE_DEVICE_BIOMETRIC, 0, 0, 0)) {
-
- if ((ControlCode & IOCTL_BIOMETRIC_VENDOR) == IOCTL_BIOMETRIC_VENDOR) {
- // This is a vendor IOCTL.
- m_BiometricDevice->OnControlUnit(FxRequest);
- break;
- }
-
- } else {
-
- // This is a legacy IOCTL - non-Windows Biometric Framework
- TraceEvents(TRACE_LEVEL_ERROR,
- BIOMETRIC_TRACE_QUEUE,
- "%!FUNC!Legacy control units not supported by the driver.");
-
- }
-
- //
- // Didn't match any of the above.
- //
- TraceEvents(TRACE_LEVEL_ERROR,
- BIOMETRIC_TRACE_QUEUE,
- "%!FUNC! Unsupported IOCTL - 0x%x.",
- ControlCode);
- FxRequest->Complete(HRESULT_FROM_WIN32(ERROR_INVALID_FUNCTION));
- break;
-
- }
-
- return;
-
-}
-
diff --git a/biometrics/driver/IoQueue.h b/biometrics/driver/IoQueue.h
deleted file mode 100644
index 1a68416b..00000000
--- a/biometrics/driver/IoQueue.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/*++
-
- 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:
-
- IoQueue.h
-
-Abstract:
-
- This file defines the queue callback interface.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// Queue Callback Object.
-//
-
-class CBiometricIoQueue :
- public CComObjectRootEx<CComMultiThreadModel>,
- public IQueueCallbackDeviceIoControl
-{
-
-public:
-
- DECLARE_NOT_AGGREGATABLE(CBiometricIoQueue)
-
- BEGIN_COM_MAP(CBiometricIoQueue)
- COM_INTERFACE_ENTRY(IQueueCallbackDeviceIoControl)
- END_COM_MAP()
-
- CBiometricIoQueue() :
- m_FxQueue(NULL),
- m_BiometricDevice(NULL)
- {
- }
-
- ~CBiometricIoQueue()
- {
- // empty
- }
-
- HRESULT
- Initialize(
- _In_ IWDFDevice *FxDevice,
- _In_ CBiometricDevice *BiometricDevice
- );
-
- static
- HRESULT
- CreateInstanceAndInitialize(
- _In_ IWDFDevice *FxDevice,
- _In_ CBiometricDevice *BiometricDevice,
- _Out_ CBiometricIoQueue** Queue
- );
-
- HRESULT
- Configure(
- VOID
- )
- {
- return S_OK;
- }
-
- VOID
- Start(
- )
- {
- m_FxQueue->Start();
- }
-
- VOID
- StopSynchronously(
- )
- {
- m_FxQueue->StopSynchronously();
- }
-
- //
- // Wdf Callbacks
- //
-
- //
- // IQueueCallbackDeviceIoControl
- //
- virtual
- VOID
- STDMETHODCALLTYPE
- OnDeviceIoControl(
- _In_ IWDFIoQueue *pWdfQueue,
- _In_ IWDFIoRequest *pWdfRequest,
- _In_ ULONG ControlCode,
- _In_ SIZE_T InputBufferSizeInBytes,
- _In_ SIZE_T OutputBufferSizeInBytes
- );
-
-//
-// Private member variables.
-//
-private:
-
- //
- // Weak reference to framework queue object.
- //
- IWDFIoQueue * m_FxQueue;
-
- //
- // Pointer to device class.
- //
- CBiometricDevice * m_BiometricDevice;
-
-};
diff --git a/biometrics/driver/RequestHelper.h b/biometrics/driver/RequestHelper.h
deleted file mode 100644
index 89a8747c..00000000
--- a/biometrics/driver/RequestHelper.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*++
-
- 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:
-
- RequestHelper.h
-
-Abstract:
-
- This module contains the class definition and implementation
- of an RAII Request object helper class.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// This class handles RAII for IWdfIoRequest pointers.
-// A function can declare this class at the beginning, and
-// set the HRESULT for the request completion.
-//
-// The destructor is always called on function exit.
-// It will complete the request only if the HRESULT
-// is something besides HRESULT_FROM_WIN32(ERROR_IO_PENDING)
-//
-// If the function does not want to complete the request,
-// it should not call SetCompletionHr. Then the request
-// will remain pending.
-//
-
-class CRequestHelper
-{
-
-//
-// Public methods
-//
-public:
-
- CRequestHelper(
- IWDFIoRequest *FxRequest
- )
- {
- m_Request = FxRequest;
- m_Hr = HRESULT_FROM_WIN32(ERROR_IO_PENDING);
- }
-
- ~CRequestHelper()
- {
- if (m_Hr != HRESULT_FROM_WIN32(ERROR_IO_PENDING))
- {
- m_Request->Complete(m_Hr);
- }
- }
-
- void
- SetCompletionHr(
- HRESULT Hr
- )
- {
- m_Hr = Hr;
- }
-
- void
- SetInformation(
- SIZE_T Information
- )
- {
- m_Request->SetInformation(Information);
- }
-
-//
-// Private members
-//
-private:
-
- IWDFIoRequest * m_Request;
- HRESULT m_Hr;
-
-};
diff --git a/biometrics/driver/WudfBioUsbSample.inx b/biometrics/driver/WudfBioUsbSample.inx
deleted file mode 100644
index 71f9277b..00000000
--- a/biometrics/driver/WudfBioUsbSample.inx
+++ /dev/null
Binary files differ
diff --git a/biometrics/driver/WudfBioUsbSample.vcxproj b/biometrics/driver/WudfBioUsbSample.vcxproj
deleted file mode 100644
index c54af93e..00000000
--- a/biometrics/driver/WudfBioUsbSample.vcxproj
+++ /dev/null
@@ -1,327 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{474A1976-0414-48E7-9F2B-4FDED5BA700C}</ProjectGuid>
- <RootNamespace>$(MSBuildProjectName)</RootNamespace>
- <UMDF_VERSION_MAJOR>1</UMDF_VERSION_MAJOR>
- <KMDF_VERSION_MAJOR>1</KMDF_VERSION_MAJOR>
- <SupportsPackaging>false</SupportsPackaging>
- <RequiresPackageProject>true</RequiresPackageProject>
- <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
- <Platform Condition="'$(Platform)' == ''">Win32</Platform>
- <SampleGuid>{446E3007-2D5F-41DF-80D9-3B5FD3ACBF57}</SampleGuid>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>False</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetVersion>Windows10</TargetVersion>
- <UseDebugLibraries>True</UseDebugLibraries>
- <DriverTargetPlatform>Desktop</DriverTargetPlatform>
- <DriverType>UMDF</DriverType>
- <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <PropertyGroup>
- <OutDir>$(IntDir)</OutDir>
- </PropertyGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
- </ImportGroup>
- <ItemGroup Label="WrappedTaskItems">
- <ClCompile Include="device.cpp">
- <WppEnabled>true</WppEnabled>
- <WppDllMacro>true</WppDllMacro>
- <WppScanConfigurationData>internal.h</WppScanConfigurationData>
- <AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreCompiledHeaderFile>Internal.h</PreCompiledHeaderFile>
- <PreCompiledHeader>Use</PreCompiledHeader>
- <PreCompiledHeaderOutputFile>$(IntDir)\Internal.h.pch</PreCompiledHeaderOutputFile>
- </ClCompile>
- <ClCompile Include="dllsup.cpp">
- <WppEnabled>true</WppEnabled>
- <WppDllMacro>true</WppDllMacro>
- <WppScanConfigurationData>internal.h</WppScanConfigurationData>
- <AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreCompiledHeaderFile>Internal.h</PreCompiledHeaderFile>
- <PreCompiledHeader>Use</PreCompiledHeader>
- <PreCompiledHeaderOutputFile>$(IntDir)\Internal.h.pch</PreCompiledHeaderOutputFile>
- </ClCompile>
- <ClCompile Include="driver.cpp">
- <WppEnabled>true</WppEnabled>
- <WppDllMacro>true</WppDllMacro>
- <WppScanConfigurationData>internal.h</WppScanConfigurationData>
- <AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreCompiledHeaderFile>Internal.h</PreCompiledHeaderFile>
- <PreCompiledHeader>Use</PreCompiledHeader>
- <PreCompiledHeaderOutputFile>$(IntDir)\Internal.h.pch</PreCompiledHeaderOutputFile>
- </ClCompile>
- <ClCompile Include="ioqueue.cpp">
- <WppEnabled>true</WppEnabled>
- <WppDllMacro>true</WppDllMacro>
- <WppScanConfigurationData>internal.h</WppScanConfigurationData>
- <AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreCompiledHeaderFile>Internal.h</PreCompiledHeaderFile>
- <PreCompiledHeader>Use</PreCompiledHeader>
- <PreCompiledHeaderOutputFile>$(IntDir)\Internal.h.pch</PreCompiledHeaderOutputFile>
- </ClCompile>
- <Inf Include="WudfBioUsbSample.inx">
- <Architecture>$(InfArch)</Architecture>
- <SpecifyArchitecture>true</SpecifyArchitecture>
- <CopyOutput>.\$(IntDir)\WudfBioUsbSample.inf</CopyOutput>
- </Inf>
- <OtherWpp Include="BioUsbSample.rc">
- <WppEnabled>true</WppEnabled>
- <WppDllMacro>true</WppDllMacro>
- <WppScanConfigurationData>internal.h</WppScanConfigurationData>
- </OtherWpp>
- </ItemGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <TargetName>WudfBioUsbSample</TargetName>
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- <UseOfAtl>Dynamic</UseOfAtl>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <TargetName>WudfBioUsbSample</TargetName>
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- <UseOfAtl>Dynamic</UseOfAtl>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetName>WudfBioUsbSample</TargetName>
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- <UseOfAtl>Dynamic</UseOfAtl>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetName>WudfBioUsbSample</TargetName>
- <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION>
- <NTDDI_VERSION>0x0A000000</NTDDI_VERSION>
- <UseOfAtl>Dynamic</UseOfAtl>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <DisableSpecificWarnings>%(DisableSpecificWarnings);4201</DisableSpecificWarnings>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <DisableSpecificWarnings>%(DisableSpecificWarnings);4201</DisableSpecificWarnings>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <DisableSpecificWarnings>%(DisableSpecificWarnings);4201</DisableSpecificWarnings>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <TreatWarningAsError>true</TreatWarningAsError>
- <WarningLevel>Level4</WarningLevel>
- <DisableSpecificWarnings>%(DisableSpecificWarnings);4201</DisableSpecificWarnings>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ClCompile>
- <Midl>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </Midl>
- <ResourceCompile>
- <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions>
- </ResourceCompile>
- <Link>
- <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol>
- <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);inc;$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);inc;$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);inc;$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\advapi32.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\ole32.lib;$(SDK_LIB_PATH)\oleaut32.lib;$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\user32.lib;$(SDK_LIB_PATH)\uuid.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);inc;$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);inc;$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);inc;$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\advapi32.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\ole32.lib;$(SDK_LIB_PATH)\oleaut32.lib;$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\user32.lib;$(SDK_LIB_PATH)\uuid.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);inc;$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);inc;$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);inc;$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\advapi32.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\ole32.lib;$(SDK_LIB_PATH)\oleaut32.lib;$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\user32.lib;$(SDK_LIB_PATH)\uuid.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ResourceCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);inc;$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </ResourceCompile>
- <ClCompile>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);inc;$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- <ExceptionHandling>
- </ExceptionHandling>
- </ClCompile>
- <Midl>
- <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);inc;$(DDK_INC_PATH)</AdditionalIncludeDirectories>
- </Midl>
- <Link>
- <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\advapi32.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\ole32.lib;$(SDK_LIB_PATH)\oleaut32.lib;$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\user32.lib;$(SDK_LIB_PATH)\uuid.lib</AdditionalDependencies>
- <ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
- </Link>
- <DriverSign>
- <FileDigestAlgorithm>sha256</FileDigestAlgorithm>
- </DriverSign>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="Internalsrc.cpp">
- <AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreCompiledHeaderFile>Internal.h</PreCompiledHeaderFile>
- <PreCompiledHeader>Create</PreCompiledHeader>
- <PreCompiledHeaderOutputFile>$(IntDir)\Internal.h.pch</PreCompiledHeaderOutputFile>
- </ClCompile>
- <ResourceCompile Include="BioUsbSample.rc" />
- </ItemGroup>
- <ItemGroup>
- <Inf Exclude="@(Inf)" Include="*.inf" />
- <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" />
- </ItemGroup>
- <ItemGroup>
- <None Exclude="@(None)" Include="*.txt;*.htm;*.html" />
- <None Exclude="@(None)" Include="*.ico;*.cur;*.bmp;*.dlg;*.rct;*.gif;*.jpg;*.jpeg;*.wav;*.jpe;*.tiff;*.tif;*.png;*.rc2" />
- <None Exclude="@(None)" Include="*.def;*.bat;*.hpj;*.asmx" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-</Project> \ No newline at end of file
diff --git a/biometrics/driver/WudfBioUsbSample.vcxproj.Filters b/biometrics/driver/WudfBioUsbSample.vcxproj.Filters
deleted file mode 100644
index f4bbd976..00000000
--- a/biometrics/driver/WudfBioUsbSample.vcxproj.Filters
+++ /dev/null
@@ -1,73 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions>
- <UniqueIdentifier>{E6E929B2-2CDF-41CF-9E24-FC00BD508586}</UniqueIdentifier>
- </Filter>
- <Filter Include="Header Files">
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- <UniqueIdentifier>{4197754B-41E9-46E9-BB6C-32A9FD55F25C}</UniqueIdentifier>
- </Filter>
- <Filter Include="Resource Files">
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions>
- <UniqueIdentifier>{216999F8-06DE-407C-B349-8709AD141CCF}</UniqueIdentifier>
- </Filter>
- <Filter Include="Driver Files">
- <Extensions>inf;inv;inx;mof;mc;</Extensions>
- <UniqueIdentifier>{41FD81A3-D683-4D3C-91BE-D00EB56515FE}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="device.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="dllsup.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="driver.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="Internalsrc.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="ioqueue.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <Inf Include="WudfBioUsbSample.inx">
- <Filter>Driver Files</Filter>
- </Inf>
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="BioUsbSample.rc">
- <Filter>Resource Files</Filter>
- </ResourceCompile>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd">
- <Filter>Header Files</Filter>
- </ClInclude>
- </ItemGroup>
- <ItemGroup>
- <None Include="*.def;*.bat;*.hpj;*.asmx">
- <Filter>Source Files</Filter>
- </None>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/biometrics/driver/dllsup.cpp b/biometrics/driver/dllsup.cpp
deleted file mode 100644
index 8030a1c0..00000000
--- a/biometrics/driver/dllsup.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/*++
-
- 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:
-
- Dllsup.cpp
-
-Abstract:
-
- This module contains the implementation of the Driver DLL entry point.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#include "internal.h"
-#include "dllsup.tmh"
-
-//
-// TODO - define a new GUID here
-// This GUID goes in the inf file in the DriverCLSID value for the service binary
-// {F1CB3C15-A916-47bc-BEA1-D5D4163BC6AE}
-//
-const CLSID CLSID_BiometricUsbSample =
-{ 0xf1cb3c15, 0xa916, 0x47bc, { 0xbe, 0xa1, 0xd5, 0xd4, 0x16, 0x3b, 0xc6, 0xae } };
-
-
-
-HINSTANCE g_hInstance = NULL;
-
-class CBiometricDriverModule :
- public CAtlDllModuleT< CBiometricDriverModule >
-{
-};
-
-CBiometricDriverModule _AtlModule;
-
-//
-// DLL Entry Point
-//
-
-extern "C"
-BOOL
-WINAPI
-DllMain(
- HINSTANCE hInstance,
- DWORD dwReason,
- LPVOID lpReserved
- )
-{
- if (dwReason == DLL_PROCESS_ATTACH) {
- WPP_INIT_TRACING(MYDRIVER_TRACING_ID);
-
- g_hInstance = hInstance;
- DisableThreadLibraryCalls(hInstance);
-
- } else if (dwReason == DLL_PROCESS_DETACH) {
- WPP_CLEANUP();
- }
-
- return _AtlModule.DllMain(dwReason, lpReserved);
-}
-
-
-//
-// Returns a class factory to create an object of the requested type
-//
-
-STDAPI
-DllGetClassObject(
- _In_ REFCLSID rclsid,
- _In_ REFIID riid,
- _Outptr_ LPVOID FAR* ppv
- )
-{
- return _AtlModule.DllGetClassObject(rclsid, riid, ppv);
-}
-
-
diff --git a/biometrics/driver/exports.def b/biometrics/driver/exports.def
deleted file mode 100644
index 37b13622..00000000
--- a/biometrics/driver/exports.def
+++ /dev/null
@@ -1,10 +0,0 @@
-; Exports.def : Declares the module parameters.
-
-;
-; TODO: Change the library name here to match your binary name.
-;
-
-LIBRARY "WudfBioUsbSample.DLL"
-
-EXPORTS
- DllGetClassObject PRIVATE
diff --git a/biometrics/driver/inc/public.h b/biometrics/driver/inc/public.h
deleted file mode 100644
index 11a7e8fa..00000000
--- a/biometrics/driver/inc/public.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*++
-
- 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:
-
- public.h
-
-Abstract:
-
- Public definitions for the Biometric Device.
-
-Environment:
-
- User & Kernel mode
-
---*/
-
-#ifndef _PUBLIC_H
-#define _PUBLIC_H
-
-#include <initguid.h>
-
-//
-// INTERRUPT_MESSAGE
-//
-
-typedef struct _INTERRUPT_MESSAGE
-{
-
- //
- // TODO: Fill this in with your device specific fields.
- //
-
-} INTERRUPT_MESSAGE, *PINTERRUPT_MESSAGE;
-
-#endif
diff --git a/biometrics/driver/inc/usb_hw.h b/biometrics/driver/inc/usb_hw.h
deleted file mode 100644
index 299e7a02..00000000
--- a/biometrics/driver/inc/usb_hw.h
+++ /dev/null
@@ -1,238 +0,0 @@
-/*++
-
- 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:
-
- Usb.h
-
-Abstract:
-
- Contains prototypes for interfacing with a USB connected device. These
- are copied from the KMDF WDFUSB.H header file (but with the WDF specific
- portions removed)
-
-Environment:
-
- kernel mode only
-
---*/
-
-#pragma once
-
-typedef enum _WINUSB_BMREQUEST_DIRECTION {
- BmRequestHostToDevice = BMREQUEST_HOST_TO_DEVICE,
- BmRequestDeviceToHost = BMREQUEST_DEVICE_TO_HOST,
-} WINUSB_BMREQUEST_DIRECTION;
-
-typedef enum _WINUSB_BMREQUEST_TYPE {
- BmRequestStandard = BMREQUEST_STANDARD,
- BmRequestClass = BMREQUEST_CLASS,
- BmRequestVendor = BMREQUEST_VENDOR,
-} WINUSB_BMREQUEST_TYPE;
-
-typedef enum _WINUSB_BMREQUEST_RECIPIENT {
- BmRequestToDevice = BMREQUEST_TO_DEVICE,
- BmRequestToInterface = BMREQUEST_TO_INTERFACE,
- BmRequestToEndpoint = BMREQUEST_TO_ENDPOINT,
- BmRequestToOther = BMREQUEST_TO_OTHER,
-} WINUSB_BMREQUEST_RECIPIENT;
-
-typedef enum _WINUSB_DEVICE_TRAITS {
- WINUSB_DEVICE_TRAIT_SELF_POWERED = 0x00000001,
- WINUSB_DEVICE_TRAIT_REMOTE_WAKE_CAPABLE = 0x00000002,
- WINUSB_DEVICE_TRAIT_AT_HIGH_SPEED = 0x00000004,
-} WINUSB_DEVICE_TRAITS;
-
-typedef enum _WdfUsbTargetDeviceSelectInterfaceType {
- WdfUsbTargetDeviceSelectInterfaceTypeInterface = 0x10,
- WdfUsbTargetDeviceSelectInterfaceTypeUrb = 0x11,
-} WdfUsbTargetDeviceSelectInterfaceType;
-
-
-
-typedef union _WINUSB_CONTROL_SETUP_PACKET {
- struct {
- union {
- #pragma warning(disable:4214) // bit field types other than int
- struct {
- //
- // Valid values are BMREQUEST_TO_DEVICE, BMREQUEST_TO_INTERFACE,
- // BMREQUEST_TO_ENDPOINT, BMREQUEST_TO_OTHER
- //
- BYTE Recipient:2;
-
- BYTE Reserved:3;
-
- //
- // Valid values are BMREQUEST_STANDARD, BMREQUEST_CLASS,
- // BMREQUEST_VENDOR
- //
- BYTE Type:2;
-
- //
- // Valid values are BMREQUEST_HOST_TO_DEVICE,
- // BMREQUEST_DEVICE_TO_HOST
- //
- BYTE Dir:1;
- } Request;
- #pragma warning(default:4214) // bit field types other than int
- BYTE Byte;
- } bm;
-
- BYTE bRequest;
-
- union {
- struct {
- BYTE LowByte;
- BYTE HiByte;
- } Bytes;
- USHORT Value;
- } wValue;
-
- union {
- struct {
- BYTE LowByte;
- BYTE HiByte;
- } Bytes;
- USHORT Value;
- } wIndex;
-
- USHORT wLength;
- } Packet;
-
- struct {
- BYTE Bytes[8];
- } Generic;
-
- WINUSB_SETUP_PACKET WinUsb;
-
-} WINUSB_CONTROL_SETUP_PACKET, *PWINUSB_CONTROL_SETUP_PACKET;
-
-VOID
-FORCEINLINE
-WINUSB_CONTROL_SETUP_PACKET_INIT(
- PWINUSB_CONTROL_SETUP_PACKET Packet,
- WINUSB_BMREQUEST_DIRECTION Direction,
- WINUSB_BMREQUEST_RECIPIENT Recipient,
- BYTE Request,
- USHORT Value,
- USHORT Index
- )
-{
- RtlZeroMemory(Packet, sizeof(WINUSB_CONTROL_SETUP_PACKET));
-
- Packet->Packet.bm.Request.Dir = (BYTE) Direction;
- Packet->Packet.bm.Request.Type = (BYTE) BmRequestStandard;
- Packet->Packet.bm.Request.Recipient = (BYTE) Recipient;
-
- Packet->Packet.bRequest = Request;
- Packet->Packet.wValue.Value = Value;
- Packet->Packet.wIndex.Value = Index;
-
- // Packet->Packet.wLength will be set by the formatting function
-}
-
-VOID
-FORCEINLINE
-WINUSB_CONTROL_SETUP_PACKET_INIT_CLASS(
- PWINUSB_CONTROL_SETUP_PACKET Packet,
- WINUSB_BMREQUEST_DIRECTION Direction,
- WINUSB_BMREQUEST_RECIPIENT Recipient,
- BYTE Request,
- USHORT Value,
- USHORT Index
- )
-{
- RtlZeroMemory(Packet, sizeof(WINUSB_CONTROL_SETUP_PACKET));
-
- Packet->Packet.bm.Request.Dir = (BYTE) Direction;
- Packet->Packet.bm.Request.Type = (BYTE) BmRequestClass;
- Packet->Packet.bm.Request.Recipient = (BYTE) Recipient;
-
- Packet->Packet.bRequest = Request;
- Packet->Packet.wValue.Value = Value;
- Packet->Packet.wIndex.Value = Index;
-
- // Packet->Packet.wLength will be set by the formatting function
-}
-
-VOID
-FORCEINLINE
-WINUSB_CONTROL_SETUP_PACKET_INIT_VENDOR(
- PWINUSB_CONTROL_SETUP_PACKET Packet,
- WINUSB_BMREQUEST_DIRECTION Direction,
- WINUSB_BMREQUEST_RECIPIENT Recipient,
- BYTE Request,
- USHORT Value,
- USHORT Index
- )
-{
- RtlZeroMemory(Packet, sizeof(WINUSB_CONTROL_SETUP_PACKET));
-
- Packet->Packet.bm.Request.Dir = (BYTE) Direction;
- Packet->Packet.bm.Request.Type = (BYTE) BmRequestVendor;
- Packet->Packet.bm.Request.Recipient = (BYTE) Recipient;
-
- Packet->Packet.bRequest = Request;
- Packet->Packet.wValue.Value = Value;
- Packet->Packet.wIndex.Value = Index;
-
- // Packet->Packet.wLength will be set by the formatting function
-}
-
-VOID
-FORCEINLINE
-WINUSB_CONTROL_SETUP_PACKET_INIT_FEATURE(
- PWINUSB_CONTROL_SETUP_PACKET Packet,
- WINUSB_BMREQUEST_RECIPIENT BmRequestRecipient,
- USHORT FeatureSelector,
- USHORT Index,
- BOOLEAN SetFeature
- )
-{
- RtlZeroMemory(Packet, sizeof(WINUSB_CONTROL_SETUP_PACKET));
-
- Packet->Packet.bm.Request.Dir = (BYTE) BmRequestHostToDevice;
- Packet->Packet.bm.Request.Type = (BYTE) BmRequestStandard;
- Packet->Packet.bm.Request.Recipient = (BYTE) BmRequestRecipient;
-
- if (SetFeature) {
- Packet->Packet.bRequest = USB_REQUEST_SET_FEATURE;
- }
- else {
- Packet->Packet.bRequest = USB_REQUEST_CLEAR_FEATURE;
- }
-
- Packet->Packet.wValue.Value = FeatureSelector;
- Packet->Packet.wIndex.Value = Index;
-
- // Packet->Packet.wLength will be set by the formatting function
-}
-
-VOID
-FORCEINLINE
-WINUSB_CONTROL_SETUP_PACKET_INIT_GET_STATUS(
- PWINUSB_CONTROL_SETUP_PACKET Packet,
- WINUSB_BMREQUEST_RECIPIENT BmRequestRecipient,
- USHORT Index
- )
-{
- RtlZeroMemory(Packet, sizeof(WINUSB_CONTROL_SETUP_PACKET));
-
- Packet->Packet.bm.Request.Dir = (BYTE) BmRequestDeviceToHost;
- Packet->Packet.bm.Request.Type = (BYTE) BmRequestStandard;
- Packet->Packet.bm.Request.Recipient = (BYTE) BmRequestRecipient;
-
- Packet->Packet.bRequest = USB_REQUEST_GET_STATUS;
- Packet->Packet.wIndex.Value = Index;
- Packet->Packet.wValue.Value = 0;
-
- // Packet->Packet.wLength will be set by the formatting function
-}
-
diff --git a/biometrics/driver/internal.h b/biometrics/driver/internal.h
deleted file mode 100644
index bbccbdba..00000000
--- a/biometrics/driver/internal.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/*++
-
- 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:
-
- Internal.h
-
-Abstract:
-
- This module contains necessary include directives, WPP tracing macros,
- and string definitions for the Biometric driver sample.
-
-Environment:
-
- Windows User-Mode Driver Framework (WUDF)
-
---*/
-
-#pragma once
-
-//
-// ATL support
-//
-#include "atlbase.h"
-#include "atlcom.h"
-
-//
-// Include the WUDF Headers
-//
-
-#include "wudfddi.h"
-
-//
-// Use specstrings for in/out annotation of function parameters.
-//
-
-#include "specstrings.h"
-
-//
-// Get limits on common data types (ULONG_MAX for example)
-//
-
-#include "limits.h"
-
-//
-// We need usb I/O targets to talk to the USB device.
-//
-
-#include "wudfusb.h"
-
-//
-// WinUsb structures.
-//
-
-#include "usb_hw.h"
-
-//
-// Public definitions.
-//
-#include "public.h"
-
-//
-// GUID include
-//
-#include <initguid.h>
-
-//
-// Windows IOCTL definitions.
-//
-#include "winioctl.h"
-
-//
-// WinBio includes
-//
-#include "winbio_types.h"
-#include "winbio_err.h"
-#include "winbio_ioctl.h"
-
-//
-// RAII helper class for requests
-//
-#include "RequestHelper.h"
-
-//
-// Define the tracing flags.
-//
-// Tracing GUID defined in BioUsbSample.ctl - 864936A6-DB79-451e-B764-E720D61A9361
-//
-// TODO: Generate a new tracing GUID for your driver, and replace all
-// instances of the GUID above with your new GUID.
-//
-
-#define WPP_CONTROL_GUIDS \
- WPP_DEFINE_CONTROL_GUID( \
- WudfBioUsbSampleTraceGuid, (864936A6,DB79,451e,B764,E720D61A9361), \
- \
- WPP_DEFINE_BIT(MYDRIVER_ALL_INFO) \
- WPP_DEFINE_BIT(BIOMETRIC_TRACE_DRIVER) \
- WPP_DEFINE_BIT(BIOMETRIC_TRACE_DEVICE) \
- WPP_DEFINE_BIT(BIOMETRIC_TRACE_QUEUE) \
- )
-
-#define WPP_FLAG_LEVEL_LOGGER(flag, level) \
- WPP_LEVEL_LOGGER(flag)
-
-#define WPP_FLAG_LEVEL_ENABLED(flag, level) \
- (WPP_LEVEL_ENABLED(flag) && \
- WPP_CONTROL(WPP_BIT_ ## flag).Level >= level)
-
-#define WPP_LEVEL_FLAGS_LOGGER(lvl,flags) \
- WPP_LEVEL_LOGGER(flags)
-
-#define WPP_LEVEL_FLAGS_ENABLED(lvl, flags) \
- (WPP_LEVEL_ENABLED(flags) && WPP_CONTROL(WPP_BIT_ ## flags).Level >= lvl)
-
-//
-// This comment block is scanned by the trace preprocessor to define our
-// Trace function.
-//
-// begin_wpp config
-// FUNC Trace{FLAG=MYDRIVER_ALL_INFO}(LEVEL, MSG, ...);
-// FUNC TraceEvents(LEVEL, FLAGS, MSG, ...);
-// end_wpp
-//
-
-//
-// Forward definition of queue.
-//
-typedef class CBiometricIoQueue *PCBiometricIoQueue;
-
-//
-// Include the type specific headers.
-//
-#include "Driver.h"
-#include "Device.h"
-#include "IoQueue.h"
-
-//
-// Driver specific #defines
-// TODO: Put strings specific to your device here.
-//
-
-#define MYDRIVER_TRACING_ID L"Microsoft\\UMDF\\Biometric USB Sample V1.0"
-
-#define SAMPLE_MANUFACTURER_NAME L"Biometric Sample Manufacturer"
-#define SAMPLE_MODEL_NAME L"Biometric Sample Model"
-#define SAMPLE_SERIAL_NUMBER L"000-000-000"
-
-
-template <typename T>
-inline void BiometricSafeRelease(T *&t)
-{
- if (t)
- {
- t->Release();
- }
- t = NULL;
-}
diff --git a/biometrics/driver/resource.h b/biometrics/driver/resource.h
deleted file mode 100644
index 09e852e8..00000000
--- a/biometrics/driver/resource.h
+++ /dev/null
@@ -1,4 +0,0 @@
-//
-// Copyright (C) Microsoft. All rights reserved.
-//
-#define IDR_MYDRIVER_CLASSINFO 101