ホーム › NetworkManagement.WiFi › WLAN_AVAILABLE_NETWORK_LIST
WLAN_AVAILABLE_NETWORK_LIST
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| dwNumberOfItems | DWORD | 4 | +0 | +0 | Networkに含まれる利用可能ネットワークの数。 |
| dwIndex | DWORD | 4 | +4 | +4 | 列挙時に使用する現在のインデックス。 |
| Network | WLAN_AVAILABLE_NETWORK | 628 | +8 | +8 | 利用可能ネットワークの配列(可変長の先頭要素)。 |
各言語での定義
#include <windows.h>
// DOT11_SSID (x64 36 / x86 36 バイト)
typedef struct DOT11_SSID {
DWORD uSSIDLength;
BYTE ucSSID[32];
} DOT11_SSID;
// WLAN_AVAILABLE_NETWORK (x64 628 / x86 628 バイト)
typedef struct WLAN_AVAILABLE_NETWORK {
WCHAR strProfileName[256];
DOT11_SSID dot11Ssid;
DOT11_BSS_TYPE dot11BssType;
DWORD uNumberOfBssids;
BOOL bNetworkConnectable;
DWORD wlanNotConnectableReason;
DWORD uNumberOfPhyTypes;
DOT11_PHY_TYPE dot11PhyTypes[8];
BOOL bMorePhyTypes;
DWORD wlanSignalQuality;
BOOL bSecurityEnabled;
DOT11_AUTH_ALGORITHM dot11DefaultAuthAlgorithm;
DOT11_CIPHER_ALGORITHM dot11DefaultCipherAlgorithm;
DWORD dwFlags;
DWORD dwReserved;
} WLAN_AVAILABLE_NETWORK;
// WLAN_AVAILABLE_NETWORK_LIST (x64 636 / x86 636 バイト)
typedef struct WLAN_AVAILABLE_NETWORK_LIST {
DWORD dwNumberOfItems;
DWORD dwIndex;
WLAN_AVAILABLE_NETWORK Network[1];
} WLAN_AVAILABLE_NETWORK_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_AVAILABLE_NETWORK
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string strProfileName;
public DOT11_SSID dot11Ssid;
public int dot11BssType;
public uint uNumberOfBssids;
[MarshalAs(UnmanagedType.Bool)] public bool bNetworkConnectable;
public uint wlanNotConnectableReason;
public uint uNumberOfPhyTypes;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public int[] dot11PhyTypes;
[MarshalAs(UnmanagedType.Bool)] public bool bMorePhyTypes;
public uint wlanSignalQuality;
[MarshalAs(UnmanagedType.Bool)] public bool bSecurityEnabled;
public int dot11DefaultAuthAlgorithm;
public int dot11DefaultCipherAlgorithm;
public uint dwFlags;
public uint dwReserved;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WLAN_AVAILABLE_NETWORK_LIST
{
public uint dwNumberOfItems;
public uint dwIndex;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public WLAN_AVAILABLE_NETWORK[] Network;
}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_AVAILABLE_NETWORK
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=256)> Public strProfileName As String
Public dot11Ssid As DOT11_SSID
Public dot11BssType As Integer
Public uNumberOfBssids As UInteger
<MarshalAs(UnmanagedType.Bool)> Public bNetworkConnectable As Boolean
Public wlanNotConnectableReason As UInteger
Public uNumberOfPhyTypes As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)> Public dot11PhyTypes() As Integer
<MarshalAs(UnmanagedType.Bool)> Public bMorePhyTypes As Boolean
Public wlanSignalQuality As UInteger
<MarshalAs(UnmanagedType.Bool)> Public bSecurityEnabled As Boolean
Public dot11DefaultAuthAlgorithm As Integer
Public dot11DefaultCipherAlgorithm As Integer
Public dwFlags As UInteger
Public dwReserved As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WLAN_AVAILABLE_NETWORK_LIST
Public dwNumberOfItems As UInteger
Public dwIndex As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public Network() As WLAN_AVAILABLE_NETWORK
End Structureimport ctypes
from ctypes import wintypes
class DOT11_SSID(ctypes.Structure):
_fields_ = [
("uSSIDLength", wintypes.DWORD),
("ucSSID", ctypes.c_ubyte * 32),
]
class WLAN_AVAILABLE_NETWORK(ctypes.Structure):
_fields_ = [
("strProfileName", ctypes.c_wchar * 256),
("dot11Ssid", DOT11_SSID),
("dot11BssType", ctypes.c_int),
("uNumberOfBssids", wintypes.DWORD),
("bNetworkConnectable", wintypes.BOOL),
("wlanNotConnectableReason", wintypes.DWORD),
("uNumberOfPhyTypes", wintypes.DWORD),
("dot11PhyTypes", ctypes.c_int * 8),
("bMorePhyTypes", wintypes.BOOL),
("wlanSignalQuality", wintypes.DWORD),
("bSecurityEnabled", wintypes.BOOL),
("dot11DefaultAuthAlgorithm", ctypes.c_int),
("dot11DefaultCipherAlgorithm", ctypes.c_int),
("dwFlags", wintypes.DWORD),
("dwReserved", wintypes.DWORD),
]
class WLAN_AVAILABLE_NETWORK_LIST(ctypes.Structure):
_fields_ = [
("dwNumberOfItems", wintypes.DWORD),
("dwIndex", wintypes.DWORD),
("Network", WLAN_AVAILABLE_NETWORK * 1),
]#[repr(C)]
pub struct DOT11_SSID {
pub uSSIDLength: u32,
pub ucSSID: [u8; 32],
}
#[repr(C)]
pub struct WLAN_AVAILABLE_NETWORK {
pub strProfileName: [u16; 256],
pub dot11Ssid: DOT11_SSID,
pub dot11BssType: i32,
pub uNumberOfBssids: u32,
pub bNetworkConnectable: i32,
pub wlanNotConnectableReason: u32,
pub uNumberOfPhyTypes: u32,
pub dot11PhyTypes: [i32; 8],
pub bMorePhyTypes: i32,
pub wlanSignalQuality: u32,
pub bSecurityEnabled: i32,
pub dot11DefaultAuthAlgorithm: i32,
pub dot11DefaultCipherAlgorithm: i32,
pub dwFlags: u32,
pub dwReserved: u32,
}
#[repr(C)]
pub struct WLAN_AVAILABLE_NETWORK_LIST {
pub dwNumberOfItems: u32,
pub dwIndex: u32,
pub Network: [WLAN_AVAILABLE_NETWORK; 1],
}import "golang.org/x/sys/windows"
type DOT11_SSID struct {
uSSIDLength uint32
ucSSID [32]byte
}
type WLAN_AVAILABLE_NETWORK struct {
strProfileName [256]uint16
dot11Ssid DOT11_SSID
dot11BssType int32
uNumberOfBssids uint32
bNetworkConnectable int32
wlanNotConnectableReason uint32
uNumberOfPhyTypes uint32
dot11PhyTypes [8]int32
bMorePhyTypes int32
wlanSignalQuality uint32
bSecurityEnabled int32
dot11DefaultAuthAlgorithm int32
dot11DefaultCipherAlgorithm int32
dwFlags uint32
dwReserved uint32
}
type WLAN_AVAILABLE_NETWORK_LIST struct {
dwNumberOfItems uint32
dwIndex uint32
Network [1]WLAN_AVAILABLE_NETWORK
}type
DOT11_SSID = record
uSSIDLength: DWORD;
ucSSID: array[0..31] of Byte;
end;
WLAN_AVAILABLE_NETWORK = record
strProfileName: array[0..255] of WideChar;
dot11Ssid: DOT11_SSID;
dot11BssType: Integer;
uNumberOfBssids: DWORD;
bNetworkConnectable: BOOL;
wlanNotConnectableReason: DWORD;
uNumberOfPhyTypes: DWORD;
dot11PhyTypes: array[0..7] of Integer;
bMorePhyTypes: BOOL;
wlanSignalQuality: DWORD;
bSecurityEnabled: BOOL;
dot11DefaultAuthAlgorithm: Integer;
dot11DefaultCipherAlgorithm: Integer;
dwFlags: DWORD;
dwReserved: DWORD;
end;
WLAN_AVAILABLE_NETWORK_LIST = record
dwNumberOfItems: DWORD;
dwIndex: DWORD;
Network: array[0..0] of WLAN_AVAILABLE_NETWORK;
end;const DOT11_SSID = extern struct {
uSSIDLength: u32,
ucSSID: [32]u8,
};
const WLAN_AVAILABLE_NETWORK = extern struct {
strProfileName: [256]u16,
dot11Ssid: DOT11_SSID,
dot11BssType: i32,
uNumberOfBssids: u32,
bNetworkConnectable: i32,
wlanNotConnectableReason: u32,
uNumberOfPhyTypes: u32,
dot11PhyTypes: [8]i32,
bMorePhyTypes: i32,
wlanSignalQuality: u32,
bSecurityEnabled: i32,
dot11DefaultAuthAlgorithm: i32,
dot11DefaultCipherAlgorithm: i32,
dwFlags: u32,
dwReserved: u32,
};
const WLAN_AVAILABLE_NETWORK_LIST = extern struct {
dwNumberOfItems: u32,
dwIndex: u32,
Network: [1]WLAN_AVAILABLE_NETWORK,
};type
DOT11_SSID {.bycopy.} = object
uSSIDLength: uint32
ucSSID: array[32, uint8]
WLAN_AVAILABLE_NETWORK {.bycopy.} = object
strProfileName: array[256, uint16]
dot11Ssid: DOT11_SSID
dot11BssType: int32
uNumberOfBssids: uint32
bNetworkConnectable: int32
wlanNotConnectableReason: uint32
uNumberOfPhyTypes: uint32
dot11PhyTypes: array[8, int32]
bMorePhyTypes: int32
wlanSignalQuality: uint32
bSecurityEnabled: int32
dot11DefaultAuthAlgorithm: int32
dot11DefaultCipherAlgorithm: int32
dwFlags: uint32
dwReserved: uint32
WLAN_AVAILABLE_NETWORK_LIST {.bycopy.} = object
dwNumberOfItems: uint32
dwIndex: uint32
Network: array[1, WLAN_AVAILABLE_NETWORK]struct DOT11_SSID
{
uint uSSIDLength;
ubyte[32] ucSSID;
}
struct WLAN_AVAILABLE_NETWORK
{
wchar[256] strProfileName;
DOT11_SSID dot11Ssid;
int dot11BssType;
uint uNumberOfBssids;
int bNetworkConnectable;
uint wlanNotConnectableReason;
uint uNumberOfPhyTypes;
int[8] dot11PhyTypes;
int bMorePhyTypes;
uint wlanSignalQuality;
int bSecurityEnabled;
int dot11DefaultAuthAlgorithm;
int dot11DefaultCipherAlgorithm;
uint dwFlags;
uint dwReserved;
}
struct WLAN_AVAILABLE_NETWORK_LIST
{
uint dwNumberOfItems;
uint dwIndex;
WLAN_AVAILABLE_NETWORK[1] Network;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WLAN_AVAILABLE_NETWORK_LIST サイズ: 636 バイト(x64)
dim st, 159 ; 4byte整数×159(構造体サイズ 636 / 4 切り上げ)
; dwNumberOfItems : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwIndex : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; Network : WLAN_AVAILABLE_NETWORK (+8, 628byte) varptr(st)+8 を基点に操作(628byte:入れ子/配列)
; ※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_AVAILABLE_NETWORK
#field wchar strProfileName 256
#field DOT11_SSID dot11Ssid
#field int dot11BssType
#field int uNumberOfBssids
#field bool bNetworkConnectable
#field int wlanNotConnectableReason
#field int uNumberOfPhyTypes
#field int dot11PhyTypes 8
#field bool bMorePhyTypes
#field int wlanSignalQuality
#field bool bSecurityEnabled
#field int dot11DefaultAuthAlgorithm
#field int dot11DefaultCipherAlgorithm
#field int dwFlags
#field int dwReserved
#endstruct
#defstruct global WLAN_AVAILABLE_NETWORK_LIST
#field int dwNumberOfItems
#field int dwIndex
#field WLAN_AVAILABLE_NETWORK Network 1
#endstruct
stdim st, WLAN_AVAILABLE_NETWORK_LIST ; NSTRUCT 変数を確保
st->dwNumberOfItems = 100
mes "dwNumberOfItems=" + st->dwNumberOfItems