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

WinBioGetCredentialState

関数
指定IDの生体認証資格情報の状態を取得する。
DLLwinbio.dll呼出規約winapi対応OSWindows 7 以降

シグネチャ

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

HRESULT WinBioGetCredentialState(
    WINBIO_IDENTITY Identity,
    WINBIO_CREDENTIAL_TYPE Type,
    WINBIO_CREDENTIAL_STATE* CredentialState
);

パラメーター

名前方向説明
IdentityWINBIO_IDENTITYin資格情報の状態を取得する対象ユーザーのIDを指定する構造体。
TypeWINBIO_CREDENTIAL_TYPEin状態を取得する資格情報の種類を指定する列挙値。
CredentialStateWINBIO_CREDENTIAL_STATE*out資格情報の状態(設定済み/未設定等)を受け取る出力ポインタ。

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT WinBioGetCredentialState(
    WINBIO_IDENTITY Identity,
    WINBIO_CREDENTIAL_TYPE Type,
    WINBIO_CREDENTIAL_STATE* CredentialState
);
[DllImport("winbio.dll", ExactSpelling = true)]
static extern int WinBioGetCredentialState(
    WINBIO_IDENTITY Identity,   // WINBIO_IDENTITY
    int Type,   // WINBIO_CREDENTIAL_TYPE
    out int CredentialState   // WINBIO_CREDENTIAL_STATE* out
);
<DllImport("winbio.dll", ExactSpelling:=True)>
Public Shared Function WinBioGetCredentialState(
    Identity As WINBIO_IDENTITY,   ' WINBIO_IDENTITY
    Type As Integer,   ' WINBIO_CREDENTIAL_TYPE
    <Out> ByRef CredentialState As Integer   ' WINBIO_CREDENTIAL_STATE* out
) As Integer
End Function
' Identity : WINBIO_IDENTITY
' Type : WINBIO_CREDENTIAL_TYPE
' CredentialState : WINBIO_CREDENTIAL_STATE* out
Declare PtrSafe Function WinBioGetCredentialState Lib "winbio" ( _
    ByVal Identity As LongPtr, _
    ByVal Type As Long, _
    ByRef CredentialState As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WinBioGetCredentialState = ctypes.windll.winbio.WinBioGetCredentialState
WinBioGetCredentialState.restype = ctypes.c_int
WinBioGetCredentialState.argtypes = [
    WINBIO_IDENTITY,  # Identity : WINBIO_IDENTITY
    ctypes.c_int,  # Type : WINBIO_CREDENTIAL_TYPE
    ctypes.c_void_p,  # CredentialState : WINBIO_CREDENTIAL_STATE* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('winbio.dll')
WinBioGetCredentialState = Fiddle::Function.new(
  lib['WinBioGetCredentialState'],
  [
    Fiddle::TYPE_VOIDP,  # Identity : WINBIO_IDENTITY
    Fiddle::TYPE_INT,  # Type : WINBIO_CREDENTIAL_TYPE
    Fiddle::TYPE_VOIDP,  # CredentialState : WINBIO_CREDENTIAL_STATE* out
  ],
  Fiddle::TYPE_INT)
#[link(name = "winbio")]
extern "system" {
    fn WinBioGetCredentialState(
        Identity: WINBIO_IDENTITY,  // WINBIO_IDENTITY
        Type: i32,  // WINBIO_CREDENTIAL_TYPE
        CredentialState: *mut i32  // WINBIO_CREDENTIAL_STATE* out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("winbio.dll")]
public static extern int WinBioGetCredentialState(WINBIO_IDENTITY Identity, int Type, out int CredentialState);
"@
$api = Add-Type -MemberDefinition $sig -Name 'winbio_WinBioGetCredentialState' -Namespace Win32 -PassThru
# $api::WinBioGetCredentialState(Identity, Type, CredentialState)
#uselib "winbio.dll"
#func global WinBioGetCredentialState "WinBioGetCredentialState" sptr, sptr, sptr
; WinBioGetCredentialState Identity, Type, varptr(CredentialState)   ; 戻り値は stat
; Identity : WINBIO_IDENTITY -> "sptr"
; Type : WINBIO_CREDENTIAL_TYPE -> "sptr"
; CredentialState : WINBIO_CREDENTIAL_STATE* out -> "sptr"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "winbio.dll"
#cfunc global WinBioGetCredentialState "WinBioGetCredentialState" int, int, var
; res = WinBioGetCredentialState(Identity, Type, CredentialState)
; Identity : WINBIO_IDENTITY -> "int"
; Type : WINBIO_CREDENTIAL_TYPE -> "int"
; CredentialState : WINBIO_CREDENTIAL_STATE* out -> "var"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT WinBioGetCredentialState(WINBIO_IDENTITY Identity, WINBIO_CREDENTIAL_TYPE Type, WINBIO_CREDENTIAL_STATE* CredentialState)
#uselib "winbio.dll"
#cfunc global WinBioGetCredentialState "WinBioGetCredentialState" int, int, var
; res = WinBioGetCredentialState(Identity, Type, CredentialState)
; Identity : WINBIO_IDENTITY -> "int"
; Type : WINBIO_CREDENTIAL_TYPE -> "int"
; CredentialState : WINBIO_CREDENTIAL_STATE* out -> "var"
; ※値渡し構造体は直接渡せません。intにパック、または var で構造体変数を渡してください。
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	winbio = windows.NewLazySystemDLL("winbio.dll")
	procWinBioGetCredentialState = winbio.NewProc("WinBioGetCredentialState")
)

// Identity (WINBIO_IDENTITY), Type (WINBIO_CREDENTIAL_TYPE), CredentialState (WINBIO_CREDENTIAL_STATE* out)
r1, _, err := procWinBioGetCredentialState.Call(
	uintptr(Identity),
	uintptr(Type),
	uintptr(CredentialState),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function WinBioGetCredentialState(
  Identity: WINBIO_IDENTITY;   // WINBIO_IDENTITY
  Type: Integer;   // WINBIO_CREDENTIAL_TYPE
  CredentialState: Pointer   // WINBIO_CREDENTIAL_STATE* out
): Integer; stdcall;
  external 'winbio.dll' name 'WinBioGetCredentialState';
result := DllCall("winbio\WinBioGetCredentialState"
    , "Ptr", Identity   ; WINBIO_IDENTITY
    , "Int", Type   ; WINBIO_CREDENTIAL_TYPE
    , "Ptr", CredentialState   ; WINBIO_CREDENTIAL_STATE* out
    , "Int")   ; return: HRESULT
●WinBioGetCredentialState(Identity, Type, CredentialState) = DLL("winbio.dll", "int WinBioGetCredentialState(void*, int, void*)")
# 呼び出し: WinBioGetCredentialState(Identity, Type, CredentialState)
# Identity : WINBIO_IDENTITY -> "void*"
# Type : WINBIO_CREDENTIAL_TYPE -> "int"
# CredentialState : WINBIO_CREDENTIAL_STATE* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "winbio" fn WinBioGetCredentialState(
    Identity: WINBIO_IDENTITY, // WINBIO_IDENTITY
    Type: i32, // WINBIO_CREDENTIAL_TYPE
    CredentialState: [*c]i32 // WINBIO_CREDENTIAL_STATE* out
) callconv(std.os.windows.WINAPI) i32;
proc WinBioGetCredentialState(
    Identity: WINBIO_IDENTITY,  # WINBIO_IDENTITY
    Type: int32,  # WINBIO_CREDENTIAL_TYPE
    CredentialState: ptr int32  # WINBIO_CREDENTIAL_STATE* out
): int32 {.importc: "WinBioGetCredentialState", stdcall, dynlib: "winbio.dll".}
pragma(lib, "winbio");
extern(Windows)
int WinBioGetCredentialState(
    WINBIO_IDENTITY Identity,   // WINBIO_IDENTITY
    int Type,   // WINBIO_CREDENTIAL_TYPE
    int* CredentialState   // WINBIO_CREDENTIAL_STATE* out
);
ccall((:WinBioGetCredentialState, "winbio.dll"), stdcall, Int32,
      (WINBIO_IDENTITY, Int32, Ptr{Int32}),
      Identity, Type, CredentialState)
# Identity : WINBIO_IDENTITY -> WINBIO_IDENTITY
# Type : WINBIO_CREDENTIAL_TYPE -> Int32
# CredentialState : WINBIO_CREDENTIAL_STATE* out -> Ptr{Int32}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t WinBioGetCredentialState(
    WINBIO_IDENTITY Identity,
    int32_t Type,
    int32_t* CredentialState);
]]
local winbio = ffi.load("winbio")
-- winbio.WinBioGetCredentialState(Identity, Type, CredentialState)
-- Identity : WINBIO_IDENTITY
-- Type : WINBIO_CREDENTIAL_TYPE
-- CredentialState : WINBIO_CREDENTIAL_STATE* out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('winbio.dll');
const WinBioGetCredentialState = lib.func('__stdcall', 'WinBioGetCredentialState', 'int32_t', ['WINBIO_IDENTITY', 'int32_t', 'int32_t *']);
// WinBioGetCredentialState(Identity, Type, CredentialState)
// Identity : WINBIO_IDENTITY -> 'WINBIO_IDENTITY'
// Type : WINBIO_CREDENTIAL_TYPE -> 'int32_t'
// CredentialState : WINBIO_CREDENTIAL_STATE* out -> 'int32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("winbio.dll", {
  WinBioGetCredentialState: { parameters: ["buffer", "i32", "pointer"], result: "i32" },
});
// lib.symbols.WinBioGetCredentialState(Identity, Type, CredentialState)
// Identity : WINBIO_IDENTITY -> "buffer"
// Type : WINBIO_CREDENTIAL_TYPE -> "i32"
// CredentialState : WINBIO_CREDENTIAL_STATE* out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t WinBioGetCredentialState(
    WINBIO_IDENTITY Identity,
    int32_t Type,
    int32_t* CredentialState);
