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

DOT11_PEER_INFO_LIST

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

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

フィールド

フィールドサイズx64x86説明
HeaderNDIS_OBJECT_HEADER4+0+0NDISオブジェクトの種類・リビジョン・サイズを示す共通ヘッダー。
uNumOfEntriesDWORD4+4+4この構造体に実際に含まれるピア情報エントリ数。
uTotalNumOfEntriesDWORD4+8+8利用可能な全ピア情報エントリ数。
PeerInfoDOT11_PEER_INFO352+16+16ピア情報エントリの配列(可変長の先頭要素)。

各言語での定義

#include <windows.h>

// NDIS_OBJECT_HEADER  (x64 4 / x86 4 バイト)
typedef struct NDIS_OBJECT_HEADER {
    BYTE Type;
    BYTE Revision;
    WORD Size;
} NDIS_OBJECT_HEADER;

// DOT11_PEER_STATISTICS  (x64 48 / x86 48 バイト)
typedef struct DOT11_PEER_STATISTICS {
    ULONGLONG ullDecryptSuccessCount;
    ULONGLONG ullDecryptFailureCount;
    ULONGLONG ullTxPacketSuccessCount;
    ULONGLONG ullTxPacketFailureCount;
    ULONGLONG ullRxPacketSuccessCount;
    ULONGLONG ullRxPacketFailureCount;
} DOT11_PEER_STATISTICS;

// DOT11_PEER_INFO  (x64 352 / x86 352 バイト)
typedef struct DOT11_PEER_INFO {
    BYTE MacAddress[6];
    WORD usCapabilityInformation;
    DOT11_AUTH_ALGORITHM AuthAlgo;
    DOT11_CIPHER_ALGORITHM UnicastCipherAlgo;
    DOT11_CIPHER_ALGORITHM MulticastCipherAlgo;
    BOOLEAN bWpsEnabled;
    WORD usListenInterval;
    BYTE ucSupportedRates[255];
    WORD usAssociationID;
    DOT11_ASSOCIATION_STATE AssociationState;
    DOT11_POWER_MODE PowerMode;
    LONGLONG liAssociationUpTime;
    DOT11_PEER_STATISTICS Statistics;
} DOT11_PEER_INFO;

// DOT11_PEER_INFO_LIST  (x64 368 / x86 368 バイト)
typedef struct DOT11_PEER_INFO_LIST {
    NDIS_OBJECT_HEADER Header;
    DWORD uNumOfEntries;
    DWORD uTotalNumOfEntries;
    DOT11_PEER_INFO PeerInfo[1];
} DOT11_PEER_INFO_LIST;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NDIS_OBJECT_HEADER
{
    public byte Type;
    public byte Revision;
    public ushort Size;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DOT11_PEER_STATISTICS
{
    public ulong ullDecryptSuccessCount;
    public ulong ullDecryptFailureCount;
    public ulong ullTxPacketSuccessCount;
    public ulong ullTxPacketFailureCount;
    public ulong ullRxPacketSuccessCount;
    public ulong ullRxPacketFailureCount;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DOT11_PEER_INFO
{
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] MacAddress;
    public ushort usCapabilityInformation;
    public int AuthAlgo;
    public int UnicastCipherAlgo;
    public int MulticastCipherAlgo;
    [MarshalAs(UnmanagedType.U1)] public bool bWpsEnabled;
    public ushort usListenInterval;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 255)] public byte[] ucSupportedRates;
    public ushort usAssociationID;
    public int AssociationState;
    public int PowerMode;
    public long liAssociationUpTime;
    public DOT11_PEER_STATISTICS Statistics;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DOT11_PEER_INFO_LIST
{
    public NDIS_OBJECT_HEADER Header;
    public uint uNumOfEntries;
    public uint uTotalNumOfEntries;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public DOT11_PEER_INFO[] PeerInfo;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NDIS_OBJECT_HEADER
    Public Type As Byte
    Public Revision As Byte
    Public Size As UShort
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DOT11_PEER_STATISTICS
    Public ullDecryptSuccessCount As ULong
    Public ullDecryptFailureCount As ULong
    Public ullTxPacketSuccessCount As ULong
    Public ullTxPacketFailureCount As ULong
    Public ullRxPacketSuccessCount As ULong
    Public ullRxPacketFailureCount As ULong
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DOT11_PEER_INFO
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=6)> Public MacAddress() As Byte
    Public usCapabilityInformation As UShort
    Public AuthAlgo As Integer
    Public UnicastCipherAlgo As Integer
    Public MulticastCipherAlgo As Integer
    <MarshalAs(UnmanagedType.U1)> Public bWpsEnabled As Boolean
    Public usListenInterval As UShort
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=255)> Public ucSupportedRates() As Byte
    Public usAssociationID As UShort
    Public AssociationState As Integer
    Public PowerMode As Integer
    Public liAssociationUpTime As Long
    Public Statistics As DOT11_PEER_STATISTICS
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DOT11_PEER_INFO_LIST
    Public Header As NDIS_OBJECT_HEADER
    Public uNumOfEntries As UInteger
    Public uTotalNumOfEntries As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public PeerInfo() As DOT11_PEER_INFO
