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

NDIS_802_11_BSSID_LIST

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

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

フィールド

フィールドサイズx64x86説明
NumberOfItemsDWORD4+0+0Bssid配列に含まれるBSSIDエントリ数。
BssidNDIS_WLAN_BSSID104+4+4検出したBSSID情報を格納する可変長配列の先頭要素。

各言語での定義

#include <windows.h>

// NDIS_802_11_SSID  (x64 36 / x86 36 バイト)
typedef struct NDIS_802_11_SSID {
    DWORD SsidLength;
    BYTE Ssid[32];
} NDIS_802_11_SSID;

// NDIS_802_11_CONFIGURATION_FH  (x64 16 / x86 16 バイト)
typedef struct NDIS_802_11_CONFIGURATION_FH {
    DWORD Length;
    DWORD HopPattern;
    DWORD HopSet;
    DWORD DwellTime;
} NDIS_802_11_CONFIGURATION_FH;

// NDIS_802_11_CONFIGURATION  (x64 32 / x86 32 バイト)
typedef struct NDIS_802_11_CONFIGURATION {
    DWORD Length;
    DWORD BeaconPeriod;
    DWORD ATIMWindow;
    DWORD DSConfig;
    NDIS_802_11_CONFIGURATION_FH FHConfig;
} NDIS_802_11_CONFIGURATION;

// NDIS_WLAN_BSSID  (x64 104 / x86 104 バイト)
typedef struct NDIS_WLAN_BSSID {
    DWORD Length;
    BYTE MacAddress[6];
    BYTE Reserved[2];
    NDIS_802_11_SSID Ssid;
    DWORD Privacy;
    INT Rssi;
    NDIS_802_11_NETWORK_TYPE NetworkTypeInUse;
    NDIS_802_11_CONFIGURATION Configuration;
    NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode;
    BYTE SupportedRates[8];
} NDIS_WLAN_BSSID;

// NDIS_802_11_BSSID_LIST  (x64 108 / x86 108 バイト)
typedef struct NDIS_802_11_BSSID_LIST {
    DWORD NumberOfItems;
    NDIS_WLAN_BSSID Bssid[1];
} NDIS_802_11_BSSID_LIST;
using System;
using System.Runtime.InteropServices;

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

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NDIS_802_11_CONFIGURATION_FH
{
    public uint Length;
    public uint HopPattern;
    public uint HopSet;
    public uint DwellTime;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NDIS_802_11_CONFIGURATION
{
    public uint Length;
    public uint BeaconPeriod;
    public uint ATIMWindow;
    public uint DSConfig;
    public NDIS_802_11_CONFIGURATION_FH FHConfig;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NDIS_WLAN_BSSID
{
    public uint Length;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] MacAddress;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] Reserved;
    public NDIS_802_11_SSID Ssid;
    public uint Privacy;
    public int Rssi;
    public int NetworkTypeInUse;
    public NDIS_802_11_CONFIGURATION Configuration;
    public int InfrastructureMode;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] SupportedRates;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NDIS_802_11_BSSID_LIST
{
    public uint NumberOfItems;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public NDIS_WLAN_BSSID[] Bssid;
}
Imports System.Runtime.InteropServices

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

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NDIS_802_11_CONFIGURATION_FH
    Public Length As UInteger
    Public HopPattern As UInteger
    Public HopSet As UInteger
    Public DwellTime As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NDIS_802_11_CONFIGURATION
    Public Length As UInteger
    Public BeaconPeriod As UInteger
    Public ATIMWindow As UInteger
    Public DSConfig As UInteger
    Public FHConfig As NDIS_802_11_CONFIGURATION_FH
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NDIS_WLAN_BSSID
    Public Length As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=6)> Public MacAddress() As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)> Public Reserved() As Byte
    Public Ssid As NDIS_802_11_SSID
    Public Privacy As UInteger
    Public Rssi As Integer
    Public NetworkTypeInUse As Integer
    Public Configuration As NDIS_802_11_CONFIGURATION
    Public InfrastructureMode As Integer
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)> Public SupportedRates() As Byte
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NDIS_802_11_BSSID_LIST
    Public NumberOfItems As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public Bssid() As NDIS_WLAN_BSSID
End Structure
import ctypes
from ctypes import wintypes

class NDIS_802_11_SSID(ctypes.Structure):
    _fields_ = [
        ("SsidLength", wintypes.DWORD),
        ("Ssid", ctypes.c_ubyte * 32),
    ]

class NDIS_802_11_CONFIGURATION_FH(ctypes.Structure):
    _fields_ = [
        ("Length", wintypes.DWORD),
        ("HopPattern", wintypes.DWORD),
        ("HopSet", wintypes.DWORD),
        ("DwellTime", wintypes.DWORD),
    ]

