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

NFC_LLCP_SERVICE_DISCOVER_SAP

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

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

フィールド

フィールドサイズx64x86説明
NumberOfEntriesDWORD4+0+0SAPEntries内のSAP値の個数を表す。
SAPEntriesBYTE1+4+4探索で得られたサービスアクセスポイント(SAP)値の配列。

各言語での定義

#include <windows.h>

// NFC_LLCP_SERVICE_DISCOVER_SAP  (x64 8 / x86 8 バイト)
typedef struct NFC_LLCP_SERVICE_DISCOVER_SAP {
    DWORD NumberOfEntries;
    BYTE SAPEntries[1];
} NFC_LLCP_SERVICE_DISCOVER_SAP;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NFC_LLCP_SERVICE_DISCOVER_SAP
{
    public uint NumberOfEntries;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public byte[] SAPEntries;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NFC_LLCP_SERVICE_DISCOVER_SAP
    Public NumberOfEntries As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public SAPEntries() As Byte
End Structure
import ctypes
from ctypes import wintypes

class NFC_LLCP_SERVICE_DISCOVER_SAP(ctypes.Structure):
    _fields_ = [
        ("NumberOfEntries", wintypes.DWORD),
        ("SAPEntries", ctypes.c_ubyte * 1),
    ]
#[repr(C)]
pub struct NFC_LLCP_SERVICE_DISCOVER_SAP {
    pub NumberOfEntries: u32,
    pub SAPEntries: [u8; 1],
}
import "golang.org/x/sys/windows"

type NFC_LLCP_SERVICE_DISCOVER_SAP struct {
	NumberOfEntries uint32
	SAPEntries [1]byte
}
type
  NFC_LLCP_SERVICE_DISCOVER_SAP = record
    NumberOfEntries: DWORD;
    SAPEntries: array[0..0] of Byte;
  end;
const NFC_LLCP_SERVICE_DISCOVER_SAP = extern struct {
    NumberOfEntries: u32,
    SAPEntries: [1]u8,
};
type
  NFC_LLCP_SERVICE_DISCOVER_SAP {.bycopy.} = object
    NumberOfEntries: uint32
    SAPEntries: array[1, uint8]
struct NFC_LLCP_SERVICE_DISCOVER_SAP
{
    uint NumberOfEntries;
    ubyte[1] SAPEntries;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NFC_LLCP_SERVICE_DISCOVER_SAP サイズ: 8 バイト(x64)
dim st, 2    ; 4byte整数×2(構造体サイズ 8 / 4 切り上げ)
; NumberOfEntries : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; SAPEntries : BYTE (+4, 1byte)  varptr(st)+4 を基点に操作(1byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global NFC_LLCP_SERVICE_DISCOVER_SAP
    #field int NumberOfEntries
    #field byte SAPEntries 1
#endstruct

stdim st, NFC_LLCP_SERVICE_DISCOVER_SAP        ; NSTRUCT 変数を確保
st->NumberOfEntries = 100
mes "NumberOfEntries=" + st->NumberOfEntries