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

RAS_CONNECTION_3

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

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

フィールド

フィールドサイズx64x86説明
dwVersionDWORD4+0+0構造体のバージョン番号。
dwSizeDWORD4+4+4この構造体のバイト単位のサイズ。
hConnectionHANDLE8/4+8+8接続を識別するハンドル。
wszUserNameWCHAR514+16+12接続したユーザーの名前(ワイド文字列)。
dwInterfaceTypeROUTER_INTERFACE_TYPE4+532+528インターフェイスの種別を表すROUTER_INTERFACE_TYPE列挙値。
guidGUID16+536+532接続を一意に識別するGUID。
PppInfo3PPP_INFO_3228+552+548接続のPPP/IPv6プロジェクション情報(PPP_INFO_3)。
rasQuarStateRAS_QUARANTINE_STATE4+780+776ネットワーク検疫の状態を表すRAS_QUARANTINE_STATE列挙値。
timerFILETIME8+784+780検疫の試用期間終了時刻を表すFILETIME。

各言語での定義

#include <windows.h>

// PPP_NBFCP_INFO  (x64 40 / x86 40 バイト)
typedef struct PPP_NBFCP_INFO {
    DWORD dwError;
    WCHAR wszWksta[17];
} PPP_NBFCP_INFO;

// PPP_IPCP_INFO2  (x64 76 / x86 76 バイト)
typedef struct PPP_IPCP_INFO2 {
    DWORD dwError;
    WCHAR wszAddress[16];
    WCHAR wszRemoteAddress[16];
    DWORD dwOptions;
    DWORD dwRemoteOptions;
} PPP_IPCP_INFO2;

// PPP_IPV6_CP_INFO  (x64 48 / x86 48 バイト)
typedef struct PPP_IPV6_CP_INFO {
    DWORD dwVersion;
    DWORD dwSize;
    DWORD dwError;
    BYTE bInterfaceIdentifier[8];
    BYTE bRemoteInterfaceIdentifier[8];
    DWORD dwOptions;
    DWORD dwRemoteOptions;
    BYTE bPrefix[8];
    DWORD dwPrefixLength;
} PPP_IPV6_CP_INFO;

// PPP_CCP_INFO  (x64 20 / x86 20 バイト)
typedef struct PPP_CCP_INFO {
    DWORD dwError;
    DWORD dwCompressionAlgorithm;
    DWORD dwOptions;
    DWORD dwRemoteCompressionAlgorithm;
    DWORD dwRemoteOptions;
} PPP_CCP_INFO;

// PPP_LCP_INFO  (x64 44 / x86 44 バイト)
typedef struct PPP_LCP_INFO {
    DWORD dwError;
    PPP_LCP dwAuthenticationProtocol;
    PPP_LCP_INFO_AUTH_DATA dwAuthenticationData;
    DWORD dwRemoteAuthenticationProtocol;
    DWORD dwRemoteAuthenticationData;
    DWORD dwTerminateReason;
    DWORD dwRemoteTerminateReason;
    DWORD dwOptions;
    DWORD dwRemoteOptions;
    DWORD dwEapTypeId;
    DWORD dwRemoteEapTypeId;
} PPP_LCP_INFO;

// PPP_INFO_3  (x64 228 / x86 228 バイト)
typedef struct PPP_INFO_3 {
    PPP_NBFCP_INFO nbf;
    PPP_IPCP_INFO2 ip;
    PPP_IPV6_CP_INFO ipv6;
    PPP_CCP_INFO ccp;
    PPP_LCP_INFO lcp;
} PPP_INFO_3;

// FILETIME  (x64 8 / x86 8 バイト)
typedef struct FILETIME {
    DWORD dwLowDateTime;
    DWORD dwHighDateTime;
} FILETIME;

