ホーム › Devices.BiometricFramework › PIBIO_SENSOR_EXPORT_SENSOR_DATA_FN
PIBIO_SENSOR_EXPORT_SENSOR_DATA_FN
コールバックシグネチャ
HRESULT PIBIO_SENSOR_EXPORT_SENSOR_DATA_FN(
WINBIO_PIPELINE* Pipeline,
WINBIO_BIR** SampleBuffer,
UINT_PTR* SampleSize
);パラメーター
| フィールド | 型 | 説明 |
|---|---|---|
| Pipeline | WINBIO_PIPELINE* | 操作を実行する生体認証ユニットに関連付けられた WINBIO_PIPELINE 構造体へのポインター。 |
| SampleBuffer | WINBIO_BIR** | サンプルを格納する WINBIO_BIR 構造体へのポインターを受け取る変数のアドレス。 |
| SampleSize | UINT_PTR* | SampleBuffer パラメーターで指定されたバッファーのサイズ (バイト単位) を受け取る変数へのポインター。 |
公式ドキュメント
直近にキャプチャされた生体サンプルのコピーを標準の WINBIO_BIR 構造体の形式で取得するために、Windows Biometric Framework から呼び出されます。
戻り値
関数が成功した場合は S_OK を返します。関数が失敗した場合は、エラーを示すために次のいずれかの HRESULT 値を返す必要があります。
| 戻り値 | 説明 |
|---|---|
| WINBIO_BIR 構造体を作成するための十分なメモリがありません。 | |
| 必須のポインターパラメーターが NULL です。 | |
| Pipeline 引数が指す WINBIO_PIPELINE 構造体の SensorContext メンバーが NULL です。 | |
| キャプチャデータが存在しません。 | |
| このメソッドは現在実装されていません。 |
解説(Remarks)
SampleBuffer パラメーターで返すバッファーは、HeapAlloc 関数を使用してプロセスヒープから割り当てる必要があります。作成されたバッファーは Windows Biometric Framework の所有物になります。Framework は使用を終えた時点でこのメモリを解放するため、この関数の実装ではバッファーを解放したり、そのポインターを保存したりしてはなりません。ポインターを保存しないことで、この関数から戻った後にエンジンアダプターの他の部分がそのバッファーを使用しようとするのを防げます。
例
次の擬似コードは、この関数の実装の一例を示しています。この例はそのままではコンパイルできません。目的に合わせて調整してください。
//////////////////////////////////////////////////////////////////////////////////////////
//
// SensorAdapterExportSensorData
//
// Purpose:
// Retrieves a copy of the most recently captured biometric sample.
//
// Parameters:
// Pipeline - Pointer to a WINBIO_PIPELINE structure associated with
// the biometric unit.
// SampleBuffer - Address of a variable that receives a pointer to a
// WINBIO_BIR structure that contains the sample.
// SampleSize - Pointer to a variable that receives the size, in bytes,
// of the buffer specified by the SampleBuffer parameter.
//
static HRESULT
WINAPI
SensorAdapterExportSensorData(
__inout PWINBIO_PIPELINE Pipeline,
__out PWINBIO_BIR *SampleBuffer,
__out SIZE_T *SampleSize
)
{
PWINBIO_BIR sampleBuffer = NULL;
// Verify that pointer arguments are not NULL.
if (!ARGUMENT_PRESENT(Pipeline) ||
!ARGUMENT_PRESENT(SampleBuffer) ||
!ARGUMENT_PRESENT(SampleSize))
{
hr = E_POINTER;
goto cleanup;
}
// Retrieve the context from the pipeline.
PWINBIO_SENSOR_CONTEXT sensorContext =
(PWINBIO_SENSOR_CONTEXT)Pipeline->SensorContext;
// Verify the state of the pipeline.
if (sensorContext == NULL)
{
return WINBIO_E_INVALID_DEVICE_STATE;
}
// Determine whether there is capture data to return.
if (sensorContext->CaptureBuffer == NULL ||
sensorContext->CaptureBuffer->CaptureData.Size == 0)
{
return WINBIO_E_NO_CAPTURE_DATA;
}
// Allocate a buffer, copy the data into it, and return
// the buffer and buffer size to the caller.
sampleBuffer = _AdapterAlloc(sensorContext->CaptureBuffer->CaptureData.Size);
if (sampleBuffer == NULL)
{
return E_OUTOFMEMORY;
}
RtlCopyMemory(
sampleBuffer,
sensorContext->CaptureBuffer->CaptureData.Data,
sensorContext->CaptureBuffer->CaptureData.Size
);
*SampleBuffer = sampleBuffer;
sampleBuffer = NULL;
*SampleSize = Pipeline->SensorContext->CaptureBuffer->CaptureData.Size;
return S_OK;
}
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)