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

DOT11_WFD_DEVICE_CAPABILITY_CONFIG

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

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

フィールド

フィールドサイズx64x86説明
HeaderNDIS_OBJECT_HEADER4+0+0NDISオブジェクトの種類・リビジョン・サイズを示す共通ヘッダー。
bServiceDiscoveryEnabledBOOLEAN1+4+4サービスディスカバリが有効かを示す真偽値。
bClientDiscoverabilityEnabledBOOLEAN1+5+5クライアントの被検出性が有効かを示す真偽値。
bConcurrentOperationSupportedBOOLEAN1+6+6同時動作をサポートするかを示す真偽値。
bInfrastructureManagementEnabledBOOLEAN1+7+7インフラ管理が有効かを示す真偽値。
bDeviceLimitReachedBOOLEAN1+8+8デバイス数の上限に達しているかを示す真偽値。
bInvitationProcedureEnabledBOOLEAN1+9+9招待手続きが有効かを示す真偽値。
WPSVersionsEnabledDWORD4+12+12有効化されているWPSバージョンのビットマスク。

各言語での定義

#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_DEVICE_CAPABILITY_CONFIG  (x64 16 / x86 16 バイト)
typedef struct DOT11_WFD_DEVICE_CAPABILITY_CONFIG {
    NDIS_OBJECT_HEADER Header;
    BOOLEAN bServiceDiscoveryEnabled;
    BOOLEAN bClientDiscoverabilityEnabled;
    BOOLEAN bConcurrentOperationSupported;
    BOOLEAN bInfrastructureManagementEnabled;
    BOOLEAN bDeviceLimitReached;
    BOOLEAN bInvitationProcedureEnabled;
    DWORD WPSVersionsEnabled;
} DOT11_WFD_DEVICE_CAPABILITY_CONFIG;
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_DEVICE_CAPABILITY_CONFIG
{
    public NDIS_OBJECT_HEADER Header;
    [MarshalAs(UnmanagedType.U1)] public bool bServiceDiscoveryEnabled;
    [MarshalAs(UnmanagedType.U1)] public bool bClientDiscoverabilityEnabled;
    [MarshalAs(UnmanagedType.U1)] public bool bConcurrentOperationSupported;
    [MarshalAs(UnmanagedType.U1)] public bool bInfrastructureManagementEnabled;
    [MarshalAs(UnmanagedType.U1)] public bool bDeviceLimitReached;
    [MarshalAs(UnmanagedType.U1)] public bool bInvitationProcedureEnabled;
    public uint WPSVersionsEnabled;
}
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_DEVICE_CAPABILITY_CONFIG
    Public Header As NDIS_OBJECT_HEADER
    <MarshalAs(UnmanagedType.U1)> Public bServiceDiscoveryEnabled As Boolean
    <MarshalAs(UnmanagedType.U1)> Public bClientDiscoverabilityEnabled As Boolean
    <MarshalAs(UnmanagedType.U1)> Public bConcurrentOperationSupported As Boolean
    <MarshalAs(UnmanagedType.U1)> Public bInfrastructureManagementEnabled As Boolean
    <MarshalAs(UnmanagedType.U1)> Public bDeviceLimitReached As Boolean
    <MarshalAs(UnmanagedType.U1)> Public bInvitationProcedureEnabled As Boolean
    Public WPSVersionsEnabled As UInteger
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_DEVICE_CAPABILITY_CONFIG(ctypes.Structure):
    _fields_ = [
        ("Header", NDIS_OBJECT_HEADER),
        ("bServiceDiscoveryEnabled", ctypes.c_byte),
        ("bClientDiscoverabilityEnabled", ctypes.c_byte),
        ("bConcurrentOperationSupported", ctypes.c_byte),
        ("bInfrastructureManagementEnabled", ctypes.c_byte),
        ("bDeviceLimitReached", ctypes.c_byte),
        ("bInvitationProcedureEnabled", ctypes.c_byte),
        ("WPSVersionsEnabled", wintypes.DWORD),
    ]
#[repr(C)]
pub struct NDIS_OBJECT_HEADER {
    pub Type: u8,
    pub Revision: u8,
    pub Size: u16,
}

#[repr(C)]
pub struct DOT11_WFD_DEVICE_CAPABILITY_CONFIG {
    pub Header: NDIS_OBJECT_HEADER,
    pub bServiceDiscoveryEnabled: u8,
    pub bClientDiscoverabilityEnabled: u8,
    pub bConcurrentOperationSupported: u8,
    pub bInfrastructureManagementEnabled: u8,
    pub bDeviceLimitReached: u8,
    pub bInvitationProcedureEnabled: u8,
    pub WPSVersionsEnabled: u32,
}
import "golang.org/x/sys/windows"

