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

DOT11_WFD_GROUP_JOIN_PARAMETERS

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

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

フィールド

フィールドサイズx64x86説明
HeaderNDIS_OBJECT_HEADER4+0+0NDISオブジェクトの種類・リビジョン・サイズを示す共通ヘッダー。
GOOperatingChannelDOT11_WFD_CHANNEL5+4+4参加先グループオーナーの運用チャネル。
GOConfigTimeDWORD4+12+12グループオーナーの構成時間(ミリ秒)。
bInGroupFormationBOOLEAN1+16+16グループ形成中であるかを示す真偽値。
bWaitForWPSReadyBOOLEAN1+17+17WPS準備完了を待機するかを示す真偽値。

各言語での定義

#include <windows.h>

// NDIS_OBJECT_HEADER  (x64 4 / x86 4 バイト)
typedef struct NDIS_OBJECT_HEADER {
    BYTE Type;
    BYTE Revision;
    WORD Size;
} NDIS_OBJECT_HEADER;

// DOT11_WFD_CHANNEL  (x64 5 / x86 5 バイト)
typedef struct DOT11_WFD_CHANNEL {
    BYTE CountryRegionString[3];
    BYTE OperatingClass;
    BYTE ChannelNumber;
} DOT11_WFD_CHANNEL;

