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

DOT11_OFFLOAD_NETWORK_LIST_INFO

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

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

フィールド

フィールドサイズx64x86説明
HeaderNDIS_OBJECT_HEADER4+0+0NDISオブジェクトの種類・リビジョン・サイズを示す共通ヘッダー。
ulFlagsDWORD4+4+4オフロードスキャン動作を制御するフラグ。
FastScanPeriodDWORD4+8+8高速スキャンの間隔(ミリ秒)。
FastScanIterationsDWORD4+12+12高速スキャンの繰り返し回数。
SlowScanPeriodDWORD4+16+16低速スキャンの間隔(ミリ秒)。
uNumOfEntriesDWORD4+20+20offloadNetworkListに含まれるネットワーク数。
offloadNetworkListDOT11_OFFLOAD_NETWORK76+24+24オフロードスキャン対象ネットワークの配列(可変長の先頭要素)。

各言語での定義

#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_SSID  (x64 36 / x86 36 バイト)
typedef struct DOT11_SSID {
    DWORD uSSIDLength;
    BYTE ucSSID[32];
} DOT11_SSID;

// DOT11_CHANNEL_HINT  (x64 8 / x86 8 バイト)
typedef struct DOT11_CHANNEL_HINT {
    DOT11_PHY_TYPE Dot11PhyType;
    DWORD uChannelNumber;
} DOT11_CHANNEL_HINT;

// DOT11_OFFLOAD_NETWORK  (x64 76 / x86 76 バイト)
typedef struct DOT11_OFFLOAD_NETWORK {
    DOT11_SSID Ssid;
    DOT11_CIPHER_ALGORITHM UnicastCipher;
    DOT11_AUTH_ALGORITHM AuthAlgo;
    DOT11_CHANNEL_HINT Dot11ChannelHints[4];
} DOT11_OFFLOAD_NETWORK;

// DOT11_OFFLOAD_NETWORK_LIST_INFO  (x64 100 / x86 100 バイト)
typedef struct DOT11_OFFLOAD_NETWORK_LIST_INFO {
    NDIS_OBJECT_HEADER Header;
    DWORD ulFlags;
    DWORD FastScanPeriod;
    DWORD FastScanIterations;
    DWORD SlowScanPeriod;
    DWORD uNumOfEntries;
    DOT11_OFFLOAD_NETWORK offloadNetworkList[1];
} DOT11_OFFLOAD_NETWORK_LIST_INFO;
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_SSID
{
    public uint uSSIDLength;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] ucSSID;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DOT11_CHANNEL_HINT
{
    public int Dot11PhyType;
    public uint uChannelNumber;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DOT11_OFFLOAD_NETWORK
{
    public DOT11_SSID Ssid;
    public int UnicastCipher;
    public int AuthAlgo;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public DOT11_CHANNEL_HINT[] Dot11ChannelHints;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DOT11_OFFLOAD_NETWORK_LIST_INFO
{
    public NDIS_OBJECT_HEADER Header;
    public uint ulFlags;
    public uint FastScanPeriod;
    public uint FastScanIterations;
    public uint SlowScanPeriod;
    public uint uNumOfEntries;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public DOT11_OFFLOAD_NETWORK[] offloadNetworkList;
}
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_SSID
    Public uSSIDLength As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=32)> Public ucSSID() As Byte
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DOT11_CHANNEL_HINT
    Public Dot11PhyType As Integer
    Public uChannelNumber As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DOT11_OFFLOAD_NETWORK
    Public Ssid As DOT11_SSID
    Public UnicastCipher As Integer
    Public AuthAlgo As Integer
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)> Public Dot11ChannelHints() As DOT11_CHANNEL_HINT
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DOT11_OFFLOAD_NETWORK_LIST_INFO
    Public Header As NDIS_OBJECT_HEADER
    Public ulFlags As UInteger
    Public FastScanPeriod As UInteger
    Public FastScanIterations As UInteger
    Public SlowScanPeriod As UInteger
    Public uNumOfEntries As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public offloadNetworkList() As DOT11_OFFLOAD_NETWORK
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_SSID(ctypes.Structure):
    _fields_ = [
        ("uSSIDLength", wintypes.DWORD),
        ("ucSSID", ctypes.c_ubyte * 32),
    ]

