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

BluetoothSendAuthenticationResponseEx

関数
拡張版のBluetooth認証応答を送信する。
DLLBluetoothApis.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

DWORD BluetoothSendAuthenticationResponseEx(
    HANDLE hRadioIn,   // optional
    BLUETOOTH_AUTHENTICATE_RESPONSE* pauthResponse
);

パラメーター

名前方向説明
hRadioInHANDLEinoptional認証応答を送るBluetoothラジオのハンドル。NULL可。
pauthResponseBLUETOOTH_AUTHENTICATE_RESPONSE*in送信する認証応答の詳細(方式や鍵等)を保持する構造体ポインタ。

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD BluetoothSendAuthenticationResponseEx(
    HANDLE hRadioIn,   // optional
    BLUETOOTH_AUTHENTICATE_RESPONSE* pauthResponse
);
[DllImport("BluetoothApis.dll", ExactSpelling = true)]
static extern uint BluetoothSendAuthenticationResponseEx(
    IntPtr hRadioIn,   // HANDLE optional
    IntPtr pauthResponse   // BLUETOOTH_AUTHENTICATE_RESPONSE*
);
<DllImport("BluetoothApis.dll", ExactSpelling:=True)>
Public Shared Function BluetoothSendAuthenticationResponseEx(
    hRadioIn As IntPtr,   ' HANDLE optional
    pauthResponse As IntPtr   ' BLUETOOTH_AUTHENTICATE_RESPONSE*
) As UInteger
End Function
' hRadioIn : HANDLE optional
' pauthResponse : BLUETOOTH_AUTHENTICATE_RESPONSE*
Declare PtrSafe Function BluetoothSendAuthenticationResponseEx Lib "bluetoothapis" ( _
    ByVal hRadioIn As LongPtr, _
    ByVal pauthResponse As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

BluetoothSendAuthenticationResponseEx = ctypes.windll.bluetoothapis.BluetoothSendAuthenticationResponseEx
BluetoothSendAuthenticationResponseEx.restype = wintypes.DWORD
BluetoothSendAuthenticationResponseEx.argtypes = [
    wintypes.HANDLE,  # hRadioIn : HANDLE optional
    ctypes.c_void_p,  # pauthResponse : BLUETOOTH_AUTHENTICATE_RESPONSE*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('BluetoothApis.dll')
BluetoothSendAuthenticationResponseEx = Fiddle::Function.new(
  lib['BluetoothSendAuthenticationResponseEx'],
  [
    Fiddle::TYPE_VOIDP,  # hRadioIn : HANDLE optional
    Fiddle::TYPE_VOIDP,  # pauthResponse : BLUETOOTH_AUTHENTICATE_RESPONSE*
  ],
  -Fiddle::TYPE_INT)
#[link(name = "bluetoothapis")]
extern "system" {
    fn BluetoothSendAuthenticationResponseEx(
        hRadioIn: *mut core::ffi::c_void,  // HANDLE optional
        pauthResponse: *mut BLUETOOTH_AUTHENTICATE_RESPONSE  // BLUETOOTH_AUTHENTICATE_RESPONSE*
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("BluetoothApis.dll")]
public static extern uint BluetoothSendAuthenticationResponseEx(IntPtr hRadioIn, IntPtr pauthResponse);
"@
$api = Add-Type -MemberDefinition $sig -Name 'BluetoothApis_BluetoothSendAuthenticationResponseEx' -Namespace Win32 -PassThru
# $api::BluetoothSendAuthenticationResponseEx(hRadioIn, pauthResponse)
#uselib "BluetoothApis.dll"
#func global BluetoothSendAuthenticationResponseEx "BluetoothSendAuthenticationResponseEx" sptr, sptr
; BluetoothSendAuthenticationResponseEx hRadioIn, varptr(pauthResponse)   ; 戻り値は stat
; hRadioIn : HANDLE optional -> "sptr"
; pauthResponse : BLUETOOTH_AUTHENTICATE_RESPONSE* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "BluetoothApis.dll"
#cfunc global BluetoothSendAuthenticationResponseEx "BluetoothSendAuthenticationResponseEx" sptr, var
; res = BluetoothSendAuthenticationResponseEx(hRadioIn, pauthResponse)
; hRadioIn : HANDLE optional -> "sptr"
; pauthResponse : BLUETOOTH_AUTHENTICATE_RESPONSE* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD BluetoothSendAuthenticationResponseEx(HANDLE hRadioIn, BLUETOOTH_AUTHENTICATE_RESPONSE* pauthResponse)
#uselib "BluetoothApis.dll"
#cfunc global BluetoothSendAuthenticationResponseEx "BluetoothSendAuthenticationResponseEx" intptr, var
; res = BluetoothSendAuthenticationResponseEx(hRadioIn, pauthResponse)
; hRadioIn : HANDLE optional -> "intptr"
; pauthResponse : BLUETOOTH_AUTHENTICATE_RESPONSE* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	bluetoothapis = windows.NewLazySystemDLL("BluetoothApis.dll")
	procBluetoothSendAuthenticationResponseEx = bluetoothapis.NewProc("BluetoothSendAuthenticationResponseEx")
)

// hRadioIn (HANDLE optional), pauthResponse (BLUETOOTH_AUTHENTICATE_RESPONSE*)
r1, _, err := procBluetoothSendAuthenticationResponseEx.Call(
	uintptr(hRadioIn),
	uintptr(pauthResponse),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function BluetoothSendAuthenticationResponseEx(
  hRadioIn: THandle;   // HANDLE optional
  pauthResponse: Pointer   // BLUETOOTH_AUTHENTICATE_RESPONSE*
): DWORD; stdcall;
  external 'BluetoothApis.dll' name 'BluetoothSendAuthenticationResponseEx';
result := DllCall("BluetoothApis\BluetoothSendAuthenticationResponseEx"
    , "Ptr", hRadioIn   ; HANDLE optional
    , "Ptr", pauthResponse   ; BLUETOOTH_AUTHENTICATE_RESPONSE*
    , "UInt")   ; return: DWORD
●BluetoothSendAuthenticationResponseEx(hRadioIn, pauthResponse) = DLL("BluetoothApis.dll", "dword BluetoothSendAuthenticationResponseEx(void*, void*)")
# 呼び出し: BluetoothSendAuthenticationResponseEx(hRadioIn, pauthResponse)
# hRadioIn : HANDLE optional -> "void*"
# pauthResponse : BLUETOOTH_AUTHENTICATE_RESPONSE* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "bluetoothapis" fn BluetoothSendAuthenticationResponseEx(
    hRadioIn: ?*anyopaque, // HANDLE optional
    pauthResponse: [*c]BLUETOOTH_AUTHENTICATE_RESPONSE // BLUETOOTH_AUTHENTICATE_RESPONSE*
) callconv(std.os.windows.WINAPI) u32;
proc BluetoothSendAuthenticationResponseEx(
    hRadioIn: pointer,  # HANDLE optional
    pauthResponse: ptr BLUETOOTH_AUTHENTICATE_RESPONSE  # BLUETOOTH_AUTHENTICATE_RESPONSE*
): uint32 {.importc: "BluetoothSendAuthenticationResponseEx", stdcall, dynlib: "BluetoothApis.dll".}
pragma(lib, "bluetoothapis");
extern(Windows)
uint BluetoothSendAuthenticationResponseEx(
    void* hRadioIn,   // HANDLE optional
    BLUETOOTH_AUTHENTICATE_RESPONSE* pauthResponse   // BLUETOOTH_AUTHENTICATE_RESPONSE*
);
ccall((:BluetoothSendAuthenticationResponseEx, "BluetoothApis.dll"), stdcall, UInt32,
      (Ptr{Cvoid}, Ptr{BLUETOOTH_AUTHENTICATE_RESPONSE}),
      hRadioIn, pauthResponse)
# hRadioIn : HANDLE optional -> Ptr{Cvoid}
# pauthResponse : BLUETOOTH_AUTHENTICATE_RESPONSE* -> Ptr{BLUETOOTH_AUTHENTICATE_RESPONSE}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
uint32_t BluetoothSendAuthenticationResponseEx(
    void* hRadioIn,
    void* pauthResponse);
]]
local bluetoothapis = ffi.load("bluetoothapis")
-- bluetoothapis.BluetoothSendAuthenticationResponseEx(hRadioIn, pauthResponse)
-- hRadioIn : HANDLE optional
-- pauthResponse : BLUETOOTH_AUTHENTICATE_RESPONSE*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('BluetoothApis.dll');
const BluetoothSendAuthenticationResponseEx = lib.func('__stdcall', 'BluetoothSendAuthenticationResponseEx', 'uint32_t', ['void *', 'void *']);
// BluetoothSendAuthenticationResponseEx(hRadioIn, pauthResponse)
// hRadioIn : HANDLE optional -> 'void *'
// pauthResponse : BLUETOOTH_AUTHENTICATE_RESPONSE* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("BluetoothApis.dll", {
  BluetoothSendAuthenticationResponseEx: { parameters: ["pointer", "pointer"], result: "u32" },
});
// lib.symbols.BluetoothSendAuthenticationResponseEx(hRadioIn, pauthResponse)
// hRadioIn : HANDLE optional -> "pointer"
// pauthResponse : BLUETOOTH_AUTHENTICATE_RESPONSE* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint32_t BluetoothSendAuthenticationResponseEx(
    void* hRadioIn,
    void* pauthResponse);