// DOT11_WFD_GROUP_JOIN_PARAMETERS  (x64 20 / x86 20 バイト)
typedef struct DOT11_WFD_GROUP_JOIN_PARAMETERS {
    NDIS_OBJECT_HEADER Header;
    DOT11_WFD_CHANNEL GOOperatingChannel;
    DWORD GOConfigTime;
    BOOLEAN bInGroupFormation;
    BOOLEAN bWaitForWPSReady;
} DOT11_WFD_GROUP_JOIN_PARAMETERS;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NDIS_OBJECT_HEADER
{
    public byte Type;
    public byte Revision;
    public ushort Size;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DOT11_WFD_CHANNEL
{
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] CountryRegionString;
    public byte OperatingClass;
    public byte ChannelNumber;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DOT11_WFD_GROUP_JOIN_PARAMETERS
{
    public NDIS_OBJECT_HEADER Header;
    public DOT11_WFD_CHANNEL GOOperatingChannel;
    public uint GOConfigTime;
    [MarshalAs(UnmanagedType.U1)] public bool bInGroupFormation;
    [MarshalAs(UnmanagedType.U1)] public bool bWaitForWPSReady;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NDIS_OBJECT_HEADER
    Public Type As Byte
    Public Revision As Byte
    Public Size As UShort
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DOT11_WFD_CHANNEL
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)> Public CountryRegionString() As Byte
    Public OperatingClass As Byte
    Public ChannelNumber As Byte
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DOT11_WFD_GROUP_JOIN_PARAMETERS
    Public Header As NDIS_OBJECT_HEADER
    Public GOOperatingChannel As DOT11_WFD_CHANNEL
    Public GOConfigTime As UInteger
    <MarshalAs(UnmanagedType.U1)> Public bInGroupFormation As Boolean
    <MarshalAs(UnmanagedType.U1)> Public bWaitForWPSReady As Boolean
End Structure
import ctypes
from ctypes import wintypes

class NDIS_OBJECT_HEADER(ctypes.Structure):
    _fields_ = [
        ("Type", ctypes.c_ubyte),
        ("Revision", ctypes.c_ubyte),
        ("Size", ctypes.c_ushort),
    ]

class DOT11_WFD_CHANNEL(ctypes.Structure):
    _fields_ = [
        ("CountryRegionString", ctypes.c_ubyte * 3),
        ("OperatingClass", ctypes.c_ubyte),
        ("ChannelNumber", ctypes.c_ubyte),
    ]

class DOT11_WFD_GROUP_JOIN_PARAMETERS(ctypes.Structure):
    _fields_ = [
        ("Header", NDIS_OBJECT_HEADER),
        ("GOOperatingChannel", DOT11_WFD_CHANNEL),
        ("GOConfigTime", wintypes.DWORD),
        ("bInGroupFormation", ctypes.c_byte),
        ("bWaitForWPSReady", ctypes.c_byte),
    ]
#[repr(C)]
pub struct NDIS_OBJECT_HEADER {
    pub Type: u8,
    pub Revision: u8,
    pub Size: u16,
}

#[repr(C)]
pub struct DOT11_WFD_CHANNEL {
    pub CountryRegionString: [u8; 3],
    pub OperatingClass: u8,
    pub ChannelNumber: u8,
}

#[repr(C)]
pub struct DOT11_WFD_GROUP_JOIN_PARAMETERS {
    pub Header: NDIS_OBJECT_HEADER,
    pub GOOperatingChannel: DOT11_WFD_CHANNEL,
    pub GOConfigTime: u32,
    pub bInGroupFormation: u8,
    pub bWaitForWPSReady: u8,
}
import "golang.org/x/sys/windows"

type NDIS_OBJECT_HEADER struct {
	Type byte
	Revision byte
	Size uint16
}

type DOT11_WFD_CHANNEL struct {
	CountryRegionString [3]byte
	OperatingClass byte
	ChannelNumber byte
}

type DOT11_WFD_GROUP_JOIN_PARAMETERS struct {
	Header NDIS_OBJECT_HEADER
	GOOperatingChannel DOT11_WFD_CHANNEL
	GOConfigTime uint32
	bInGroupFormation byte
	bWaitForWPSReady byte
}
type
  NDIS_OBJECT_HEADER = record
    Type: Byte;
    Revision: Byte;
    Size: Word;
  end;

  DOT11_WFD_CHANNEL = record
    CountryRegionString: array[0..2] of Byte;
    OperatingClass: Byte;
    ChannelNumber: Byte;
  end;

  DOT11_WFD_GROUP_JOIN_PARAMETERS = record
    Header: NDIS_OBJECT_HEADER;
    GOOperatingChannel: DOT11_WFD_CHANNEL;
    GOConfigTime: DWORD;
    bInGroupFormation: ByteBool;
    bWaitForWPSReady: ByteBool;
  end;
const NDIS_OBJECT_HEADER = extern struct {
    Type: u8,
    Revision: u8,
    Size: u16,
};

const DOT11_WFD_CHANNEL = extern struct {
    CountryRegionString: [3]u8,
    OperatingClass: u8,
    ChannelNumber: u8,
};

const DOT11_WFD_GROUP_JOIN_PARAMETERS = extern struct {
    Header: NDIS_OBJECT_HEADER,
    GOOperatingChannel: DOT11_WFD_CHANNEL,
    GOConfigTime: u32,
    bInGroupFormation: u8,
    bWaitForWPSReady: u8,
};
type
  NDIS_OBJECT_HEADER {.bycopy.} = object
    Type: uint8
    Revision: uint8
    Size: uint16

  DOT11_WFD_CHANNEL {.bycopy.} = object
    CountryRegionString: array[3, uint8]
    OperatingClass: uint8
    ChannelNumber: uint8

  DOT11_WFD_GROUP_JOIN_PARAMETERS {.bycopy.} = object
    Header: NDIS_OBJECT_HEADER
    GOOperatingChannel: DOT11_WFD_CHANNEL
    GOConfigTime: uint32
    bInGroupFormation: uint8
    bWaitForWPSReady: uint8
struct NDIS_OBJECT_HEADER
{
    ubyte Type;
    ubyte Revision;
    ushort Size;
}

struct DOT11_WFD_CHANNEL
{
    ubyte[3] CountryRegionString;
    ubyte OperatingClass;
    ubyte ChannelNumber;
}

struct DOT11_WFD_GROUP_JOIN_PARAMETERS
{
    NDIS_OBJECT_HEADER Header;
    DOT11_WFD_CHANNEL GOOperatingChannel;
    uint GOConfigTime;
    ubyte bInGroupFormation;
    ubyte bWaitForWPSReady;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DOT11_WFD_GROUP_JOIN_PARAMETERS サイズ: 20 バイト(x64)
dim st, 5    ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; Header : NDIS_OBJECT_HEADER (+0, 4byte)  varptr(st)+0 を基点に操作(4byte:入れ子/配列)
; GOOperatingChannel : DOT11_WFD_CHANNEL (+4, 5byte)  varptr(st)+4 を基点に操作(5byte:入れ子/配列)
; GOConfigTime : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; bInGroupFormation : BOOLEAN (+16, 1byte)  poke st,16,値  /  値 = peek(st,16)
; bWaitForWPSReady : BOOLEAN (+17, 1byte)  poke st,17,値  /  値 = peek(st,17)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global NDIS_OBJECT_HEADER
    #field byte Type
    #field byte Revision
    #field short Size
#endstruct

#defstruct global DOT11_WFD_CHANNEL
    #field byte CountryRegionString 3
    #field byte OperatingClass
    #field byte ChannelNumber
#endstruct

#defstruct global DOT11_WFD_GROUP_JOIN_PARAMETERS
    #field NDIS_OBJECT_HEADER Header
    #field DOT11_WFD_CHANNEL GOOperatingChannel
    #field int GOConfigTime
    #field bool1 bInGroupFormation
    #field bool1 bWaitForWPSReady
#endstruct

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