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