C, "winbio.dll");
// $ffi->WinBioGetCredentialState(Identity, Type, CredentialState);
// Identity : WINBIO_IDENTITY
// Type : WINBIO_CREDENTIAL_TYPE
// CredentialState : WINBIO_CREDENTIAL_STATE* out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Winbio extends StdCallLibrary {
    Winbio INSTANCE = Native.load("winbio", Winbio.class);
    int WinBioGetCredentialState(
        WINBIO_IDENTITY /* extends Structure (by value) */ Identity,   // WINBIO_IDENTITY
        int Type,   // WINBIO_CREDENTIAL_TYPE
        IntByReference CredentialState   // WINBIO_CREDENTIAL_STATE* out
    );
}
@[Link("winbio")]
lib Libwinbio
  fun WinBioGetCredentialState = WinBioGetCredentialState(
    Identity : WINBIO_IDENTITY,   # WINBIO_IDENTITY
    Type : Int32,   # WINBIO_CREDENTIAL_TYPE
    CredentialState : Int32*   # WINBIO_CREDENTIAL_STATE* out
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef WinBioGetCredentialStateNative = Int32 Function(WINBIO_IDENTITY, Int32, Pointer<Int32>);
typedef WinBioGetCredentialStateDart = int Function(int, int, Pointer<Int32>);
final WinBioGetCredentialState = DynamicLibrary.open('winbio.dll')
    .lookupFunction<WinBioGetCredentialStateNative, WinBioGetCredentialStateDart>('WinBioGetCredentialState');
// Identity : WINBIO_IDENTITY -> WINBIO_IDENTITY
// Type : WINBIO_CREDENTIAL_TYPE -> Int32
// CredentialState : WINBIO_CREDENTIAL_STATE* out -> Pointer<Int32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function WinBioGetCredentialState(
  Identity: WINBIO_IDENTITY;   // WINBIO_IDENTITY
  Type: Integer;   // WINBIO_CREDENTIAL_TYPE
  CredentialState: Pointer   // WINBIO_CREDENTIAL_STATE* out
): Integer; stdcall;
  external 'winbio.dll' name 'WinBioGetCredentialState';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "WinBioGetCredentialState"
  c_WinBioGetCredentialState :: WINBIO_IDENTITY -> Int32 -> Ptr Int32 -> IO Int32
