Win32 API 日本語リファレンス
ホームNetworkManagement.WiFi › DOT11_WFD_ADVERTISED_SERVICE_DESCRIPTOR

DOT11_WFD_ADVERTISED_SERVICE_DESCRIPTOR

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

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

フィールド

フィールドサイズx64x86説明
AdvertisementIDDWORD4+0+0サービスのアドバタイズメント識別子。
ConfigMethodsWORD2+4+4サービスがサポートするWPS構成メソッドのビットマスク。
ServiceNameLengthBYTE1+6+6ServiceNameのバイト長。
ServiceNameBYTE255+7+7アドバタイズされるサービス名を保持するバイト配列。

各言語での定義

#include <windows.h>

// DOT11_WFD_ADVERTISED_SERVICE_DESCRIPTOR  (x64 264 / x86 264 バイト)
typedef struct DOT11_WFD_ADVERTISED_SERVICE_DESCRIPTOR {
    DWORD AdvertisementID;
    WORD ConfigMethods;
    BYTE ServiceNameLength;
    BYTE ServiceName[255];
} DOT11_WFD_ADVERTISED_SERVICE_DESCRIPTOR;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DOT11_WFD_ADVERTISED_SERVICE_DESCRIPTOR
{
    public uint AdvertisementID;
    public ushort ConfigMethods;
    public byte ServiceNameLength;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 255)] public byte[] ServiceName;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DOT11_WFD_ADVERTISED_SERVICE_DESCRIPTOR
    Public AdvertisementID As UInteger
    Public ConfigMethods As UShort
    Public ServiceNameLength As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=255)> Public ServiceName() As Byte
End Structure
import ctypes
from ctypes import wintypes

class DOT11_WFD_ADVERTISED_SERVICE_DESCRIPTOR(ctypes.Structure):
    _fields_ = [
        ("AdvertisementID", wintypes.DWORD),
        ("ConfigMethods", ctypes.c_ushort),
        ("ServiceNameLength", ctypes.c_ubyte),
        ("ServiceName", ctypes.c_ubyte * 255),
    ]
#[repr(C)]
pub struct DOT11_WFD_ADVERTISED_SERVICE_DESCRIPTOR {
    pub AdvertisementID: u32,
    pub ConfigMethods: u16,
    pub ServiceNameLength: u8,
    pub ServiceName: [u8; 255],
}
import "golang.org/x/sys/windows"

type DOT11_WFD_ADVERTISED_SERVICE_DESCRIPTOR struct {
	AdvertisementID uint32
	ConfigMethods uint16
	ServiceNameLength byte
	ServiceName [255]byte
}
type
  DOT11_WFD_ADVERTISED_SERVICE_DESCRIPTOR = record
    AdvertisementID: DWORD;
    ConfigMethods: Word;
    ServiceNameLength: Byte;
    ServiceName: array[0..254] of Byte;
  end;
const DOT11_WFD_ADVERTISED_SERVICE_DESCRIPTOR = extern struct {
    AdvertisementID: u32,
    ConfigMethods: u16,
    ServiceNameLength: u8,
    ServiceName: [255]u8,
};
type
  DOT11_WFD_ADVERTISED_SERVICE_DESCRIPTOR {.bycopy.} = object
    AdvertisementID: uint32
    ConfigMethods: uint16
    ServiceNameLength: uint8
    ServiceName: array[255, uint8]
struct DOT11_WFD_ADVERTISED_SERVICE_DESCRIPTOR
{
    uint AdvertisementID;
    ushort ConfigMethods;
    ubyte ServiceNameLength;
    ubyte[255] ServiceName;
}

HSP用 定義

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

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

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