class DOT11_CHANNEL_HINT(ctypes.Structure):
    _fields_ = [
        ("Dot11PhyType", ctypes.c_int),
        ("uChannelNumber", wintypes.DWORD),
    ]

class DOT11_OFFLOAD_NETWORK(ctypes.Structure):
    _fields_ = [
        ("Ssid", DOT11_SSID),
        ("UnicastCipher", ctypes.c_int),
        ("AuthAlgo", ctypes.c_int),
        ("Dot11ChannelHints", DOT11_CHANNEL_HINT * 4),
    ]

class DOT11_OFFLOAD_NETWORK_LIST_INFO(ctypes.Structure):
    _fields_ = [
        ("Header", NDIS_OBJECT_HEADER),
        ("ulFlags", wintypes.DWORD),
        ("FastScanPeriod", wintypes.DWORD),
        ("FastScanIterations", wintypes.DWORD),
        ("SlowScanPeriod", wintypes.DWORD),
        ("uNumOfEntries", wintypes.DWORD),
        ("offloadNetworkList", DOT11_OFFLOAD_NETWORK * 1),
    ]
#[repr(C)]
pub struct NDIS_OBJECT_HEADER {
    pub Type: u8,
    pub Revision: u8,
    pub Size: u16,
}

#[repr(C)]
pub struct DOT11_SSID {
    pub uSSIDLength: u32,
    pub ucSSID: [u8; 32],
}

#[repr(C)]
pub struct DOT11_CHANNEL_HINT {
    pub Dot11PhyType: i32,
    pub uChannelNumber: u32,
}

#[repr(C)]
pub struct DOT11_OFFLOAD_NETWORK {
    pub Ssid: DOT11_SSID,
    pub UnicastCipher: i32,
    pub AuthAlgo: i32,
    pub Dot11ChannelHints: [DOT11_CHANNEL_HINT; 4],
}

#[repr(C)]
pub struct DOT11_OFFLOAD_NETWORK_LIST_INFO {
    pub Header: NDIS_OBJECT_HEADER,
    pub ulFlags: u32,
    pub FastScanPeriod: u32,
    pub FastScanIterations: u32,
    pub SlowScanPeriod: u32,
    pub uNumOfEntries: u32,
    pub offloadNetworkList: [DOT11_OFFLOAD_NETWORK; 1],
}
import "golang.org/x/sys/windows"

type NDIS_OBJECT_HEADER struct {
	Type byte
	Revision byte
	Size uint16
}

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

type DOT11_CHANNEL_HINT struct {
	Dot11PhyType int32
	uChannelNumber uint32
}

type DOT11_OFFLOAD_NETWORK struct {
	Ssid DOT11_SSID
	UnicastCipher int32
	AuthAlgo int32
	Dot11ChannelHints [4]DOT11_CHANNEL_HINT
}

type DOT11_OFFLOAD_NETWORK_LIST_INFO struct {
	Header NDIS_OBJECT_HEADER
	ulFlags uint32
	FastScanPeriod uint32
	FastScanIterations uint32
	SlowScanPeriod uint32
	uNumOfEntries uint32
	offloadNetworkList [1]DOT11_OFFLOAD_NETWORK
}
type
  NDIS_OBJECT_HEADER = record
    Type: Byte;
    Revision: Byte;
    Size: Word;
  end;

  DOT11_SSID = record
    uSSIDLength: DWORD;
    ucSSID: array[0..31] of Byte;
  end;

  DOT11_CHANNEL_HINT = record
    Dot11PhyType: Integer;
    uChannelNumber: DWORD;
  end;

  DOT11_OFFLOAD_NETWORK = record
    Ssid: DOT11_SSID;
    UnicastCipher: Integer;
    AuthAlgo: Integer;
    Dot11ChannelHints: array[0..3] of DOT11_CHANNEL_HINT;
  end;

  DOT11_OFFLOAD_NETWORK_LIST_INFO = record
    Header: NDIS_OBJECT_HEADER;
    ulFlags: DWORD;
    FastScanPeriod: DWORD;
    FastScanIterations: DWORD;
    SlowScanPeriod: DWORD;
    uNumOfEntries: DWORD;
    offloadNetworkList: array[0..0] of DOT11_OFFLOAD_NETWORK;
  end;
const NDIS_OBJECT_HEADER = extern struct {
    Type: u8,
    Revision: u8,
    Size: u16,
};

const DOT11_SSID = extern struct {
    uSSIDLength: u32,
    ucSSID: [32]u8,
};

