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

DOT11_SCAN_REQUEST

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

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

フィールド

フィールドサイズx64x86説明
dot11BSSTypeDOT11_BSS_TYPE4+0+0スキャン対象の BSS 種別(インフラ/アドホック)。
dot11BSSIDBYTE6+4+4スキャン対象 BSSID。全FFでワイルドカード指定。
dot11SSIDDOT11_SSID36+12+12スキャン対象の SSID を指定する。
dot11ScanTypeDOT11_SCAN_TYPE4+48+48アクティブ/パッシブ等のスキャン方式を示す。
bRestrictedScanBOOLEAN1+52+52制限付きスキャンを行うか示すフラグ。
bUseRequestIEBOOLEAN1+53+53要求情報要素を使用するか示すフラグ。
uRequestIDsOffsetDWORD4+56+56要求 ID 配列への先頭からのオフセット。
uNumOfRequestIDsDWORD4+60+60要求 ID の個数を表す。
uPhyTypesOffsetDWORD4+64+64PHY 種別配列への先頭からのオフセット。
uNumOfPhyTypesDWORD4+68+68対象 PHY 種別の個数を表す。
uIEsOffsetDWORD4+72+72情報要素データへの先頭からのオフセット。
uIEsLengthDWORD4+76+76情報要素データのバイト長を表す。
ucBufferBYTE1+80+80可変長データを格納する汎用バッファ。

各言語での定義

#include <windows.h>

// DOT11_SSID  (x64 36 / x86 36 バイト)
typedef struct DOT11_SSID {
    DWORD uSSIDLength;
    BYTE ucSSID[32];
} DOT11_SSID;

// DOT11_SCAN_REQUEST  (x64 84 / x86 84 バイト)
typedef struct DOT11_SCAN_REQUEST {
    DOT11_BSS_TYPE dot11BSSType;
    BYTE dot11BSSID[6];
    DOT11_SSID dot11SSID;
    DOT11_SCAN_TYPE dot11ScanType;
    BOOLEAN bRestrictedScan;
    BOOLEAN bUseRequestIE;
    DWORD uRequestIDsOffset;
    DWORD uNumOfRequestIDs;
    DWORD uPhyTypesOffset;
    DWORD uNumOfPhyTypes;
    DWORD uIEsOffset;
    DWORD uIEsLength;
    BYTE ucBuffer[1];
} DOT11_SCAN_REQUEST;
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 DOT11_SCAN_REQUEST
{
    public int dot11BSSType;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] dot11BSSID;
    public DOT11_SSID dot11SSID;
    public int dot11ScanType;
    [MarshalAs(UnmanagedType.U1)] public bool bRestrictedScan;
    [MarshalAs(UnmanagedType.U1)] public bool bUseRequestIE;
    public uint uRequestIDsOffset;
    public uint uNumOfRequestIDs;
    public uint uPhyTypesOffset;
    public uint uNumOfPhyTypes;
    public uint uIEsOffset;
    public uint uIEsLength;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public byte[] ucBuffer;
}
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 DOT11_SCAN_REQUEST
    Public dot11BSSType As Integer
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=6)> Public dot11BSSID() As Byte
    Public dot11SSID As DOT11_SSID
    Public dot11ScanType As Integer
    <MarshalAs(UnmanagedType.U1)> Public bRestrictedScan As Boolean
    <MarshalAs(UnmanagedType.U1)> Public bUseRequestIE As Boolean
    Public uRequestIDsOffset As UInteger
    Public uNumOfRequestIDs As UInteger
    Public uPhyTypesOffset As UInteger
    Public uNumOfPhyTypes As UInteger
    Public uIEsOffset As UInteger
    Public uIEsLength As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public ucBuffer() As Byte
End Structure
import ctypes
from ctypes import wintypes

class DOT11_SSID(ctypes.Structure):
    _fields_ = [
        ("uSSIDLength", wintypes.DWORD),
        ("ucSSID", ctypes.c_ubyte * 32),
    ]

class DOT11_SCAN_REQUEST(ctypes.Structure):
    _fields_ = [
        ("dot11BSSType", ctypes.c_int),
        ("dot11BSSID", ctypes.c_ubyte * 6),
        ("dot11SSID", DOT11_SSID),
        ("dot11ScanType", ctypes.c_int),
        ("bRestrictedScan", ctypes.c_byte),
        ("bUseRequestIE", ctypes.c_byte),
        ("uRequestIDsOffset", wintypes.DWORD),
        ("uNumOfRequestIDs", wintypes.DWORD),
        ("uPhyTypesOffset", wintypes.DWORD),
        ("uNumOfPhyTypes", wintypes.DWORD),
        ("uIEsOffset", wintypes.DWORD),
        ("uIEsLength", wintypes.DWORD),
        ("ucBuffer", ctypes.c_ubyte * 1),
    ]
#[repr(C)]
pub struct DOT11_SSID {
    pub uSSIDLength: u32,
    pub ucSSID: [u8; 32],
}

#[repr(C)]
pub struct DOT11_SCAN_REQUEST {
    pub dot11BSSType: i32,
    pub dot11BSSID: [u8; 6],
    pub dot11SSID: DOT11_SSID,
    pub dot11ScanType: i32,
    pub bRestrictedScan: u8,
    pub bUseRequestIE: u8,
    pub uRequestIDsOffset: u32,
    pub uNumOfRequestIDs: u32,
    pub uPhyTypesOffset: u32,
    pub uNumOfPhyTypes: u32,
    pub uIEsOffset: u32,
    pub uIEsLength: u32,
    pub ucBuffer: [u8; 1],
}
import "golang.org/x/sys/windows"

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

