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

WLAN_INTERFACE_INFO

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

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

フィールド

フィールドサイズx64x86説明
InterfaceGuidGUID16+0+0ワイヤレスインターフェイスのGUID。
strInterfaceDescriptionWCHAR512+16+16インターフェイスの説明文字列(WCHAR)。
isStateWLAN_INTERFACE_STATE4+528+528インターフェイスの現在の状態。

各言語での定義

#include <windows.h>

// WLAN_INTERFACE_INFO  (x64 532 / x86 532 バイト)
typedef struct WLAN_INTERFACE_INFO {
    GUID InterfaceGuid;
    WCHAR strInterfaceDescription[256];
    WLAN_INTERFACE_STATE isState;
} WLAN_INTERFACE_INFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WLAN_INTERFACE_INFO
{
    public Guid InterfaceGuid;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string strInterfaceDescription;
    public int isState;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WLAN_INTERFACE_INFO
    Public InterfaceGuid As Guid
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=256)> Public strInterfaceDescription As String
    Public isState As Integer
End Structure
import ctypes
from ctypes import wintypes

class WLAN_INTERFACE_INFO(ctypes.Structure):
    _fields_ = [
        ("InterfaceGuid", GUID),
        ("strInterfaceDescription", ctypes.c_wchar * 256),
        ("isState", ctypes.c_int),
    ]
#[repr(C)]
pub struct WLAN_INTERFACE_INFO {
    pub InterfaceGuid: GUID,
    pub strInterfaceDescription: [u16; 256],
    pub isState: i32,
}
import "golang.org/x/sys/windows"

type WLAN_INTERFACE_INFO struct {
	InterfaceGuid windows.GUID
	strInterfaceDescription [256]uint16
	isState int32
}
type
  WLAN_INTERFACE_INFO = record
    InterfaceGuid: TGUID;
    strInterfaceDescription: array[0..255] of WideChar;
    isState: Integer;
  end;
const WLAN_INTERFACE_INFO = extern struct {
    InterfaceGuid: GUID,
    strInterfaceDescription: [256]u16,
    isState: i32,
};
type
  WLAN_INTERFACE_INFO {.bycopy.} = object
    InterfaceGuid: GUID
    strInterfaceDescription: array[256, uint16]
    isState: int32
struct WLAN_INTERFACE_INFO
{
    GUID InterfaceGuid;
    wchar[256] strInterfaceDescription;
    int isState;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WLAN_INTERFACE_INFO サイズ: 532 バイト(x64)
dim st, 133    ; 4byte整数×133(構造体サイズ 532 / 4 切り上げ)
; InterfaceGuid : GUID (+0, 16byte)  varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; strInterfaceDescription : WCHAR (+16, 512byte)  varptr(st)+16 を基点に操作(512byte:入れ子/配列)
; isState : WLAN_INTERFACE_STATE (+528, 4byte)  st.132 = 値  /  値 = st.132   (lpoke/lpeek も可)
; ※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 WLAN_INTERFACE_INFO
    #field GUID InterfaceGuid
    #field wchar strInterfaceDescription 256
    #field int isState
#endstruct

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