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

WLAN_BSS_LIST

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

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

フィールド

フィールドサイズx64x86説明
dwTotalSizeDWORD4+0+0この構造体全体のサイズ(バイト)。
dwNumberOfItemsDWORD4+4+4wlanBssEntriesに含まれるBSSエントリの数。
wlanBssEntriesWLAN_BSS_ENTRY360+8+8BSSエントリの配列(可変長の先頭要素)。

各言語での定義

#include <windows.h>

// DOT11_SSID  (x64 36 / x86 36 バイト)
typedef struct DOT11_SSID {
    DWORD uSSIDLength;
    BYTE ucSSID[32];
} DOT11_SSID;

// WLAN_RATE_SET  (x64 256 / x86 256 バイト)
typedef struct WLAN_RATE_SET {
    DWORD uRateSetLength;
    WORD usRateSet[126];
} WLAN_RATE_SET;

// WLAN_BSS_ENTRY  (x64 360 / x86 360 バイト)
typedef struct WLAN_BSS_ENTRY {
    DOT11_SSID dot11Ssid;
    DWORD uPhyId;
    BYTE dot11Bssid[6];
    DOT11_BSS_TYPE dot11BssType;
    DOT11_PHY_TYPE dot11BssPhyType;
    INT lRssi;
    DWORD uLinkQuality;
    BOOLEAN bInRegDomain;
    WORD usBeaconPeriod;
    ULONGLONG ullTimestamp;
    ULONGLONG ullHostTimestamp;
    WORD usCapabilityInformation;
    DWORD ulChCenterFrequency;
    WLAN_RATE_SET wlanRateSet;
    DWORD ulIeOffset;
    DWORD ulIeSize;
} WLAN_BSS_ENTRY;

// WLAN_BSS_LIST  (x64 368 / x86 368 バイト)
typedef struct WLAN_BSS_LIST {
    DWORD dwTotalSize;
    DWORD dwNumberOfItems;
    WLAN_BSS_ENTRY wlanBssEntries[1];
} WLAN_BSS_LIST;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DOT11_SSID
{
    public uint uSSIDLength;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] ucSSID;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WLAN_RATE_SET
{
    public uint uRateSetLength;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 126)] public ushort[] usRateSet;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WLAN_BSS_ENTRY
{
    public DOT11_SSID dot11Ssid;
    public uint uPhyId;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] dot11Bssid;
    public int dot11BssType;
    public int dot11BssPhyType;
    public int lRssi;
    public uint uLinkQuality;
    [MarshalAs(UnmanagedType.U1)] public bool bInRegDomain;
    public ushort usBeaconPeriod;
    public ulong ullTimestamp;
    public ulong ullHostTimestamp;
    public ushort usCapabilityInformation;
    public uint ulChCenterFrequency;
    public WLAN_RATE_SET wlanRateSet;
    public uint ulIeOffset;
    public uint ulIeSize;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WLAN_BSS_LIST
{
    public uint dwTotalSize;
    public uint dwNumberOfItems;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public WLAN_BSS_ENTRY[] wlanBssEntries;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DOT11_SSID
    Public uSSIDLength As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=32)> Public ucSSID() As Byte
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WLAN_RATE_SET
    Public uRateSetLength As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=126)> Public usRateSet() As UShort
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WLAN_BSS_ENTRY
    Public dot11Ssid As DOT11_SSID
    Public uPhyId As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=6)> Public dot11Bssid() As Byte
    Public dot11BssType As Integer
    Public dot11BssPhyType As Integer
    Public lRssi As Integer
    Public uLinkQuality As UInteger
    <MarshalAs(UnmanagedType.U1)> Public bInRegDomain As Boolean
    Public usBeaconPeriod As UShort
    Public ullTimestamp As ULong
    Public ullHostTimestamp As ULong
    Public usCapabilityInformation As UShort
    Public ulChCenterFrequency As UInteger
    Public wlanRateSet As WLAN_RATE_SET
    Public ulIeOffset As UInteger
    Public ulIeSize As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WLAN_BSS_LIST
    Public dwTotalSize As UInteger
    Public dwNumberOfItems As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public wlanBssEntries() As WLAN_BSS_ENTRY
End Structure
import ctypes
from ctypes import wintypes

class DOT11_SSID(ctypes.Structure):
    _fields_ = [
        ("uSSIDLength", wintypes.DWORD),
        ("ucSSID", ctypes.c_ubyte * 32),
    ]

class WLAN_RATE_SET(ctypes.Structure):
    _fields_ = [
        ("uRateSetLength", wintypes.DWORD),
        ("usRateSet", ctypes.c_ushort * 126),
    ]

