通过对 Windows 生物识别框架 API 函数的早期调用释放为客户端应用程序分配的内存。 从 Windows 10 版本 1607 开始,此函数可用于移动映像。
Syntax
HRESULT WinBioFree(
[in] PVOID Address
);
参数
[in] Address
要删除的内存块的地址。
返回值
如果函数成功,它将返回S_OK。 如果函数失败,它将返回指示错误的 HRESULT 值。 可能的值包括但不限于下表中的值。 有关常见错误代码的列表,请参阅 通用 HRESULT 值。
| 返回代码 | Description |
|---|---|
|
Address 参数不能为 NULL。 |
注解
Windows 生物识别框架 API 中的多个函数为客户端应用程序分配内存,并将该内存的地址传递给客户端。 若要防止内存泄漏,在使用 WinBioFree 包含的信息完成后,必须调用 WinBioFree 删除该块。 通过将内存地址传递给 WinBioFree 来删除内存。 可以通过取消引用以下每个函数中的相应参数指定的指针来查找地址。
| 功能 | 参数 | 已分配块的类型 |
|---|---|---|
| WinBioCaptureSample | 示例 | 结构 |
| WinBioEnumBiometricUnits | UnitSchemaArray | 结构数组 |
| WinBioEnumDatabases | StorageSchemaArray | 结构数组 |
| WinBioEnumEnrollments | SubFactorArray | 整数数组 |
| WinBioEnumServiceProviders | BspSchemaArray | 结构数组 |
| EventCallBack | Event | 结构 |
| CaptureCallback | 示例 | 结构 |
例子
以下函数调用 WinBioEnumBiometricUnits 来枚举已安装的生物识别传感器,并调用 WinBioFree 释放 WinBioEnumBiometricUnits 创建的内存。 链接到 Winbio.lib 静态库,并包含以下头文件:
- Windows.h
- Stdio.h
- Conio.h
- Winbio.h
HRESULT EnumerateSensors( )
{
HRESULT hr = S_OK;
PWINBIO_UNIT_SCHEMA unitSchema = NULL;
SIZE_T unitCount = 0;
// Enumerate the installed biometric units.
hr = WinBioEnumBiometricUnits(
WINBIO_TYPE_FINGERPRINT, // Type of biometric unit
&unitSchema, // Array of unit schemas
&unitCount ); // Count of unit schemas
if (FAILED(hr))
{
wprintf_s(L"\nWinBioEnumBiometricUnits failed. hr = 0x%x\n", hr);
goto e_Exit;
}
e_Exit:
// Free memory.
if (unitSchema != NULL)
{
WinBioFree(unitSchema);
unitSchema = NULL;
}
return hr;
}
要求
| Requirement | 价值 |
|---|---|
| 最低支持的客户端 | Windows 7 [仅限桌面应用] |
| 支持的最低服务器 | Windows Server 2008 R2 [仅限桌面应用] |
| 目标平台 | Windows操作系统 |
| Header | winbio.h (包括 Winbio.h) |
| Library | Winbio.lib |
| DLL | Winbio.dll |