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

DOT11_ADAPTER

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

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

フィールド

フィールドサイズx64x86説明
gAdapterIdGUID16+0+0802.11アダプターを一意に識別するGUID。デバイスインスタンスの識別子として用いる。
pszDescriptionLPWSTR8/4+16+16アダプターの説明文字列へのポインター。NULL終端のワイド文字列。
Dot11CurrentOpModeDOT11_CURRENT_OPERATION_MODE8+24+20アダプターの現在の動作モード(拡張STA/ネットワークモニター等)を示す列挙値。

各言語での定義

#include <windows.h>

// DOT11_CURRENT_OPERATION_MODE  (x64 8 / x86 8 バイト)
typedef struct DOT11_CURRENT_OPERATION_MODE {
    DWORD uReserved;
    DWORD uCurrentOpMode;
} DOT11_CURRENT_OPERATION_MODE;

// DOT11_ADAPTER  (x64 32 / x86 28 バイト)
typedef struct DOT11_ADAPTER {
    GUID gAdapterId;
    LPWSTR pszDescription;
    DOT11_CURRENT_OPERATION_MODE Dot11CurrentOpMode;
} DOT11_ADAPTER;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DOT11_CURRENT_OPERATION_MODE
{
    public uint uReserved;
    public uint uCurrentOpMode;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DOT11_ADAPTER
{
    public Guid gAdapterId;
    public IntPtr pszDescription;
    public DOT11_CURRENT_OPERATION_MODE Dot11CurrentOpMode;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DOT11_CURRENT_OPERATION_MODE
    Public uReserved As UInteger
    Public uCurrentOpMode As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DOT11_ADAPTER
    Public gAdapterId As Guid
    Public pszDescription As IntPtr
    Public Dot11CurrentOpMode As DOT11_CURRENT_OPERATION_MODE
End Structure
import ctypes
from ctypes import wintypes

class DOT11_CURRENT_OPERATION_MODE(ctypes.Structure):
    _fields_ = [
        ("uReserved", wintypes.DWORD),
        ("uCurrentOpMode", wintypes.DWORD),
    ]

class DOT11_ADAPTER(ctypes.Structure):
    _fields_ = [
        ("gAdapterId", GUID),
        ("pszDescription", ctypes.c_void_p),
        ("Dot11CurrentOpMode", DOT11_CURRENT_OPERATION_MODE),
    ]
#[repr(C)]
pub struct DOT11_CURRENT_OPERATION_MODE {
    pub uReserved: u32,
    pub uCurrentOpMode: u32,
}

#[repr(C)]
pub struct DOT11_ADAPTER {
    pub gAdapterId: GUID,
    pub pszDescription: *mut core::ffi::c_void,
    pub Dot11CurrentOpMode: DOT11_CURRENT_OPERATION_MODE,
}
import "golang.org/x/sys/windows"

type DOT11_CURRENT_OPERATION_MODE struct {
	uReserved uint32
	uCurrentOpMode uint32
}

type DOT11_ADAPTER struct {
	gAdapterId windows.GUID
	pszDescription uintptr
	Dot11CurrentOpMode DOT11_CURRENT_OPERATION_MODE
}
type
  DOT11_CURRENT_OPERATION_MODE = record
    uReserved: DWORD;
    uCurrentOpMode: DWORD;
  end;

  DOT11_ADAPTER = record
    gAdapterId: TGUID;
    pszDescription: Pointer;
    Dot11CurrentOpMode: DOT11_CURRENT_OPERATION_MODE;
  end;
const DOT11_CURRENT_OPERATION_MODE = extern struct {
    uReserved: u32,
    uCurrentOpMode: u32,
};

const DOT11_ADAPTER = extern struct {
    gAdapterId: GUID,
    pszDescription: ?*anyopaque,
    Dot11CurrentOpMode: DOT11_CURRENT_OPERATION_MODE,
};
type
  DOT11_CURRENT_OPERATION_MODE {.bycopy.} = object
    uReserved: uint32
    uCurrentOpMode: uint32

  DOT11_ADAPTER {.bycopy.} = object
    gAdapterId: GUID
    pszDescription: pointer
    Dot11CurrentOpMode: DOT11_CURRENT_OPERATION_MODE
struct DOT11_CURRENT_OPERATION_MODE
{
    uint uReserved;
    uint uCurrentOpMode;
}

struct DOT11_ADAPTER
{
    GUID gAdapterId;
    void* pszDescription;
    DOT11_CURRENT_OPERATION_MODE Dot11CurrentOpMode;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DOT11_ADAPTER サイズ: 28 バイト(x86)
dim st, 7    ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; gAdapterId : GUID (+0, 16byte)  varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; pszDescription : LPWSTR (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; Dot11CurrentOpMode : DOT11_CURRENT_OPERATION_MODE (+20, 8byte)  varptr(st)+20 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DOT11_ADAPTER サイズ: 32 バイト(x64)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; gAdapterId : GUID (+0, 16byte)  varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; pszDescription : LPWSTR (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; Dot11CurrentOpMode : DOT11_CURRENT_OPERATION_MODE (+24, 8byte)  varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global GUID, pack=1
    #field int Data1
    #field short Data2
    #field short Data3
    #field byte Data4 8
#endstruct

#defstruct global DOT11_CURRENT_OPERATION_MODE
    #field int uReserved
    #field int uCurrentOpMode
#endstruct

#defstruct global DOT11_ADAPTER
    #field GUID gAdapterId
    #field intptr pszDescription
    #field DOT11_CURRENT_OPERATION_MODE Dot11CurrentOpMode
#endstruct

stdim st, DOT11_ADAPTER        ; NSTRUCT 変数を確保