// RAS_CONNECTION_3  (x64 792 / x86 788 バイト)
typedef struct RAS_CONNECTION_3 {
    DWORD dwVersion;
    DWORD dwSize;
    HANDLE hConnection;
    WCHAR wszUserName[257];
    ROUTER_INTERFACE_TYPE dwInterfaceType;
    GUID guid;
    PPP_INFO_3 PppInfo3;
    RAS_QUARANTINE_STATE rasQuarState;
    FILETIME timer;
} RAS_CONNECTION_3;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PPP_NBFCP_INFO
{
    public uint dwError;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 17)] public string wszWksta;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PPP_IPCP_INFO2
{
    public uint dwError;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)] public string wszAddress;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)] public string wszRemoteAddress;
    public uint dwOptions;
    public uint dwRemoteOptions;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PPP_IPV6_CP_INFO
{
    public uint dwVersion;
    public uint dwSize;
    public uint dwError;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] bInterfaceIdentifier;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] bRemoteInterfaceIdentifier;
    public uint dwOptions;
    public uint dwRemoteOptions;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] bPrefix;
    public uint dwPrefixLength;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PPP_CCP_INFO
{
    public uint dwError;
    public uint dwCompressionAlgorithm;
    public uint dwOptions;
    public uint dwRemoteCompressionAlgorithm;
    public uint dwRemoteOptions;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PPP_LCP_INFO
{
    public uint dwError;
    public uint dwAuthenticationProtocol;
    public uint dwAuthenticationData;
    public uint dwRemoteAuthenticationProtocol;
    public uint dwRemoteAuthenticationData;
    public uint dwTerminateReason;
    public uint dwRemoteTerminateReason;
    public uint dwOptions;
    public uint dwRemoteOptions;
    public uint dwEapTypeId;
    public uint dwRemoteEapTypeId;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PPP_INFO_3
{
    public PPP_NBFCP_INFO nbf;
    public PPP_IPCP_INFO2 ip;
    public PPP_IPV6_CP_INFO ipv6;
    public PPP_CCP_INFO ccp;
    public PPP_LCP_INFO lcp;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct FILETIME
{
    public uint dwLowDateTime;
    public uint dwHighDateTime;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct RAS_CONNECTION_3
{
    public uint dwVersion;
    public uint dwSize;
    public IntPtr hConnection;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 257)] public string wszUserName;
    public int dwInterfaceType;
    public Guid guid;
    public PPP_INFO_3 PppInfo3;
    public int rasQuarState;
    public FILETIME timer;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PPP_NBFCP_INFO
    Public dwError As UInteger
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=17)> Public wszWksta As String
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PPP_IPCP_INFO2
    Public dwError As UInteger
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=16)> Public wszAddress As String
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=16)> Public wszRemoteAddress As String
    Public dwOptions As UInteger
    Public dwRemoteOptions As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PPP_IPV6_CP_INFO
    Public dwVersion As UInteger
    Public dwSize As UInteger
    Public dwError As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)> Public bInterfaceIdentifier() As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)> Public bRemoteInterfaceIdentifier() As Byte
    Public dwOptions As UInteger
    Public dwRemoteOptions As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)> Public bPrefix() As Byte
    Public dwPrefixLength As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PPP_CCP_INFO
    Public dwError As UInteger
    Public dwCompressionAlgorithm As UInteger
    Public dwOptions As UInteger
    Public dwRemoteCompressionAlgorithm As UInteger
    Public dwRemoteOptions As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PPP_LCP_INFO
    Public dwError As UInteger
    Public dwAuthenticationProtocol As UInteger
    Public dwAuthenticationData As UInteger
    Public dwRemoteAuthenticationProtocol As UInteger
    Public dwRemoteAuthenticationData As UInteger
    Public dwTerminateReason As UInteger
    Public dwRemoteTerminateReason As UInteger
    Public dwOptions As UInteger
    Public dwRemoteOptions As UInteger
    Public dwEapTypeId As UInteger
    Public dwRemoteEapTypeId As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PPP_INFO_3
    Public nbf As PPP_NBFCP_INFO
    Public ip As PPP_IPCP_INFO2
    Public ipv6 As PPP_IPV6_CP_INFO
    Public ccp As PPP_CCP_INFO
    Public lcp As PPP_LCP_INFO
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure FILETIME
    Public dwLowDateTime As UInteger
    Public dwHighDateTime As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure RAS_CONNECTION_3
    Public dwVersion As UInteger
    Public dwSize As UInteger
    Public hConnection As IntPtr
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=257)> Public wszUserName As String
    Public dwInterfaceType As Integer
    Public guid As Guid
    Public PppInfo3 As PPP_INFO_3
    Public rasQuarState As Integer
    Public timer As FILETIME
End Structure
import ctypes
from ctypes import wintypes

