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

IPSEC_SA_DETAILS1

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

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

フィールド

フィールドサイズx64x86説明
ipVersionFWP_IP_VERSION4+0+0対象のIPバージョン(IPv4/IPv6)。
saDirectionFWP_DIRECTION4+4+4SAの方向(受信/送信)を示す列挙値。
trafficIPSEC_TRAFFIC172+8+8このSAが適用されるトラフィック情報(バージョン1)。
saBundleIPSEC_SA_BUNDLE1112/96+80+80SAバンドル(バージョン1)。
Anonymous_Anonymous_e__Union8/4+192+176メインモードSAなど追加情報を保持する共用体。
transportFilterFWPM_FILTER0*8/4+200+180関連付くトランスポートフィルターへのポインター。
virtualIfTunnelInfoIPSEC_VIRTUAL_IF_TUNNEL_INFO016+208+184仮想インターフェイストンネルの情報。バージョン1で追加。

共用体: _Anonymous_e__Union x64 8B / x86 4B

フィールドサイズx64x86
udpEncapsulationIPSEC_V4_UDP_ENCAPSULATION0*8/4+0+0

各言語での定義

#include <windows.h>

// IPSEC_TRAFFIC1  (x64 72 / x86 72 バイト)
typedef struct IPSEC_TRAFFIC1 {
    FWP_IP_VERSION ipVersion;
    _Anonymous1_e__Union Anonymous1;
    _Anonymous2_e__Union Anonymous2;
    IPSEC_TRAFFIC_TYPE trafficType;
    _Anonymous3_e__Union Anonymous3;
    WORD remotePort;
    WORD localPort;
    BYTE ipProtocol;
    ULONGLONG localIfLuid;
    DWORD realIfProfileId;
} IPSEC_TRAFFIC1;

// IPSEC_SA_LIFETIME0  (x64 12 / x86 12 バイト)
typedef struct IPSEC_SA_LIFETIME0 {
    DWORD lifetimeSeconds;
    DWORD lifetimeKilobytes;
    DWORD lifetimePackets;
} IPSEC_SA_LIFETIME0;

// IPSEC_SA_BUNDLE1  (x64 112 / x86 96 バイト)
typedef struct IPSEC_SA_BUNDLE1 {
    IPSEC_SA_BUNDLE_FLAGS flags;
    IPSEC_SA_LIFETIME0 lifetime;
    DWORD idleTimeoutSeconds;
    DWORD ndAllowClearTimeoutSeconds;
    IPSEC_ID0* ipsecId;
    DWORD napContext;
    DWORD qmSaId;
    DWORD numSAs;
    IPSEC_SA0* saList;
    IPSEC_KEYMODULE_STATE0* keyModuleState;
    FWP_IP_VERSION ipVersion;
    _Anonymous_e__Union Anonymous;
    ULONGLONG mmSaId;
    IPSEC_PFS_GROUP pfsGroup;
    GUID saLookupContext;
    ULONGLONG qmFilterId;
} IPSEC_SA_BUNDLE1;

// IPSEC_VIRTUAL_IF_TUNNEL_INFO0  (x64 16 / x86 16 バイト)
typedef struct IPSEC_VIRTUAL_IF_TUNNEL_INFO0 {
    ULONGLONG virtualIfTunnelId;
    ULONGLONG trafficSelectorId;
} IPSEC_VIRTUAL_IF_TUNNEL_INFO0;

