ホーム › Devices.Bluetooth › BluetoothSdpEnumAttributes
BluetoothSdpEnumAttributes
関数SDPストリーム内の全属性をコールバックで列挙する。
シグネチャ
// BluetoothApis.dll
#include <windows.h>
BOOL BluetoothSdpEnumAttributes(
BYTE* pSDPStream,
DWORD cbStreamSize,
PFN_BLUETOOTH_ENUM_ATTRIBUTES_CALLBACK pfnCallback,
void* pvParam
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pSDPStream | BYTE* | in |
| cbStreamSize | DWORD | in |
| pfnCallback | PFN_BLUETOOTH_ENUM_ATTRIBUTES_CALLBACK | in |
| pvParam | void* | in |
戻り値の型: BOOL
各言語での呼び出し定義
// BluetoothApis.dll
#include <windows.h>
BOOL BluetoothSdpEnumAttributes(
BYTE* pSDPStream,
DWORD cbStreamSize,
PFN_BLUETOOTH_ENUM_ATTRIBUTES_CALLBACK pfnCallback,
void* pvParam
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("BluetoothApis.dll", SetLastError = true, ExactSpelling = true)]
static extern bool BluetoothSdpEnumAttributes(
IntPtr pSDPStream, // BYTE*
uint cbStreamSize, // DWORD
IntPtr pfnCallback, // PFN_BLUETOOTH_ENUM_ATTRIBUTES_CALLBACK
IntPtr pvParam // void*
);<DllImport("BluetoothApis.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function BluetoothSdpEnumAttributes(
pSDPStream As IntPtr, ' BYTE*
cbStreamSize As UInteger, ' DWORD
pfnCallback As IntPtr, ' PFN_BLUETOOTH_ENUM_ATTRIBUTES_CALLBACK
pvParam As IntPtr ' void*
) As Boolean
End Function' pSDPStream : BYTE*
' cbStreamSize : DWORD
' pfnCallback : PFN_BLUETOOTH_ENUM_ATTRIBUTES_CALLBACK
' pvParam : void*
Declare PtrSafe Function BluetoothSdpEnumAttributes Lib "bluetoothapis" ( _
ByVal pSDPStream As LongPtr, _
ByVal cbStreamSize As Long, _
ByVal pfnCallback 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
BluetoothSdpEnumAttributes = ctypes.windll.bluetoothapis.BluetoothSdpEnumAttributes
BluetoothSdpEnumAttributes.restype = wintypes.BOOL
BluetoothSdpEnumAttributes.argtypes = [
ctypes.POINTER(ctypes.c_ubyte), # pSDPStream : BYTE*
wintypes.DWORD, # cbStreamSize : DWORD
ctypes.c_void_p, # pfnCallback : PFN_BLUETOOTH_ENUM_ATTRIBUTES_CALLBACK
ctypes.POINTER(None), # pvParam : void*
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('BluetoothApis.dll')
BluetoothSdpEnumAttributes = Fiddle::Function.new(
lib['BluetoothSdpEnumAttributes'],
[
Fiddle::TYPE_VOIDP, # pSDPStream : BYTE*
-Fiddle::TYPE_INT, # cbStreamSize : DWORD
Fiddle::TYPE_VOIDP, # pfnCallback : PFN_BLUETOOTH_ENUM_ATTRIBUTES_CALLBACK
Fiddle::TYPE_VOIDP, # pvParam : void*
],
Fiddle::TYPE_INT)#[link(name = "bluetoothapis")]
extern "system" {
fn BluetoothSdpEnumAttributes(
pSDPStream: *mut u8, // BYTE*
cbStreamSize: u32, // DWORD
pfnCallback: *const core::ffi::c_void, // PFN_BLUETOOTH_ENUM_ATTRIBUTES_CALLBACK
pvParam: *mut () // void*
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("BluetoothApis.dll", SetLastError = true)]
public static extern bool BluetoothSdpEnumAttributes(IntPtr pSDPStream, uint cbStreamSize, IntPtr pfnCallback, IntPtr pvParam);
"@
$api = Add-Type -MemberDefinition $sig -Name 'BluetoothApis_BluetoothSdpEnumAttributes' -Namespace Win32 -PassThru
# $api::BluetoothSdpEnumAttributes(pSDPStream, cbStreamSize, pfnCallback, pvParam)#uselib "BluetoothApis.dll"
#func global BluetoothSdpEnumAttributes "BluetoothSdpEnumAttributes" sptr, sptr, sptr, sptr
; BluetoothSdpEnumAttributes varptr(pSDPStream), cbStreamSize, pfnCallback, pvParam ; 戻り値は stat
; pSDPStream : BYTE* -> "sptr"
; cbStreamSize : DWORD -> "sptr"
; pfnCallback : PFN_BLUETOOTH_ENUM_ATTRIBUTES_CALLBACK -> "sptr"
; pvParam : void* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "BluetoothApis.dll" #cfunc global BluetoothSdpEnumAttributes "BluetoothSdpEnumAttributes" var, int, sptr, sptr ; res = BluetoothSdpEnumAttributes(pSDPStream, cbStreamSize, pfnCallback, pvParam) ; pSDPStream : BYTE* -> "var" ; cbStreamSize : DWORD -> "int" ; pfnCallback : PFN_BLUETOOTH_ENUM_ATTRIBUTES_CALLBACK -> "sptr" ; pvParam : void* -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "BluetoothApis.dll" #cfunc global BluetoothSdpEnumAttributes "BluetoothSdpEnumAttributes" sptr, int, sptr, sptr ; res = BluetoothSdpEnumAttributes(varptr(pSDPStream), cbStreamSize, pfnCallback, pvParam) ; pSDPStream : BYTE* -> "sptr" ; cbStreamSize : DWORD -> "int" ; pfnCallback : PFN_BLUETOOTH_ENUM_ATTRIBUTES_CALLBACK -> "sptr" ; pvParam : void* -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL BluetoothSdpEnumAttributes(BYTE* pSDPStream, DWORD cbStreamSize, PFN_BLUETOOTH_ENUM_ATTRIBUTES_CALLBACK pfnCallback, void* pvParam) #uselib "BluetoothApis.dll" #cfunc global BluetoothSdpEnumAttributes "BluetoothSdpEnumAttributes" var, int, intptr, intptr ; res = BluetoothSdpEnumAttributes(pSDPStream, cbStreamSize, pfnCallback, pvParam) ; pSDPStream : BYTE* -> "var" ; cbStreamSize : DWORD -> "int" ; pfnCallback : PFN_BLUETOOTH_ENUM_ATTRIBUTES_CALLBACK -> "intptr" ; pvParam : void* -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL BluetoothSdpEnumAttributes(BYTE* pSDPStream, DWORD cbStreamSize, PFN_BLUETOOTH_ENUM_ATTRIBUTES_CALLBACK pfnCallback, void* pvParam) #uselib "BluetoothApis.dll" #cfunc global BluetoothSdpEnumAttributes "BluetoothSdpEnumAttributes" intptr, int, intptr, intptr ; res = BluetoothSdpEnumAttributes(varptr(pSDPStream), cbStreamSize, pfnCallback, pvParam) ; pSDPStream : BYTE* -> "intptr" ; cbStreamSize : DWORD -> "int" ; pfnCallback : PFN_BLUETOOTH_ENUM_ATTRIBUTES_CALLBACK -> "intptr" ; pvParam : void* -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
bluetoothapis = windows.NewLazySystemDLL("BluetoothApis.dll")
procBluetoothSdpEnumAttributes = bluetoothapis.NewProc("BluetoothSdpEnumAttributes")
)
// pSDPStream (BYTE*), cbStreamSize (DWORD), pfnCallback (PFN_BLUETOOTH_ENUM_ATTRIBUTES_CALLBACK), pvParam (void*)
r1, _, err := procBluetoothSdpEnumAttributes.Call(
uintptr(pSDPStream),
uintptr(cbStreamSize),
uintptr(pfnCallback),
uintptr(pvParam),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction BluetoothSdpEnumAttributes(
pSDPStream: Pointer; // BYTE*
cbStreamSize: DWORD; // DWORD
pfnCallback: Pointer; // PFN_BLUETOOTH_ENUM_ATTRIBUTES_CALLBACK
pvParam: Pointer // void*
): BOOL; stdcall;
external 'BluetoothApis.dll' name 'BluetoothSdpEnumAttributes';result := DllCall("BluetoothApis\BluetoothSdpEnumAttributes"
, "Ptr", pSDPStream ; BYTE*
, "UInt", cbStreamSize ; DWORD
, "Ptr", pfnCallback ; PFN_BLUETOOTH_ENUM_ATTRIBUTES_CALLBACK
, "Ptr", pvParam ; void*
, "Int") ; return: BOOL●BluetoothSdpEnumAttributes(pSDPStream, cbStreamSize, pfnCallback, pvParam) = DLL("BluetoothApis.dll", "bool BluetoothSdpEnumAttributes(void*, dword, void*, void*)")
# 呼び出し: BluetoothSdpEnumAttributes(pSDPStream, cbStreamSize, pfnCallback, pvParam)
# pSDPStream : BYTE* -> "void*"
# cbStreamSize : DWORD -> "dword"
# pfnCallback : PFN_BLUETOOTH_ENUM_ATTRIBUTES_CALLBACK -> "void*"
# pvParam : void* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。