class PPP_NBFCP_INFO(ctypes.Structure):
    _fields_ = [
        ("dwError", wintypes.DWORD),
        ("wszWksta", ctypes.c_wchar * 17),
    ]

class PPP_IPCP_INFO2(ctypes.Structure):
    _fields_ = [
        ("dwError", wintypes.DWORD),
        ("wszAddress", ctypes.c_wchar * 16),
        ("wszRemoteAddress", ctypes.c_wchar * 16),
        ("dwOptions", wintypes.DWORD),
        ("dwRemoteOptions", wintypes.DWORD),
    ]

class PPP_IPV6_CP_INFO(ctypes.Structure):
    _fields_ = [
        ("dwVersion", wintypes.DWORD),
        ("dwSize", wintypes.DWORD),
        ("dwError", wintypes.DWORD),
        ("bInterfaceIdentifier", ctypes.c_ubyte * 8),
        ("bRemoteInterfaceIdentifier", ctypes.c_ubyte * 8),
        ("dwOptions", wintypes.DWORD),
        ("dwRemoteOptions", wintypes.DWORD),
        ("bPrefix", ctypes.c_ubyte * 8),
        ("dwPrefixLength", wintypes.DWORD),
    ]

class PPP_CCP_INFO(ctypes.Structure):
    _fields_ = [
        ("dwError", wintypes.DWORD),
        ("dwCompressionAlgorithm", wintypes.DWORD),
        ("dwOptions", wintypes.DWORD),
        ("dwRemoteCompressionAlgorithm", wintypes.DWORD),
        ("dwRemoteOptions", wintypes.DWORD),
    ]

class PPP_LCP_INFO(ctypes.Structure):
    _fields_ = [
        ("dwError", wintypes.DWORD),
        ("dwAuthenticationProtocol", wintypes.DWORD),
        ("dwAuthenticationData", wintypes.DWORD),
        ("dwRemoteAuthenticationProtocol", wintypes.DWORD),
        ("dwRemoteAuthenticationData", wintypes.DWORD),
        ("dwTerminateReason", wintypes.DWORD),
        ("dwRemoteTerminateReason", wintypes.DWORD),
        ("dwOptions", wintypes.DWORD),
        ("dwRemoteOptions", wintypes.DWORD),
        ("dwEapTypeId", wintypes.DWORD),
        ("dwRemoteEapTypeId", wintypes.DWORD),
    ]

class PPP_INFO_3(ctypes.Structure):
    _fields_ = [
        ("nbf", PPP_NBFCP_INFO),
        ("ip", PPP_IPCP_INFO2),
        ("ipv6", PPP_IPV6_CP_INFO),
        ("ccp", PPP_CCP_INFO),
        ("lcp", PPP_LCP_INFO),
    ]

class FILETIME(ctypes.Structure):
    _fields_ = [
        ("dwLowDateTime", wintypes.DWORD),
        ("dwHighDateTime", wintypes.DWORD),
    ]

class RAS_CONNECTION_3(ctypes.Structure):
    _fields_ = [
        ("dwVersion", wintypes.DWORD),
        ("dwSize", wintypes.DWORD),
        ("hConnection", ctypes.c_void_p),
        ("wszUserName", ctypes.c_wchar * 257),
        ("dwInterfaceType", ctypes.c_int),
        ("guid", GUID),
        ("PppInfo3", PPP_INFO_3),
        ("rasQuarState", ctypes.c_int),
        ("timer", FILETIME),
    ]
#[repr(C)]
pub struct PPP_NBFCP_INFO {
    pub dwError: u32,
    pub wszWksta: [u16; 17],
}

#[repr(C)]
pub struct PPP_IPCP_INFO2 {
    pub dwError: u32,
    pub wszAddress: [u16; 16],
    pub wszRemoteAddress: [u16; 16],
    pub dwOptions: u32,
    pub dwRemoteOptions: u32,
}

#[repr(C)]
pub struct PPP_IPV6_CP_INFO {
    pub dwVersion: u32,
    pub dwSize: u32,
    pub dwError: u32,
    pub bInterfaceIdentifier: [u8; 8],
    pub bRemoteInterfaceIdentifier: [u8; 8],
    pub dwOptions: u32,
    pub dwRemoteOptions: u32,
    pub bPrefix: [u8; 8],
    pub dwPrefixLength: u32,
}