const DOT11_CHANNEL_HINT = extern struct {
    Dot11PhyType: i32,
    uChannelNumber: u32,
};

const DOT11_OFFLOAD_NETWORK = extern struct {
    Ssid: DOT11_SSID,
    UnicastCipher: i32,
    AuthAlgo: i32,
    Dot11ChannelHints: [4]DOT11_CHANNEL_HINT,
};

const DOT11_OFFLOAD_NETWORK_LIST_INFO = extern struct {
    Header: NDIS_OBJECT_HEADER,
    ulFlags: u32,
    FastScanPeriod: u32,
    FastScanIterations: u32,
    SlowScanPeriod: u32,
    uNumOfEntries: u32,
    offloadNetworkList: [1]DOT11_OFFLOAD_NETWORK,
};
type
  NDIS_OBJECT_HEADER {.bycopy.} = object
    Type: uint8
    Revision: uint8
    Size: uint16

  DOT11_SSID {.bycopy.} = object
    uSSIDLength: uint32
    ucSSID: array[32, uint8]

  DOT11_CHANNEL_HINT {.bycopy.} = object
    Dot11PhyType: int32
    uChannelNumber: uint32

  DOT11_OFFLOAD_NETWORK {.bycopy.} = object
    Ssid: DOT11_SSID
    UnicastCipher: int32
    AuthAlgo: int32
    Dot11ChannelHints: array[4, DOT11_CHANNEL_HINT]

  DOT11_OFFLOAD_NETWORK_LIST_INFO {.bycopy.} = object
    Header: NDIS_OBJECT_HEADER
    ulFlags: uint32
    FastScanPeriod: uint32
    FastScanIterations: uint32
    SlowScanPeriod: uint32
    uNumOfEntries: uint32
    offloadNetworkList: array[1, DOT11_OFFLOAD_NETWORK]
struct NDIS_OBJECT_HEADER
{
    ubyte Type;
    ubyte Revision;
    ushort Size;
}

struct DOT11_SSID
{
    uint uSSIDLength;
    ubyte[32] ucSSID;
}

struct DOT11_CHANNEL_HINT
{
    int Dot11PhyType;
    uint uChannelNumber;
}

struct DOT11_OFFLOAD_NETWORK
{
    DOT11_SSID Ssid;
    int UnicastCipher;
    int AuthAlgo;
    DOT11_CHANNEL_HINT[4] Dot11ChannelHints;
}

struct DOT11_OFFLOAD_NETWORK_LIST_INFO
{
    NDIS_OBJECT_HEADER Header;
    uint ulFlags;
    uint FastScanPeriod;
    uint FastScanIterations;
    uint SlowScanPeriod;
    uint uNumOfEntries;
    DOT11_OFFLOAD_NETWORK[1] offloadNetworkList;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DOT11_OFFLOAD_NETWORK_LIST_INFO サイズ: 100 バイト(x64)
dim st, 25    ; 4byte整数×25(構造体サイズ 100 / 4 切り上げ)
; Header : NDIS_OBJECT_HEADER (+0, 4byte)  varptr(st)+0 を基点に操作(4byte:入れ子/配列)
; ulFlags : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; FastScanPeriod : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; FastScanIterations : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; SlowScanPeriod : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; uNumOfEntries : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; offloadNetworkList : DOT11_OFFLOAD_NETWORK (+24, 76byte)  varptr(st)+24 を基点に操作(76byte:入れ子/配列)
; ※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_SSID
    #field int uSSIDLength
    #field byte ucSSID 32
#endstruct

#defstruct global DOT11_CHANNEL_HINT
    #field int Dot11PhyType
    #field int uChannelNumber
#endstruct

#defstruct global DOT11_OFFLOAD_NETWORK
    #field DOT11_SSID Ssid
    #field int UnicastCipher
    #field int AuthAlgo
    #field DOT11_CHANNEL_HINT Dot11ChannelHints 4
#endstruct

#defstruct global DOT11_OFFLOAD_NETWORK_LIST_INFO
    #field NDIS_OBJECT_HEADER Header
    #field int ulFlags
    #field int FastScanPeriod
    #field int FastScanIterations
    #field int SlowScanPeriod
    #field int uNumOfEntries
    #field DOT11_OFFLOAD_NETWORK offloadNetworkList 1
#endstruct

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