C, "BluetoothApis.dll");
// $ffi->BluetoothSendAuthenticationResponseEx(hRadioIn, pauthResponse);
// hRadioIn : HANDLE optional
// pauthResponse : BLUETOOTH_AUTHENTICATE_RESPONSE*
// 構造体/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 Bluetoothapis extends StdCallLibrary {
    Bluetoothapis INSTANCE = Native.load("bluetoothapis", Bluetoothapis.class);
    int BluetoothSendAuthenticationResponseEx(
        Pointer hRadioIn,   // HANDLE optional
        Pointer pauthResponse   // BLUETOOTH_AUTHENTICATE_RESPONSE*
    );
}
@[Link("bluetoothapis")]
lib LibBluetoothApis
  fun BluetoothSendAuthenticationResponseEx = BluetoothSendAuthenticationResponseEx(
    hRadioIn : Void*,   # HANDLE optional
    pauthResponse : BLUETOOTH_AUTHENTICATE_RESPONSE*   # BLUETOOTH_AUTHENTICATE_RESPONSE*
  ) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef BluetoothSendAuthenticationResponseExNative = Uint32 Function(Pointer<Void>, Pointer<Void>);
typedef BluetoothSendAuthenticationResponseExDart = int Function(Pointer<Void>, Pointer<Void>);
final BluetoothSendAuthenticationResponseEx = DynamicLibrary.open('BluetoothApis.dll')
    .lookupFunction<BluetoothSendAuthenticationResponseExNative, BluetoothSendAuthenticationResponseExDart>('BluetoothSendAuthenticationResponseEx');
