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

PPP_INFO

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

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

フィールド

フィールドサイズx64x86説明
nbfPPP_NBFCP_INFO40+0+0NetBEUI(NBFCP)に関するPPP制御情報。
ipPPP_IPCP_INFO68+40+40IP(IPCP)に関するPPP制御情報。
ipxPPP_IPXCP_INFO52+108+108IPX(IPXCP)に関するPPP制御情報。
atPPP_ATCP_INFO72+160+160AppleTalk(ATCP)に関するPPP制御情報。

各言語での定義

#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_INFO  (x64 68 / x86 68 バイト)
typedef struct PPP_IPCP_INFO {
    DWORD dwError;
    WCHAR wszAddress[16];
    WCHAR wszRemoteAddress[16];
} PPP_IPCP_INFO;

// PPP_IPXCP_INFO  (x64 52 / x86 52 バイト)
typedef struct PPP_IPXCP_INFO {
    DWORD dwError;
    WCHAR wszAddress[23];
} PPP_IPXCP_INFO;

// PPP_ATCP_INFO  (x64 72 / x86 72 バイト)
typedef struct PPP_ATCP_INFO {
    DWORD dwError;
    WCHAR wszAddress[33];
} PPP_ATCP_INFO;

// PPP_INFO  (x64 232 / x86 232 バイト)
typedef struct PPP_INFO {
    PPP_NBFCP_INFO nbf;
    PPP_IPCP_INFO ip;
    PPP_IPXCP_INFO ipx;
    PPP_ATCP_INFO at;
} PPP_INFO;
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_INFO
{
    public uint dwError;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)] public string wszAddress;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)] public string wszRemoteAddress;
}

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

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

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PPP_INFO
{
    public PPP_NBFCP_INFO nbf;
    public PPP_IPCP_INFO ip;
    public PPP_IPXCP_INFO ipx;
    public PPP_ATCP_INFO at;
}
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_INFO
    Public dwError As UInteger
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=16)> Public wszAddress As String
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=16)> Public wszRemoteAddress As String
End Structure

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

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

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PPP_INFO
    Public nbf As PPP_NBFCP_INFO
    Public ip As PPP_IPCP_INFO
    Public ipx As PPP_IPXCP_INFO
    Public at As PPP_ATCP_INFO
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_INFO(ctypes.Structure):
    _fields_ = [
        ("dwError", wintypes.DWORD),
        ("wszAddress", ctypes.c_wchar * 16),
        ("wszRemoteAddress", ctypes.c_wchar * 16),
    ]

class PPP_IPXCP_INFO(ctypes.Structure):
    _fields_ = [
        ("dwError", wintypes.DWORD),
        ("wszAddress", ctypes.c_wchar * 23),
    ]

class PPP_ATCP_INFO(ctypes.Structure):
    _fields_ = [
        ("dwError", wintypes.DWORD),
        ("wszAddress", ctypes.c_wchar * 33),
    ]

class PPP_INFO(ctypes.Structure):
    _fields_ = [
        ("nbf", PPP_NBFCP_INFO),
        ("ip", PPP_IPCP_INFO),
        ("ipx", PPP_IPXCP_INFO),
        ("at", PPP_ATCP_INFO),
    ]
#[repr(C)]
pub struct PPP_NBFCP_INFO {
    pub dwError: u32,
    pub wszWksta: [u16; 17],
}

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

#[repr(C)]
pub struct PPP_IPXCP_INFO {
    pub dwError: u32,
    pub wszAddress: [u16; 23],
}

#[repr(C)]
pub struct PPP_ATCP_INFO {
    pub dwError: u32,
    pub wszAddress: [u16; 33],
}

#[repr(C)]
pub struct PPP_INFO {
    pub nbf: PPP_NBFCP_INFO,
    pub ip: PPP_IPCP_INFO,
    pub ipx: PPP_IPXCP_INFO,
    pub at: PPP_ATCP_INFO,
}
import "golang.org/x/sys/windows"

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

type PPP_IPCP_INFO struct {
	dwError uint32
	wszAddress [16]uint16
	wszRemoteAddress [16]uint16
}

type PPP_IPXCP_INFO struct {
	dwError uint32
	wszAddress [23]uint16
}

