ホーム › NetworkManagement.Rras › PPP_IPCP_INFO2
PPP_IPCP_INFO2
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| dwError | DWORD | 4 | +0 | +0 | IPCP(IP制御プロトコル)のエラーコード。0なら正常。 |
| wszAddress | WCHAR | 32 | +4 | +4 | ローカルに割り当てられたIPアドレス(ワイド文字列)。 |
| wszRemoteAddress | WCHAR | 32 | +36 | +36 | リモート側のIPアドレス(ワイド文字列)。 |
| dwOptions | DWORD | 4 | +68 | +68 | ローカルのIPCPオプションフラグ(PPP_IPCP_*)。 |
| dwRemoteOptions | DWORD | 4 | +72 | +72 | リモートのIPCPオプションフラグ。 |
各言語での定義
#include <windows.h>
// 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;using System;
using System.Runtime.InteropServices;
[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;
}Imports System.Runtime.InteropServices
<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 Structureimport ctypes
from ctypes import wintypes
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),
]#[repr(C)]
pub struct PPP_IPCP_INFO2 {
pub dwError: u32,
pub wszAddress: [u16; 16],
pub wszRemoteAddress: [u16; 16],
pub dwOptions: u32,
pub dwRemoteOptions: u32,
}import "golang.org/x/sys/windows"
type PPP_IPCP_INFO2 struct {
dwError uint32
wszAddress [16]uint16
wszRemoteAddress [16]uint16
dwOptions uint32
dwRemoteOptions uint32
}type
PPP_IPCP_INFO2 = record
dwError: DWORD;
wszAddress: array[0..15] of WideChar;
wszRemoteAddress: array[0..15] of WideChar;
dwOptions: DWORD;
dwRemoteOptions: DWORD;
end;const PPP_IPCP_INFO2 = extern struct {
dwError: u32,
wszAddress: [16]u16,
wszRemoteAddress: [16]u16,
dwOptions: u32,
dwRemoteOptions: u32,
};type
PPP_IPCP_INFO2 {.bycopy.} = object
dwError: uint32
wszAddress: array[16, uint16]
wszRemoteAddress: array[16, uint16]
dwOptions: uint32
dwRemoteOptions: uint32struct PPP_IPCP_INFO2
{
uint dwError;
wchar[16] wszAddress;
wchar[16] wszRemoteAddress;
uint dwOptions;
uint dwRemoteOptions;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; PPP_IPCP_INFO2 サイズ: 76 バイト(x64)
dim st, 19 ; 4byte整数×19(構造体サイズ 76 / 4 切り上げ)
; dwError : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; wszAddress : WCHAR (+4, 32byte) varptr(st)+4 を基点に操作(32byte:入れ子/配列)
; wszRemoteAddress : WCHAR (+36, 32byte) varptr(st)+36 を基点に操作(32byte:入れ子/配列)
; dwOptions : DWORD (+68, 4byte) st.17 = 値 / 値 = st.17 (lpoke/lpeek も可)
; dwRemoteOptions : DWORD (+72, 4byte) st.18 = 値 / 値 = st.18 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global PPP_IPCP_INFO2
#field int dwError
#field wchar wszAddress 16
#field wchar wszRemoteAddress 16
#field int dwOptions
#field int dwRemoteOptions
#endstruct
stdim st, PPP_IPCP_INFO2 ; NSTRUCT 変数を確保
st->dwError = 100
mes "dwError=" + st->dwError