#[repr(C)]
pub struct PPP_CCP_INFO {
    pub dwError: u32,
    pub dwCompressionAlgorithm: u32,
    pub dwOptions: u32,
    pub dwRemoteCompressionAlgorithm: u32,
    pub dwRemoteOptions: u32,
}

#[repr(C)]
pub struct PPP_LCP_INFO {
    pub dwError: u32,
    pub dwAuthenticationProtocol: u32,
    pub dwAuthenticationData: u32,
    pub dwRemoteAuthenticationProtocol: u32,
    pub dwRemoteAuthenticationData: u32,
    pub dwTerminateReason: u32,
    pub dwRemoteTerminateReason: u32,
    pub dwOptions: u32,
    pub dwRemoteOptions: u32,
    pub dwEapTypeId: u32,
    pub dwRemoteEapTypeId: u32,
}

#[repr(C)]
pub struct PPP_INFO_3 {
    pub nbf: PPP_NBFCP_INFO,
    pub ip: PPP_IPCP_INFO2,
    pub ipv6: PPP_IPV6_CP_INFO,
    pub ccp: PPP_CCP_INFO,
    pub lcp: PPP_LCP_INFO,
}

#[repr(C)]
pub struct FILETIME {
    pub dwLowDateTime: u32,
    pub dwHighDateTime: u32,
}

#[repr(C)]
pub struct RAS_CONNECTION_3 {
    pub dwVersion: u32,
    pub dwSize: u32,
    pub hConnection: *mut core::ffi::c_void,
    pub wszUserName: [u16; 257],
    pub dwInterfaceType: i32,
    pub guid: GUID,
    pub PppInfo3: PPP_INFO_3,
    pub rasQuarState: i32,
    pub timer: FILETIME,
}
import "golang.org/x/sys/windows"

type PPP_NBFCP_INFO struct {
	dwError uint32
	wszWksta [17]uint16
}

type PPP_IPCP_INFO2 struct {
	dwError uint32
	wszAddress [16]uint16
	wszRemoteAddress [16]uint16
	dwOptions uint32
	dwRemoteOptions uint32
}

type PPP_IPV6_CP_INFO struct {
	dwVersion uint32
	dwSize uint32
	dwError uint32
	bInterfaceIdentifier [8]byte
	bRemoteInterfaceIdentifier [8]byte
	dwOptions uint32
	dwRemoteOptions uint32
	bPrefix [8]byte
	dwPrefixLength uint32
}

type PPP_CCP_INFO struct {
	dwError uint32
	dwCompressionAlgorithm uint32
	dwOptions uint32
	dwRemoteCompressionAlgorithm uint32
	dwRemoteOptions uint32
}

type PPP_LCP_INFO struct {
	dwError uint32
	dwAuthenticationProtocol uint32
	dwAuthenticationData uint32
	dwRemoteAuthenticationProtocol uint32
	dwRemoteAuthenticationData uint32
	dwTerminateReason uint32
	dwRemoteTerminateReason uint32
	dwOptions uint32
	dwRemoteOptions uint32
	dwEapTypeId uint32
	dwRemoteEapTypeId uint32
}

type PPP_INFO_3 struct {
	nbf PPP_NBFCP_INFO
	ip PPP_IPCP_INFO2
	ipv6 PPP_IPV6_CP_INFO
	ccp PPP_CCP_INFO
	lcp PPP_LCP_INFO
}

type FILETIME struct {
	dwLowDateTime uint32
	dwHighDateTime uint32
}