type NDIS_OBJECT_HEADER struct {
	Type byte
	Revision byte
	Size uint16
}

type DOT11_WFD_DEVICE_CAPABILITY_CONFIG struct {
	Header NDIS_OBJECT_HEADER
	bServiceDiscoveryEnabled byte
	bClientDiscoverabilityEnabled byte
	bConcurrentOperationSupported byte
	bInfrastructureManagementEnabled byte
	bDeviceLimitReached byte
	bInvitationProcedureEnabled byte
	WPSVersionsEnabled uint32
}
type
  NDIS_OBJECT_HEADER = record
    Type: Byte;
    Revision: Byte;
    Size: Word;
  end;

  DOT11_WFD_DEVICE_CAPABILITY_CONFIG = record
    Header: NDIS_OBJECT_HEADER;
    bServiceDiscoveryEnabled: ByteBool;
    bClientDiscoverabilityEnabled: ByteBool;
    bConcurrentOperationSupported: ByteBool;
    bInfrastructureManagementEnabled: ByteBool;
    bDeviceLimitReached: ByteBool;
    bInvitationProcedureEnabled: ByteBool;
    WPSVersionsEnabled: DWORD;
  end;
const NDIS_OBJECT_HEADER = extern struct {
    Type: u8,
    Revision: u8,
    Size: u16,
};

const DOT11_WFD_DEVICE_CAPABILITY_CONFIG = extern struct {
    Header: NDIS_OBJECT_HEADER,
    bServiceDiscoveryEnabled: u8,
    bClientDiscoverabilityEnabled: u8,
    bConcurrentOperationSupported: u8,
    bInfrastructureManagementEnabled: u8,
    bDeviceLimitReached: u8,
    bInvitationProcedureEnabled: u8,
    WPSVersionsEnabled: u32,
};
type
  NDIS_OBJECT_HEADER {.bycopy.} = object
    Type: uint8
    Revision: uint8
    Size: uint16

  DOT11_WFD_DEVICE_CAPABILITY_CONFIG {.bycopy.} = object
    Header: NDIS_OBJECT_HEADER
    bServiceDiscoveryEnabled: uint8
    bClientDiscoverabilityEnabled: uint8
    bConcurrentOperationSupported: uint8
    bInfrastructureManagementEnabled: uint8
    bDeviceLimitReached: uint8
    bInvitationProcedureEnabled: uint8
    WPSVersionsEnabled: uint32
struct NDIS_OBJECT_HEADER
{
    ubyte Type;
    ubyte Revision;
    ushort Size;
}

struct DOT11_WFD_DEVICE_CAPABILITY_CONFIG
{
    NDIS_OBJECT_HEADER Header;
    ubyte bServiceDiscoveryEnabled;
    ubyte bClientDiscoverabilityEnabled;
    ubyte bConcurrentOperationSupported;
    ubyte bInfrastructureManagementEnabled;
    ubyte bDeviceLimitReached;
    ubyte bInvitationProcedureEnabled;
    uint WPSVersionsEnabled;
}

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_DEVICE_CAPABILITY_CONFIG サイズ: 16 バイト(x64)
dim st, 4    ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; Header : NDIS_OBJECT_HEADER (+0, 4byte)  varptr(st)+0 を基点に操作(4byte:入れ子/配列)
; bServiceDiscoveryEnabled : BOOLEAN (+4, 1byte)  poke st,4,値  /  値 = peek(st,4)
; bClientDiscoverabilityEnabled : BOOLEAN (+5, 1byte)  poke st,5,値  /  値 = peek(st,5)
; bConcurrentOperationSupported : BOOLEAN (+6, 1byte)  poke st,6,値  /  値 = peek(st,6)
; bInfrastructureManagementEnabled : BOOLEAN (+7, 1byte)  poke st,7,値  /  値 = peek(st,7)
; bDeviceLimitReached : BOOLEAN (+8, 1byte)  poke st,8,値  /  値 = peek(st,8)
; bInvitationProcedureEnabled : BOOLEAN (+9, 1byte)  poke st,9,値  /  値 = peek(st,9)
; WPSVersionsEnabled : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; ※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_DEVICE_CAPABILITY_CONFIG
    #field NDIS_OBJECT_HEADER Header
    #field bool1 bServiceDiscoveryEnabled
    #field bool1 bClientDiscoverabilityEnabled
    #field bool1 bConcurrentOperationSupported
    #field bool1 bInfrastructureManagementEnabled
    #field bool1 bDeviceLimitReached
    #field bool1 bInvitationProcedureEnabled
    #field int WPSVersionsEnabled
#endstruct

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