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

MPR_SERVER_1

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

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

フィールド

フィールドサイズx64x86説明
dwNumPptpPortsDWORD4+0+0

デバイス上で PPTP 用に構成されているポート数を指定します。 dwNumPptpPorts の最大値は次の表のとおりです。値 0 は指定できません。

最大値 Windows のバージョン
1
Windows Server 2003, Web Edition
1000
Windows Server 2003, Standard Edition
16,384
Windows Server 2003, Datacenter Edition および Windows Server 2003, Enterprise Edition

サービス開始時にレジストリで構成された上限を超える値が dwNumPptpPorts に格納されている場合 (既定値は Windows Server 2003, Standard Edition および Windows Server 2003, Enterprise Edition では 1000)、MprConfigServerSetInfo 関数および MprAdminServerSetInfo 関数は ERROR_SUCCESS_REBOOT_REQUIRED を返します。

dwPptpPortFlagsDWORD4+4+4

デバイス上で RAS またはルーティングが有効になっているかどうかを示すビットフラグのセットです。

意味
MPR_ENABLE_RAS_ON_DEVICE
設定されている場合、デバイス上で RAS が有効です。
MPR_ENABLE_ROUTING_ON_DEVICE
設定されている場合、デバイス上でルーティングが有効です。
dwNumL2tpPortsDWORD4+8+8

デバイス上で L2TP 用に構成されているポート数を指定します。 dwNumL2tpPorts の最大値は次の表のとおりです。値 0 は指定できません。

最大値 Windows のバージョン
1
Windows Server 2003, Web Edition
1000
Windows Server 2003, Standard Edition
30,000
Windows Server 2003, Datacenter Edition および Windows Server 2003, Enterprise Edition

サービス開始時にレジストリで構成された上限を超える値が dwNumL2tpPorts に格納されている場合 (既定値は Windows Server 2003, Standard Edition および Windows Server 2003, Enterprise Edition では 1000)、MprConfigServerSetInfo 関数および MprAdminServerSetInfo 関数は ERROR_SUCCESS_REBOOT_REQUIRED を返します。

dwL2tpPortFlagsDWORD4+12+12

デバイス上で RAS またはルーティングが有効になっているかどうかを示すビットフラグのセットです。

意味
MPR_ENABLE_RAS_ON_DEVICE
設定されている場合、デバイス上で RAS が有効です。
MPR_ENABLE_ROUTING_ON_DEVICE
設定されている場合、デバイス上でルーティングが有効です。

公式ドキュメント

MPR_SERVER_1 構造体は、デバイス上で Point-to-Point Tunneling Protocol (PPTP) および Layer 2 Tunneling Protocol (L2TP) に使用できるポート数を取得および設定するために使用されます。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での定義

#include <windows.h>

// MPR_SERVER_1  (x64 16 / x86 16 バイト)
typedef struct MPR_SERVER_1 {
    DWORD dwNumPptpPorts;
    DWORD dwPptpPortFlags;
    DWORD dwNumL2tpPorts;
    DWORD dwL2tpPortFlags;
} MPR_SERVER_1;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MPR_SERVER_1
{
    public uint dwNumPptpPorts;
    public uint dwPptpPortFlags;
    public uint dwNumL2tpPorts;
    public uint dwL2tpPortFlags;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MPR_SERVER_1
    Public dwNumPptpPorts As UInteger
    Public dwPptpPortFlags As UInteger
    Public dwNumL2tpPorts As UInteger
    Public dwL2tpPortFlags As UInteger
End Structure
import ctypes
from ctypes import wintypes

class MPR_SERVER_1(ctypes.Structure):
    _fields_ = [
        ("dwNumPptpPorts", wintypes.DWORD),
        ("dwPptpPortFlags", wintypes.DWORD),
        ("dwNumL2tpPorts", wintypes.DWORD),
        ("dwL2tpPortFlags", wintypes.DWORD),
    ]
#[repr(C)]
pub struct MPR_SERVER_1 {
    pub dwNumPptpPorts: u32,
    pub dwPptpPortFlags: u32,
    pub dwNumL2tpPorts: u32,
    pub dwL2tpPortFlags: u32,
}
import "golang.org/x/sys/windows"

type MPR_SERVER_1 struct {
	dwNumPptpPorts uint32
	dwPptpPortFlags uint32
	dwNumL2tpPorts uint32
	dwL2tpPortFlags uint32
}
type
  MPR_SERVER_1 = record
    dwNumPptpPorts: DWORD;
    dwPptpPortFlags: DWORD;
    dwNumL2tpPorts: DWORD;
    dwL2tpPortFlags: DWORD;
  end;
const MPR_SERVER_1 = extern struct {
    dwNumPptpPorts: u32,
    dwPptpPortFlags: u32,
    dwNumL2tpPorts: u32,
    dwL2tpPortFlags: u32,
};
type
  MPR_SERVER_1 {.bycopy.} = object
    dwNumPptpPorts: uint32
    dwPptpPortFlags: uint32
    dwNumL2tpPorts: uint32
    dwL2tpPortFlags: uint32
struct MPR_SERVER_1
{
    uint dwNumPptpPorts;
    uint dwPptpPortFlags;
    uint dwNumL2tpPorts;
    uint dwL2tpPortFlags;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MPR_SERVER_1 サイズ: 16 バイト(x64)
dim st, 4    ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; dwNumPptpPorts : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwPptpPortFlags : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; dwNumL2tpPorts : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; dwL2tpPortFlags : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global MPR_SERVER_1
    #field int dwNumPptpPorts
    #field int dwPptpPortFlags
    #field int dwNumL2tpPorts
    #field int dwL2tpPortFlags
#endstruct

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