End Structure
import ctypes
from ctypes import wintypes

class NDIS_OBJECT_HEADER(ctypes.Structure):
    _fields_ = [
        ("Type", ctypes.c_ubyte),
        ("Revision", ctypes.c_ubyte),
        ("Size", ctypes.c_ushort),
    ]

class DOT11_PEER_STATISTICS(ctypes.Structure):
    _fields_ = [
        ("ullDecryptSuccessCount", ctypes.c_ulonglong),
        ("ullDecryptFailureCount", ctypes.c_ulonglong),
        ("ullTxPacketSuccessCount", ctypes.c_ulonglong),
        ("ullTxPacketFailureCount", ctypes.c_ulonglong),
        ("ullRxPacketSuccessCount", ctypes.c_ulonglong),
        ("ullRxPacketFailureCount", ctypes.c_ulonglong),
    ]

class DOT11_PEER_INFO(ctypes.Structure):
    _fields_ = [
        ("MacAddress", ctypes.c_ubyte * 6),
        ("usCapabilityInformation", ctypes.c_ushort),
        ("AuthAlgo", ctypes.c_int),
        ("UnicastCipherAlgo", ctypes.c_int),
        ("MulticastCipherAlgo", ctypes.c_int),
        ("bWpsEnabled", ctypes.c_byte),
        ("usListenInterval", ctypes.c_ushort),
        ("ucSupportedRates", ctypes.c_ubyte * 255),
        ("usAssociationID", ctypes.c_ushort),
        ("AssociationState", ctypes.c_int),
        ("PowerMode", ctypes.c_int),
        ("liAssociationUpTime", ctypes.c_longlong),
        ("Statistics", DOT11_PEER_STATISTICS),
    ]

class DOT11_PEER_INFO_LIST(ctypes.Structure):
    _fields_ = [
        ("Header", NDIS_OBJECT_HEADER),
        ("uNumOfEntries", wintypes.DWORD),
        ("uTotalNumOfEntries", wintypes.DWORD),
        ("PeerInfo", DOT11_PEER_INFO * 1),
    ]
#[repr(C)]
pub struct NDIS_OBJECT_HEADER {
    pub Type: u8,
    pub Revision: u8,
    pub Size: u16,
}

#[repr(C)]
pub struct DOT11_PEER_STATISTICS {
    pub ullDecryptSuccessCount: u64,
    pub ullDecryptFailureCount: u64,
    pub ullTxPacketSuccessCount: u64,
    pub ullTxPacketFailureCount: u64,
    pub ullRxPacketSuccessCount: u64,
    pub ullRxPacketFailureCount: u64,
}