-- Identity : WINBIO_IDENTITY -> WINBIO_IDENTITY
-- Type : WINBIO_CREDENTIAL_TYPE -> Int32
-- CredentialState : WINBIO_CREDENTIAL_STATE* out -> Ptr Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
-- ※値渡し構造体は GHC FFI で直接渡せません。Ptr で渡すラッパ(C側)経由にしてください。
open Ctypes
open Foreign

let winbiogetcredentialstate =
  foreign "WinBioGetCredentialState"
    (WINBIO_IDENTITY @-> int32_t @-> (ptr int32_t) @-> returning int32_t)
(* Identity : WINBIO_IDENTITY -> WINBIO_IDENTITY *)
(* Type : WINBIO_CREDENTIAL_TYPE -> int32_t *)
(* CredentialState : WINBIO_CREDENTIAL_STATE* out -> (ptr int32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library winbio (t "winbio.dll"))
(cffi:use-foreign-library winbio)

(cffi:defcfun ("WinBioGetCredentialState" win-bio-get-credential-state :convention :stdcall) :int32
  (identity (:struct winbio-identity))   ; WINBIO_IDENTITY
  (type :int32)   ; WINBIO_CREDENTIAL_TYPE
  (credential-state :pointer))   ; WINBIO_CREDENTIAL_STATE* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $WinBioGetCredentialState = Win32::API::More->new('winbio',
    'int WinBioGetCredentialState(LPVOID Identity, int Type, LPVOID CredentialState)');
# my $ret = $WinBioGetCredentialState->Call($Identity, $Type, $CredentialState);
# Identity : WINBIO_IDENTITY -> LPVOID
# Type : WINBIO_CREDENTIAL_TYPE -> int
# CredentialState : WINBIO_CREDENTIAL_STATE* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型