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

NDIS_WLAN_BSSID

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

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

フィールド

フィールドサイズx64x86説明
LengthDWORD4+0+0本構造体の長さ(バイト)。次エントリへのオフセットにもなる。
MacAddressBYTE6+4+4アクセスポイントのMACアドレス(BSSID、6バイト)。
ReservedBYTE2+10+10予約フィールド(2バイト)。アライメント用。
SsidNDIS_802_11_SSID36+12+12対象ネットワークのSSID。
PrivacyDWORD4+48+48暗号化(WEP等)が必要か否かを示す。0で不要。
RssiINT4+52+52受信信号強度(dBm)。値が大きいほど強い。
NetworkTypeInUseNDIS_802_11_NETWORK_TYPE4+56+56使用中のネットワーク種別(FH/DS/OFDM等)。
ConfigurationNDIS_802_11_CONFIGURATION32+60+60周波数や間隔などの構成パラメータ。
InfrastructureModeNDIS_802_11_NETWORK_INFRASTRUCTURE4+92+92インフラストラクチャ/アドホックの動作モード。
SupportedRatesBYTE8+96+96サポートする伝送レートの配列(各値は0.5Mbps単位)。

各言語での定義

#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;
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;
}
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
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),
    ]
#[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],
}
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_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;
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,
};
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]
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;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NDIS_WLAN_BSSID サイズ: 104 バイト(x64)
dim st, 26    ; 4byte整数×26(構造体サイズ 104 / 4 切り上げ)
; Length : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; MacAddress : BYTE (+4, 6byte)  varptr(st)+4 を基点に操作(6byte:入れ子/配列)
; Reserved : BYTE (+10, 2byte)  varptr(st)+10 を基点に操作(2byte:入れ子/配列)
; Ssid : NDIS_802_11_SSID (+12, 36byte)  varptr(st)+12 を基点に操作(36byte:入れ子/配列)
; Privacy : DWORD (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; Rssi : INT (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; NetworkTypeInUse : NDIS_802_11_NETWORK_TYPE (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; Configuration : NDIS_802_11_CONFIGURATION (+60, 32byte)  varptr(st)+60 を基点に操作(32byte:入れ子/配列)
; InfrastructureMode : NDIS_802_11_NETWORK_INFRASTRUCTURE (+92, 4byte)  st.23 = 値  /  値 = st.23   (lpoke/lpeek も可)
; SupportedRates : BYTE (+96, 8byte)  varptr(st)+96 を基点に操作(8byte:入れ子/配列)
; ※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

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