ホーム › Devices.BiometricFramework › WinBioGetProperty
WinBioGetProperty
関数生体認証の指定プロパティ値を取得する。
シグネチャ
// winbio.dll
#include <windows.h>
HRESULT WinBioGetProperty(
DWORD SessionHandle,
DWORD PropertyType,
DWORD PropertyId,
DWORD UnitId, // optional
WINBIO_IDENTITY* Identity, // optional
BYTE SubFactor, // optional
void** PropertyBuffer,
UINT_PTR* PropertyBufferSize // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| SessionHandle | DWORD | in | プロパティ取得に用いるセッションのハンドル。 |
| PropertyType | DWORD | in | プロパティの種別(セッション/ユニット/テンプレート単位)を指定するDWORD値。 |
| PropertyId | DWORD | in | 取得するプロパティを識別するDWORD値。 |
| UnitId | DWORD | inoptional | ユニット単位プロパティの場合の対象ユニットID。不要時は0。 |
| Identity | WINBIO_IDENTITY* | inoptional | テンプレート単位プロパティの場合の対象ユーザーIDポインタ。不要時はNULL可。 |
| SubFactor | BYTE | inoptional | テンプレート単位プロパティの場合の下位ファクターを指定するバイト値。 |
| PropertyBuffer | void** | out | 取得したプロパティ値を受け取る出力ポインタ。要WinBioFreeで解放。 |
| PropertyBufferSize | UINT_PTR* | outoptional | 取得したプロパティ値のバイトサイズを受け取る出力ポインタ。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// winbio.dll
#include <windows.h>
HRESULT WinBioGetProperty(
DWORD SessionHandle,
DWORD PropertyType,
DWORD PropertyId,
DWORD UnitId, // optional
WINBIO_IDENTITY* Identity, // optional
BYTE SubFactor, // optional
void** PropertyBuffer,
UINT_PTR* PropertyBufferSize // optional
);[DllImport("winbio.dll", ExactSpelling = true)]
static extern int WinBioGetProperty(
uint SessionHandle, // DWORD
uint PropertyType, // DWORD
uint PropertyId, // DWORD
uint UnitId, // DWORD optional
IntPtr Identity, // WINBIO_IDENTITY* optional
byte SubFactor, // BYTE optional
IntPtr PropertyBuffer, // void** out
IntPtr PropertyBufferSize // UINT_PTR* optional, out
);<DllImport("winbio.dll", ExactSpelling:=True)>
Public Shared Function WinBioGetProperty(
SessionHandle As UInteger, ' DWORD
PropertyType As UInteger, ' DWORD
PropertyId As UInteger, ' DWORD
UnitId As UInteger, ' DWORD optional
Identity As IntPtr, ' WINBIO_IDENTITY* optional
SubFactor As Byte, ' BYTE optional
PropertyBuffer As IntPtr, ' void** out
PropertyBufferSize As IntPtr ' UINT_PTR* optional, out
) As Integer
End Function' SessionHandle : DWORD
' PropertyType : DWORD
' PropertyId : DWORD
' UnitId : DWORD optional
' Identity : WINBIO_IDENTITY* optional
' SubFactor : BYTE optional
' PropertyBuffer : void** out
' PropertyBufferSize : UINT_PTR* optional, out
Declare PtrSafe Function WinBioGetProperty Lib "winbio" ( _
ByVal SessionHandle As Long, _
ByVal PropertyType As Long, _
ByVal PropertyId As Long, _
ByVal UnitId As Long, _
ByVal Identity As LongPtr, _
ByVal SubFactor As Byte, _
ByVal PropertyBuffer As LongPtr, _
ByVal PropertyBufferSize As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
WinBioGetProperty = ctypes.windll.winbio.WinBioGetProperty
WinBioGetProperty.restype = ctypes.c_int
WinBioGetProperty.argtypes = [
wintypes.DWORD, # SessionHandle : DWORD
wintypes.DWORD, # PropertyType : DWORD
wintypes.DWORD, # PropertyId : DWORD
wintypes.DWORD, # UnitId : DWORD optional
ctypes.c_void_p, # Identity : WINBIO_IDENTITY* optional
ctypes.c_ubyte, # SubFactor : BYTE optional
ctypes.c_void_p, # PropertyBuffer : void** out
ctypes.POINTER(ctypes.c_size_t), # PropertyBufferSize : UINT_PTR* optional, out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('winbio.dll')
WinBioGetProperty = Fiddle::Function.new(
lib['WinBioGetProperty'],
[
-Fiddle::TYPE_INT, # SessionHandle : DWORD
-Fiddle::TYPE_INT, # PropertyType : DWORD
-Fiddle::TYPE_INT, # PropertyId : DWORD
-Fiddle::TYPE_INT, # UnitId : DWORD optional
Fiddle::TYPE_VOIDP, # Identity : WINBIO_IDENTITY* optional
-Fiddle::TYPE_CHAR, # SubFactor : BYTE optional
Fiddle::TYPE_VOIDP, # PropertyBuffer : void** out
Fiddle::TYPE_VOIDP, # PropertyBufferSize : UINT_PTR* optional, out
],
Fiddle::TYPE_INT)#[link(name = "winbio")]
extern "system" {
fn WinBioGetProperty(
SessionHandle: u32, // DWORD
PropertyType: u32, // DWORD
PropertyId: u32, // DWORD
UnitId: u32, // DWORD optional
Identity: *mut WINBIO_IDENTITY, // WINBIO_IDENTITY* optional
SubFactor: u8, // BYTE optional
PropertyBuffer: *mut *mut (), // void** out
PropertyBufferSize: *mut usize // UINT_PTR* optional, out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("winbio.dll")]
public static extern int WinBioGetProperty(uint SessionHandle, uint PropertyType, uint PropertyId, uint UnitId, IntPtr Identity, byte SubFactor, IntPtr PropertyBuffer, IntPtr PropertyBufferSize);
"@
$api = Add-Type -MemberDefinition $sig -Name 'winbio_WinBioGetProperty' -Namespace Win32 -PassThru
# $api::WinBioGetProperty(SessionHandle, PropertyType, PropertyId, UnitId, Identity, SubFactor, PropertyBuffer, PropertyBufferSize)#uselib "winbio.dll"
#func global WinBioGetProperty "WinBioGetProperty" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; WinBioGetProperty SessionHandle, PropertyType, PropertyId, UnitId, varptr(Identity), SubFactor, PropertyBuffer, varptr(PropertyBufferSize) ; 戻り値は stat
; SessionHandle : DWORD -> "sptr"
; PropertyType : DWORD -> "sptr"
; PropertyId : DWORD -> "sptr"
; UnitId : DWORD optional -> "sptr"
; Identity : WINBIO_IDENTITY* optional -> "sptr"
; SubFactor : BYTE optional -> "sptr"
; PropertyBuffer : void** out -> "sptr"
; PropertyBufferSize : UINT_PTR* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "winbio.dll" #cfunc global WinBioGetProperty "WinBioGetProperty" int, int, int, int, var, int, sptr, var ; res = WinBioGetProperty(SessionHandle, PropertyType, PropertyId, UnitId, Identity, SubFactor, PropertyBuffer, PropertyBufferSize) ; SessionHandle : DWORD -> "int" ; PropertyType : DWORD -> "int" ; PropertyId : DWORD -> "int" ; UnitId : DWORD optional -> "int" ; Identity : WINBIO_IDENTITY* optional -> "var" ; SubFactor : BYTE optional -> "int" ; PropertyBuffer : void** out -> "sptr" ; PropertyBufferSize : UINT_PTR* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "winbio.dll" #cfunc global WinBioGetProperty "WinBioGetProperty" int, int, int, int, sptr, int, sptr, sptr ; res = WinBioGetProperty(SessionHandle, PropertyType, PropertyId, UnitId, varptr(Identity), SubFactor, PropertyBuffer, varptr(PropertyBufferSize)) ; SessionHandle : DWORD -> "int" ; PropertyType : DWORD -> "int" ; PropertyId : DWORD -> "int" ; UnitId : DWORD optional -> "int" ; Identity : WINBIO_IDENTITY* optional -> "sptr" ; SubFactor : BYTE optional -> "int" ; PropertyBuffer : void** out -> "sptr" ; PropertyBufferSize : UINT_PTR* optional, out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT WinBioGetProperty(DWORD SessionHandle, DWORD PropertyType, DWORD PropertyId, DWORD UnitId, WINBIO_IDENTITY* Identity, BYTE SubFactor, void** PropertyBuffer, UINT_PTR* PropertyBufferSize) #uselib "winbio.dll" #cfunc global WinBioGetProperty "WinBioGetProperty" int, int, int, int, var, int, intptr, var ; res = WinBioGetProperty(SessionHandle, PropertyType, PropertyId, UnitId, Identity, SubFactor, PropertyBuffer, PropertyBufferSize) ; SessionHandle : DWORD -> "int" ; PropertyType : DWORD -> "int" ; PropertyId : DWORD -> "int" ; UnitId : DWORD optional -> "int" ; Identity : WINBIO_IDENTITY* optional -> "var" ; SubFactor : BYTE optional -> "int" ; PropertyBuffer : void** out -> "intptr" ; PropertyBufferSize : UINT_PTR* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT WinBioGetProperty(DWORD SessionHandle, DWORD PropertyType, DWORD PropertyId, DWORD UnitId, WINBIO_IDENTITY* Identity, BYTE SubFactor, void** PropertyBuffer, UINT_PTR* PropertyBufferSize) #uselib "winbio.dll" #cfunc global WinBioGetProperty "WinBioGetProperty" int, int, int, int, intptr, int, intptr, intptr ; res = WinBioGetProperty(SessionHandle, PropertyType, PropertyId, UnitId, varptr(Identity), SubFactor, PropertyBuffer, varptr(PropertyBufferSize)) ; SessionHandle : DWORD -> "int" ; PropertyType : DWORD -> "int" ; PropertyId : DWORD -> "int" ; UnitId : DWORD optional -> "int" ; Identity : WINBIO_IDENTITY* optional -> "intptr" ; SubFactor : BYTE optional -> "int" ; PropertyBuffer : void** out -> "intptr" ; PropertyBufferSize : UINT_PTR* optional, out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
winbio = windows.NewLazySystemDLL("winbio.dll")
procWinBioGetProperty = winbio.NewProc("WinBioGetProperty")
)
// SessionHandle (DWORD), PropertyType (DWORD), PropertyId (DWORD), UnitId (DWORD optional), Identity (WINBIO_IDENTITY* optional), SubFactor (BYTE optional), PropertyBuffer (void** out), PropertyBufferSize (UINT_PTR* optional, out)
r1, _, err := procWinBioGetProperty.Call(
uintptr(SessionHandle),
uintptr(PropertyType),
uintptr(PropertyId),
uintptr(UnitId),
uintptr(Identity),
uintptr(SubFactor),
uintptr(PropertyBuffer),
uintptr(PropertyBufferSize),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction WinBioGetProperty(
SessionHandle: DWORD; // DWORD
PropertyType: DWORD; // DWORD
PropertyId: DWORD; // DWORD
UnitId: DWORD; // DWORD optional
Identity: Pointer; // WINBIO_IDENTITY* optional
SubFactor: Byte; // BYTE optional
PropertyBuffer: Pointer; // void** out
PropertyBufferSize: Pointer // UINT_PTR* optional, out
): Integer; stdcall;
external 'winbio.dll' name 'WinBioGetProperty';result := DllCall("winbio\WinBioGetProperty"
, "UInt", SessionHandle ; DWORD
, "UInt", PropertyType ; DWORD
, "UInt", PropertyId ; DWORD
, "UInt", UnitId ; DWORD optional
, "Ptr", Identity ; WINBIO_IDENTITY* optional
, "UChar", SubFactor ; BYTE optional
, "Ptr", PropertyBuffer ; void** out
, "Ptr", PropertyBufferSize ; UINT_PTR* optional, out
, "Int") ; return: HRESULT●WinBioGetProperty(SessionHandle, PropertyType, PropertyId, UnitId, Identity, SubFactor, PropertyBuffer, PropertyBufferSize) = DLL("winbio.dll", "int WinBioGetProperty(dword, dword, dword, dword, void*, byte, void*, void*)")
# 呼び出し: WinBioGetProperty(SessionHandle, PropertyType, PropertyId, UnitId, Identity, SubFactor, PropertyBuffer, PropertyBufferSize)
# SessionHandle : DWORD -> "dword"
# PropertyType : DWORD -> "dword"
# PropertyId : DWORD -> "dword"
# UnitId : DWORD optional -> "dword"
# Identity : WINBIO_IDENTITY* optional -> "void*"
# SubFactor : BYTE optional -> "byte"
# PropertyBuffer : void** out -> "void*"
# PropertyBufferSize : UINT_PTR* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "winbio" fn WinBioGetProperty(
SessionHandle: u32, // DWORD
PropertyType: u32, // DWORD
PropertyId: u32, // DWORD
UnitId: u32, // DWORD optional
Identity: [*c]WINBIO_IDENTITY, // WINBIO_IDENTITY* optional
SubFactor: u8, // BYTE optional
PropertyBuffer: ?*anyopaque, // void** out
PropertyBufferSize: [*c]usize // UINT_PTR* optional, out
) callconv(std.os.windows.WINAPI) i32;proc WinBioGetProperty(
SessionHandle: uint32, # DWORD
PropertyType: uint32, # DWORD
PropertyId: uint32, # DWORD
UnitId: uint32, # DWORD optional
Identity: ptr WINBIO_IDENTITY, # WINBIO_IDENTITY* optional
SubFactor: uint8, # BYTE optional
PropertyBuffer: pointer, # void** out
PropertyBufferSize: ptr uint # UINT_PTR* optional, out
): int32 {.importc: "WinBioGetProperty", stdcall, dynlib: "winbio.dll".}pragma(lib, "winbio");
extern(Windows)
int WinBioGetProperty(
uint SessionHandle, // DWORD
uint PropertyType, // DWORD
uint PropertyId, // DWORD
uint UnitId, // DWORD optional
WINBIO_IDENTITY* Identity, // WINBIO_IDENTITY* optional
ubyte SubFactor, // BYTE optional
void** PropertyBuffer, // void** out
size_t* PropertyBufferSize // UINT_PTR* optional, out
);ccall((:WinBioGetProperty, "winbio.dll"), stdcall, Int32,
(UInt32, UInt32, UInt32, UInt32, Ptr{WINBIO_IDENTITY}, UInt8, Ptr{Cvoid}, Ptr{Csize_t}),
SessionHandle, PropertyType, PropertyId, UnitId, Identity, SubFactor, PropertyBuffer, PropertyBufferSize)
# SessionHandle : DWORD -> UInt32
# PropertyType : DWORD -> UInt32
# PropertyId : DWORD -> UInt32
# UnitId : DWORD optional -> UInt32
# Identity : WINBIO_IDENTITY* optional -> Ptr{WINBIO_IDENTITY}
# SubFactor : BYTE optional -> UInt8
# PropertyBuffer : void** out -> Ptr{Cvoid}
# PropertyBufferSize : UINT_PTR* optional, out -> Ptr{Csize_t}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t WinBioGetProperty(
uint32_t SessionHandle,
uint32_t PropertyType,
uint32_t PropertyId,
uint32_t UnitId,
void* Identity,
uint8_t SubFactor,
void** PropertyBuffer,
uintptr_t* PropertyBufferSize);
]]
local winbio = ffi.load("winbio")
-- winbio.WinBioGetProperty(SessionHandle, PropertyType, PropertyId, UnitId, Identity, SubFactor, PropertyBuffer, PropertyBufferSize)
-- SessionHandle : DWORD
-- PropertyType : DWORD
-- PropertyId : DWORD
-- UnitId : DWORD optional
-- Identity : WINBIO_IDENTITY* optional
-- SubFactor : BYTE optional
-- PropertyBuffer : void** out
-- PropertyBufferSize : UINT_PTR* optional, out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('winbio.dll');
const WinBioGetProperty = lib.func('__stdcall', 'WinBioGetProperty', 'int32_t', ['uint32_t', 'uint32_t', 'uint32_t', 'uint32_t', 'void *', 'uint8_t', 'void *', 'uintptr_t *']);
// WinBioGetProperty(SessionHandle, PropertyType, PropertyId, UnitId, Identity, SubFactor, PropertyBuffer, PropertyBufferSize)
// SessionHandle : DWORD -> 'uint32_t'
// PropertyType : DWORD -> 'uint32_t'
// PropertyId : DWORD -> 'uint32_t'
// UnitId : DWORD optional -> 'uint32_t'
// Identity : WINBIO_IDENTITY* optional -> 'void *'
// SubFactor : BYTE optional -> 'uint8_t'
// PropertyBuffer : void** out -> 'void *'
// PropertyBufferSize : UINT_PTR* optional, out -> 'uintptr_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("winbio.dll", {
WinBioGetProperty: { parameters: ["u32", "u32", "u32", "u32", "pointer", "u8", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.WinBioGetProperty(SessionHandle, PropertyType, PropertyId, UnitId, Identity, SubFactor, PropertyBuffer, PropertyBufferSize)
// SessionHandle : DWORD -> "u32"
// PropertyType : DWORD -> "u32"
// PropertyId : DWORD -> "u32"
// UnitId : DWORD optional -> "u32"
// Identity : WINBIO_IDENTITY* optional -> "pointer"
// SubFactor : BYTE optional -> "u8"
// PropertyBuffer : void** out -> "pointer"
// PropertyBufferSize : UINT_PTR* optional, out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t WinBioGetProperty(
uint32_t SessionHandle,
uint32_t PropertyType,
uint32_t PropertyId,
uint32_t UnitId,
void* Identity,
uint8_t SubFactor,
void** PropertyBuffer,
size_t* PropertyBufferSize);
C, "winbio.dll");
// $ffi->WinBioGetProperty(SessionHandle, PropertyType, PropertyId, UnitId, Identity, SubFactor, PropertyBuffer, PropertyBufferSize);
// SessionHandle : DWORD
// PropertyType : DWORD
// PropertyId : DWORD
// UnitId : DWORD optional
// Identity : WINBIO_IDENTITY* optional
// SubFactor : BYTE optional
// PropertyBuffer : void** out
// PropertyBufferSize : UINT_PTR* optional, 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 WinBioGetProperty(
int SessionHandle, // DWORD
int PropertyType, // DWORD
int PropertyId, // DWORD
int UnitId, // DWORD optional
Pointer Identity, // WINBIO_IDENTITY* optional
byte SubFactor, // BYTE optional
Pointer PropertyBuffer, // void** out
LongByReference PropertyBufferSize // UINT_PTR* optional, out
);
}@[Link("winbio")]
lib Libwinbio
fun WinBioGetProperty = WinBioGetProperty(
SessionHandle : UInt32, # DWORD
PropertyType : UInt32, # DWORD
PropertyId : UInt32, # DWORD
UnitId : UInt32, # DWORD optional
Identity : WINBIO_IDENTITY*, # WINBIO_IDENTITY* optional
SubFactor : UInt8, # BYTE optional
PropertyBuffer : Void**, # void** out
PropertyBufferSize : LibC::SizeT* # UINT_PTR* optional, out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef WinBioGetPropertyNative = Int32 Function(Uint32, Uint32, Uint32, Uint32, Pointer<Void>, Uint8, Pointer<Void>, Pointer<UintPtr>);
typedef WinBioGetPropertyDart = int Function(int, int, int, int, Pointer<Void>, int, Pointer<Void>, Pointer<UintPtr>);
final WinBioGetProperty = DynamicLibrary.open('winbio.dll')
.lookupFunction<WinBioGetPropertyNative, WinBioGetPropertyDart>('WinBioGetProperty');
// SessionHandle : DWORD -> Uint32
// PropertyType : DWORD -> Uint32
// PropertyId : DWORD -> Uint32
// UnitId : DWORD optional -> Uint32
// Identity : WINBIO_IDENTITY* optional -> Pointer<Void>
// SubFactor : BYTE optional -> Uint8
// PropertyBuffer : void** out -> Pointer<Void>
// PropertyBufferSize : UINT_PTR* optional, out -> Pointer<UintPtr>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function WinBioGetProperty(
SessionHandle: DWORD; // DWORD
PropertyType: DWORD; // DWORD
PropertyId: DWORD; // DWORD
UnitId: DWORD; // DWORD optional
Identity: Pointer; // WINBIO_IDENTITY* optional
SubFactor: Byte; // BYTE optional
PropertyBuffer: Pointer; // void** out
PropertyBufferSize: Pointer // UINT_PTR* optional, out
): Integer; stdcall;
external 'winbio.dll' name 'WinBioGetProperty';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "WinBioGetProperty"
c_WinBioGetProperty :: Word32 -> Word32 -> Word32 -> Word32 -> Ptr () -> Word8 -> Ptr () -> Ptr CUIntPtr -> IO Int32
-- SessionHandle : DWORD -> Word32
-- PropertyType : DWORD -> Word32
-- PropertyId : DWORD -> Word32
-- UnitId : DWORD optional -> Word32
-- Identity : WINBIO_IDENTITY* optional -> Ptr ()
-- SubFactor : BYTE optional -> Word8
-- PropertyBuffer : void** out -> Ptr ()
-- PropertyBufferSize : UINT_PTR* optional, out -> Ptr CUIntPtr
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let winbiogetproperty =
foreign "WinBioGetProperty"
(uint32_t @-> uint32_t @-> uint32_t @-> uint32_t @-> (ptr void) @-> uint8_t @-> (ptr void) @-> (ptr size_t) @-> returning int32_t)
(* SessionHandle : DWORD -> uint32_t *)
(* PropertyType : DWORD -> uint32_t *)
(* PropertyId : DWORD -> uint32_t *)
(* UnitId : DWORD optional -> uint32_t *)
(* Identity : WINBIO_IDENTITY* optional -> (ptr void) *)
(* SubFactor : BYTE optional -> uint8_t *)
(* PropertyBuffer : void** out -> (ptr void) *)
(* PropertyBufferSize : UINT_PTR* optional, out -> (ptr size_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library winbio (t "winbio.dll"))
(cffi:use-foreign-library winbio)
(cffi:defcfun ("WinBioGetProperty" win-bio-get-property :convention :stdcall) :int32
(session-handle :uint32) ; DWORD
(property-type :uint32) ; DWORD
(property-id :uint32) ; DWORD
(unit-id :uint32) ; DWORD optional
(identity :pointer) ; WINBIO_IDENTITY* optional
(sub-factor :uint8) ; BYTE optional
(property-buffer :pointer) ; void** out
(property-buffer-size :pointer)) ; UINT_PTR* optional, out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $WinBioGetProperty = Win32::API::More->new('winbio',
'int WinBioGetProperty(DWORD SessionHandle, DWORD PropertyType, DWORD PropertyId, DWORD UnitId, LPVOID Identity, BYTE SubFactor, LPVOID PropertyBuffer, LPVOID PropertyBufferSize)');
# my $ret = $WinBioGetProperty->Call($SessionHandle, $PropertyType, $PropertyId, $UnitId, $Identity, $SubFactor, $PropertyBuffer, $PropertyBufferSize);
# SessionHandle : DWORD -> DWORD
# PropertyType : DWORD -> DWORD
# PropertyId : DWORD -> DWORD
# UnitId : DWORD optional -> DWORD
# Identity : WINBIO_IDENTITY* optional -> LPVOID
# SubFactor : BYTE optional -> BYTE
# PropertyBuffer : void** out -> LPVOID
# PropertyBufferSize : UINT_PTR* optional, out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型