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

MPR_SERVER_SET_CONFIG_EX0

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

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

フィールド

フィールドサイズx64x86説明
HeaderMPRAPI_OBJECT_HEADER4+0+0オブジェクトのリビジョン・種別・サイズを示すMPRAPI_OBJECT_HEADER。
setConfigForProtocolsDWORD4+4+4どのトンネルプロトコルの構成を設定するかを示すフラグ。
ConfigParamsMPRAPI_TUNNEL_CONFIG_PARAMS0216/148+8+8適用する各トンネルプロトコルの構成パラメータ群。

各言語での定義

#include <windows.h>

// MPRAPI_OBJECT_HEADER  (x64 4 / x86 4 バイト)
typedef struct MPRAPI_OBJECT_HEADER {
    BYTE revision;
    BYTE type;
    WORD size;
} MPRAPI_OBJECT_HEADER;

// CRYPT_INTEGER_BLOB  (x64 16 / x86 8 バイト)
typedef struct CRYPT_INTEGER_BLOB {
    DWORD cbData;
    BYTE* pbData;
} CRYPT_INTEGER_BLOB;

// IKEV2_TUNNEL_CONFIG_PARAMS4  (x64 104 / x86 64 バイト)
typedef struct IKEV2_TUNNEL_CONFIG_PARAMS4 {
    DWORD dwIdleTimeout;
    DWORD dwNetworkBlackoutTime;
    DWORD dwSaLifeTime;
    DWORD dwSaDataSizeForRenegotiation;
    DWORD dwConfigOptions;
    DWORD dwTotalCertificates;
    CRYPT_INTEGER_BLOB* certificateNames;
    CRYPT_INTEGER_BLOB machineCertificateName;
    DWORD dwEncryptionType;
    ROUTER_CUSTOM_IKEv2_POLICY0* customPolicy;
    DWORD dwTotalEkus;
    MPR_CERT_EKU* certificateEKUs;
    CRYPT_INTEGER_BLOB machineCertificateHash;
    DWORD dwMmSaLifeTime;
} IKEV2_TUNNEL_CONFIG_PARAMS4;

// IKEV2_CONFIG_PARAMS  (x64 120 / x86 76 バイト)
typedef struct IKEV2_CONFIG_PARAMS {
    DWORD dwNumPorts;
    DWORD dwPortFlags;
    DWORD dwTunnelConfigParamFlags;
    IKEV2_TUNNEL_CONFIG_PARAMS4 TunnelConfigParams;
} IKEV2_CONFIG_PARAMS;

// PPTP_CONFIG_PARAMS  (x64 8 / x86 8 バイト)
typedef struct PPTP_CONFIG_PARAMS {
    DWORD dwNumPorts;
    DWORD dwPortFlags;
} PPTP_CONFIG_PARAMS;

// L2TP_TUNNEL_CONFIG_PARAMS2  (x64 32 / x86 24 バイト)
typedef struct L2TP_TUNNEL_CONFIG_PARAMS2 {
    DWORD dwIdleTimeout;
    DWORD dwEncryptionType;
    DWORD dwSaLifeTime;
    DWORD dwSaDataSizeForRenegotiation;
    ROUTER_CUSTOM_IKEv2_POLICY0* customPolicy;
    DWORD dwMmSaLifeTime;
} L2TP_TUNNEL_CONFIG_PARAMS2;

// L2TP_CONFIG_PARAMS1  (x64 48 / x86 36 バイト)
typedef struct L2TP_CONFIG_PARAMS1 {
    DWORD dwNumPorts;
    DWORD dwPortFlags;
    DWORD dwTunnelConfigParamFlags;
    L2TP_TUNNEL_CONFIG_PARAMS2 TunnelConfigParams;
} L2TP_CONFIG_PARAMS1;

// SSTP_CERT_INFO  (x64 24 / x86 12 バイト)
typedef struct SSTP_CERT_INFO {
    BOOL isDefault;
    CRYPT_INTEGER_BLOB certBlob;
} SSTP_CERT_INFO;

// SSTP_CONFIG_PARAMS  (x64 40 / x86 28 バイト)
typedef struct SSTP_CONFIG_PARAMS {
    DWORD dwNumPorts;
    DWORD dwPortFlags;
    BOOL isUseHttps;
    DWORD certAlgorithm;
    SSTP_CERT_INFO sstpCertDetails;
} SSTP_CONFIG_PARAMS;

// MPRAPI_TUNNEL_CONFIG_PARAMS0  (x64 216 / x86 148 バイト)
typedef struct MPRAPI_TUNNEL_CONFIG_PARAMS0 {
    IKEV2_CONFIG_PARAMS IkeConfigParams;
    PPTP_CONFIG_PARAMS PptpConfigParams;
    L2TP_CONFIG_PARAMS1 L2tpConfigParams;
    SSTP_CONFIG_PARAMS SstpConfigParams;
} MPRAPI_TUNNEL_CONFIG_PARAMS0;