class WLAN_BSS_ENTRY(ctypes.Structure):
    _fields_ = [
        ("dot11Ssid", DOT11_SSID),
        ("uPhyId", wintypes.DWORD),
        ("dot11Bssid", ctypes.c_ubyte * 6),
        ("dot11BssType", ctypes.c_int),
        ("dot11BssPhyType", ctypes.c_int),
        ("lRssi", ctypes.c_int),
        ("uLinkQuality", wintypes.DWORD),
        ("bInRegDomain", ctypes.c_byte),
        ("usBeaconPeriod", ctypes.c_ushort),
        ("ullTimestamp", ctypes.c_ulonglong),
        ("ullHostTimestamp", ctypes.c_ulonglong),
        ("usCapabilityInformation", ctypes.c_ushort),
        ("ulChCenterFrequency", wintypes.DWORD),
        ("wlanRateSet", WLAN_RATE_SET),
        ("ulIeOffset", wintypes.DWORD),
        ("ulIeSize", wintypes.DWORD),
    ]

class WLAN_BSS_LIST(ctypes.Structure):
    _fields_ = [
        ("dwTotalSize", wintypes.DWORD),
        ("dwNumberOfItems", wintypes.DWORD),
        ("wlanBssEntries", WLAN_BSS_ENTRY * 1),
    ]
#[repr(C)]
pub struct DOT11_SSID {
    pub uSSIDLength: u32,
    pub ucSSID: [u8; 32],
}

#[repr(C)]
pub struct WLAN_RATE_SET {
    pub uRateSetLength: u32,
    pub usRateSet: [u16; 126],
}

#[repr(C)]
pub struct WLAN_BSS_ENTRY {
    pub dot11Ssid: DOT11_SSID,
    pub uPhyId: u32,
    pub dot11Bssid: [u8; 6],
    pub dot11BssType: i32,
    pub dot11BssPhyType: i32,
    pub lRssi: i32,
    pub uLinkQuality: u32,
    pub bInRegDomain: u8,
    pub usBeaconPeriod: u16,
    pub ullTimestamp: u64,
    pub ullHostTimestamp: u64,
    pub usCapabilityInformation: u16,
    pub ulChCenterFrequency: u32,
    pub wlanRateSet: WLAN_RATE_SET,
    pub ulIeOffset: u32,
    pub ulIeSize: u32,
}

#[repr(C)]
pub struct WLAN_BSS_LIST {
    pub dwTotalSize: u32,
    pub dwNumberOfItems: u32,
    pub wlanBssEntries: [WLAN_BSS_ENTRY; 1],
}
import "golang.org/x/sys/windows"

type DOT11_SSID struct {
	uSSIDLength uint32
	ucSSID [32]byte
}

type WLAN_RATE_SET struct {
	uRateSetLength uint32
	usRateSet [126]uint16
}

type WLAN_BSS_ENTRY struct {
	dot11Ssid DOT11_SSID
	uPhyId uint32
	dot11Bssid [6]byte
	dot11BssType int32
	dot11BssPhyType int32
	lRssi int32
	uLinkQuality uint32
	bInRegDomain byte
	usBeaconPeriod uint16
	ullTimestamp uint64
	ullHostTimestamp uint64
	usCapabilityInformation uint16
	ulChCenterFrequency uint32
	wlanRateSet WLAN_RATE_SET
	ulIeOffset uint32
	ulIeSize uint32
}

type WLAN_BSS_LIST struct {
	dwTotalSize uint32
	dwNumberOfItems uint32
	wlanBssEntries [1]WLAN_BSS_ENTRY
}
type
  DOT11_SSID = record
    uSSIDLength: DWORD;
    ucSSID: array[0..31] of Byte;
  end;

  WLAN_RATE_SET = record
    uRateSetLength: DWORD;
    usRateSet: array[0..125] of Word;
  end;

  WLAN_BSS_ENTRY = record
    dot11Ssid: DOT11_SSID;
    uPhyId: DWORD;
    dot11Bssid: array[0..5] of Byte;
    dot11BssType: Integer;
    dot11BssPhyType: Integer;
    lRssi: Integer;
    uLinkQuality: DWORD;
    bInRegDomain: ByteBool;
    usBeaconPeriod: Word;
    ullTimestamp: UInt64;
    ullHostTimestamp: UInt64;
    usCapabilityInformation: Word;
    ulChCenterFrequency: DWORD;
    wlanRateSet: WLAN_RATE_SET;
    ulIeOffset: DWORD;
    ulIeSize: DWORD;
  end;

  WLAN_BSS_LIST = record
    dwTotalSize: DWORD;
    dwNumberOfItems: DWORD;
    wlanBssEntries: array[0..0] of WLAN_BSS_ENTRY;
  end;
