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

BluetoothSdpGetElementData

関数
SDPストリームから単一要素のデータを取得する。
DLLBluetoothApis.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

DWORD BluetoothSdpGetElementData(
    BYTE* pSdpStream,
    DWORD cbSdpStreamLength,
    SDP_ELEMENT_DATA* pData
);

パラメーター

名前方向
pSdpStreamBYTE*in
cbSdpStreamLengthDWORDin
pDataSDP_ELEMENT_DATA*out

戻り値の型: DWORD

各言語での呼び出し定義

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

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

BluetoothSdpGetElementData = ctypes.windll.bluetoothapis.BluetoothSdpGetElementData
BluetoothSdpGetElementData.restype = wintypes.DWORD
BluetoothSdpGetElementData.argtypes = [
    ctypes.POINTER(ctypes.c_ubyte),  # pSdpStream : BYTE*
    wintypes.DWORD,  # cbSdpStreamLength : DWORD
    ctypes.c_void_p,  # pData : SDP_ELEMENT_DATA* out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	bluetoothapis = windows.NewLazySystemDLL("BluetoothApis.dll")
	procBluetoothSdpGetElementData = bluetoothapis.NewProc("BluetoothSdpGetElementData")
)

// pSdpStream (BYTE*), cbSdpStreamLength (DWORD), pData (SDP_ELEMENT_DATA* out)
r1, _, err := procBluetoothSdpGetElementData.Call(
	uintptr(pSdpStream),
	uintptr(cbSdpStreamLength),
	uintptr(pData),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function BluetoothSdpGetElementData(
  pSdpStream: Pointer;   // BYTE*
  cbSdpStreamLength: DWORD;   // DWORD
  pData: Pointer   // SDP_ELEMENT_DATA* out
): DWORD; stdcall;
  external 'BluetoothApis.dll' name 'BluetoothSdpGetElementData';
result := DllCall("BluetoothApis\BluetoothSdpGetElementData"
    , "Ptr", pSdpStream   ; BYTE*
    , "UInt", cbSdpStreamLength   ; DWORD
    , "Ptr", pData   ; SDP_ELEMENT_DATA* out
    , "UInt")   ; return: DWORD
●BluetoothSdpGetElementData(pSdpStream, cbSdpStreamLength, pData) = DLL("BluetoothApis.dll", "dword BluetoothSdpGetElementData(void*, dword, void*)")
# 呼び出し: BluetoothSdpGetElementData(pSdpStream, cbSdpStreamLength, pData)
# pSdpStream : BYTE* -> "void*"
# cbSdpStreamLength : DWORD -> "dword"
# pData : SDP_ELEMENT_DATA* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。