Win32 API 日本語リファレンス
ホームDevices.BiometricFramework › WinBioSetCredential

WinBioSetCredential

関数
指定種別の生体認証資格情報を設定する。
DLLwinbio.dll呼出規約winapi対応OSWindows 8.1 以降

シグネチャ

// winbio.dll
#include <windows.h>

HRESULT WinBioSetCredential(
    WINBIO_CREDENTIAL_TYPE Type,
    BYTE* Credential,
    UINT_PTR CredentialSize,
    WINBIO_CREDENTIAL_FORMAT Format
);

パラメーター

名前方向
TypeWINBIO_CREDENTIAL_TYPEin
CredentialBYTE*in
CredentialSizeUINT_PTRin
FormatWINBIO_CREDENTIAL_FORMATin

戻り値の型: HRESULT

各言語での呼び出し定義

// winbio.dll
#include <windows.h>

HRESULT WinBioSetCredential(
    WINBIO_CREDENTIAL_TYPE Type,
    BYTE* Credential,
    UINT_PTR CredentialSize,
    WINBIO_CREDENTIAL_FORMAT Format
);
[DllImport("winbio.dll", ExactSpelling = true)]
static extern int WinBioSetCredential(
    int Type,   // WINBIO_CREDENTIAL_TYPE
    IntPtr Credential,   // BYTE*
    UIntPtr CredentialSize,   // UINT_PTR
    int Format   // WINBIO_CREDENTIAL_FORMAT
);
<DllImport("winbio.dll", ExactSpelling:=True)>
Public Shared Function WinBioSetCredential(
    Type As Integer,   ' WINBIO_CREDENTIAL_TYPE
    Credential As IntPtr,   ' BYTE*
    CredentialSize As UIntPtr,   ' UINT_PTR
    Format As Integer   ' WINBIO_CREDENTIAL_FORMAT
) As Integer
End Function
' Type : WINBIO_CREDENTIAL_TYPE
' Credential : BYTE*
' CredentialSize : UINT_PTR
' Format : WINBIO_CREDENTIAL_FORMAT
Declare PtrSafe Function WinBioSetCredential Lib "winbio" ( _
    ByVal Type As Long, _
    ByVal Credential As LongPtr, _
    ByVal CredentialSize As LongPtr, _
    ByVal Format As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WinBioSetCredential = ctypes.windll.winbio.WinBioSetCredential
WinBioSetCredential.restype = ctypes.c_int
WinBioSetCredential.argtypes = [
    ctypes.c_int,  # Type : WINBIO_CREDENTIAL_TYPE
    ctypes.POINTER(ctypes.c_ubyte),  # Credential : BYTE*
    ctypes.c_size_t,  # CredentialSize : UINT_PTR
    ctypes.c_int,  # Format : WINBIO_CREDENTIAL_FORMAT
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('winbio.dll')
WinBioSetCredential = Fiddle::Function.new(
  lib['WinBioSetCredential'],
  [
    Fiddle::TYPE_INT,  # Type : WINBIO_CREDENTIAL_TYPE
    Fiddle::TYPE_VOIDP,  # Credential : BYTE*
    Fiddle::TYPE_UINTPTR_T,  # CredentialSize : UINT_PTR
    Fiddle::TYPE_INT,  # Format : WINBIO_CREDENTIAL_FORMAT
  ],
  Fiddle::TYPE_INT)
#[link(name = "winbio")]
extern "system" {
    fn WinBioSetCredential(
        Type: i32,  // WINBIO_CREDENTIAL_TYPE
        Credential: *mut u8,  // BYTE*
        CredentialSize: usize,  // UINT_PTR
        Format: i32  // WINBIO_CREDENTIAL_FORMAT
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("winbio.dll")]
public static extern int WinBioSetCredential(int Type, IntPtr Credential, UIntPtr CredentialSize, int Format);
"@
$api = Add-Type -MemberDefinition $sig -Name 'winbio_WinBioSetCredential' -Namespace Win32 -PassThru
# $api::WinBioSetCredential(Type, Credential, CredentialSize, Format)
#uselib "winbio.dll"
#func global WinBioSetCredential "WinBioSetCredential" sptr, sptr, sptr, sptr
; WinBioSetCredential Type, varptr(Credential), CredentialSize, Format   ; 戻り値は stat
; Type : WINBIO_CREDENTIAL_TYPE -> "sptr"
; Credential : BYTE* -> "sptr"
; CredentialSize : UINT_PTR -> "sptr"
; Format : WINBIO_CREDENTIAL_FORMAT -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "winbio.dll"
#cfunc global WinBioSetCredential "WinBioSetCredential" int, var, sptr, int
; res = WinBioSetCredential(Type, Credential, CredentialSize, Format)
; Type : WINBIO_CREDENTIAL_TYPE -> "int"
; Credential : BYTE* -> "var"
; CredentialSize : UINT_PTR -> "sptr"
; Format : WINBIO_CREDENTIAL_FORMAT -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT WinBioSetCredential(WINBIO_CREDENTIAL_TYPE Type, BYTE* Credential, UINT_PTR CredentialSize, WINBIO_CREDENTIAL_FORMAT Format)
#uselib "winbio.dll"
#cfunc global WinBioSetCredential "WinBioSetCredential" int, var, intptr, int
; res = WinBioSetCredential(Type, Credential, CredentialSize, Format)
; Type : WINBIO_CREDENTIAL_TYPE -> "int"
; Credential : BYTE* -> "var"
; CredentialSize : UINT_PTR -> "intptr"
; Format : WINBIO_CREDENTIAL_FORMAT -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	winbio = windows.NewLazySystemDLL("winbio.dll")
	procWinBioSetCredential = winbio.NewProc("WinBioSetCredential")
)

// Type (WINBIO_CREDENTIAL_TYPE), Credential (BYTE*), CredentialSize (UINT_PTR), Format (WINBIO_CREDENTIAL_FORMAT)
r1, _, err := procWinBioSetCredential.Call(
	uintptr(Type),
	uintptr(Credential),
	uintptr(CredentialSize),
	uintptr(Format),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function WinBioSetCredential(
  Type: Integer;   // WINBIO_CREDENTIAL_TYPE
  Credential: Pointer;   // BYTE*
  CredentialSize: NativeUInt;   // UINT_PTR
  Format: Integer   // WINBIO_CREDENTIAL_FORMAT
): Integer; stdcall;
  external 'winbio.dll' name 'WinBioSetCredential';
result := DllCall("winbio\WinBioSetCredential"
    , "Int", Type   ; WINBIO_CREDENTIAL_TYPE
    , "Ptr", Credential   ; BYTE*
    , "UPtr", CredentialSize   ; UINT_PTR
    , "Int", Format   ; WINBIO_CREDENTIAL_FORMAT
    , "Int")   ; return: HRESULT
●WinBioSetCredential(Type, Credential, CredentialSize, Format) = DLL("winbio.dll", "int WinBioSetCredential(int, void*, int, int)")
# 呼び出し: WinBioSetCredential(Type, Credential, CredentialSize, Format)
# Type : WINBIO_CREDENTIAL_TYPE -> "int"
# Credential : BYTE* -> "void*"
# CredentialSize : UINT_PTR -> "int"
# Format : WINBIO_CREDENTIAL_FORMAT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。