ホーム › Devices.Bluetooth › BluetoothAuthenticateDeviceEx
BluetoothAuthenticateDeviceEx
関数認証要件を指定してBluetoothデバイスを認証する。
シグネチャ
// bthprops.cpl
#include <windows.h>
DWORD BluetoothAuthenticateDeviceEx(
HWND hwndParentIn, // optional
HANDLE hRadioIn, // optional
BLUETOOTH_DEVICE_INFO* pbtdiInout,
BLUETOOTH_OOB_DATA_INFO* pbtOobData, // optional
AUTHENTICATION_REQUIREMENTS authenticationRequirement
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hwndParentIn | HWND | inoptional | 認証UIダイアログの親ウィンドウハンドル。NULL可。 |
| hRadioIn | HANDLE | inoptional | 認証に用いるBluetoothラジオのハンドル。NULL可。 |
| pbtdiInout | BLUETOOTH_DEVICE_INFO* | inout | 認証対象デバイスの情報を入力し更新結果を受け取る構造体ポインタ。 |
| pbtOobData | BLUETOOTH_OOB_DATA_INFO* | inoptional | アウトオブバンド(OOB)ペアリングデータへのポインタ。不要時はNULL可。 |
| authenticationRequirement | AUTHENTICATION_REQUIREMENTS | in | 要求する認証レベル(MITM保護有無等)を指定する列挙値。 |
戻り値の型: DWORD
各言語での呼び出し定義
// bthprops.cpl
#include <windows.h>
DWORD BluetoothAuthenticateDeviceEx(
HWND hwndParentIn, // optional
HANDLE hRadioIn, // optional
BLUETOOTH_DEVICE_INFO* pbtdiInout,
BLUETOOTH_OOB_DATA_INFO* pbtOobData, // optional
AUTHENTICATION_REQUIREMENTS authenticationRequirement
);[DllImport("bthprops.cpl", ExactSpelling = true)]
static extern uint BluetoothAuthenticateDeviceEx(
IntPtr hwndParentIn, // HWND optional
IntPtr hRadioIn, // HANDLE optional
IntPtr pbtdiInout, // BLUETOOTH_DEVICE_INFO* in/out
IntPtr pbtOobData, // BLUETOOTH_OOB_DATA_INFO* optional
int authenticationRequirement // AUTHENTICATION_REQUIREMENTS
);<DllImport("bthprops.cpl", ExactSpelling:=True)>
Public Shared Function BluetoothAuthenticateDeviceEx(
hwndParentIn As IntPtr, ' HWND optional
hRadioIn As IntPtr, ' HANDLE optional
pbtdiInout As IntPtr, ' BLUETOOTH_DEVICE_INFO* in/out
pbtOobData As IntPtr, ' BLUETOOTH_OOB_DATA_INFO* optional
authenticationRequirement As Integer ' AUTHENTICATION_REQUIREMENTS
) As UInteger
End Function' hwndParentIn : HWND optional
' hRadioIn : HANDLE optional
' pbtdiInout : BLUETOOTH_DEVICE_INFO* in/out
' pbtOobData : BLUETOOTH_OOB_DATA_INFO* optional
' authenticationRequirement : AUTHENTICATION_REQUIREMENTS
Declare PtrSafe Function BluetoothAuthenticateDeviceEx Lib "bthprops.cpl" ( _
ByVal hwndParentIn As LongPtr, _
ByVal hRadioIn As LongPtr, _
ByVal pbtdiInout As LongPtr, _
ByVal pbtOobData As LongPtr, _
ByVal authenticationRequirement As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
BluetoothAuthenticateDeviceEx = ctypes.windll.LoadLibrary("bthprops.cpl").BluetoothAuthenticateDeviceEx
BluetoothAuthenticateDeviceEx.restype = wintypes.DWORD
BluetoothAuthenticateDeviceEx.argtypes = [
wintypes.HANDLE, # hwndParentIn : HWND optional
wintypes.HANDLE, # hRadioIn : HANDLE optional
ctypes.c_void_p, # pbtdiInout : BLUETOOTH_DEVICE_INFO* in/out
ctypes.c_void_p, # pbtOobData : BLUETOOTH_OOB_DATA_INFO* optional
ctypes.c_int, # authenticationRequirement : AUTHENTICATION_REQUIREMENTS
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('bthprops.cpl')
BluetoothAuthenticateDeviceEx = Fiddle::Function.new(
lib['BluetoothAuthenticateDeviceEx'],
[
Fiddle::TYPE_VOIDP, # hwndParentIn : HWND optional
Fiddle::TYPE_VOIDP, # hRadioIn : HANDLE optional
Fiddle::TYPE_VOIDP, # pbtdiInout : BLUETOOTH_DEVICE_INFO* in/out
Fiddle::TYPE_VOIDP, # pbtOobData : BLUETOOTH_OOB_DATA_INFO* optional
Fiddle::TYPE_INT, # authenticationRequirement : AUTHENTICATION_REQUIREMENTS
],
-Fiddle::TYPE_INT)#[link(name = "bthprops.cpl")]
extern "system" {
fn BluetoothAuthenticateDeviceEx(
hwndParentIn: *mut core::ffi::c_void, // HWND optional
hRadioIn: *mut core::ffi::c_void, // HANDLE optional
pbtdiInout: *mut BLUETOOTH_DEVICE_INFO, // BLUETOOTH_DEVICE_INFO* in/out
pbtOobData: *mut BLUETOOTH_OOB_DATA_INFO, // BLUETOOTH_OOB_DATA_INFO* optional
authenticationRequirement: i32 // AUTHENTICATION_REQUIREMENTS
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("bthprops.cpl")]
public static extern uint BluetoothAuthenticateDeviceEx(IntPtr hwndParentIn, IntPtr hRadioIn, IntPtr pbtdiInout, IntPtr pbtOobData, int authenticationRequirement);
"@
$api = Add-Type -MemberDefinition $sig -Name 'bthprops.cpl_BluetoothAuthenticateDeviceEx' -Namespace Win32 -PassThru
# $api::BluetoothAuthenticateDeviceEx(hwndParentIn, hRadioIn, pbtdiInout, pbtOobData, authenticationRequirement)#uselib "bthprops.cpl"
#func global BluetoothAuthenticateDeviceEx "BluetoothAuthenticateDeviceEx" sptr, sptr, sptr, sptr, sptr
; BluetoothAuthenticateDeviceEx hwndParentIn, hRadioIn, varptr(pbtdiInout), varptr(pbtOobData), authenticationRequirement ; 戻り値は stat
; hwndParentIn : HWND optional -> "sptr"
; hRadioIn : HANDLE optional -> "sptr"
; pbtdiInout : BLUETOOTH_DEVICE_INFO* in/out -> "sptr"
; pbtOobData : BLUETOOTH_OOB_DATA_INFO* optional -> "sptr"
; authenticationRequirement : AUTHENTICATION_REQUIREMENTS -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "bthprops.cpl" #cfunc global BluetoothAuthenticateDeviceEx "BluetoothAuthenticateDeviceEx" sptr, sptr, var, var, int ; res = BluetoothAuthenticateDeviceEx(hwndParentIn, hRadioIn, pbtdiInout, pbtOobData, authenticationRequirement) ; hwndParentIn : HWND optional -> "sptr" ; hRadioIn : HANDLE optional -> "sptr" ; pbtdiInout : BLUETOOTH_DEVICE_INFO* in/out -> "var" ; pbtOobData : BLUETOOTH_OOB_DATA_INFO* optional -> "var" ; authenticationRequirement : AUTHENTICATION_REQUIREMENTS -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "bthprops.cpl" #cfunc global BluetoothAuthenticateDeviceEx "BluetoothAuthenticateDeviceEx" sptr, sptr, sptr, sptr, int ; res = BluetoothAuthenticateDeviceEx(hwndParentIn, hRadioIn, varptr(pbtdiInout), varptr(pbtOobData), authenticationRequirement) ; hwndParentIn : HWND optional -> "sptr" ; hRadioIn : HANDLE optional -> "sptr" ; pbtdiInout : BLUETOOTH_DEVICE_INFO* in/out -> "sptr" ; pbtOobData : BLUETOOTH_OOB_DATA_INFO* optional -> "sptr" ; authenticationRequirement : AUTHENTICATION_REQUIREMENTS -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD BluetoothAuthenticateDeviceEx(HWND hwndParentIn, HANDLE hRadioIn, BLUETOOTH_DEVICE_INFO* pbtdiInout, BLUETOOTH_OOB_DATA_INFO* pbtOobData, AUTHENTICATION_REQUIREMENTS authenticationRequirement) #uselib "bthprops.cpl" #cfunc global BluetoothAuthenticateDeviceEx "BluetoothAuthenticateDeviceEx" intptr, intptr, var, var, int ; res = BluetoothAuthenticateDeviceEx(hwndParentIn, hRadioIn, pbtdiInout, pbtOobData, authenticationRequirement) ; hwndParentIn : HWND optional -> "intptr" ; hRadioIn : HANDLE optional -> "intptr" ; pbtdiInout : BLUETOOTH_DEVICE_INFO* in/out -> "var" ; pbtOobData : BLUETOOTH_OOB_DATA_INFO* optional -> "var" ; authenticationRequirement : AUTHENTICATION_REQUIREMENTS -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD BluetoothAuthenticateDeviceEx(HWND hwndParentIn, HANDLE hRadioIn, BLUETOOTH_DEVICE_INFO* pbtdiInout, BLUETOOTH_OOB_DATA_INFO* pbtOobData, AUTHENTICATION_REQUIREMENTS authenticationRequirement) #uselib "bthprops.cpl" #cfunc global BluetoothAuthenticateDeviceEx "BluetoothAuthenticateDeviceEx" intptr, intptr, intptr, intptr, int ; res = BluetoothAuthenticateDeviceEx(hwndParentIn, hRadioIn, varptr(pbtdiInout), varptr(pbtOobData), authenticationRequirement) ; hwndParentIn : HWND optional -> "intptr" ; hRadioIn : HANDLE optional -> "intptr" ; pbtdiInout : BLUETOOTH_DEVICE_INFO* in/out -> "intptr" ; pbtOobData : BLUETOOTH_OOB_DATA_INFO* optional -> "intptr" ; authenticationRequirement : AUTHENTICATION_REQUIREMENTS -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
bthprops_cpl = windows.NewLazySystemDLL("bthprops.cpl")
procBluetoothAuthenticateDeviceEx = bthprops_cpl.NewProc("BluetoothAuthenticateDeviceEx")
)
// hwndParentIn (HWND optional), hRadioIn (HANDLE optional), pbtdiInout (BLUETOOTH_DEVICE_INFO* in/out), pbtOobData (BLUETOOTH_OOB_DATA_INFO* optional), authenticationRequirement (AUTHENTICATION_REQUIREMENTS)
r1, _, err := procBluetoothAuthenticateDeviceEx.Call(
uintptr(hwndParentIn),
uintptr(hRadioIn),
uintptr(pbtdiInout),
uintptr(pbtOobData),
uintptr(authenticationRequirement),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction BluetoothAuthenticateDeviceEx(
hwndParentIn: THandle; // HWND optional
hRadioIn: THandle; // HANDLE optional
pbtdiInout: Pointer; // BLUETOOTH_DEVICE_INFO* in/out
pbtOobData: Pointer; // BLUETOOTH_OOB_DATA_INFO* optional
authenticationRequirement: Integer // AUTHENTICATION_REQUIREMENTS
): DWORD; stdcall;
external 'bthprops.cpl' name 'BluetoothAuthenticateDeviceEx';result := DllCall("bthprops.cpl\BluetoothAuthenticateDeviceEx"
, "Ptr", hwndParentIn ; HWND optional
, "Ptr", hRadioIn ; HANDLE optional
, "Ptr", pbtdiInout ; BLUETOOTH_DEVICE_INFO* in/out
, "Ptr", pbtOobData ; BLUETOOTH_OOB_DATA_INFO* optional
, "Int", authenticationRequirement ; AUTHENTICATION_REQUIREMENTS
, "UInt") ; return: DWORD●BluetoothAuthenticateDeviceEx(hwndParentIn, hRadioIn, pbtdiInout, pbtOobData, authenticationRequirement) = DLL("bthprops.cpl", "dword BluetoothAuthenticateDeviceEx(void*, void*, void*, void*, int)")
# 呼び出し: BluetoothAuthenticateDeviceEx(hwndParentIn, hRadioIn, pbtdiInout, pbtOobData, authenticationRequirement)
# hwndParentIn : HWND optional -> "void*"
# hRadioIn : HANDLE optional -> "void*"
# pbtdiInout : BLUETOOTH_DEVICE_INFO* in/out -> "void*"
# pbtOobData : BLUETOOTH_OOB_DATA_INFO* optional -> "void*"
# authenticationRequirement : AUTHENTICATION_REQUIREMENTS -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "bthprops.cpl" fn BluetoothAuthenticateDeviceEx(
hwndParentIn: ?*anyopaque, // HWND optional
hRadioIn: ?*anyopaque, // HANDLE optional
pbtdiInout: [*c]BLUETOOTH_DEVICE_INFO, // BLUETOOTH_DEVICE_INFO* in/out
pbtOobData: [*c]BLUETOOTH_OOB_DATA_INFO, // BLUETOOTH_OOB_DATA_INFO* optional
authenticationRequirement: i32 // AUTHENTICATION_REQUIREMENTS
) callconv(std.os.windows.WINAPI) u32;proc BluetoothAuthenticateDeviceEx(
hwndParentIn: pointer, # HWND optional
hRadioIn: pointer, # HANDLE optional
pbtdiInout: ptr BLUETOOTH_DEVICE_INFO, # BLUETOOTH_DEVICE_INFO* in/out
pbtOobData: ptr BLUETOOTH_OOB_DATA_INFO, # BLUETOOTH_OOB_DATA_INFO* optional
authenticationRequirement: int32 # AUTHENTICATION_REQUIREMENTS
): uint32 {.importc: "BluetoothAuthenticateDeviceEx", stdcall, dynlib: "bthprops.cpl".}pragma(lib, "bthprops.cpl");
extern(Windows)
uint BluetoothAuthenticateDeviceEx(
void* hwndParentIn, // HWND optional
void* hRadioIn, // HANDLE optional
BLUETOOTH_DEVICE_INFO* pbtdiInout, // BLUETOOTH_DEVICE_INFO* in/out
BLUETOOTH_OOB_DATA_INFO* pbtOobData, // BLUETOOTH_OOB_DATA_INFO* optional
int authenticationRequirement // AUTHENTICATION_REQUIREMENTS
);ccall((:BluetoothAuthenticateDeviceEx, "bthprops.cpl"), stdcall, UInt32,
(Ptr{Cvoid}, Ptr{Cvoid}, Ptr{BLUETOOTH_DEVICE_INFO}, Ptr{BLUETOOTH_OOB_DATA_INFO}, Int32),
hwndParentIn, hRadioIn, pbtdiInout, pbtOobData, authenticationRequirement)
# hwndParentIn : HWND optional -> Ptr{Cvoid}
# hRadioIn : HANDLE optional -> Ptr{Cvoid}
# pbtdiInout : BLUETOOTH_DEVICE_INFO* in/out -> Ptr{BLUETOOTH_DEVICE_INFO}
# pbtOobData : BLUETOOTH_OOB_DATA_INFO* optional -> Ptr{BLUETOOTH_OOB_DATA_INFO}
# authenticationRequirement : AUTHENTICATION_REQUIREMENTS -> Int32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
uint32_t BluetoothAuthenticateDeviceEx(
void* hwndParentIn,
void* hRadioIn,
void* pbtdiInout,
void* pbtOobData,
int32_t authenticationRequirement);
]]
local bthprops.cpl = ffi.load("bthprops.cpl")
-- bthprops.cpl.BluetoothAuthenticateDeviceEx(hwndParentIn, hRadioIn, pbtdiInout, pbtOobData, authenticationRequirement)
-- hwndParentIn : HWND optional
-- hRadioIn : HANDLE optional
-- pbtdiInout : BLUETOOTH_DEVICE_INFO* in/out
-- pbtOobData : BLUETOOTH_OOB_DATA_INFO* optional
-- authenticationRequirement : AUTHENTICATION_REQUIREMENTS
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('bthprops.cpl');
const BluetoothAuthenticateDeviceEx = lib.func('__stdcall', 'BluetoothAuthenticateDeviceEx', 'uint32_t', ['void *', 'void *', 'void *', 'void *', 'int32_t']);
// BluetoothAuthenticateDeviceEx(hwndParentIn, hRadioIn, pbtdiInout, pbtOobData, authenticationRequirement)
// hwndParentIn : HWND optional -> 'void *'
// hRadioIn : HANDLE optional -> 'void *'
// pbtdiInout : BLUETOOTH_DEVICE_INFO* in/out -> 'void *'
// pbtOobData : BLUETOOTH_OOB_DATA_INFO* optional -> 'void *'
// authenticationRequirement : AUTHENTICATION_REQUIREMENTS -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("bthprops.cpl", {
BluetoothAuthenticateDeviceEx: { parameters: ["pointer", "pointer", "pointer", "pointer", "i32"], result: "u32" },
});
// lib.symbols.BluetoothAuthenticateDeviceEx(hwndParentIn, hRadioIn, pbtdiInout, pbtOobData, authenticationRequirement)
// hwndParentIn : HWND optional -> "pointer"
// hRadioIn : HANDLE optional -> "pointer"
// pbtdiInout : BLUETOOTH_DEVICE_INFO* in/out -> "pointer"
// pbtOobData : BLUETOOTH_OOB_DATA_INFO* optional -> "pointer"
// authenticationRequirement : AUTHENTICATION_REQUIREMENTS -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
uint32_t BluetoothAuthenticateDeviceEx(
void* hwndParentIn,
void* hRadioIn,
void* pbtdiInout,
void* pbtOobData,
int32_t authenticationRequirement);
C, "bthprops.cpl");
// $ffi->BluetoothAuthenticateDeviceEx(hwndParentIn, hRadioIn, pbtdiInout, pbtOobData, authenticationRequirement);
// hwndParentIn : HWND optional
// hRadioIn : HANDLE optional
// pbtdiInout : BLUETOOTH_DEVICE_INFO* in/out
// pbtOobData : BLUETOOTH_OOB_DATA_INFO* optional
// authenticationRequirement : AUTHENTICATION_REQUIREMENTS
// 構造体/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 Bthprops.cpl extends StdCallLibrary {
Bthprops.cpl INSTANCE = Native.load("bthprops.cpl", Bthprops.cpl.class);
int BluetoothAuthenticateDeviceEx(
Pointer hwndParentIn, // HWND optional
Pointer hRadioIn, // HANDLE optional
Pointer pbtdiInout, // BLUETOOTH_DEVICE_INFO* in/out
Pointer pbtOobData, // BLUETOOTH_OOB_DATA_INFO* optional
int authenticationRequirement // AUTHENTICATION_REQUIREMENTS
);
}@[Link("bthprops.cpl")]
lib Libbthprops.cpl
fun BluetoothAuthenticateDeviceEx = BluetoothAuthenticateDeviceEx(
hwndParentIn : Void*, # HWND optional
hRadioIn : Void*, # HANDLE optional
pbtdiInout : BLUETOOTH_DEVICE_INFO*, # BLUETOOTH_DEVICE_INFO* in/out
pbtOobData : BLUETOOTH_OOB_DATA_INFO*, # BLUETOOTH_OOB_DATA_INFO* optional
authenticationRequirement : Int32 # AUTHENTICATION_REQUIREMENTS
) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef BluetoothAuthenticateDeviceExNative = Uint32 Function(Pointer<Void>, Pointer<Void>, Pointer<Void>, Pointer<Void>, Int32);
typedef BluetoothAuthenticateDeviceExDart = int Function(Pointer<Void>, Pointer<Void>, Pointer<Void>, Pointer<Void>, int);
final BluetoothAuthenticateDeviceEx = DynamicLibrary.open('bthprops.cpl')
.lookupFunction<BluetoothAuthenticateDeviceExNative, BluetoothAuthenticateDeviceExDart>('BluetoothAuthenticateDeviceEx');
// hwndParentIn : HWND optional -> Pointer<Void>
// hRadioIn : HANDLE optional -> Pointer<Void>
// pbtdiInout : BLUETOOTH_DEVICE_INFO* in/out -> Pointer<Void>
// pbtOobData : BLUETOOTH_OOB_DATA_INFO* optional -> Pointer<Void>
// authenticationRequirement : AUTHENTICATION_REQUIREMENTS -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function BluetoothAuthenticateDeviceEx(
hwndParentIn: THandle; // HWND optional
hRadioIn: THandle; // HANDLE optional
pbtdiInout: Pointer; // BLUETOOTH_DEVICE_INFO* in/out
pbtOobData: Pointer; // BLUETOOTH_OOB_DATA_INFO* optional
authenticationRequirement: Integer // AUTHENTICATION_REQUIREMENTS
): DWORD; stdcall;
external 'bthprops.cpl' name 'BluetoothAuthenticateDeviceEx';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "BluetoothAuthenticateDeviceEx"
c_BluetoothAuthenticateDeviceEx :: Ptr () -> Ptr () -> Ptr () -> Ptr () -> Int32 -> IO Word32
-- hwndParentIn : HWND optional -> Ptr ()
-- hRadioIn : HANDLE optional -> Ptr ()
-- pbtdiInout : BLUETOOTH_DEVICE_INFO* in/out -> Ptr ()
-- pbtOobData : BLUETOOTH_OOB_DATA_INFO* optional -> Ptr ()
-- authenticationRequirement : AUTHENTICATION_REQUIREMENTS -> Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let bluetoothauthenticatedeviceex =
foreign "BluetoothAuthenticateDeviceEx"
((ptr void) @-> (ptr void) @-> (ptr void) @-> (ptr void) @-> int32_t @-> returning uint32_t)
(* hwndParentIn : HWND optional -> (ptr void) *)
(* hRadioIn : HANDLE optional -> (ptr void) *)
(* pbtdiInout : BLUETOOTH_DEVICE_INFO* in/out -> (ptr void) *)
(* pbtOobData : BLUETOOTH_OOB_DATA_INFO* optional -> (ptr void) *)
(* authenticationRequirement : AUTHENTICATION_REQUIREMENTS -> int32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library bthprops.cpl (t "bthprops.cpl"))
(cffi:use-foreign-library bthprops.cpl)
(cffi:defcfun ("BluetoothAuthenticateDeviceEx" bluetooth-authenticate-device-ex :convention :stdcall) :uint32
(hwnd-parent-in :pointer) ; HWND optional
(h-radio-in :pointer) ; HANDLE optional
(pbtdi-inout :pointer) ; BLUETOOTH_DEVICE_INFO* in/out
(pbt-oob-data :pointer) ; BLUETOOTH_OOB_DATA_INFO* optional
(authentication-requirement :int32)) ; AUTHENTICATION_REQUIREMENTS
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $BluetoothAuthenticateDeviceEx = Win32::API::More->new('bthprops.cpl',
'DWORD BluetoothAuthenticateDeviceEx(HANDLE hwndParentIn, HANDLE hRadioIn, LPVOID pbtdiInout, LPVOID pbtOobData, int authenticationRequirement)');
# my $ret = $BluetoothAuthenticateDeviceEx->Call($hwndParentIn, $hRadioIn, $pbtdiInout, $pbtOobData, $authenticationRequirement);
# hwndParentIn : HWND optional -> HANDLE
# hRadioIn : HANDLE optional -> HANDLE
# pbtdiInout : BLUETOOTH_DEVICE_INFO* in/out -> LPVOID
# pbtOobData : BLUETOOTH_OOB_DATA_INFO* optional -> LPVOID
# authenticationRequirement : AUTHENTICATION_REQUIREMENTS -> int
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
類似 API
- f BluetoothAuthenticateDevice — パスキーを用いてBluetoothデバイスを認証しペアリングする。