C++ - 向 WBF 发送 IOCTL 命令以获取 Windows 上的传感器属性
C++ - Send IOCTL command to WBF to get sensor attributes on Windows
我正在尝试了解如何使用 WBF API 检索 WINBIO_SENSOR_ATTRIBUTES 缓冲区。
我发现这个 link:https://msdn.microsoft.com/en-us/library/windows/hardware/ff536431
它提到了发送 IOCTL 命令,但是,我无法理解如何从 C++ 代码中调用它并接收传感器属性结构。有人可以帮忙吗?或者指出一些执行类似操作的示例代码?
首先看一下DeviceIoControl - this is the function to which you must supply the IOCTL_BIOMETRIC_GET_ATTRIBUTES
value as the second parameter to obtain the biometric data (the link you included describes how to handle the size ouf the output buffer - first supply a DWORD
sized buffer to get the actual size of the output and then allocate a properly sized buffer and retrieve the actual data). But to do this you also need a valid device handle (first parameter of DeviceIoControl). This handle should be obtained by calling CreateFile并传递驱动程序的设备名称。如果您不知道 PDO,那么您可以尝试在设备管理器中查看 "Details" 选项卡下的内容,或者您必须使用 SetupDi* 系列函数来枚举生物识别设备 class并从那里获取名称。
我正在尝试了解如何使用 WBF API 检索 WINBIO_SENSOR_ATTRIBUTES 缓冲区。 我发现这个 link:https://msdn.microsoft.com/en-us/library/windows/hardware/ff536431
它提到了发送 IOCTL 命令,但是,我无法理解如何从 C++ 代码中调用它并接收传感器属性结构。有人可以帮忙吗?或者指出一些执行类似操作的示例代码?
首先看一下DeviceIoControl - this is the function to which you must supply the IOCTL_BIOMETRIC_GET_ATTRIBUTES
value as the second parameter to obtain the biometric data (the link you included describes how to handle the size ouf the output buffer - first supply a DWORD
sized buffer to get the actual size of the output and then allocate a properly sized buffer and retrieve the actual data). But to do this you also need a valid device handle (first parameter of DeviceIoControl). This handle should be obtained by calling CreateFile并传递驱动程序的设备名称。如果您不知道 PDO,那么您可以尝试在设备管理器中查看 "Details" 选项卡下的内容,或者您必须使用 SetupDi* 系列函数来枚举生物识别设备 class并从那里获取名称。