// IPSEC_SA_DETAILS1  (x64 224 / x86 200 バイト)
typedef struct IPSEC_SA_DETAILS1 {
    FWP_IP_VERSION ipVersion;
    FWP_DIRECTION saDirection;
    IPSEC_TRAFFIC1 traffic;
    IPSEC_SA_BUNDLE1 saBundle;
    _Anonymous_e__Union Anonymous;
    FWPM_FILTER0* transportFilter;
    IPSEC_VIRTUAL_IF_TUNNEL_INFO0 virtualIfTunnelInfo;
} IPSEC_SA_DETAILS1;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct IPSEC_TRAFFIC1
{
    public int ipVersion;
    public _Anonymous1_e__Union Anonymous1;
    public _Anonymous2_e__Union Anonymous2;
    public int trafficType;
    public _Anonymous3_e__Union Anonymous3;
    public ushort remotePort;
    public ushort localPort;
    public byte ipProtocol;
    public ulong localIfLuid;
    public uint realIfProfileId;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct IPSEC_SA_LIFETIME0
{
    public uint lifetimeSeconds;
    public uint lifetimeKilobytes;
    public uint lifetimePackets;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct IPSEC_SA_BUNDLE1
{
    public uint flags;
    public IPSEC_SA_LIFETIME0 lifetime;
    public uint idleTimeoutSeconds;
    public uint ndAllowClearTimeoutSeconds;
    public IntPtr ipsecId;
    public uint napContext;
    public uint qmSaId;
    public uint numSAs;
    public IntPtr saList;
    public IntPtr keyModuleState;
    public int ipVersion;
    public _Anonymous_e__Union Anonymous;
    public ulong mmSaId;
    public int pfsGroup;
    public Guid saLookupContext;
    public ulong qmFilterId;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct IPSEC_VIRTUAL_IF_TUNNEL_INFO0
{
    public ulong virtualIfTunnelId;
    public ulong trafficSelectorId;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct IPSEC_SA_DETAILS1
{
    public int ipVersion;
    public int saDirection;
    public IPSEC_TRAFFIC1 traffic;
    public IPSEC_SA_BUNDLE1 saBundle;
    public _Anonymous_e__Union Anonymous;
    public IntPtr transportFilter;
    public IPSEC_VIRTUAL_IF_TUNNEL_INFO0 virtualIfTunnelInfo;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure IPSEC_TRAFFIC1
    Public ipVersion As Integer
    Public Anonymous1 As _Anonymous1_e__Union
    Public Anonymous2 As _Anonymous2_e__Union
    Public trafficType As Integer
    Public Anonymous3 As _Anonymous3_e__Union
    Public remotePort As UShort
    Public localPort As UShort
    Public ipProtocol As Byte
    Public localIfLuid As ULong
    Public realIfProfileId As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure IPSEC_SA_LIFETIME0
    Public lifetimeSeconds As UInteger
    Public lifetimeKilobytes As UInteger
    Public lifetimePackets As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure IPSEC_SA_BUNDLE1
    Public flags As UInteger
    Public lifetime As IPSEC_SA_LIFETIME0
    Public idleTimeoutSeconds As UInteger
    Public ndAllowClearTimeoutSeconds As UInteger
    Public ipsecId As IntPtr
    Public napContext As UInteger
    Public qmSaId As UInteger
    Public numSAs As UInteger
    Public saList As IntPtr
    Public keyModuleState As IntPtr
    Public ipVersion As Integer
    Public Anonymous As _Anonymous_e__Union
    Public mmSaId As ULong
    Public pfsGroup As Integer
    Public saLookupContext As Guid
    Public qmFilterId As ULong
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure IPSEC_VIRTUAL_IF_TUNNEL_INFO0
    Public virtualIfTunnelId As ULong
    Public trafficSelectorId As ULong
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure IPSEC_SA_DETAILS1
    Public ipVersion As Integer
    Public saDirection As Integer
    Public traffic As IPSEC_TRAFFIC1
    Public saBundle As IPSEC_SA_BUNDLE1
    Public Anonymous As _Anonymous_e__Union
    Public transportFilter As IntPtr
    Public virtualIfTunnelInfo As IPSEC_VIRTUAL_IF_TUNNEL_INFO0
End Structure
import ctypes
from ctypes import wintypes

class IPSEC_TRAFFIC1(ctypes.Structure):
    _fields_ = [
        ("ipVersion", ctypes.c_int),
        ("Anonymous1", _Anonymous1_e__Union),
        ("Anonymous2", _Anonymous2_e__Union),
        ("trafficType", ctypes.c_int),
        ("Anonymous3", _Anonymous3_e__Union),
        ("remotePort", ctypes.c_ushort),
        ("localPort", ctypes.c_ushort),
        ("ipProtocol", ctypes.c_ubyte),
        ("localIfLuid", ctypes.c_ulonglong),
        ("realIfProfileId", wintypes.DWORD),
    ]

class IPSEC_SA_LIFETIME0(ctypes.Structure):
    _fields_ = [
        ("lifetimeSeconds", wintypes.DWORD),
        ("lifetimeKilobytes", wintypes.DWORD),
        ("lifetimePackets", wintypes.DWORD),
    ]

class IPSEC_SA_BUNDLE1(ctypes.Structure):
    _fields_ = [
        ("flags", wintypes.DWORD),
        ("lifetime", IPSEC_SA_LIFETIME0),
        ("idleTimeoutSeconds", wintypes.DWORD),
        ("ndAllowClearTimeoutSeconds", wintypes.DWORD),
        ("ipsecId", ctypes.c_void_p),
        ("napContext", wintypes.DWORD),
        ("qmSaId", wintypes.DWORD),
        ("numSAs", wintypes.DWORD),
        ("saList", ctypes.c_void_p),
        ("keyModuleState", ctypes.c_void_p),
        ("ipVersion", ctypes.c_int),
        ("Anonymous", _Anonymous_e__Union),
        ("mmSaId", ctypes.c_ulonglong),
        ("pfsGroup", ctypes.c_int),
        ("saLookupContext", GUID),
        ("qmFilterId", ctypes.c_ulonglong),
    ]

class IPSEC_VIRTUAL_IF_TUNNEL_INFO0(ctypes.Structure):
    _fields_ = [
        ("virtualIfTunnelId", ctypes.c_ulonglong),
        ("trafficSelectorId", ctypes.c_ulonglong),
    ]

class IPSEC_SA_DETAILS1(ctypes.Structure):
    _fields_ = [
        ("ipVersion", ctypes.c_int),
        ("saDirection", ctypes.c_int),
        ("traffic", IPSEC_TRAFFIC1),
        ("saBundle", IPSEC_SA_BUNDLE1),
        ("Anonymous", _Anonymous_e__Union),
        ("transportFilter", ctypes.c_void_p),
        ("virtualIfTunnelInfo", IPSEC_VIRTUAL_IF_TUNNEL_INFO0),
    ]
#[repr(C)]
pub struct IPSEC_TRAFFIC1 {
    pub ipVersion: i32,
    pub Anonymous1: _Anonymous1_e__Union,
    pub Anonymous2: _Anonymous2_e__Union,
    pub trafficType: i32,
    pub Anonymous3: _Anonymous3_e__Union,
    pub remotePort: u16,
    pub localPort: u16,
    pub ipProtocol: u8,
    pub localIfLuid: u64,
    pub realIfProfileId: u32,
}

#[repr(C)]
pub struct IPSEC_SA_LIFETIME0 {
    pub lifetimeSeconds: u32,
    pub lifetimeKilobytes: u32,
    pub lifetimePackets: u32,
}

#[repr(C)]
pub struct IPSEC_SA_BUNDLE1 {
    pub flags: u32,
    pub lifetime: IPSEC_SA_LIFETIME0,
    pub idleTimeoutSeconds: u32,
    pub ndAllowClearTimeoutSeconds: u32,
    pub ipsecId: *mut core::ffi::c_void,
    pub napContext: u32,
    pub qmSaId: u32,
    pub numSAs: u32,
    pub saList: *mut core::ffi::c_void,
    pub keyModuleState: *mut core::ffi::c_void,
    pub ipVersion: i32,
    pub Anonymous: _Anonymous_e__Union,
    pub mmSaId: u64,
    pub pfsGroup: i32,
    pub saLookupContext: GUID,
    pub qmFilterId: u64,
}

#[repr(C)]
pub struct IPSEC_VIRTUAL_IF_TUNNEL_INFO0 {
    pub virtualIfTunnelId: u64,
    pub trafficSelectorId: u64,
}

#[repr(C)]
pub struct IPSEC_SA_DETAILS1 {
    pub ipVersion: i32,
    pub saDirection: i32,
    pub traffic: IPSEC_TRAFFIC1,
    pub saBundle: IPSEC_SA_BUNDLE1,
    pub Anonymous: _Anonymous_e__Union,
    pub transportFilter: *mut core::ffi::c_void,
    pub virtualIfTunnelInfo: IPSEC_VIRTUAL_IF_TUNNEL_INFO0,
}
import "golang.org/x/sys/windows"

type IPSEC_TRAFFIC1 struct {
	ipVersion int32
	Anonymous1 _Anonymous1_e__Union
	Anonymous2 _Anonymous2_e__Union
	trafficType int32
	Anonymous3 _Anonymous3_e__Union
	remotePort uint16
	localPort uint16
	ipProtocol byte
	localIfLuid uint64
	realIfProfileId uint32
}

type IPSEC_SA_LIFETIME0 struct {
	lifetimeSeconds uint32
	lifetimeKilobytes uint32
	lifetimePackets uint32
}

type IPSEC_SA_BUNDLE1 struct {
	flags uint32
	lifetime IPSEC_SA_LIFETIME0
	idleTimeoutSeconds uint32
	ndAllowClearTimeoutSeconds uint32
	ipsecId uintptr
	napContext uint32
	qmSaId uint32
	numSAs uint32
	saList uintptr
	keyModuleState uintptr
	ipVersion int32
	Anonymous _Anonymous_e__Union
	mmSaId uint64
	pfsGroup int32
	saLookupContext windows.GUID
	qmFilterId uint64
}

type IPSEC_VIRTUAL_IF_TUNNEL_INFO0 struct {
	virtualIfTunnelId uint64
	trafficSelectorId uint64
}

type IPSEC_SA_DETAILS1 struct {
	ipVersion int32
	saDirection int32
	traffic IPSEC_TRAFFIC1
	saBundle IPSEC_SA_BUNDLE1
	Anonymous _Anonymous_e__Union
	transportFilter uintptr
	virtualIfTunnelInfo IPSEC_VIRTUAL_IF_TUNNEL_INFO0
}
type
  IPSEC_TRAFFIC1 = record
    ipVersion: Integer;
    Anonymous1: _Anonymous1_e__Union;
    Anonymous2: _Anonymous2_e__Union;
    trafficType: Integer;
    Anonymous3: _Anonymous3_e__Union;
    remotePort: Word;
    localPort: Word;
    ipProtocol: Byte;
    localIfLuid: UInt64;
    realIfProfileId: DWORD;
  end;

  IPSEC_SA_LIFETIME0 = record
    lifetimeSeconds: DWORD;
    lifetimeKilobytes: DWORD;
    lifetimePackets: DWORD;
  end;

  IPSEC_SA_BUNDLE1 = record
    flags: DWORD;
    lifetime: IPSEC_SA_LIFETIME0;
    idleTimeoutSeconds: DWORD;
    ndAllowClearTimeoutSeconds: DWORD;
    ipsecId: Pointer;
    napContext: DWORD;
    qmSaId: DWORD;
    numSAs: DWORD;
    saList: Pointer;
    keyModuleState: Pointer;
    ipVersion: Integer;
    Anonymous: _Anonymous_e__Union;
    mmSaId: UInt64;
    pfsGroup: Integer;
    saLookupContext: TGUID;
    qmFilterId: UInt64;
  end;

  IPSEC_VIRTUAL_IF_TUNNEL_INFO0 = record
    virtualIfTunnelId: UInt64;
    trafficSelectorId: UInt64;
  end;

  IPSEC_SA_DETAILS1 = record
    ipVersion: Integer;
    saDirection: Integer;
    traffic: IPSEC_TRAFFIC1;
    saBundle: IPSEC_SA_BUNDLE1;
    Anonymous: _Anonymous_e__Union;
    transportFilter: Pointer;
    virtualIfTunnelInfo: IPSEC_VIRTUAL_IF_TUNNEL_INFO0;
  end;
const IPSEC_TRAFFIC1 = extern struct {
    ipVersion: i32,
    Anonymous1: _Anonymous1_e__Union,
    Anonymous2: _Anonymous2_e__Union,
    trafficType: i32,
    Anonymous3: _Anonymous3_e__Union,
    remotePort: u16,
    localPort: u16,
    ipProtocol: u8,
    localIfLuid: u64,
    realIfProfileId: u32,
};

const IPSEC_SA_LIFETIME0 = extern struct {
    lifetimeSeconds: u32,
    lifetimeKilobytes: u32,
    lifetimePackets: u32,
};

const IPSEC_SA_BUNDLE1 = extern struct {
    flags: u32,
    lifetime: IPSEC_SA_LIFETIME0,
    idleTimeoutSeconds: u32,
    ndAllowClearTimeoutSeconds: u32,
    ipsecId: ?*anyopaque,
    napContext: u32,
    qmSaId: u32,
    numSAs: u32,
    saList: ?*anyopaque,
    keyModuleState: ?*anyopaque,
    ipVersion: i32,
    Anonymous: _Anonymous_e__Union,
    mmSaId: u64,
    pfsGroup: i32,
    saLookupContext: GUID,
    qmFilterId: u64,
};

const IPSEC_VIRTUAL_IF_TUNNEL_INFO0 = extern struct {
    virtualIfTunnelId: u64,
    trafficSelectorId: u64,
};

const IPSEC_SA_DETAILS1 = extern struct {
    ipVersion: i32,
    saDirection: i32,
    traffic: IPSEC_TRAFFIC1,
    saBundle: IPSEC_SA_BUNDLE1,
    Anonymous: _Anonymous_e__Union,
    transportFilter: ?*anyopaque,
    virtualIfTunnelInfo: IPSEC_VIRTUAL_IF_TUNNEL_INFO0,
};
type
  IPSEC_TRAFFIC1 {.bycopy.} = object
    ipVersion: int32
    Anonymous1: _Anonymous1_e__Union
    Anonymous2: _Anonymous2_e__Union
    trafficType: int32
    Anonymous3: _Anonymous3_e__Union
    remotePort: uint16
    localPort: uint16
    ipProtocol: uint8
    localIfLuid: uint64
    realIfProfileId: uint32

  IPSEC_SA_LIFETIME0 {.bycopy.} = object
    lifetimeSeconds: uint32
    lifetimeKilobytes: uint32
    lifetimePackets: uint32

  IPSEC_SA_BUNDLE1 {.bycopy.} = object
    flags: uint32
    lifetime: IPSEC_SA_LIFETIME0
    idleTimeoutSeconds: uint32
    ndAllowClearTimeoutSeconds: uint32
    ipsecId: pointer
    napContext: uint32
    qmSaId: uint32
    numSAs: uint32
    saList: pointer
    keyModuleState: pointer
    ipVersion: int32
    Anonymous: _Anonymous_e__Union
    mmSaId: uint64
    pfsGroup: int32
    saLookupContext: GUID
    qmFilterId: uint64

  IPSEC_VIRTUAL_IF_TUNNEL_INFO0 {.bycopy.} = object
    virtualIfTunnelId: uint64
    trafficSelectorId: uint64

  IPSEC_SA_DETAILS1 {.bycopy.} = object
    ipVersion: int32
    saDirection: int32
    traffic: IPSEC_TRAFFIC1
    saBundle: IPSEC_SA_BUNDLE1
    Anonymous: _Anonymous_e__Union
    transportFilter: pointer
    virtualIfTunnelInfo: IPSEC_VIRTUAL_IF_TUNNEL_INFO0
struct IPSEC_TRAFFIC1
{
    int ipVersion;
    _Anonymous1_e__Union Anonymous1;
    _Anonymous2_e__Union Anonymous2;
    int trafficType;
    _Anonymous3_e__Union Anonymous3;
    ushort remotePort;
    ushort localPort;
    ubyte ipProtocol;
    ulong localIfLuid;
    uint realIfProfileId;
}

struct IPSEC_SA_LIFETIME0
{
    uint lifetimeSeconds;
    uint lifetimeKilobytes;
    uint lifetimePackets;
}

struct IPSEC_SA_BUNDLE1
{
    uint flags;
    IPSEC_SA_LIFETIME0 lifetime;
    uint idleTimeoutSeconds;
    uint ndAllowClearTimeoutSeconds;
    void* ipsecId;
    uint napContext;
    uint qmSaId;
    uint numSAs;
    void* saList;
    void* keyModuleState;
    int ipVersion;
    _Anonymous_e__Union Anonymous;
    ulong mmSaId;
    int pfsGroup;
    GUID saLookupContext;
    ulong qmFilterId;
}

struct IPSEC_VIRTUAL_IF_TUNNEL_INFO0
{
    ulong virtualIfTunnelId;
    ulong trafficSelectorId;
}

struct IPSEC_SA_DETAILS1
{
    int ipVersion;
    int saDirection;
    IPSEC_TRAFFIC1 traffic;
    IPSEC_SA_BUNDLE1 saBundle;
    _Anonymous_e__Union Anonymous;
    void* transportFilter;
    IPSEC_VIRTUAL_IF_TUNNEL_INFO0 virtualIfTunnelInfo;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; IPSEC_SA_DETAILS1 サイズ: 200 バイト(x86)
dim st, 50    ; 4byte整数×50(構造体サイズ 200 / 4 切り上げ)
; ipVersion : FWP_IP_VERSION (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; saDirection : FWP_DIRECTION (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; traffic : IPSEC_TRAFFIC1 (+8, 72byte)  varptr(st)+8 を基点に操作(72byte:入れ子/配列)
; saBundle : IPSEC_SA_BUNDLE1 (+80, 96byte)  varptr(st)+80 を基点に操作(96byte:入れ子/配列)
; Anonymous : _Anonymous_e__Union (+176, 4byte)  varptr(st)+176 を基点に操作(4byte:入れ子/配列)
; transportFilter : FWPM_FILTER0* (+180, 4byte)  varptr(st)+180 を基点に操作(4byte:入れ子/配列)
; virtualIfTunnelInfo : IPSEC_VIRTUAL_IF_TUNNEL_INFO0 (+184, 16byte)  varptr(st)+184 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; IPSEC_SA_DETAILS1 サイズ: 224 バイト(x64)
dim st, 56    ; 4byte整数×56(構造体サイズ 224 / 4 切り上げ)
; ipVersion : FWP_IP_VERSION (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; saDirection : FWP_DIRECTION (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; traffic : IPSEC_TRAFFIC1 (+8, 72byte)  varptr(st)+8 を基点に操作(72byte:入れ子/配列)
; saBundle : IPSEC_SA_BUNDLE1 (+80, 112byte)  varptr(st)+80 を基点に操作(112byte:入れ子/配列)
; Anonymous : _Anonymous_e__Union (+192, 8byte)  varptr(st)+192 を基点に操作(8byte:入れ子/配列)
; transportFilter : FWPM_FILTER0* (+200, 8byte)  varptr(st)+200 を基点に操作(8byte:入れ子/配列)
; virtualIfTunnelInfo : IPSEC_VIRTUAL_IF_TUNNEL_INFO0 (+208, 16byte)  varptr(st)+208 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global IPSEC_TRAFFIC1
    #field int ipVersion
    #field byte Anonymous1 16
    #field byte Anonymous2 16
    #field int trafficType
    #field byte Anonymous3 8
    #field short remotePort
    #field short localPort
    #field byte ipProtocol
    #field int64 localIfLuid
    #field int realIfProfileId
#endstruct

#defstruct global IPSEC_SA_LIFETIME0
    #field int lifetimeSeconds
    #field int lifetimeKilobytes
    #field int lifetimePackets
#endstruct

#defstruct global GUID, pack=1
    #field int Data1
    #field short Data2
    #field short Data3
    #field byte Data4 8
#endstruct

#defstruct global IPSEC_SA_BUNDLE1
    #field int flags
    #field IPSEC_SA_LIFETIME0 lifetime
    #field int idleTimeoutSeconds
    #field int ndAllowClearTimeoutSeconds
    #field intptr ipsecId
    #field int napContext
    #field int qmSaId
    #field int numSAs
    #field intptr saList
    #field intptr keyModuleState
    #field int ipVersion
    #field byte Anonymous 4
    #field int64 mmSaId
    #field int pfsGroup
    #field GUID saLookupContext
    #field int64 qmFilterId
#endstruct

#defstruct global IPSEC_VIRTUAL_IF_TUNNEL_INFO0
    #field int64 virtualIfTunnelId
    #field int64 trafficSelectorId
#endstruct

#defstruct global IPSEC_SA_DETAILS1
    #field int ipVersion
    #field int saDirection
    #field IPSEC_TRAFFIC1 traffic
    #field IPSEC_SA_BUNDLE1 saBundle
    #field byte Anonymous 8
    #field intptr transportFilter
    #field IPSEC_VIRTUAL_IF_TUNNEL_INFO0 virtualIfTunnelInfo
#endstruct

stdim st, IPSEC_SA_DETAILS1        ; NSTRUCT 変数を確保
st->ipVersion = 100
mes "ipVersion=" + st->ipVersion
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。