// MPR_SERVER_SET_CONFIG_EX0  (x64 224 / x86 156 バイト)
typedef struct MPR_SERVER_SET_CONFIG_EX0 {
    MPRAPI_OBJECT_HEADER Header;
    DWORD setConfigForProtocols;
    MPRAPI_TUNNEL_CONFIG_PARAMS0 ConfigParams;
} MPR_SERVER_SET_CONFIG_EX0;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MPRAPI_OBJECT_HEADER
{
    public byte revision;
    public byte type;
    public ushort size;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CRYPT_INTEGER_BLOB
{
    public uint cbData;
    public IntPtr pbData;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct IKEV2_TUNNEL_CONFIG_PARAMS4
{
    public uint dwIdleTimeout;
    public uint dwNetworkBlackoutTime;
    public uint dwSaLifeTime;
    public uint dwSaDataSizeForRenegotiation;
    public uint dwConfigOptions;
    public uint dwTotalCertificates;
    public IntPtr certificateNames;
    public CRYPT_INTEGER_BLOB machineCertificateName;
    public uint dwEncryptionType;
    public IntPtr customPolicy;
    public uint dwTotalEkus;
    public IntPtr certificateEKUs;
    public CRYPT_INTEGER_BLOB machineCertificateHash;
    public uint dwMmSaLifeTime;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct IKEV2_CONFIG_PARAMS
{
    public uint dwNumPorts;
    public uint dwPortFlags;
    public uint dwTunnelConfigParamFlags;
    public IKEV2_TUNNEL_CONFIG_PARAMS4 TunnelConfigParams;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PPTP_CONFIG_PARAMS
{
    public uint dwNumPorts;
    public uint dwPortFlags;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct L2TP_TUNNEL_CONFIG_PARAMS2
{
    public uint dwIdleTimeout;
    public uint dwEncryptionType;
    public uint dwSaLifeTime;
    public uint dwSaDataSizeForRenegotiation;
    public IntPtr customPolicy;
    public uint dwMmSaLifeTime;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct L2TP_CONFIG_PARAMS1
{
    public uint dwNumPorts;
    public uint dwPortFlags;
    public uint dwTunnelConfigParamFlags;
    public L2TP_TUNNEL_CONFIG_PARAMS2 TunnelConfigParams;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SSTP_CERT_INFO
{
    [MarshalAs(UnmanagedType.Bool)] public bool isDefault;
    public CRYPT_INTEGER_BLOB certBlob;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SSTP_CONFIG_PARAMS
{
    public uint dwNumPorts;
    public uint dwPortFlags;
    [MarshalAs(UnmanagedType.Bool)] public bool isUseHttps;
    public uint certAlgorithm;
    public SSTP_CERT_INFO sstpCertDetails;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MPRAPI_TUNNEL_CONFIG_PARAMS0
{
    public IKEV2_CONFIG_PARAMS IkeConfigParams;
    public PPTP_CONFIG_PARAMS PptpConfigParams;
    public L2TP_CONFIG_PARAMS1 L2tpConfigParams;
    public SSTP_CONFIG_PARAMS SstpConfigParams;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MPR_SERVER_SET_CONFIG_EX0
{
    public MPRAPI_OBJECT_HEADER Header;
    public uint setConfigForProtocols;
    public MPRAPI_TUNNEL_CONFIG_PARAMS0 ConfigParams;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MPRAPI_OBJECT_HEADER
    Public revision As Byte
    Public type As Byte
    Public size As UShort
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CRYPT_INTEGER_BLOB
    Public cbData As UInteger
    Public pbData As IntPtr
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure IKEV2_TUNNEL_CONFIG_PARAMS4
    Public dwIdleTimeout As UInteger
    Public dwNetworkBlackoutTime As UInteger
    Public dwSaLifeTime As UInteger
    Public dwSaDataSizeForRenegotiation As UInteger
    Public dwConfigOptions As UInteger
    Public dwTotalCertificates As UInteger
    Public certificateNames As IntPtr
    Public machineCertificateName As CRYPT_INTEGER_BLOB
    Public dwEncryptionType As UInteger
    Public customPolicy As IntPtr
    Public dwTotalEkus As UInteger
    Public certificateEKUs As IntPtr
    Public machineCertificateHash As CRYPT_INTEGER_BLOB
    Public dwMmSaLifeTime As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure IKEV2_CONFIG_PARAMS
    Public dwNumPorts As UInteger
    Public dwPortFlags As UInteger
    Public dwTunnelConfigParamFlags As UInteger
    Public TunnelConfigParams As IKEV2_TUNNEL_CONFIG_PARAMS4
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PPTP_CONFIG_PARAMS
    Public dwNumPorts As UInteger
    Public dwPortFlags As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure L2TP_TUNNEL_CONFIG_PARAMS2
    Public dwIdleTimeout As UInteger
    Public dwEncryptionType As UInteger
    Public dwSaLifeTime As UInteger
    Public dwSaDataSizeForRenegotiation As UInteger
    Public customPolicy As IntPtr
    Public dwMmSaLifeTime As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure L2TP_CONFIG_PARAMS1
    Public dwNumPorts As UInteger
    Public dwPortFlags As UInteger
    Public dwTunnelConfigParamFlags As UInteger
    Public TunnelConfigParams As L2TP_TUNNEL_CONFIG_PARAMS2
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SSTP_CERT_INFO
    <MarshalAs(UnmanagedType.Bool)> Public isDefault As Boolean
    Public certBlob As CRYPT_INTEGER_BLOB
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SSTP_CONFIG_PARAMS
    Public dwNumPorts As UInteger
    Public dwPortFlags As UInteger
    <MarshalAs(UnmanagedType.Bool)> Public isUseHttps As Boolean
    Public certAlgorithm As UInteger
    Public sstpCertDetails As SSTP_CERT_INFO
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MPRAPI_TUNNEL_CONFIG_PARAMS0
    Public IkeConfigParams As IKEV2_CONFIG_PARAMS
    Public PptpConfigParams As PPTP_CONFIG_PARAMS
    Public L2tpConfigParams As L2TP_CONFIG_PARAMS1
    Public SstpConfigParams As SSTP_CONFIG_PARAMS
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MPR_SERVER_SET_CONFIG_EX0
    Public Header As MPRAPI_OBJECT_HEADER
    Public setConfigForProtocols As UInteger
    Public ConfigParams As MPRAPI_TUNNEL_CONFIG_PARAMS0
End Structure
import ctypes
from ctypes import wintypes

class MPRAPI_OBJECT_HEADER(ctypes.Structure):
    _fields_ = [
        ("revision", ctypes.c_ubyte),
        ("type", ctypes.c_ubyte),
        ("size", ctypes.c_ushort),
    ]

class CRYPT_INTEGER_BLOB(ctypes.Structure):
    _fields_ = [
        ("cbData", wintypes.DWORD),
        ("pbData", ctypes.c_void_p),
    ]

class IKEV2_TUNNEL_CONFIG_PARAMS4(ctypes.Structure):
    _fields_ = [
        ("dwIdleTimeout", wintypes.DWORD),
        ("dwNetworkBlackoutTime", wintypes.DWORD),
        ("dwSaLifeTime", wintypes.DWORD),
        ("dwSaDataSizeForRenegotiation", wintypes.DWORD),
        ("dwConfigOptions", wintypes.DWORD),
        ("dwTotalCertificates", wintypes.DWORD),
        ("certificateNames", ctypes.c_void_p),
        ("machineCertificateName", CRYPT_INTEGER_BLOB),
        ("dwEncryptionType", wintypes.DWORD),
        ("customPolicy", ctypes.c_void_p),
        ("dwTotalEkus", wintypes.DWORD),
        ("certificateEKUs", ctypes.c_void_p),
        ("machineCertificateHash", CRYPT_INTEGER_BLOB),
        ("dwMmSaLifeTime", wintypes.DWORD),
    ]

class IKEV2_CONFIG_PARAMS(ctypes.Structure):
    _fields_ = [
        ("dwNumPorts", wintypes.DWORD),
        ("dwPortFlags", wintypes.DWORD),
        ("dwTunnelConfigParamFlags", wintypes.DWORD),
        ("TunnelConfigParams", IKEV2_TUNNEL_CONFIG_PARAMS4),
    ]

class PPTP_CONFIG_PARAMS(ctypes.Structure):
    _fields_ = [
        ("dwNumPorts", wintypes.DWORD),
        ("dwPortFlags", wintypes.DWORD),
    ]

class L2TP_TUNNEL_CONFIG_PARAMS2(ctypes.Structure):
    _fields_ = [
        ("dwIdleTimeout", wintypes.DWORD),
        ("dwEncryptionType", wintypes.DWORD),
        ("dwSaLifeTime", wintypes.DWORD),
        ("dwSaDataSizeForRenegotiation", wintypes.DWORD),
        ("customPolicy", ctypes.c_void_p),
        ("dwMmSaLifeTime", wintypes.DWORD),
    ]

class L2TP_CONFIG_PARAMS1(ctypes.Structure):
    _fields_ = [
        ("dwNumPorts", wintypes.DWORD),
        ("dwPortFlags", wintypes.DWORD),
        ("dwTunnelConfigParamFlags", wintypes.DWORD),
        ("TunnelConfigParams", L2TP_TUNNEL_CONFIG_PARAMS2),
    ]

class SSTP_CERT_INFO(ctypes.Structure):
    _fields_ = [
        ("isDefault", wintypes.BOOL),
        ("certBlob", CRYPT_INTEGER_BLOB),
    ]

class SSTP_CONFIG_PARAMS(ctypes.Structure):
    _fields_ = [
        ("dwNumPorts", wintypes.DWORD),
        ("dwPortFlags", wintypes.DWORD),
        ("isUseHttps", wintypes.BOOL),
        ("certAlgorithm", wintypes.DWORD),
        ("sstpCertDetails", SSTP_CERT_INFO),
    ]

class MPRAPI_TUNNEL_CONFIG_PARAMS0(ctypes.Structure):
    _fields_ = [
        ("IkeConfigParams", IKEV2_CONFIG_PARAMS),
        ("PptpConfigParams", PPTP_CONFIG_PARAMS),
        ("L2tpConfigParams", L2TP_CONFIG_PARAMS1),
        ("SstpConfigParams", SSTP_CONFIG_PARAMS),
    ]

class MPR_SERVER_SET_CONFIG_EX0(ctypes.Structure):
    _fields_ = [
        ("Header", MPRAPI_OBJECT_HEADER),
        ("setConfigForProtocols", wintypes.DWORD),
        ("ConfigParams", MPRAPI_TUNNEL_CONFIG_PARAMS0),
    ]
#[repr(C)]
pub struct MPRAPI_OBJECT_HEADER {
    pub revision: u8,
    pub type: u8,
    pub size: u16,
}

#[repr(C)]
pub struct CRYPT_INTEGER_BLOB {
    pub cbData: u32,
    pub pbData: *mut core::ffi::c_void,
}

#[repr(C)]
pub struct IKEV2_TUNNEL_CONFIG_PARAMS4 {
    pub dwIdleTimeout: u32,
    pub dwNetworkBlackoutTime: u32,
    pub dwSaLifeTime: u32,
    pub dwSaDataSizeForRenegotiation: u32,
    pub dwConfigOptions: u32,
    pub dwTotalCertificates: u32,
    pub certificateNames: *mut core::ffi::c_void,
    pub machineCertificateName: CRYPT_INTEGER_BLOB,
    pub dwEncryptionType: u32,
    pub customPolicy: *mut core::ffi::c_void,
    pub dwTotalEkus: u32,
    pub certificateEKUs: *mut core::ffi::c_void,
    pub machineCertificateHash: CRYPT_INTEGER_BLOB,
    pub dwMmSaLifeTime: u32,
}

#[repr(C)]
pub struct IKEV2_CONFIG_PARAMS {
    pub dwNumPorts: u32,
    pub dwPortFlags: u32,
    pub dwTunnelConfigParamFlags: u32,
    pub TunnelConfigParams: IKEV2_TUNNEL_CONFIG_PARAMS4,
}

#[repr(C)]
pub struct PPTP_CONFIG_PARAMS {
    pub dwNumPorts: u32,
    pub dwPortFlags: u32,
}

#[repr(C)]
pub struct L2TP_TUNNEL_CONFIG_PARAMS2 {
    pub dwIdleTimeout: u32,
    pub dwEncryptionType: u32,
    pub dwSaLifeTime: u32,
    pub dwSaDataSizeForRenegotiation: u32,
    pub customPolicy: *mut core::ffi::c_void,
    pub dwMmSaLifeTime: u32,
}

#[repr(C)]
pub struct L2TP_CONFIG_PARAMS1 {
    pub dwNumPorts: u32,
    pub dwPortFlags: u32,
    pub dwTunnelConfigParamFlags: u32,
    pub TunnelConfigParams: L2TP_TUNNEL_CONFIG_PARAMS2,
}

#[repr(C)]
pub struct SSTP_CERT_INFO {
    pub isDefault: i32,
    pub certBlob: CRYPT_INTEGER_BLOB,
}

#[repr(C)]
pub struct SSTP_CONFIG_PARAMS {
    pub dwNumPorts: u32,
    pub dwPortFlags: u32,
    pub isUseHttps: i32,
    pub certAlgorithm: u32,
    pub sstpCertDetails: SSTP_CERT_INFO,
}

#[repr(C)]
pub struct MPRAPI_TUNNEL_CONFIG_PARAMS0 {
    pub IkeConfigParams: IKEV2_CONFIG_PARAMS,
    pub PptpConfigParams: PPTP_CONFIG_PARAMS,
    pub L2tpConfigParams: L2TP_CONFIG_PARAMS1,
    pub SstpConfigParams: SSTP_CONFIG_PARAMS,
}

#[repr(C)]
pub struct MPR_SERVER_SET_CONFIG_EX0 {
    pub Header: MPRAPI_OBJECT_HEADER,
    pub setConfigForProtocols: u32,
    pub ConfigParams: MPRAPI_TUNNEL_CONFIG_PARAMS0,
}
import "golang.org/x/sys/windows"

type MPRAPI_OBJECT_HEADER struct {
	revision byte
	type byte
	size uint16
}

type CRYPT_INTEGER_BLOB struct {
	cbData uint32
	pbData uintptr
}

type IKEV2_TUNNEL_CONFIG_PARAMS4 struct {
	dwIdleTimeout uint32
	dwNetworkBlackoutTime uint32
	dwSaLifeTime uint32
	dwSaDataSizeForRenegotiation uint32
	dwConfigOptions uint32
	dwTotalCertificates uint32
	certificateNames uintptr
	machineCertificateName CRYPT_INTEGER_BLOB
	dwEncryptionType uint32
	customPolicy uintptr
	dwTotalEkus uint32
	certificateEKUs uintptr
	machineCertificateHash CRYPT_INTEGER_BLOB
	dwMmSaLifeTime uint32
}

type IKEV2_CONFIG_PARAMS struct {
	dwNumPorts uint32
	dwPortFlags uint32
	dwTunnelConfigParamFlags uint32
	TunnelConfigParams IKEV2_TUNNEL_CONFIG_PARAMS4
}

type PPTP_CONFIG_PARAMS struct {
	dwNumPorts uint32
	dwPortFlags uint32
}

type L2TP_TUNNEL_CONFIG_PARAMS2 struct {
	dwIdleTimeout uint32
	dwEncryptionType uint32
	dwSaLifeTime uint32
	dwSaDataSizeForRenegotiation uint32
	customPolicy uintptr
	dwMmSaLifeTime uint32
}

type L2TP_CONFIG_PARAMS1 struct {
	dwNumPorts uint32
	dwPortFlags uint32
	dwTunnelConfigParamFlags uint32
	TunnelConfigParams L2TP_TUNNEL_CONFIG_PARAMS2
}

type SSTP_CERT_INFO struct {
	isDefault int32
	certBlob CRYPT_INTEGER_BLOB
}

type SSTP_CONFIG_PARAMS struct {
	dwNumPorts uint32
	dwPortFlags uint32
	isUseHttps int32
	certAlgorithm uint32
	sstpCertDetails SSTP_CERT_INFO
}

type MPRAPI_TUNNEL_CONFIG_PARAMS0 struct {
	IkeConfigParams IKEV2_CONFIG_PARAMS
	PptpConfigParams PPTP_CONFIG_PARAMS
	L2tpConfigParams L2TP_CONFIG_PARAMS1
	SstpConfigParams SSTP_CONFIG_PARAMS
}

type MPR_SERVER_SET_CONFIG_EX0 struct {
	Header MPRAPI_OBJECT_HEADER
	setConfigForProtocols uint32
	ConfigParams MPRAPI_TUNNEL_CONFIG_PARAMS0
}
type
  MPRAPI_OBJECT_HEADER = record
    revision: Byte;
    type: Byte;
    size: Word;
  end;

  CRYPT_INTEGER_BLOB = record
    cbData: DWORD;
    pbData: Pointer;
  end;

  IKEV2_TUNNEL_CONFIG_PARAMS4 = record
    dwIdleTimeout: DWORD;
    dwNetworkBlackoutTime: DWORD;
    dwSaLifeTime: DWORD;
    dwSaDataSizeForRenegotiation: DWORD;
    dwConfigOptions: DWORD;
    dwTotalCertificates: DWORD;
    certificateNames: Pointer;
    machineCertificateName: CRYPT_INTEGER_BLOB;
    dwEncryptionType: DWORD;
    customPolicy: Pointer;
    dwTotalEkus: DWORD;
    certificateEKUs: Pointer;
    machineCertificateHash: CRYPT_INTEGER_BLOB;
    dwMmSaLifeTime: DWORD;
  end;

  IKEV2_CONFIG_PARAMS = record
    dwNumPorts: DWORD;
    dwPortFlags: DWORD;
    dwTunnelConfigParamFlags: DWORD;
    TunnelConfigParams: IKEV2_TUNNEL_CONFIG_PARAMS4;
  end;

  PPTP_CONFIG_PARAMS = record
    dwNumPorts: DWORD;
    dwPortFlags: DWORD;
  end;

  L2TP_TUNNEL_CONFIG_PARAMS2 = record
    dwIdleTimeout: DWORD;
    dwEncryptionType: DWORD;
    dwSaLifeTime: DWORD;
    dwSaDataSizeForRenegotiation: DWORD;
    customPolicy: Pointer;
    dwMmSaLifeTime: DWORD;
  end;

  L2TP_CONFIG_PARAMS1 = record
    dwNumPorts: DWORD;
    dwPortFlags: DWORD;
    dwTunnelConfigParamFlags: DWORD;
    TunnelConfigParams: L2TP_TUNNEL_CONFIG_PARAMS2;
  end;

  SSTP_CERT_INFO = record
    isDefault: BOOL;
    certBlob: CRYPT_INTEGER_BLOB;
  end;

  SSTP_CONFIG_PARAMS = record
    dwNumPorts: DWORD;
    dwPortFlags: DWORD;
    isUseHttps: BOOL;
    certAlgorithm: DWORD;
    sstpCertDetails: SSTP_CERT_INFO;
  end;

  MPRAPI_TUNNEL_CONFIG_PARAMS0 = record
    IkeConfigParams: IKEV2_CONFIG_PARAMS;
    PptpConfigParams: PPTP_CONFIG_PARAMS;
    L2tpConfigParams: L2TP_CONFIG_PARAMS1;
    SstpConfigParams: SSTP_CONFIG_PARAMS;
  end;

  MPR_SERVER_SET_CONFIG_EX0 = record
    Header: MPRAPI_OBJECT_HEADER;
    setConfigForProtocols: DWORD;
    ConfigParams: MPRAPI_TUNNEL_CONFIG_PARAMS0;
  end;
const MPRAPI_OBJECT_HEADER = extern struct {
    revision: u8,
    type: u8,
    size: u16,
};

const CRYPT_INTEGER_BLOB = extern struct {
    cbData: u32,
    pbData: ?*anyopaque,
};

const IKEV2_TUNNEL_CONFIG_PARAMS4 = extern struct {
    dwIdleTimeout: u32,
    dwNetworkBlackoutTime: u32,
    dwSaLifeTime: u32,
    dwSaDataSizeForRenegotiation: u32,
    dwConfigOptions: u32,
    dwTotalCertificates: u32,
    certificateNames: ?*anyopaque,
    machineCertificateName: CRYPT_INTEGER_BLOB,
    dwEncryptionType: u32,
    customPolicy: ?*anyopaque,
    dwTotalEkus: u32,
    certificateEKUs: ?*anyopaque,
    machineCertificateHash: CRYPT_INTEGER_BLOB,
    dwMmSaLifeTime: u32,
};

const IKEV2_CONFIG_PARAMS = extern struct {
    dwNumPorts: u32,
    dwPortFlags: u32,
    dwTunnelConfigParamFlags: u32,
    TunnelConfigParams: IKEV2_TUNNEL_CONFIG_PARAMS4,
};

const PPTP_CONFIG_PARAMS = extern struct {
    dwNumPorts: u32,
    dwPortFlags: u32,
};

const L2TP_TUNNEL_CONFIG_PARAMS2 = extern struct {
    dwIdleTimeout: u32,
    dwEncryptionType: u32,
    dwSaLifeTime: u32,
    dwSaDataSizeForRenegotiation: u32,
    customPolicy: ?*anyopaque,
    dwMmSaLifeTime: u32,
};

const L2TP_CONFIG_PARAMS1 = extern struct {
    dwNumPorts: u32,
    dwPortFlags: u32,
    dwTunnelConfigParamFlags: u32,
    TunnelConfigParams: L2TP_TUNNEL_CONFIG_PARAMS2,
};

const SSTP_CERT_INFO = extern struct {
    isDefault: i32,
    certBlob: CRYPT_INTEGER_BLOB,
};

const SSTP_CONFIG_PARAMS = extern struct {
    dwNumPorts: u32,
    dwPortFlags: u32,
    isUseHttps: i32,
    certAlgorithm: u32,
    sstpCertDetails: SSTP_CERT_INFO,
};

const MPRAPI_TUNNEL_CONFIG_PARAMS0 = extern struct {
    IkeConfigParams: IKEV2_CONFIG_PARAMS,
    PptpConfigParams: PPTP_CONFIG_PARAMS,
    L2tpConfigParams: L2TP_CONFIG_PARAMS1,
    SstpConfigParams: SSTP_CONFIG_PARAMS,
};

const MPR_SERVER_SET_CONFIG_EX0 = extern struct {
    Header: MPRAPI_OBJECT_HEADER,
    setConfigForProtocols: u32,
    ConfigParams: MPRAPI_TUNNEL_CONFIG_PARAMS0,
};
type
  MPRAPI_OBJECT_HEADER {.bycopy.} = object
    revision: uint8
    type: uint8
    size: uint16

  CRYPT_INTEGER_BLOB {.bycopy.} = object
    cbData: uint32
    pbData: pointer

  IKEV2_TUNNEL_CONFIG_PARAMS4 {.bycopy.} = object
    dwIdleTimeout: uint32
    dwNetworkBlackoutTime: uint32
    dwSaLifeTime: uint32
    dwSaDataSizeForRenegotiation: uint32
    dwConfigOptions: uint32
    dwTotalCertificates: uint32
    certificateNames: pointer
    machineCertificateName: CRYPT_INTEGER_BLOB
    dwEncryptionType: uint32
    customPolicy: pointer
    dwTotalEkus: uint32
    certificateEKUs: pointer
    machineCertificateHash: CRYPT_INTEGER_BLOB
    dwMmSaLifeTime: uint32

  IKEV2_CONFIG_PARAMS {.bycopy.} = object
    dwNumPorts: uint32
    dwPortFlags: uint32
    dwTunnelConfigParamFlags: uint32
    TunnelConfigParams: IKEV2_TUNNEL_CONFIG_PARAMS4

  PPTP_CONFIG_PARAMS {.bycopy.} = object
    dwNumPorts: uint32
    dwPortFlags: uint32

  L2TP_TUNNEL_CONFIG_PARAMS2 {.bycopy.} = object
    dwIdleTimeout: uint32
    dwEncryptionType: uint32
    dwSaLifeTime: uint32
    dwSaDataSizeForRenegotiation: uint32
    customPolicy: pointer
    dwMmSaLifeTime: uint32

  L2TP_CONFIG_PARAMS1 {.bycopy.} = object
    dwNumPorts: uint32
    dwPortFlags: uint32
    dwTunnelConfigParamFlags: uint32
    TunnelConfigParams: L2TP_TUNNEL_CONFIG_PARAMS2

  SSTP_CERT_INFO {.bycopy.} = object
    isDefault: int32
    certBlob: CRYPT_INTEGER_BLOB

  SSTP_CONFIG_PARAMS {.bycopy.} = object
    dwNumPorts: uint32
    dwPortFlags: uint32
    isUseHttps: int32
    certAlgorithm: uint32
    sstpCertDetails: SSTP_CERT_INFO

  MPRAPI_TUNNEL_CONFIG_PARAMS0 {.bycopy.} = object
    IkeConfigParams: IKEV2_CONFIG_PARAMS
    PptpConfigParams: PPTP_CONFIG_PARAMS
    L2tpConfigParams: L2TP_CONFIG_PARAMS1
    SstpConfigParams: SSTP_CONFIG_PARAMS

  MPR_SERVER_SET_CONFIG_EX0 {.bycopy.} = object
    Header: MPRAPI_OBJECT_HEADER
    setConfigForProtocols: uint32
    ConfigParams: MPRAPI_TUNNEL_CONFIG_PARAMS0
struct MPRAPI_OBJECT_HEADER
{
    ubyte revision;
    ubyte type;
    ushort size;
}

struct CRYPT_INTEGER_BLOB
{
    uint cbData;
    void* pbData;
}

struct IKEV2_TUNNEL_CONFIG_PARAMS4
{
    uint dwIdleTimeout;
    uint dwNetworkBlackoutTime;
    uint dwSaLifeTime;
    uint dwSaDataSizeForRenegotiation;
    uint dwConfigOptions;
    uint dwTotalCertificates;
    void* certificateNames;
    CRYPT_INTEGER_BLOB machineCertificateName;
    uint dwEncryptionType;
    void* customPolicy;
    uint dwTotalEkus;
    void* certificateEKUs;
    CRYPT_INTEGER_BLOB machineCertificateHash;
    uint dwMmSaLifeTime;
}

struct IKEV2_CONFIG_PARAMS
{
    uint dwNumPorts;
    uint dwPortFlags;
    uint dwTunnelConfigParamFlags;
    IKEV2_TUNNEL_CONFIG_PARAMS4 TunnelConfigParams;
}

struct PPTP_CONFIG_PARAMS
{
    uint dwNumPorts;
    uint dwPortFlags;
}

struct L2TP_TUNNEL_CONFIG_PARAMS2
{
    uint dwIdleTimeout;
    uint dwEncryptionType;
    uint dwSaLifeTime;
    uint dwSaDataSizeForRenegotiation;
    void* customPolicy;
    uint dwMmSaLifeTime;
}

struct L2TP_CONFIG_PARAMS1
{
    uint dwNumPorts;
    uint dwPortFlags;
    uint dwTunnelConfigParamFlags;
    L2TP_TUNNEL_CONFIG_PARAMS2 TunnelConfigParams;
}

struct SSTP_CERT_INFO
{
    int isDefault;
    CRYPT_INTEGER_BLOB certBlob;
}

struct SSTP_CONFIG_PARAMS
{
    uint dwNumPorts;
    uint dwPortFlags;
    int isUseHttps;
    uint certAlgorithm;
    SSTP_CERT_INFO sstpCertDetails;
}

struct MPRAPI_TUNNEL_CONFIG_PARAMS0
{
    IKEV2_CONFIG_PARAMS IkeConfigParams;
    PPTP_CONFIG_PARAMS PptpConfigParams;
    L2TP_CONFIG_PARAMS1 L2tpConfigParams;
    SSTP_CONFIG_PARAMS SstpConfigParams;
}

struct MPR_SERVER_SET_CONFIG_EX0
{
    MPRAPI_OBJECT_HEADER Header;
    uint setConfigForProtocols;
    MPRAPI_TUNNEL_CONFIG_PARAMS0 ConfigParams;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; MPR_SERVER_SET_CONFIG_EX0 サイズ: 156 バイト(x86)
dim st, 39    ; 4byte整数×39(構造体サイズ 156 / 4 切り上げ)
; Header : MPRAPI_OBJECT_HEADER (+0, 4byte)  varptr(st)+0 を基点に操作(4byte:入れ子/配列)
; setConfigForProtocols : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; ConfigParams : MPRAPI_TUNNEL_CONFIG_PARAMS0 (+8, 148byte)  varptr(st)+8 を基点に操作(148byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MPR_SERVER_SET_CONFIG_EX0 サイズ: 224 バイト(x64)
dim st, 56    ; 4byte整数×56(構造体サイズ 224 / 4 切り上げ)
; Header : MPRAPI_OBJECT_HEADER (+0, 4byte)  varptr(st)+0 を基点に操作(4byte:入れ子/配列)
; setConfigForProtocols : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; ConfigParams : MPRAPI_TUNNEL_CONFIG_PARAMS0 (+8, 216byte)  varptr(st)+8 を基点に操作(216byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global MPRAPI_OBJECT_HEADER
    #field byte revision
    #field byte type
    #field short size
#endstruct

#defstruct global CRYPT_INTEGER_BLOB
    #field int cbData
    #field intptr pbData
#endstruct

#defstruct global IKEV2_TUNNEL_CONFIG_PARAMS4
    #field int dwIdleTimeout
    #field int dwNetworkBlackoutTime
    #field int dwSaLifeTime
    #field int dwSaDataSizeForRenegotiation
    #field int dwConfigOptions
    #field int dwTotalCertificates
    #field intptr certificateNames
    #field CRYPT_INTEGER_BLOB machineCertificateName
    #field int dwEncryptionType
    #field intptr customPolicy
    #field int dwTotalEkus
    #field intptr certificateEKUs
    #field CRYPT_INTEGER_BLOB machineCertificateHash
    #field int dwMmSaLifeTime
#endstruct

#defstruct global IKEV2_CONFIG_PARAMS
    #field int dwNumPorts
    #field int dwPortFlags
    #field int dwTunnelConfigParamFlags
    #field IKEV2_TUNNEL_CONFIG_PARAMS4 TunnelConfigParams
#endstruct

#defstruct global PPTP_CONFIG_PARAMS
    #field int dwNumPorts
    #field int dwPortFlags
#endstruct

#defstruct global L2TP_TUNNEL_CONFIG_PARAMS2
    #field int dwIdleTimeout
    #field int dwEncryptionType
    #field int dwSaLifeTime
    #field int dwSaDataSizeForRenegotiation
    #field intptr customPolicy
    #field int dwMmSaLifeTime
#endstruct

#defstruct global L2TP_CONFIG_PARAMS1
    #field int dwNumPorts
    #field int dwPortFlags
    #field int dwTunnelConfigParamFlags
    #field L2TP_TUNNEL_CONFIG_PARAMS2 TunnelConfigParams
#endstruct

#defstruct global SSTP_CERT_INFO
    #field bool isDefault
    #field CRYPT_INTEGER_BLOB certBlob
#endstruct

#defstruct global SSTP_CONFIG_PARAMS
    #field int dwNumPorts
    #field int dwPortFlags
    #field bool isUseHttps
    #field int certAlgorithm
    #field SSTP_CERT_INFO sstpCertDetails
#endstruct

#defstruct global MPRAPI_TUNNEL_CONFIG_PARAMS0
    #field IKEV2_CONFIG_PARAMS IkeConfigParams
    #field PPTP_CONFIG_PARAMS PptpConfigParams
    #field L2TP_CONFIG_PARAMS1 L2tpConfigParams
    #field SSTP_CONFIG_PARAMS SstpConfigParams
#endstruct

#defstruct global MPR_SERVER_SET_CONFIG_EX0
    #field MPRAPI_OBJECT_HEADER Header
    #field int setConfigForProtocols
    #field MPRAPI_TUNNEL_CONFIG_PARAMS0 ConfigParams
#endstruct

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