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

DOT11_WFD_ADVERTISED_SERVICE_LIST

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

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

フィールド

フィールドサイズx64x86説明
ServiceCountWORD2+0+0AdvertisedServiceに含まれるサービス記述子の数。
AdvertisedServiceDOT11_WFD_ADVERTISED_SERVICE_DESCRIPTOR264+4+4アドバタイズされるサービス記述子の配列(可変長の先頭要素)。

各言語での定義

#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;

// DOT11_WFD_ADVERTISED_SERVICE_LIST  (x64 268 / x86 268 バイト)
typedef struct DOT11_WFD_ADVERTISED_SERVICE_LIST {
    WORD ServiceCount;
    DOT11_WFD_ADVERTISED_SERVICE_DESCRIPTOR AdvertisedService[1];
} DOT11_WFD_ADVERTISED_SERVICE_LIST;
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;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DOT11_WFD_ADVERTISED_SERVICE_LIST
{
    public ushort ServiceCount;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public DOT11_WFD_ADVERTISED_SERVICE_DESCRIPTOR[] AdvertisedService;
}
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

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DOT11_WFD_ADVERTISED_SERVICE_LIST
    Public ServiceCount As UShort
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public AdvertisedService() As DOT11_WFD_ADVERTISED_SERVICE_DESCRIPTOR
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),
    ]

class DOT11_WFD_ADVERTISED_SERVICE_LIST(ctypes.Structure):
    _fields_ = [
        ("ServiceCount", ctypes.c_ushort),
        ("AdvertisedService", DOT11_WFD_ADVERTISED_SERVICE_DESCRIPTOR * 1),
    ]
#[repr(C)]
pub struct DOT11_WFD_ADVERTISED_SERVICE_DESCRIPTOR {
    pub AdvertisementID: u32,
    pub ConfigMethods: u16,
    pub ServiceNameLength: u8,
    pub ServiceName: [u8; 255],
}

#[repr(C)]
pub struct DOT11_WFD_ADVERTISED_SERVICE_LIST {
    pub ServiceCount: u16,
    pub AdvertisedService: [DOT11_WFD_ADVERTISED_SERVICE_DESCRIPTOR; 1],
}
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_LIST struct {
	ServiceCount uint16
	AdvertisedService [1]DOT11_WFD_ADVERTISED_SERVICE_DESCRIPTOR
}
type
  DOT11_WFD_ADVERTISED_SERVICE_DESCRIPTOR = record
    AdvertisementID: DWORD;
    ConfigMethods: Word;
    ServiceNameLength: Byte;
    ServiceName: array[0..254] of Byte;
  end;

  DOT11_WFD_ADVERTISED_SERVICE_LIST = record
    ServiceCount: Word;
    AdvertisedService: array[0..0] of DOT11_WFD_ADVERTISED_SERVICE_DESCRIPTOR;
  end;
const DOT11_WFD_ADVERTISED_SERVICE_DESCRIPTOR = extern struct {
    AdvertisementID: u32,
    ConfigMethods: u16,
    ServiceNameLength: u8,
    ServiceName: [255]u8,
};

const DOT11_WFD_ADVERTISED_SERVICE_LIST = extern struct {
    ServiceCount: u16,
    AdvertisedService: [1]DOT11_WFD_ADVERTISED_SERVICE_DESCRIPTOR,
};
type
  DOT11_WFD_ADVERTISED_SERVICE_DESCRIPTOR {.bycopy.} = object
    AdvertisementID: uint32
    ConfigMethods: uint16
    ServiceNameLength: uint8
    ServiceName: array[255, uint8]

  DOT11_WFD_ADVERTISED_SERVICE_LIST {.bycopy.} = object
    ServiceCount: uint16
    AdvertisedService: array[1, DOT11_WFD_ADVERTISED_SERVICE_DESCRIPTOR]
struct DOT11_WFD_ADVERTISED_SERVICE_DESCRIPTOR
{
    uint AdvertisementID;
    ushort ConfigMethods;
    ubyte ServiceNameLength;
    ubyte[255] ServiceName;
}

struct DOT11_WFD_ADVERTISED_SERVICE_LIST
{
    ushort ServiceCount;
    DOT11_WFD_ADVERTISED_SERVICE_DESCRIPTOR[1] AdvertisedService;
}

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_LIST サイズ: 268 バイト(x64)
dim st, 67    ; 4byte整数×67(構造体サイズ 268 / 4 切り上げ)
; ServiceCount : WORD (+0, 2byte)  wpoke st,0,値  /  値 = wpeek(st,0)
; AdvertisedService : DOT11_WFD_ADVERTISED_SERVICE_DESCRIPTOR (+4, 264byte)  varptr(st)+4 を基点に操作(264byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global DOT11_WFD_ADVERTISED_SERVICE_DESCRIPTOR
    #field int AdvertisementID
    #field short ConfigMethods
    #field byte ServiceNameLength
    #field byte ServiceName 255
#endstruct

#defstruct global DOT11_WFD_ADVERTISED_SERVICE_LIST
    #field short ServiceCount
    #field DOT11_WFD_ADVERTISED_SERVICE_DESCRIPTOR AdvertisedService 1
#endstruct

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