#[repr(C)]
pub struct DOT11_PEER_INFO {
    pub MacAddress: [u8; 6],
    pub usCapabilityInformation: u16,
    pub AuthAlgo: i32,
    pub UnicastCipherAlgo: i32,
    pub MulticastCipherAlgo: i32,
    pub bWpsEnabled: u8,
    pub usListenInterval: u16,
    pub ucSupportedRates: [u8; 255],
    pub usAssociationID: u16,
    pub AssociationState: i32,
    pub PowerMode: i32,
    pub liAssociationUpTime: i64,
    pub Statistics: DOT11_PEER_STATISTICS,
}

#[repr(C)]
pub struct DOT11_PEER_INFO_LIST {
    pub Header: NDIS_OBJECT_HEADER,
    pub uNumOfEntries: u32,
    pub uTotalNumOfEntries: u32,
    pub PeerInfo: [DOT11_PEER_INFO; 1],
}
import "golang.org/x/sys/windows"

type NDIS_OBJECT_HEADER struct {
	Type byte
	Revision byte
	Size uint16
}

type DOT11_PEER_STATISTICS struct {
	ullDecryptSuccessCount uint64
	ullDecryptFailureCount uint64
	ullTxPacketSuccessCount uint64
	ullTxPacketFailureCount uint64
	ullRxPacketSuccessCount uint64
	ullRxPacketFailureCount uint64
}

type DOT11_PEER_INFO struct {
	MacAddress [6]byte
	usCapabilityInformation uint16
	AuthAlgo int32
	UnicastCipherAlgo int32
	MulticastCipherAlgo int32
	bWpsEnabled byte
	usListenInterval uint16
	ucSupportedRates [255]byte
	usAssociationID uint16
	AssociationState int32
	PowerMode int32
	liAssociationUpTime int64
	Statistics DOT11_PEER_STATISTICS
}

type DOT11_PEER_INFO_LIST struct {
	Header NDIS_OBJECT_HEADER
	uNumOfEntries uint32
	uTotalNumOfEntries uint32
	PeerInfo [1]DOT11_PEER_INFO
}
type
  NDIS_OBJECT_HEADER = record
    Type: Byte;
    Revision: Byte;
    Size: Word;
  end;

  DOT11_PEER_STATISTICS = record
    ullDecryptSuccessCount: UInt64;
    ullDecryptFailureCount: UInt64;
    ullTxPacketSuccessCount: UInt64;
    ullTxPacketFailureCount: UInt64;
    ullRxPacketSuccessCount: UInt64;
    ullRxPacketFailureCount: UInt64;
  end;

  DOT11_PEER_INFO = record
    MacAddress: array[0..5] of Byte;
    usCapabilityInformation: Word;
    AuthAlgo: Integer;
    UnicastCipherAlgo: Integer;
    MulticastCipherAlgo: Integer;
    bWpsEnabled: ByteBool;
    usListenInterval: Word;
    ucSupportedRates: array[0..254] of Byte;
    usAssociationID: Word;
    AssociationState: Integer;
    PowerMode: Integer;
    liAssociationUpTime: Int64;
    Statistics: DOT11_PEER_STATISTICS;
  end;

  DOT11_PEER_INFO_LIST = record
    Header: NDIS_OBJECT_HEADER;
    uNumOfEntries: DWORD;
    uTotalNumOfEntries: DWORD;
    PeerInfo: array[0..0] of DOT11_PEER_INFO;
  end;
const NDIS_OBJECT_HEADER = extern struct {
    Type: u8,
    Revision: u8,
    Size: u16,
};

const DOT11_PEER_STATISTICS = extern struct {
    ullDecryptSuccessCount: u64,
    ullDecryptFailureCount: u64,
    ullTxPacketSuccessCount: u64,
    ullTxPacketFailureCount: u64,
    ullRxPacketSuccessCount: u64,
    ullRxPacketFailureCount: u64,
};

const DOT11_PEER_INFO = extern struct {
    MacAddress: [6]u8,
    usCapabilityInformation: u16,
    AuthAlgo: i32,
    UnicastCipherAlgo: i32,
    MulticastCipherAlgo: i32,
    bWpsEnabled: u8,
    usListenInterval: u16,
    ucSupportedRates: [255]u8,
    usAssociationID: u16,
    AssociationState: i32,
    PowerMode: i32,
    liAssociationUpTime: i64,
    Statistics: DOT11_PEER_STATISTICS,
};

