ホーム › Devices.Bluetooth › BluetoothRegisterForAuthenticationEx
BluetoothRegisterForAuthenticationEx
関数拡張版のBluetooth認証要求コールバックを登録する。
シグネチャ
// BluetoothApis.dll
#include <windows.h>
DWORD BluetoothRegisterForAuthenticationEx(
const BLUETOOTH_DEVICE_INFO* pbtdiIn, // optional
INT_PTR* phRegHandleOut,
PFN_AUTHENTICATION_CALLBACK_EX pfnCallbackIn, // optional
void* pvParam // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pbtdiIn | BLUETOOTH_DEVICE_INFO* | inoptional |
| phRegHandleOut | INT_PTR* | out |
| pfnCallbackIn | PFN_AUTHENTICATION_CALLBACK_EX | inoptional |
| pvParam | void* | inoptional |
戻り値の型: DWORD
各言語での呼び出し定義
// BluetoothApis.dll
#include <windows.h>
DWORD BluetoothRegisterForAuthenticationEx(
const BLUETOOTH_DEVICE_INFO* pbtdiIn, // optional
INT_PTR* phRegHandleOut,
PFN_AUTHENTICATION_CALLBACK_EX pfnCallbackIn, // optional
void* pvParam // optional
);[DllImport("BluetoothApis.dll", ExactSpelling = true)]
static extern uint BluetoothRegisterForAuthenticationEx(
IntPtr pbtdiIn, // BLUETOOTH_DEVICE_INFO* optional
out IntPtr phRegHandleOut, // INT_PTR* out
IntPtr pfnCallbackIn, // PFN_AUTHENTICATION_CALLBACK_EX optional
IntPtr pvParam // void* optional
);<DllImport("BluetoothApis.dll", ExactSpelling:=True)>
Public Shared Function BluetoothRegisterForAuthenticationEx(
pbtdiIn As IntPtr, ' BLUETOOTH_DEVICE_INFO* optional
<Out> ByRef phRegHandleOut As IntPtr, ' INT_PTR* out
pfnCallbackIn As IntPtr, ' PFN_AUTHENTICATION_CALLBACK_EX optional
pvParam As IntPtr ' void* optional
) As UInteger
End Function' pbtdiIn : BLUETOOTH_DEVICE_INFO* optional
' phRegHandleOut : INT_PTR* out
' pfnCallbackIn : PFN_AUTHENTICATION_CALLBACK_EX optional
' pvParam : void* optional
Declare PtrSafe Function BluetoothRegisterForAuthenticationEx Lib "bluetoothapis" ( _
ByVal pbtdiIn As LongPtr, _
ByRef phRegHandleOut As LongPtr, _
ByVal pfnCallbackIn As LongPtr, _
ByVal pvParam As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
BluetoothRegisterForAuthenticationEx = ctypes.windll.bluetoothapis.BluetoothRegisterForAuthenticationEx
BluetoothRegisterForAuthenticationEx.restype = wintypes.DWORD
BluetoothRegisterForAuthenticationEx.argtypes = [
ctypes.c_void_p, # pbtdiIn : BLUETOOTH_DEVICE_INFO* optional
ctypes.POINTER(ctypes.c_ssize_t), # phRegHandleOut : INT_PTR* out
ctypes.c_void_p, # pfnCallbackIn : PFN_AUTHENTICATION_CALLBACK_EX optional
ctypes.POINTER(None), # pvParam : void* optional
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('BluetoothApis.dll')
BluetoothRegisterForAuthenticationEx = Fiddle::Function.new(
lib['BluetoothRegisterForAuthenticationEx'],
[
Fiddle::TYPE_VOIDP, # pbtdiIn : BLUETOOTH_DEVICE_INFO* optional
Fiddle::TYPE_VOIDP, # phRegHandleOut : INT_PTR* out
Fiddle::TYPE_VOIDP, # pfnCallbackIn : PFN_AUTHENTICATION_CALLBACK_EX optional
Fiddle::TYPE_VOIDP, # pvParam : void* optional
],
-Fiddle::TYPE_INT)#[link(name = "bluetoothapis")]
extern "system" {
fn BluetoothRegisterForAuthenticationEx(
pbtdiIn: *const BLUETOOTH_DEVICE_INFO, // BLUETOOTH_DEVICE_INFO* optional
phRegHandleOut: *mut isize, // INT_PTR* out
pfnCallbackIn: *const core::ffi::c_void, // PFN_AUTHENTICATION_CALLBACK_EX optional
pvParam: *mut () // void* optional
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("BluetoothApis.dll")]
public static extern uint BluetoothRegisterForAuthenticationEx(IntPtr pbtdiIn, out IntPtr phRegHandleOut, IntPtr pfnCallbackIn, IntPtr pvParam);
"@
$api = Add-Type -MemberDefinition $sig -Name 'BluetoothApis_BluetoothRegisterForAuthenticationEx' -Namespace Win32 -PassThru
# $api::BluetoothRegisterForAuthenticationEx(pbtdiIn, phRegHandleOut, pfnCallbackIn, pvParam)#uselib "BluetoothApis.dll"
#func global BluetoothRegisterForAuthenticationEx "BluetoothRegisterForAuthenticationEx" sptr, sptr, sptr, sptr
; BluetoothRegisterForAuthenticationEx varptr(pbtdiIn), varptr(phRegHandleOut), pfnCallbackIn, pvParam ; 戻り値は stat
; pbtdiIn : BLUETOOTH_DEVICE_INFO* optional -> "sptr"
; phRegHandleOut : INT_PTR* out -> "sptr"
; pfnCallbackIn : PFN_AUTHENTICATION_CALLBACK_EX optional -> "sptr"
; pvParam : void* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "BluetoothApis.dll" #cfunc global BluetoothRegisterForAuthenticationEx "BluetoothRegisterForAuthenticationEx" var, var, sptr, sptr ; res = BluetoothRegisterForAuthenticationEx(pbtdiIn, phRegHandleOut, pfnCallbackIn, pvParam) ; pbtdiIn : BLUETOOTH_DEVICE_INFO* optional -> "var" ; phRegHandleOut : INT_PTR* out -> "var" ; pfnCallbackIn : PFN_AUTHENTICATION_CALLBACK_EX optional -> "sptr" ; pvParam : void* optional -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "BluetoothApis.dll" #cfunc global BluetoothRegisterForAuthenticationEx "BluetoothRegisterForAuthenticationEx" sptr, sptr, sptr, sptr ; res = BluetoothRegisterForAuthenticationEx(varptr(pbtdiIn), varptr(phRegHandleOut), pfnCallbackIn, pvParam) ; pbtdiIn : BLUETOOTH_DEVICE_INFO* optional -> "sptr" ; phRegHandleOut : INT_PTR* out -> "sptr" ; pfnCallbackIn : PFN_AUTHENTICATION_CALLBACK_EX optional -> "sptr" ; pvParam : void* optional -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD BluetoothRegisterForAuthenticationEx(BLUETOOTH_DEVICE_INFO* pbtdiIn, INT_PTR* phRegHandleOut, PFN_AUTHENTICATION_CALLBACK_EX pfnCallbackIn, void* pvParam) #uselib "BluetoothApis.dll" #cfunc global BluetoothRegisterForAuthenticationEx "BluetoothRegisterForAuthenticationEx" var, var, intptr, intptr ; res = BluetoothRegisterForAuthenticationEx(pbtdiIn, phRegHandleOut, pfnCallbackIn, pvParam) ; pbtdiIn : BLUETOOTH_DEVICE_INFO* optional -> "var" ; phRegHandleOut : INT_PTR* out -> "var" ; pfnCallbackIn : PFN_AUTHENTICATION_CALLBACK_EX optional -> "intptr" ; pvParam : void* optional -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD BluetoothRegisterForAuthenticationEx(BLUETOOTH_DEVICE_INFO* pbtdiIn, INT_PTR* phRegHandleOut, PFN_AUTHENTICATION_CALLBACK_EX pfnCallbackIn, void* pvParam) #uselib "BluetoothApis.dll" #cfunc global BluetoothRegisterForAuthenticationEx "BluetoothRegisterForAuthenticationEx" intptr, intptr, intptr, intptr ; res = BluetoothRegisterForAuthenticationEx(varptr(pbtdiIn), varptr(phRegHandleOut), pfnCallbackIn, pvParam) ; pbtdiIn : BLUETOOTH_DEVICE_INFO* optional -> "intptr" ; phRegHandleOut : INT_PTR* out -> "intptr" ; pfnCallbackIn : PFN_AUTHENTICATION_CALLBACK_EX optional -> "intptr" ; pvParam : void* optional -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
bluetoothapis = windows.NewLazySystemDLL("BluetoothApis.dll")
procBluetoothRegisterForAuthenticationEx = bluetoothapis.NewProc("BluetoothRegisterForAuthenticationEx")
)
// pbtdiIn (BLUETOOTH_DEVICE_INFO* optional), phRegHandleOut (INT_PTR* out), pfnCallbackIn (PFN_AUTHENTICATION_CALLBACK_EX optional), pvParam (void* optional)
r1, _, err := procBluetoothRegisterForAuthenticationEx.Call(
uintptr(pbtdiIn),
uintptr(phRegHandleOut),
uintptr(pfnCallbackIn),
uintptr(pvParam),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction BluetoothRegisterForAuthenticationEx(
pbtdiIn: Pointer; // BLUETOOTH_DEVICE_INFO* optional
phRegHandleOut: Pointer; // INT_PTR* out
pfnCallbackIn: Pointer; // PFN_AUTHENTICATION_CALLBACK_EX optional
pvParam: Pointer // void* optional
): DWORD; stdcall;
external 'BluetoothApis.dll' name 'BluetoothRegisterForAuthenticationEx';result := DllCall("BluetoothApis\BluetoothRegisterForAuthenticationEx"
, "Ptr", pbtdiIn ; BLUETOOTH_DEVICE_INFO* optional
, "Ptr", phRegHandleOut ; INT_PTR* out
, "Ptr", pfnCallbackIn ; PFN_AUTHENTICATION_CALLBACK_EX optional
, "Ptr", pvParam ; void* optional
, "UInt") ; return: DWORD●BluetoothRegisterForAuthenticationEx(pbtdiIn, phRegHandleOut, pfnCallbackIn, pvParam) = DLL("BluetoothApis.dll", "dword BluetoothRegisterForAuthenticationEx(void*, void*, void*, void*)")
# 呼び出し: BluetoothRegisterForAuthenticationEx(pbtdiIn, phRegHandleOut, pfnCallbackIn, pvParam)
# pbtdiIn : BLUETOOTH_DEVICE_INFO* optional -> "void*"
# phRegHandleOut : INT_PTR* out -> "void*"
# pfnCallbackIn : PFN_AUTHENTICATION_CALLBACK_EX optional -> "void*"
# pvParam : void* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。