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

WDIAG_IHV_WLAN_ID

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

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

フィールド

フィールドサイズx64x86説明
strProfileNameWCHAR512+0+0WLAN診断対象のプロファイル名(ワイド文字列固定長配列)。
SsidDOT11_SSID36+512+512対象ネットワークのSSID。
BssTypeDOT11_BSS_TYPE4+548+548BSSの種別を示す列挙値。
dwFlagsDWORD4+552+552診断識別子の付加フラグ。
dwReasonCodeDWORD4+556+556接続失敗等に対応する理由コード。

各言語での定義

#include <windows.h>

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

// WDIAG_IHV_WLAN_ID  (x64 560 / x86 560 バイト)
typedef struct WDIAG_IHV_WLAN_ID {
    WCHAR strProfileName[256];
    DOT11_SSID Ssid;
    DOT11_BSS_TYPE BssType;
    DWORD dwFlags;
    DWORD dwReasonCode;
} WDIAG_IHV_WLAN_ID;
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 WDIAG_IHV_WLAN_ID
{
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string strProfileName;
    public DOT11_SSID Ssid;
    public int BssType;
    public uint dwFlags;
    public uint dwReasonCode;
}
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 WDIAG_IHV_WLAN_ID
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=256)> Public strProfileName As String
    Public Ssid As DOT11_SSID
    Public BssType As Integer
    Public dwFlags As UInteger
    Public dwReasonCode As UInteger
End Structure
import ctypes
from ctypes import wintypes

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

class WDIAG_IHV_WLAN_ID(ctypes.Structure):
    _fields_ = [
        ("strProfileName", ctypes.c_wchar * 256),
        ("Ssid", DOT11_SSID),
        ("BssType", ctypes.c_int),
        ("dwFlags", wintypes.DWORD),
        ("dwReasonCode", wintypes.DWORD),
    ]
#[repr(C)]
pub struct DOT11_SSID {
    pub uSSIDLength: u32,
    pub ucSSID: [u8; 32],
}

#[repr(C)]
pub struct WDIAG_IHV_WLAN_ID {
    pub strProfileName: [u16; 256],
    pub Ssid: DOT11_SSID,
    pub BssType: i32,
    pub dwFlags: u32,
    pub dwReasonCode: u32,
}
import "golang.org/x/sys/windows"

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

type WDIAG_IHV_WLAN_ID struct {
	strProfileName [256]uint16
	Ssid DOT11_SSID
	BssType int32
	dwFlags uint32
	dwReasonCode uint32
}
type
  DOT11_SSID = record
    uSSIDLength: DWORD;
    ucSSID: array[0..31] of Byte;
  end;

  WDIAG_IHV_WLAN_ID = record
    strProfileName: array[0..255] of WideChar;
    Ssid: DOT11_SSID;
    BssType: Integer;
    dwFlags: DWORD;
    dwReasonCode: DWORD;
  end;
const DOT11_SSID = extern struct {
    uSSIDLength: u32,
    ucSSID: [32]u8,
};

const WDIAG_IHV_WLAN_ID = extern struct {
    strProfileName: [256]u16,
    Ssid: DOT11_SSID,
    BssType: i32,
    dwFlags: u32,
    dwReasonCode: u32,
};
type
  DOT11_SSID {.bycopy.} = object
    uSSIDLength: uint32
    ucSSID: array[32, uint8]

  WDIAG_IHV_WLAN_ID {.bycopy.} = object
    strProfileName: array[256, uint16]
    Ssid: DOT11_SSID
    BssType: int32
    dwFlags: uint32
    dwReasonCode: uint32
struct DOT11_SSID
{
    uint uSSIDLength;
    ubyte[32] ucSSID;
}

struct WDIAG_IHV_WLAN_ID
{
    wchar[256] strProfileName;
    DOT11_SSID Ssid;
    int BssType;
    uint dwFlags;
    uint dwReasonCode;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WDIAG_IHV_WLAN_ID サイズ: 560 バイト(x64)
dim st, 140    ; 4byte整数×140(構造体サイズ 560 / 4 切り上げ)
; strProfileName : WCHAR (+0, 512byte)  varptr(st)+0 を基点に操作(512byte:入れ子/配列)
; Ssid : DOT11_SSID (+512, 36byte)  varptr(st)+512 を基点に操作(36byte:入れ子/配列)
; BssType : DOT11_BSS_TYPE (+548, 4byte)  st.137 = 値  /  値 = st.137   (lpoke/lpeek も可)
; dwFlags : DWORD (+552, 4byte)  st.138 = 値  /  値 = st.138   (lpoke/lpeek も可)
; dwReasonCode : DWORD (+556, 4byte)  st.139 = 値  /  値 = st.139   (lpoke/lpeek も可)
; ※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 WDIAG_IHV_WLAN_ID
    #field wchar strProfileName 256
    #field DOT11_SSID Ssid
    #field int BssType
    #field int dwFlags
    #field int dwReasonCode
#endstruct

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