const DOT11_PEER_INFO_LIST = extern struct {
    Header: NDIS_OBJECT_HEADER,
    uNumOfEntries: u32,
    uTotalNumOfEntries: u32,
    PeerInfo: [1]DOT11_PEER_INFO,
};
type
  NDIS_OBJECT_HEADER {.bycopy.} = object
    Type: uint8
    Revision: uint8
    Size: uint16

  DOT11_PEER_STATISTICS {.bycopy.} = object
    ullDecryptSuccessCount: uint64
    ullDecryptFailureCount: uint64
    ullTxPacketSuccessCount: uint64
    ullTxPacketFailureCount: uint64
    ullRxPacketSuccessCount: uint64
    ullRxPacketFailureCount: uint64

  DOT11_PEER_INFO {.bycopy.} = object
    MacAddress: array[6, uint8]
    usCapabilityInformation: uint16
    AuthAlgo: int32
    UnicastCipherAlgo: int32
    MulticastCipherAlgo: int32
    bWpsEnabled: uint8
    usListenInterval: uint16
    ucSupportedRates: array[255, uint8]
    usAssociationID: uint16
    AssociationState: int32
    PowerMode: int32
    liAssociationUpTime: int64
    Statistics: DOT11_PEER_STATISTICS

  DOT11_PEER_INFO_LIST {.bycopy.} = object
    Header: NDIS_OBJECT_HEADER
    uNumOfEntries: uint32
    uTotalNumOfEntries: uint32
    PeerInfo: array[1, DOT11_PEER_INFO]
struct NDIS_OBJECT_HEADER
{
    ubyte Type;
    ubyte Revision;
    ushort Size;
}

struct DOT11_PEER_STATISTICS
{
    ulong ullDecryptSuccessCount;
    ulong ullDecryptFailureCount;
    ulong ullTxPacketSuccessCount;
    ulong ullTxPacketFailureCount;
    ulong ullRxPacketSuccessCount;
    ulong ullRxPacketFailureCount;
}

struct DOT11_PEER_INFO
{
    ubyte[6] MacAddress;
    ushort usCapabilityInformation;
    int AuthAlgo;
    int UnicastCipherAlgo;
    int MulticastCipherAlgo;
    ubyte bWpsEnabled;
    ushort usListenInterval;
    ubyte[255] ucSupportedRates;
    ushort usAssociationID;
    int AssociationState;
    int PowerMode;
    long liAssociationUpTime;
    DOT11_PEER_STATISTICS Statistics;
}

struct DOT11_PEER_INFO_LIST
{
    NDIS_OBJECT_HEADER Header;
    uint uNumOfEntries;
    uint uTotalNumOfEntries;
    DOT11_PEER_INFO[1] PeerInfo;
}

HSP用 定義

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

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

#defstruct global DOT11_PEER_STATISTICS
    #field int64 ullDecryptSuccessCount
    #field int64 ullDecryptFailureCount
    #field int64 ullTxPacketSuccessCount
    #field int64 ullTxPacketFailureCount
    #field int64 ullRxPacketSuccessCount
    #field int64 ullRxPacketFailureCount
#endstruct

#defstruct global DOT11_PEER_INFO
    #field byte MacAddress 6
    #field short usCapabilityInformation
    #field int AuthAlgo
    #field int UnicastCipherAlgo
    #field int MulticastCipherAlgo
    #field bool1 bWpsEnabled
    #field short usListenInterval
    #field byte ucSupportedRates 255
    #field short usAssociationID
    #field int AssociationState
    #field int PowerMode
    #field int64 liAssociationUpTime
    #field DOT11_PEER_STATISTICS Statistics
#endstruct

#defstruct global DOT11_PEER_INFO_LIST
    #field NDIS_OBJECT_HEADER Header
    #field int uNumOfEntries
    #field int uTotalNumOfEntries
    #field DOT11_PEER_INFO PeerInfo 1
#endstruct

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