type RAS_CONNECTION_3 struct {
	dwVersion uint32
	dwSize uint32
	hConnection uintptr
	wszUserName [257]uint16
	dwInterfaceType int32
	guid windows.GUID
	PppInfo3 PPP_INFO_3
	rasQuarState int32
	timer FILETIME
}
type
  PPP_NBFCP_INFO = record
    dwError: DWORD;
    wszWksta: array[0..16] of WideChar;
  end;

  PPP_IPCP_INFO2 = record
    dwError: DWORD;
    wszAddress: array[0..15] of WideChar;
    wszRemoteAddress: array[0..15] of WideChar;
    dwOptions: DWORD;
    dwRemoteOptions: DWORD;
  end;

  PPP_IPV6_CP_INFO = record
    dwVersion: DWORD;
    dwSize: DWORD;
    dwError: DWORD;
    bInterfaceIdentifier: array[0..7] of Byte;
    bRemoteInterfaceIdentifier: array[0..7] of Byte;
    dwOptions: DWORD;
    dwRemoteOptions: DWORD;
    bPrefix: array[0..7] of Byte;
    dwPrefixLength: DWORD;
  end;

  PPP_CCP_INFO = record
    dwError: DWORD;
    dwCompressionAlgorithm: DWORD;
    dwOptions: DWORD;
    dwRemoteCompressionAlgorithm: DWORD;
    dwRemoteOptions: DWORD;
  end;

  PPP_LCP_INFO = record
    dwError: DWORD;
    dwAuthenticationProtocol: DWORD;
    dwAuthenticationData: DWORD;
    dwRemoteAuthenticationProtocol: DWORD;
    dwRemoteAuthenticationData: DWORD;
    dwTerminateReason: DWORD;
    dwRemoteTerminateReason: DWORD;
    dwOptions: DWORD;
    dwRemoteOptions: DWORD;
    dwEapTypeId: DWORD;
    dwRemoteEapTypeId: DWORD;
  end;

  PPP_INFO_3 = record
    nbf: PPP_NBFCP_INFO;
    ip: PPP_IPCP_INFO2;
    ipv6: PPP_IPV6_CP_INFO;
    ccp: PPP_CCP_INFO;
    lcp: PPP_LCP_INFO;
  end;

  FILETIME = record
    dwLowDateTime: DWORD;
    dwHighDateTime: DWORD;
  end;

  RAS_CONNECTION_3 = record
    dwVersion: DWORD;
    dwSize: DWORD;
    hConnection: Pointer;
    wszUserName: array[0..256] of WideChar;
    dwInterfaceType: Integer;
    guid: TGUID;
    PppInfo3: PPP_INFO_3;
    rasQuarState: Integer;
    timer: FILETIME;
  end;
const PPP_NBFCP_INFO = extern struct {
    dwError: u32,
    wszWksta: [17]u16,
};

const PPP_IPCP_INFO2 = extern struct {
    dwError: u32,
    wszAddress: [16]u16,
    wszRemoteAddress: [16]u16,
    dwOptions: u32,
    dwRemoteOptions: u32,
};

const PPP_IPV6_CP_INFO = extern struct {
    dwVersion: u32,
    dwSize: u32,
    dwError: u32,
    bInterfaceIdentifier: [8]u8,
    bRemoteInterfaceIdentifier: [8]u8,
    dwOptions: u32,
    dwRemoteOptions: u32,
    bPrefix: [8]u8,
    dwPrefixLength: u32,
};

const PPP_CCP_INFO = extern struct {
    dwError: u32,
    dwCompressionAlgorithm: u32,
    dwOptions: u32,
    dwRemoteCompressionAlgorithm: u32,
    dwRemoteOptions: u32,
};

const PPP_LCP_INFO = extern struct {
    dwError: u32,
    dwAuthenticationProtocol: u32,
    dwAuthenticationData: u32,
    dwRemoteAuthenticationProtocol: u32,
    dwRemoteAuthenticationData: u32,
    dwTerminateReason: u32,
    dwRemoteTerminateReason: u32,
    dwOptions: u32,
    dwRemoteOptions: u32,
    dwEapTypeId: u32,
    dwRemoteEapTypeId: u32,
};

const PPP_INFO_3 = extern struct {
    nbf: PPP_NBFCP_INFO,
    ip: PPP_IPCP_INFO2,
    ipv6: PPP_IPV6_CP_INFO,
    ccp: PPP_CCP_INFO,
    lcp: PPP_LCP_INFO,
};

const FILETIME = extern struct {
    dwLowDateTime: u32,
    dwHighDateTime: u32,
};