// hRadioIn : HANDLE optional -> Pointer<Void>
// pauthResponse : BLUETOOTH_AUTHENTICATE_RESPONSE* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function BluetoothSendAuthenticationResponseEx(
  hRadioIn: THandle;   // HANDLE optional
  pauthResponse: Pointer   // BLUETOOTH_AUTHENTICATE_RESPONSE*
): DWORD; stdcall;
  external 'BluetoothApis.dll' name 'BluetoothSendAuthenticationResponseEx';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "BluetoothSendAuthenticationResponseEx"
  c_BluetoothSendAuthenticationResponseEx :: Ptr () -> Ptr () -> IO Word32
-- hRadioIn : HANDLE optional -> Ptr ()
-- pauthResponse : BLUETOOTH_AUTHENTICATE_RESPONSE* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let bluetoothsendauthenticationresponseex =
  foreign "BluetoothSendAuthenticationResponseEx"
    ((ptr void) @-> (ptr void) @-> returning uint32_t)
(* hRadioIn : HANDLE optional -> (ptr void) *)
(* pauthResponse : BLUETOOTH_AUTHENTICATE_RESPONSE* -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library bluetoothapis (t "BluetoothApis.dll"))
(cffi:use-foreign-library bluetoothapis)

(cffi:defcfun ("BluetoothSendAuthenticationResponseEx" bluetooth-send-authentication-response-ex :convention :stdcall) :uint32
  (h-radio-in :pointer)   ; HANDLE optional
  (pauth-response :pointer))   ; BLUETOOTH_AUTHENTICATE_RESPONSE*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $BluetoothSendAuthenticationResponseEx = Win32::API::More->new('BluetoothApis',
    'DWORD BluetoothSendAuthenticationResponseEx(HANDLE hRadioIn, LPVOID pauthResponse)');
# my $ret = $BluetoothSendAuthenticationResponseEx->Call($hRadioIn, $pauthResponse);
# hRadioIn : HANDLE optional -> HANDLE
# pauthResponse : BLUETOOTH_AUTHENTICATE_RESPONSE* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

類似 API
使用する型