type DOT11_SCAN_REQUEST struct {
	dot11BSSType int32
	dot11BSSID [6]byte
	dot11SSID DOT11_SSID
	dot11ScanType int32
	bRestrictedScan byte
	bUseRequestIE byte
	uRequestIDsOffset uint32
	uNumOfRequestIDs uint32
	uPhyTypesOffset uint32
	uNumOfPhyTypes uint32
	uIEsOffset uint32
	uIEsLength uint32
	ucBuffer [1]byte
}
type
  DOT11_SSID = record
    uSSIDLength: DWORD;
    ucSSID: array[0..31] of Byte;
  end;

  DOT11_SCAN_REQUEST = record
    dot11BSSType: Integer;
    dot11BSSID: array[0..5] of Byte;
    dot11SSID: DOT11_SSID;
    dot11ScanType: Integer;
    bRestrictedScan: ByteBool;
    bUseRequestIE: ByteBool;
    uRequestIDsOffset: DWORD;
    uNumOfRequestIDs: DWORD;
    uPhyTypesOffset: DWORD;
    uNumOfPhyTypes: DWORD;
    uIEsOffset: DWORD;
    uIEsLength: DWORD;
    ucBuffer: array[0..0] of Byte;
  end;
const DOT11_SSID = extern struct {
    uSSIDLength: u32,
    ucSSID: [32]u8,
};

const DOT11_SCAN_REQUEST = extern struct {
    dot11BSSType: i32,
    dot11BSSID: [6]u8,
    dot11SSID: DOT11_SSID,
    dot11ScanType: i32,
    bRestrictedScan: u8,
    bUseRequestIE: u8,
    uRequestIDsOffset: u32,
    uNumOfRequestIDs: u32,
    uPhyTypesOffset: u32,
    uNumOfPhyTypes: u32,
    uIEsOffset: u32,
    uIEsLength: u32,
    ucBuffer: [1]u8,
};
type
  DOT11_SSID {.bycopy.} = object
    uSSIDLength: uint32
    ucSSID: array[32, uint8]

  DOT11_SCAN_REQUEST {.bycopy.} = object
    dot11BSSType: int32
    dot11BSSID: array[6, uint8]
    dot11SSID: DOT11_SSID
    dot11ScanType: int32
    bRestrictedScan: uint8
    bUseRequestIE: uint8
    uRequestIDsOffset: uint32
    uNumOfRequestIDs: uint32
    uPhyTypesOffset: uint32
    uNumOfPhyTypes: uint32
    uIEsOffset: uint32
    uIEsLength: uint32
    ucBuffer: array[1, uint8]
struct DOT11_SSID
{
    uint uSSIDLength;
    ubyte[32] ucSSID;
}

struct DOT11_SCAN_REQUEST
{
    int dot11BSSType;
    ubyte[6] dot11BSSID;
    DOT11_SSID dot11SSID;
    int dot11ScanType;
    ubyte bRestrictedScan;
    ubyte bUseRequestIE;
    uint uRequestIDsOffset;
    uint uNumOfRequestIDs;
    uint uPhyTypesOffset;
    uint uNumOfPhyTypes;
    uint uIEsOffset;
    uint uIEsLength;
    ubyte[1] ucBuffer;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DOT11_SCAN_REQUEST サイズ: 84 バイト(x64)
dim st, 21    ; 4byte整数×21(構造体サイズ 84 / 4 切り上げ)
; dot11BSSType : DOT11_BSS_TYPE (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dot11BSSID : BYTE (+4, 6byte)  varptr(st)+4 を基点に操作(6byte:入れ子/配列)
; dot11SSID : DOT11_SSID (+12, 36byte)  varptr(st)+12 を基点に操作(36byte:入れ子/配列)
; dot11ScanType : DOT11_SCAN_TYPE (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; bRestrictedScan : BOOLEAN (+52, 1byte)  poke st,52,値  /  値 = peek(st,52)
; bUseRequestIE : BOOLEAN (+53, 1byte)  poke st,53,値  /  値 = peek(st,53)
; uRequestIDsOffset : DWORD (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; uNumOfRequestIDs : DWORD (+60, 4byte)  st.15 = 値  /  値 = st.15   (lpoke/lpeek も可)
; uPhyTypesOffset : DWORD (+64, 4byte)  st.16 = 値  /  値 = st.16   (lpoke/lpeek も可)
; uNumOfPhyTypes : DWORD (+68, 4byte)  st.17 = 値  /  値 = st.17   (lpoke/lpeek も可)
; uIEsOffset : DWORD (+72, 4byte)  st.18 = 値  /  値 = st.18   (lpoke/lpeek も可)
; uIEsLength : DWORD (+76, 4byte)  st.19 = 値  /  値 = st.19   (lpoke/lpeek も可)
; ucBuffer : BYTE (+80, 1byte)  varptr(st)+80 を基点に操作(1byte:入れ子/配列)
; ※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 DOT11_SCAN_REQUEST
    #field int dot11BSSType
    #field byte dot11BSSID 6
    #field DOT11_SSID dot11SSID
    #field int dot11ScanType
    #field bool1 bRestrictedScan
    #field bool1 bUseRequestIE
    #field int uRequestIDsOffset
    #field int uNumOfRequestIDs
    #field int uPhyTypesOffset
    #field int uNumOfPhyTypes
    #field int uIEsOffset
    #field int uIEsLength
    #field byte ucBuffer 1
#endstruct

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