const RAS_CONNECTION_3 = extern struct {
    dwVersion: u32,
    dwSize: u32,
    hConnection: ?*anyopaque,
    wszUserName: [257]u16,
    dwInterfaceType: i32,
    guid: GUID,
    PppInfo3: PPP_INFO_3,
    rasQuarState: i32,
    timer: FILETIME,
};
type
  PPP_NBFCP_INFO {.bycopy.} = object
    dwError: uint32
    wszWksta: array[17, uint16]

  PPP_IPCP_INFO2 {.bycopy.} = object
    dwError: uint32
    wszAddress: array[16, uint16]
    wszRemoteAddress: array[16, uint16]
    dwOptions: uint32
    dwRemoteOptions: uint32

  PPP_IPV6_CP_INFO {.bycopy.} = object
    dwVersion: uint32
    dwSize: uint32
    dwError: uint32
    bInterfaceIdentifier: array[8, uint8]
    bRemoteInterfaceIdentifier: array[8, uint8]
    dwOptions: uint32
    dwRemoteOptions: uint32
    bPrefix: array[8, uint8]
    dwPrefixLength: uint32

  PPP_CCP_INFO {.bycopy.} = object
    dwError: uint32
    dwCompressionAlgorithm: uint32
    dwOptions: uint32
    dwRemoteCompressionAlgorithm: uint32
    dwRemoteOptions: uint32

  PPP_LCP_INFO {.bycopy.} = object
    dwError: uint32
    dwAuthenticationProtocol: uint32
    dwAuthenticationData: uint32
    dwRemoteAuthenticationProtocol: uint32
    dwRemoteAuthenticationData: uint32
    dwTerminateReason: uint32
    dwRemoteTerminateReason: uint32
    dwOptions: uint32
    dwRemoteOptions: uint32
    dwEapTypeId: uint32
    dwRemoteEapTypeId: uint32

  PPP_INFO_3 {.bycopy.} = object
    nbf: PPP_NBFCP_INFO
    ip: PPP_IPCP_INFO2
    ipv6: PPP_IPV6_CP_INFO
    ccp: PPP_CCP_INFO
    lcp: PPP_LCP_INFO

  FILETIME {.bycopy.} = object
    dwLowDateTime: uint32
    dwHighDateTime: uint32

  RAS_CONNECTION_3 {.bycopy.} = object
    dwVersion: uint32
    dwSize: uint32
    hConnection: pointer
    wszUserName: array[257, uint16]
    dwInterfaceType: int32
    guid: GUID
    PppInfo3: PPP_INFO_3
    rasQuarState: int32
    timer: FILETIME
struct PPP_NBFCP_INFO
{
    uint dwError;
    wchar[17] wszWksta;
}

struct PPP_IPCP_INFO2
{
    uint dwError;
    wchar[16] wszAddress;
    wchar[16] wszRemoteAddress;
    uint dwOptions;
    uint dwRemoteOptions;
}

struct PPP_IPV6_CP_INFO
{
    uint dwVersion;
    uint dwSize;
    uint dwError;
    ubyte[8] bInterfaceIdentifier;
    ubyte[8] bRemoteInterfaceIdentifier;
    uint dwOptions;
    uint dwRemoteOptions;
    ubyte[8] bPrefix;
    uint dwPrefixLength;
}

struct PPP_CCP_INFO
{
    uint dwError;
    uint dwCompressionAlgorithm;
    uint dwOptions;
    uint dwRemoteCompressionAlgorithm;
    uint dwRemoteOptions;
}

struct PPP_LCP_INFO
{
    uint dwError;
    uint dwAuthenticationProtocol;
    uint dwAuthenticationData;
    uint dwRemoteAuthenticationProtocol;
    uint dwRemoteAuthenticationData;
    uint dwTerminateReason;
    uint dwRemoteTerminateReason;
    uint dwOptions;
    uint dwRemoteOptions;
    uint dwEapTypeId;
    uint dwRemoteEapTypeId;
}

struct PPP_INFO_3
{
    PPP_NBFCP_INFO nbf;
    PPP_IPCP_INFO2 ip;
    PPP_IPV6_CP_INFO ipv6;
    PPP_CCP_INFO ccp;
    PPP_LCP_INFO lcp;
}

struct FILETIME
{
    uint dwLowDateTime;
    uint dwHighDateTime;
}

