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

L2_NOTIFICATION_DATA

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

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

フィールド

フィールドサイズx64x86説明
NotificationSourceWLAN_NOTIFICATION_SOURCES4+0+0通知の発生元を示すソース種別。
NotificationCodeDWORD4+4+4通知の種類を示すコード。
InterfaceGuidGUID16+8+8通知に関連するインターフェイスのGUID。
dwDataSizeDWORD4+24+24pDataが指す追加データのサイズ(バイト)。
pDatavoid*8/4+32+28通知固有の追加データへのポインタ。無い場合はNULL。

各言語での定義

#include <windows.h>

// L2_NOTIFICATION_DATA  (x64 40 / x86 32 バイト)
typedef struct L2_NOTIFICATION_DATA {
    WLAN_NOTIFICATION_SOURCES NotificationSource;
    DWORD NotificationCode;
    GUID InterfaceGuid;
    DWORD dwDataSize;
    void* pData;
} L2_NOTIFICATION_DATA;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct L2_NOTIFICATION_DATA
{
    public uint NotificationSource;
    public uint NotificationCode;
    public Guid InterfaceGuid;
    public uint dwDataSize;
    public IntPtr pData;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure L2_NOTIFICATION_DATA
    Public NotificationSource As UInteger
    Public NotificationCode As UInteger
    Public InterfaceGuid As Guid
    Public dwDataSize As UInteger
    Public pData As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class L2_NOTIFICATION_DATA(ctypes.Structure):
    _fields_ = [
        ("NotificationSource", wintypes.DWORD),
        ("NotificationCode", wintypes.DWORD),
        ("InterfaceGuid", GUID),
        ("dwDataSize", wintypes.DWORD),
        ("pData", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct L2_NOTIFICATION_DATA {
    pub NotificationSource: u32,
    pub NotificationCode: u32,
    pub InterfaceGuid: GUID,
    pub dwDataSize: u32,
    pub pData: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type L2_NOTIFICATION_DATA struct {
	NotificationSource uint32
	NotificationCode uint32
	InterfaceGuid windows.GUID
	dwDataSize uint32
	pData uintptr
}
type
  L2_NOTIFICATION_DATA = record
    NotificationSource: DWORD;
    NotificationCode: DWORD;
    InterfaceGuid: TGUID;
    dwDataSize: DWORD;
    pData: Pointer;
  end;
const L2_NOTIFICATION_DATA = extern struct {
    NotificationSource: u32,
    NotificationCode: u32,
    InterfaceGuid: GUID,
    dwDataSize: u32,
    pData: ?*anyopaque,
};
type
  L2_NOTIFICATION_DATA {.bycopy.} = object
    NotificationSource: uint32
    NotificationCode: uint32
    InterfaceGuid: GUID
    dwDataSize: uint32
    pData: pointer
struct L2_NOTIFICATION_DATA
{
    uint NotificationSource;
    uint NotificationCode;
    GUID InterfaceGuid;
    uint dwDataSize;
    void* pData;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; L2_NOTIFICATION_DATA サイズ: 32 バイト(x86)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; NotificationSource : WLAN_NOTIFICATION_SOURCES (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; NotificationCode : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; InterfaceGuid : GUID (+8, 16byte)  varptr(st)+8 を基点に操作(16byte:入れ子/配列)
; dwDataSize : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; pData : void* (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; L2_NOTIFICATION_DATA サイズ: 40 バイト(x64)
dim st, 10    ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; NotificationSource : WLAN_NOTIFICATION_SOURCES (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; NotificationCode : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; InterfaceGuid : GUID (+8, 16byte)  varptr(st)+8 を基点に操作(16byte:入れ子/配列)
; dwDataSize : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; pData : void* (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; ※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 L2_NOTIFICATION_DATA
    #field int NotificationSource
    #field int NotificationCode
    #field GUID InterfaceGuid
    #field int dwDataSize
    #field intptr pData
#endstruct

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