class NDIS_802_11_CONFIGURATION(ctypes.Structure):
    _fields_ = [
        ("Length", wintypes.DWORD),
        ("BeaconPeriod", wintypes.DWORD),
        ("ATIMWindow", wintypes.DWORD),
        ("DSConfig", wintypes.DWORD),
        ("FHConfig", NDIS_802_11_CONFIGURATION_FH),
    ]

class NDIS_WLAN_BSSID(ctypes.Structure):
    _fields_ = [
        ("Length", wintypes.DWORD),
        ("MacAddress", ctypes.c_ubyte * 6),
        ("Reserved", ctypes.c_ubyte * 2),
        ("Ssid", NDIS_802_11_SSID),
        ("Privacy", wintypes.DWORD),
        ("Rssi", ctypes.c_int),
        ("NetworkTypeInUse", ctypes.c_int),
        ("Configuration", NDIS_802_11_CONFIGURATION),
        ("InfrastructureMode", ctypes.c_int),
        ("SupportedRates", ctypes.c_ubyte * 8),
    ]

class NDIS_802_11_BSSID_LIST(ctypes.Structure):
    _fields_ = [
        ("NumberOfItems", wintypes.DWORD),
        ("Bssid", NDIS_WLAN_BSSID * 1),
    ]
#[repr(C)]
pub struct NDIS_802_11_SSID {
    pub SsidLength: u32,
    pub Ssid: [u8; 32],
}

#[repr(C)]
pub struct NDIS_802_11_CONFIGURATION_FH {
    pub Length: u32,
    pub HopPattern: u32,
    pub HopSet: u32,
    pub DwellTime: u32,
}

#[repr(C)]
pub struct NDIS_802_11_CONFIGURATION {
    pub Length: u32,
    pub BeaconPeriod: u32,
    pub ATIMWindow: u32,
    pub DSConfig: u32,
    pub FHConfig: NDIS_802_11_CONFIGURATION_FH,
}

#[repr(C)]
pub struct NDIS_WLAN_BSSID {
    pub Length: u32,
    pub MacAddress: [u8; 6],
    pub Reserved: [u8; 2],
    pub Ssid: NDIS_802_11_SSID,
    pub Privacy: u32,
    pub Rssi: i32,
    pub NetworkTypeInUse: i32,
    pub Configuration: NDIS_802_11_CONFIGURATION,
    pub InfrastructureMode: i32,
    pub SupportedRates: [u8; 8],
}

#[repr(C)]
pub struct NDIS_802_11_BSSID_LIST {
    pub NumberOfItems: u32,
    pub Bssid: [NDIS_WLAN_BSSID; 1],
}
import "golang.org/x/sys/windows"

type NDIS_802_11_SSID struct {
	SsidLength uint32
	Ssid [32]byte
}

type NDIS_802_11_CONFIGURATION_FH struct {
	Length uint32
	HopPattern uint32
	HopSet uint32
	DwellTime uint32
}

type NDIS_802_11_CONFIGURATION struct {
	Length uint32
	BeaconPeriod uint32
	ATIMWindow uint32
	DSConfig uint32
	FHConfig NDIS_802_11_CONFIGURATION_FH
}

type NDIS_WLAN_BSSID struct {
	Length uint32
	MacAddress [6]byte
	Reserved [2]byte
	Ssid NDIS_802_11_SSID
	Privacy uint32
	Rssi int32
	NetworkTypeInUse int32
	Configuration NDIS_802_11_CONFIGURATION
	InfrastructureMode int32
	SupportedRates [8]byte
}

type NDIS_802_11_BSSID_LIST struct {
	NumberOfItems uint32
	Bssid [1]NDIS_WLAN_BSSID
}
type
  NDIS_802_11_SSID = record
    SsidLength: DWORD;
    Ssid: array[0..31] of Byte;
  end;

  NDIS_802_11_CONFIGURATION_FH = record
    Length: DWORD;
    HopPattern: DWORD;
    HopSet: DWORD;
    DwellTime: DWORD;
  end;

  NDIS_802_11_CONFIGURATION = record
    Length: DWORD;
    BeaconPeriod: DWORD;
    ATIMWindow: DWORD;
    DSConfig: DWORD;
    FHConfig: NDIS_802_11_CONFIGURATION_FH;
  end;

  NDIS_WLAN_BSSID = record
    Length: DWORD;
    MacAddress: array[0..5] of Byte;
    Reserved: array[0..1] of Byte;
    Ssid: NDIS_802_11_SSID;
    Privacy: DWORD;
    Rssi: Integer;
    NetworkTypeInUse: Integer;
    Configuration: NDIS_802_11_CONFIGURATION;
    InfrastructureMode: Integer;
    SupportedRates: array[0..7] of Byte;
  end;

  NDIS_802_11_BSSID_LIST = record
    NumberOfItems: DWORD;
    Bssid: array[0..0] of NDIS_WLAN_BSSID;
  end;