struct RAS_CONNECTION_3
{
    uint dwVersion;
    uint dwSize;
    void* hConnection;
    wchar[257] wszUserName;
    int dwInterfaceType;
    GUID guid;
    PPP_INFO_3 PppInfo3;
    int rasQuarState;
    FILETIME timer;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; RAS_CONNECTION_3 サイズ: 788 バイト(x86)
dim st, 197    ; 4byte整数×197(構造体サイズ 788 / 4 切り上げ)
; dwVersion : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwSize : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; hConnection : HANDLE (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; wszUserName : WCHAR (+12, 514byte)  varptr(st)+12 を基点に操作(514byte:入れ子/配列)
; dwInterfaceType : ROUTER_INTERFACE_TYPE (+528, 4byte)  st.132 = 値  /  値 = st.132   (lpoke/lpeek も可)
; guid : GUID (+532, 16byte)  varptr(st)+532 を基点に操作(16byte:入れ子/配列)
; PppInfo3 : PPP_INFO_3 (+548, 228byte)  varptr(st)+548 を基点に操作(228byte:入れ子/配列)
; rasQuarState : RAS_QUARANTINE_STATE (+776, 4byte)  st.194 = 値  /  値 = st.194   (lpoke/lpeek も可)
; timer : FILETIME (+780, 8byte)  varptr(st)+780 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; RAS_CONNECTION_3 サイズ: 792 バイト(x64)
dim st, 198    ; 4byte整数×198(構造体サイズ 792 / 4 切り上げ)
; dwVersion : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwSize : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; hConnection : HANDLE (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; wszUserName : WCHAR (+16, 514byte)  varptr(st)+16 を基点に操作(514byte:入れ子/配列)
; dwInterfaceType : ROUTER_INTERFACE_TYPE (+532, 4byte)  st.133 = 値  /  値 = st.133   (lpoke/lpeek も可)
; guid : GUID (+536, 16byte)  varptr(st)+536 を基点に操作(16byte:入れ子/配列)
; PppInfo3 : PPP_INFO_3 (+552, 228byte)  varptr(st)+552 を基点に操作(228byte:入れ子/配列)
; rasQuarState : RAS_QUARANTINE_STATE (+780, 4byte)  st.195 = 値  /  値 = st.195   (lpoke/lpeek も可)
; timer : FILETIME (+784, 8byte)  varptr(st)+784 を基点に操作(8byte:入れ子/配列)
; ※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 PPP_NBFCP_INFO
    #field int dwError
    #field wchar wszWksta 17
#endstruct

#defstruct global PPP_IPCP_INFO2
    #field int dwError
    #field wchar wszAddress 16
    #field wchar wszRemoteAddress 16
    #field int dwOptions
    #field int dwRemoteOptions
#endstruct

#defstruct global PPP_IPV6_CP_INFO
    #field int dwVersion
    #field int dwSize
    #field int dwError
    #field byte bInterfaceIdentifier 8
    #field byte bRemoteInterfaceIdentifier 8
    #field int dwOptions
    #field int dwRemoteOptions
    #field byte bPrefix 8
    #field int dwPrefixLength
#endstruct

#defstruct global PPP_CCP_INFO
    #field int dwError
    #field int dwCompressionAlgorithm
    #field int dwOptions
    #field int dwRemoteCompressionAlgorithm
    #field int dwRemoteOptions
#endstruct

#defstruct global PPP_LCP_INFO
    #field int dwError
    #field int dwAuthenticationProtocol
    #field int dwAuthenticationData
    #field int dwRemoteAuthenticationProtocol
    #field int dwRemoteAuthenticationData
    #field int dwTerminateReason
    #field int dwRemoteTerminateReason
    #field int dwOptions
    #field int dwRemoteOptions
    #field int dwEapTypeId
    #field int dwRemoteEapTypeId
#endstruct

#defstruct global PPP_INFO_3
    #field PPP_NBFCP_INFO nbf
    #field PPP_IPCP_INFO2 ip
    #field PPP_IPV6_CP_INFO ipv6
    #field PPP_CCP_INFO ccp
    #field PPP_LCP_INFO lcp
#endstruct

#defstruct global FILETIME
    #field int dwLowDateTime
    #field int dwHighDateTime
#endstruct

#defstruct global RAS_CONNECTION_3
    #field int dwVersion
    #field int dwSize
    #field intptr hConnection
    #field wchar wszUserName 257
    #field int dwInterfaceType
    #field GUID guid
    #field PPP_INFO_3 PppInfo3
    #field int rasQuarState
    #field FILETIME timer
#endstruct

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