const DOT11_SSID = extern struct {
    uSSIDLength: u32,
    ucSSID: [32]u8,
};

const WLAN_RATE_SET = extern struct {
    uRateSetLength: u32,
    usRateSet: [126]u16,
};

const WLAN_BSS_ENTRY = extern struct {
    dot11Ssid: DOT11_SSID,
    uPhyId: u32,
    dot11Bssid: [6]u8,
    dot11BssType: i32,
    dot11BssPhyType: i32,
    lRssi: i32,
    uLinkQuality: u32,
    bInRegDomain: u8,
    usBeaconPeriod: u16,
    ullTimestamp: u64,
    ullHostTimestamp: u64,
    usCapabilityInformation: u16,
    ulChCenterFrequency: u32,
    wlanRateSet: WLAN_RATE_SET,
    ulIeOffset: u32,
    ulIeSize: u32,
};

const WLAN_BSS_LIST = extern struct {
    dwTotalSize: u32,
    dwNumberOfItems: u32,
    wlanBssEntries: [1]WLAN_BSS_ENTRY,
};
type
  DOT11_SSID {.bycopy.} = object
    uSSIDLength: uint32
    ucSSID: array[32, uint8]

  WLAN_RATE_SET {.bycopy.} = object
    uRateSetLength: uint32
    usRateSet: array[126, uint16]

  WLAN_BSS_ENTRY {.bycopy.} = object
    dot11Ssid: DOT11_SSID
    uPhyId: uint32
    dot11Bssid: array[6, uint8]
    dot11BssType: int32
    dot11BssPhyType: int32
    lRssi: int32
    uLinkQuality: uint32
    bInRegDomain: uint8
    usBeaconPeriod: uint16
    ullTimestamp: uint64
    ullHostTimestamp: uint64
    usCapabilityInformation: uint16
    ulChCenterFrequency: uint32
    wlanRateSet: WLAN_RATE_SET
    ulIeOffset: uint32
    ulIeSize: uint32

  WLAN_BSS_LIST {.bycopy.} = object
    dwTotalSize: uint32
    dwNumberOfItems: uint32
    wlanBssEntries: array[1, WLAN_BSS_ENTRY]
struct DOT11_SSID
{
    uint uSSIDLength;
    ubyte[32] ucSSID;
}

struct WLAN_RATE_SET
{
    uint uRateSetLength;
    ushort[126] usRateSet;
}

struct WLAN_BSS_ENTRY
{
    DOT11_SSID dot11Ssid;
    uint uPhyId;
    ubyte[6] dot11Bssid;
    int dot11BssType;
    int dot11BssPhyType;
    int lRssi;
    uint uLinkQuality;
    ubyte bInRegDomain;
    ushort usBeaconPeriod;
    ulong ullTimestamp;
    ulong ullHostTimestamp;
    ushort usCapabilityInformation;
    uint ulChCenterFrequency;
    WLAN_RATE_SET wlanRateSet;
    uint ulIeOffset;
    uint ulIeSize;
}

struct WLAN_BSS_LIST
{
    uint dwTotalSize;
    uint dwNumberOfItems;
    WLAN_BSS_ENTRY[1] wlanBssEntries;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WLAN_BSS_LIST サイズ: 368 バイト(x64)
dim st, 92    ; 4byte整数×92(構造体サイズ 368 / 4 切り上げ)
; dwTotalSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwNumberOfItems : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; wlanBssEntries : WLAN_BSS_ENTRY (+8, 360byte)  varptr(st)+8 を基点に操作(360byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global DOT11_SSID
    #field int uSSIDLength
    #field byte ucSSID 32
#endstruct

#defstruct global WLAN_RATE_SET
    #field int uRateSetLength
    #field short usRateSet 126
#endstruct

#defstruct global WLAN_BSS_ENTRY
    #field DOT11_SSID dot11Ssid
    #field int uPhyId
    #field byte dot11Bssid 6
    #field int dot11BssType
    #field int dot11BssPhyType
    #field int lRssi
    #field int uLinkQuality
    #field bool1 bInRegDomain
    #field short usBeaconPeriod
    #field int64 ullTimestamp
    #field int64 ullHostTimestamp
    #field short usCapabilityInformation
    #field int ulChCenterFrequency
    #field WLAN_RATE_SET wlanRateSet
    #field int ulIeOffset
    #field int ulIeSize
#endstruct

#defstruct global WLAN_BSS_LIST
    #field int dwTotalSize
    #field int dwNumberOfItems
    #field WLAN_BSS_ENTRY wlanBssEntries 1
#endstruct

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