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

BLUETOOTH_AUTHENTICATE_RESPONSE

構造体
サイズx64: 48 バイト / x86: 48 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
bthAddressRemoteBLUETOOTH_ADDRESS8+0+0認証対象リモートデバイスのBluetoothアドレス。
authMethodBLUETOOTH_AUTHENTICATION_METHOD4+8+8応答に用いる認証方式を示す列挙値。
Anonymous_Anonymous_e__Union32+12+12認証方式に応じたPIN・OOB・数値・パスキー情報を格納する無名共用体。
negativeResponseBYTE1+44+44認証を拒否する場合に非ゼロを設定するブール値。0で承認。

共用体: _Anonymous_e__Union x64 32B / x86 32B

フィールドサイズx64x86
pinInfoBLUETOOTH_PIN_INFO17+0+0
oobInfoBLUETOOTH_OOB_DATA_INFO32+0+0
numericCompInfoBLUETOOTH_NUMERIC_COMPARISON_INFO4+0+0
passkeyInfoBLUETOOTH_PASSKEY_INFO4+0+0

各言語での定義

#include <windows.h>

// BLUETOOTH_ADDRESS  (x64 8 / x86 8 バイト)
typedef struct BLUETOOTH_ADDRESS {
    _Anonymous_e__Union Anonymous;
} BLUETOOTH_ADDRESS;

// BLUETOOTH_AUTHENTICATE_RESPONSE  (x64 48 / x86 48 バイト)
typedef struct BLUETOOTH_AUTHENTICATE_RESPONSE {
    BLUETOOTH_ADDRESS bthAddressRemote;
    BLUETOOTH_AUTHENTICATION_METHOD authMethod;
    _Anonymous_e__Union Anonymous;
    BYTE negativeResponse;
} BLUETOOTH_AUTHENTICATE_RESPONSE;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct BLUETOOTH_ADDRESS
{
    public _Anonymous_e__Union Anonymous;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct BLUETOOTH_AUTHENTICATE_RESPONSE
{
    public BLUETOOTH_ADDRESS bthAddressRemote;
    public int authMethod;
    public _Anonymous_e__Union Anonymous;
    public byte negativeResponse;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure BLUETOOTH_ADDRESS
    Public Anonymous As _Anonymous_e__Union
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure BLUETOOTH_AUTHENTICATE_RESPONSE
    Public bthAddressRemote As BLUETOOTH_ADDRESS
    Public authMethod As Integer
    Public Anonymous As _Anonymous_e__Union
    Public negativeResponse As Byte
End Structure
import ctypes
from ctypes import wintypes

class BLUETOOTH_ADDRESS(ctypes.Structure):
    _fields_ = [
        ("Anonymous", _Anonymous_e__Union),
    ]

class BLUETOOTH_AUTHENTICATE_RESPONSE(ctypes.Structure):
    _fields_ = [
        ("bthAddressRemote", BLUETOOTH_ADDRESS),
        ("authMethod", ctypes.c_int),
        ("Anonymous", _Anonymous_e__Union),
        ("negativeResponse", ctypes.c_ubyte),
    ]
#[repr(C)]
pub struct BLUETOOTH_ADDRESS {
    pub Anonymous: _Anonymous_e__Union,
}

#[repr(C)]
pub struct BLUETOOTH_AUTHENTICATE_RESPONSE {
    pub bthAddressRemote: BLUETOOTH_ADDRESS,
    pub authMethod: i32,
    pub Anonymous: _Anonymous_e__Union,
    pub negativeResponse: u8,
}
import "golang.org/x/sys/windows"

type BLUETOOTH_ADDRESS struct {
	Anonymous _Anonymous_e__Union
}

type BLUETOOTH_AUTHENTICATE_RESPONSE struct {
	bthAddressRemote BLUETOOTH_ADDRESS
	authMethod int32
	Anonymous _Anonymous_e__Union
	negativeResponse byte
}
type
  BLUETOOTH_ADDRESS = record
    Anonymous: _Anonymous_e__Union;
  end;

  BLUETOOTH_AUTHENTICATE_RESPONSE = record
    bthAddressRemote: BLUETOOTH_ADDRESS;
    authMethod: Integer;
    Anonymous: _Anonymous_e__Union;
    negativeResponse: Byte;
  end;
const BLUETOOTH_ADDRESS = extern struct {
    Anonymous: _Anonymous_e__Union,
};

const BLUETOOTH_AUTHENTICATE_RESPONSE = extern struct {
    bthAddressRemote: BLUETOOTH_ADDRESS,
    authMethod: i32,
    Anonymous: _Anonymous_e__Union,
    negativeResponse: u8,
};
type
  BLUETOOTH_ADDRESS {.bycopy.} = object
    Anonymous: _Anonymous_e__Union

  BLUETOOTH_AUTHENTICATE_RESPONSE {.bycopy.} = object
    bthAddressRemote: BLUETOOTH_ADDRESS
    authMethod: int32
    Anonymous: _Anonymous_e__Union
    negativeResponse: uint8
struct BLUETOOTH_ADDRESS
{
    _Anonymous_e__Union Anonymous;
}

struct BLUETOOTH_AUTHENTICATE_RESPONSE
{
    BLUETOOTH_ADDRESS bthAddressRemote;
    int authMethod;
    _Anonymous_e__Union Anonymous;
    ubyte negativeResponse;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; BLUETOOTH_AUTHENTICATE_RESPONSE サイズ: 48 バイト(x64)
dim st, 12    ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; bthAddressRemote : BLUETOOTH_ADDRESS (+0, 8byte)  varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; authMethod : BLUETOOTH_AUTHENTICATION_METHOD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; Anonymous : _Anonymous_e__Union (+12, 32byte)  varptr(st)+12 を基点に操作(32byte:入れ子/配列)
; negativeResponse : BYTE (+44, 1byte)  poke st,44,値  /  値 = peek(st,44)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global BLUETOOTH_ADDRESS
    #field byte Anonymous 8
#endstruct

#defstruct global BLUETOOTH_AUTHENTICATE_RESPONSE
    #field BLUETOOTH_ADDRESS bthAddressRemote
    #field int authMethod
    #field byte Anonymous 32
    #field byte negativeResponse
#endstruct

stdim st, BLUETOOTH_AUTHENTICATE_RESPONSE        ; NSTRUCT 変数を確保
st->authMethod = 100
mes "authMethod=" + st->authMethod
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。