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

NFC_LLCP_SERVICE_NAME_ENTRY

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

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

フィールド

フィールドサイズx64x86説明
cbServiceNameDWORD4+0+0pbServiceNameのサービス名長をバイトで表す。
pbServiceNameBYTE1+4+4LLCPサービス名(URI形式)を格納するバイト列。

各言語での定義

#include <windows.h>

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

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

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

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

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

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_NAME_ENTRY サイズ: 8 バイト(x64)
dim st, 2    ; 4byte整数×2(構造体サイズ 8 / 4 切り上げ)
; cbServiceName : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; pbServiceName : BYTE (+4, 1byte)  varptr(st)+4 を基点に操作(1byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global NFC_LLCP_SERVICE_NAME_ENTRY
    #field int cbServiceName
    #field byte pbServiceName 1
#endstruct

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