const NDIS_802_11_SSID = extern struct {
    SsidLength: u32,
    Ssid: [32]u8,
};

const NDIS_802_11_CONFIGURATION_FH = extern struct {
    Length: u32,
    HopPattern: u32,
    HopSet: u32,
    DwellTime: u32,
};

const NDIS_802_11_CONFIGURATION = extern struct {
    Length: u32,
    BeaconPeriod: u32,
    ATIMWindow: u32,
    DSConfig: u32,
    FHConfig: NDIS_802_11_CONFIGURATION_FH,
};

const NDIS_WLAN_BSSID = extern struct {
    Length: u32,
    MacAddress: [6]u8,
    Reserved: [2]u8,
    Ssid: NDIS_802_11_SSID,
    Privacy: u32,
    Rssi: i32,
    NetworkTypeInUse: i32,
    Configuration: NDIS_802_11_CONFIGURATION,
    InfrastructureMode: i32,
    SupportedRates: [8]u8,
};

const NDIS_802_11_BSSID_LIST = extern struct {
    NumberOfItems: u32,
    Bssid: [1]NDIS_WLAN_BSSID,
};
type
  NDIS_802_11_SSID {.bycopy.} = object
    SsidLength: uint32
    Ssid: array[32, uint8]

  NDIS_802_11_CONFIGURATION_FH {.bycopy.} = object
    Length: uint32
    HopPattern: uint32
    HopSet: uint32
    DwellTime: uint32

  NDIS_802_11_CONFIGURATION {.bycopy.} = object
    Length: uint32
    BeaconPeriod: uint32
    ATIMWindow: uint32
    DSConfig: uint32
    FHConfig: NDIS_802_11_CONFIGURATION_FH

  NDIS_WLAN_BSSID {.bycopy.} = object
    Length: uint32
    MacAddress: array[6, uint8]
    Reserved: array[2, uint8]
    Ssid: NDIS_802_11_SSID
    Privacy: uint32
    Rssi: int32
    NetworkTypeInUse: int32
    Configuration: NDIS_802_11_CONFIGURATION
    InfrastructureMode: int32
    SupportedRates: array[8, uint8]

  NDIS_802_11_BSSID_LIST {.bycopy.} = object
    NumberOfItems: uint32
    Bssid: array[1, NDIS_WLAN_BSSID]
struct NDIS_802_11_SSID
{
    uint SsidLength;
    ubyte[32] Ssid;
}

struct NDIS_802_11_CONFIGURATION_FH
{
    uint Length;
    uint HopPattern;
    uint HopSet;
    uint DwellTime;
}

struct NDIS_802_11_CONFIGURATION
{
    uint Length;
    uint BeaconPeriod;
    uint ATIMWindow;
    uint DSConfig;
    NDIS_802_11_CONFIGURATION_FH FHConfig;
}

struct NDIS_WLAN_BSSID
{
    uint Length;
    ubyte[6] MacAddress;
    ubyte[2] Reserved;
    NDIS_802_11_SSID Ssid;
    uint Privacy;
    int Rssi;
    int NetworkTypeInUse;
    NDIS_802_11_CONFIGURATION Configuration;
    int InfrastructureMode;
    ubyte[8] SupportedRates;
}

struct NDIS_802_11_BSSID_LIST
{
    uint NumberOfItems;
    NDIS_WLAN_BSSID[1] Bssid;
}

HSP用 定義

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

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

#defstruct global NDIS_802_11_CONFIGURATION_FH
    #field int Length
    #field int HopPattern
    #field int HopSet
    #field int DwellTime
#endstruct

#defstruct global NDIS_802_11_CONFIGURATION
    #field int Length
    #field int BeaconPeriod
    #field int ATIMWindow
    #field int DSConfig
    #field NDIS_802_11_CONFIGURATION_FH FHConfig
#endstruct

#defstruct global NDIS_WLAN_BSSID
    #field int Length
    #field byte MacAddress 6
    #field byte Reserved 2
    #field NDIS_802_11_SSID Ssid
    #field int Privacy
    #field int Rssi
    #field int NetworkTypeInUse
    #field NDIS_802_11_CONFIGURATION Configuration
    #field int InfrastructureMode
    #field byte SupportedRates 8
#endstruct

#defstruct global NDIS_802_11_BSSID_LIST
    #field int NumberOfItems
    #field NDIS_WLAN_BSSID Bssid 1
#endstruct

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