type PPP_ATCP_INFO struct {
	dwError uint32
	wszAddress [33]uint16
}

type PPP_INFO struct {
	nbf PPP_NBFCP_INFO
	ip PPP_IPCP_INFO
	ipx PPP_IPXCP_INFO
	at PPP_ATCP_INFO
}
type
  PPP_NBFCP_INFO = record
    dwError: DWORD;
    wszWksta: array[0..16] of WideChar;
  end;

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

  PPP_IPXCP_INFO = record
    dwError: DWORD;
    wszAddress: array[0..22] of WideChar;
  end;

  PPP_ATCP_INFO = record
    dwError: DWORD;
    wszAddress: array[0..32] of WideChar;
  end;

  PPP_INFO = record
    nbf: PPP_NBFCP_INFO;
    ip: PPP_IPCP_INFO;
    ipx: PPP_IPXCP_INFO;
    at: PPP_ATCP_INFO;
  end;
const PPP_NBFCP_INFO = extern struct {
    dwError: u32,
    wszWksta: [17]u16,
};

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

const PPP_IPXCP_INFO = extern struct {
    dwError: u32,
    wszAddress: [23]u16,
};

const PPP_ATCP_INFO = extern struct {
    dwError: u32,
    wszAddress: [33]u16,
};

const PPP_INFO = extern struct {
    nbf: PPP_NBFCP_INFO,
    ip: PPP_IPCP_INFO,
    ipx: PPP_IPXCP_INFO,
    at: PPP_ATCP_INFO,
};
type
  PPP_NBFCP_INFO {.bycopy.} = object
    dwError: uint32
    wszWksta: array[17, uint16]

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

  PPP_IPXCP_INFO {.bycopy.} = object
    dwError: uint32
    wszAddress: array[23, uint16]

  PPP_ATCP_INFO {.bycopy.} = object
    dwError: uint32
    wszAddress: array[33, uint16]

  PPP_INFO {.bycopy.} = object
    nbf: PPP_NBFCP_INFO
    ip: PPP_IPCP_INFO
    ipx: PPP_IPXCP_INFO
    at: PPP_ATCP_INFO
struct PPP_NBFCP_INFO
{
    uint dwError;
    wchar[17] wszWksta;
}

struct PPP_IPCP_INFO
{
    uint dwError;
    wchar[16] wszAddress;
    wchar[16] wszRemoteAddress;
}

struct PPP_IPXCP_INFO
{
    uint dwError;
    wchar[23] wszAddress;
}

struct PPP_ATCP_INFO
{
    uint dwError;
    wchar[33] wszAddress;
}

struct PPP_INFO
{
    PPP_NBFCP_INFO nbf;
    PPP_IPCP_INFO ip;
    PPP_IPXCP_INFO ipx;
    PPP_ATCP_INFO at;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; PPP_INFO サイズ: 232 バイト(x64)
dim st, 58    ; 4byte整数×58(構造体サイズ 232 / 4 切り上げ)
; nbf : PPP_NBFCP_INFO (+0, 40byte)  varptr(st)+0 を基点に操作(40byte:入れ子/配列)
; ip : PPP_IPCP_INFO (+40, 68byte)  varptr(st)+40 を基点に操作(68byte:入れ子/配列)
; ipx : PPP_IPXCP_INFO (+108, 52byte)  varptr(st)+108 を基点に操作(52byte:入れ子/配列)
; at : PPP_ATCP_INFO (+160, 72byte)  varptr(st)+160 を基点に操作(72byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global PPP_NBFCP_INFO
    #field int dwError
    #field wchar wszWksta 17
#endstruct

#defstruct global PPP_IPCP_INFO
    #field int dwError
    #field wchar wszAddress 16
    #field wchar wszRemoteAddress 16
#endstruct

#defstruct global PPP_IPXCP_INFO
    #field int dwError
    #field wchar wszAddress 23
#endstruct

#defstruct global PPP_ATCP_INFO
    #field int dwError
    #field wchar wszAddress 33
#endstruct

#defstruct global PPP_INFO
    #field PPP_NBFCP_INFO nbf
    #field PPP_IPCP_INFO ip
    #field PPP_IPXCP_INFO ipx
    #field PPP_ATCP_INFO at
#endstruct

stdim st, PPP_INFO        ; NSTRUCT 変数を確保