ホーム › NetworkManagement.Rras › MPR_INTERFACE_0
MPR_INTERFACE_0
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| wszInterfaceName | WCHAR | 514 | +0 | +0 | ルーターインターフェイスの名前(ワイド文字列)。 |
| hInterface | HANDLE | 8/4 | +520 | +516 | インターフェイスを識別するハンドル。 |
| fEnabled | BOOL | 4 | +528 | +520 | TRUEならインターフェイスが有効であることを示す。 |
| dwIfType | ROUTER_INTERFACE_TYPE | 4 | +532 | +524 | インターフェイスの種別を表すROUTER_INTERFACE_TYPE列挙値。 |
| dwConnectionState | ROUTER_CONNECTION_STATE | 4 | +536 | +528 | 接続状態を表すROUTER_CONNECTION_STATE列挙値。 |
| fUnReachabilityReasons | DWORD | 4 | +540 | +532 | 到達不能の理由を示すフラグ(MPR_INTERFACE_*)。 |
| dwLastError | DWORD | 4 | +544 | +536 | インターフェイスで最後に発生したエラーコード。 |
各言語での定義
#include <windows.h>
// MPR_INTERFACE_0 (x64 552 / x86 540 バイト)
typedef struct MPR_INTERFACE_0 {
WCHAR wszInterfaceName[257];
HANDLE hInterface;
BOOL fEnabled;
ROUTER_INTERFACE_TYPE dwIfType;
ROUTER_CONNECTION_STATE dwConnectionState;
DWORD fUnReachabilityReasons;
DWORD dwLastError;
} MPR_INTERFACE_0;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MPR_INTERFACE_0
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 257)] public string wszInterfaceName;
public IntPtr hInterface;
[MarshalAs(UnmanagedType.Bool)] public bool fEnabled;
public int dwIfType;
public int dwConnectionState;
public uint fUnReachabilityReasons;
public uint dwLastError;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MPR_INTERFACE_0
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=257)> Public wszInterfaceName As String
Public hInterface As IntPtr
<MarshalAs(UnmanagedType.Bool)> Public fEnabled As Boolean
Public dwIfType As Integer
Public dwConnectionState As Integer
Public fUnReachabilityReasons As UInteger
Public dwLastError As UInteger
End Structureimport ctypes
from ctypes import wintypes
class MPR_INTERFACE_0(ctypes.Structure):
_fields_ = [
("wszInterfaceName", ctypes.c_wchar * 257),
("hInterface", ctypes.c_void_p),
("fEnabled", wintypes.BOOL),
("dwIfType", ctypes.c_int),
("dwConnectionState", ctypes.c_int),
("fUnReachabilityReasons", wintypes.DWORD),
("dwLastError", wintypes.DWORD),
]#[repr(C)]
pub struct MPR_INTERFACE_0 {
pub wszInterfaceName: [u16; 257],
pub hInterface: *mut core::ffi::c_void,
pub fEnabled: i32,
pub dwIfType: i32,
pub dwConnectionState: i32,
pub fUnReachabilityReasons: u32,
pub dwLastError: u32,
}import "golang.org/x/sys/windows"
type MPR_INTERFACE_0 struct {
wszInterfaceName [257]uint16
hInterface uintptr
fEnabled int32
dwIfType int32
dwConnectionState int32
fUnReachabilityReasons uint32
dwLastError uint32
}type
MPR_INTERFACE_0 = record
wszInterfaceName: array[0..256] of WideChar;
hInterface: Pointer;
fEnabled: BOOL;
dwIfType: Integer;
dwConnectionState: Integer;
fUnReachabilityReasons: DWORD;
dwLastError: DWORD;
end;const MPR_INTERFACE_0 = extern struct {
wszInterfaceName: [257]u16,
hInterface: ?*anyopaque,
fEnabled: i32,
dwIfType: i32,
dwConnectionState: i32,
fUnReachabilityReasons: u32,
dwLastError: u32,
};type
MPR_INTERFACE_0 {.bycopy.} = object
wszInterfaceName: array[257, uint16]
hInterface: pointer
fEnabled: int32
dwIfType: int32
dwConnectionState: int32
fUnReachabilityReasons: uint32
dwLastError: uint32struct MPR_INTERFACE_0
{
wchar[257] wszInterfaceName;
void* hInterface;
int fEnabled;
int dwIfType;
int dwConnectionState;
uint fUnReachabilityReasons;
uint dwLastError;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; MPR_INTERFACE_0 サイズ: 540 バイト(x86)
dim st, 135 ; 4byte整数×135(構造体サイズ 540 / 4 切り上げ)
; wszInterfaceName : WCHAR (+0, 514byte) varptr(st)+0 を基点に操作(514byte:入れ子/配列)
; hInterface : HANDLE (+516, 4byte) st.129 = 値 / 値 = st.129 (lpoke/lpeek も可)
; fEnabled : BOOL (+520, 4byte) st.130 = 値 / 値 = st.130 (lpoke/lpeek も可)
; dwIfType : ROUTER_INTERFACE_TYPE (+524, 4byte) st.131 = 値 / 値 = st.131 (lpoke/lpeek も可)
; dwConnectionState : ROUTER_CONNECTION_STATE (+528, 4byte) st.132 = 値 / 値 = st.132 (lpoke/lpeek も可)
; fUnReachabilityReasons : DWORD (+532, 4byte) st.133 = 値 / 値 = st.133 (lpoke/lpeek も可)
; dwLastError : DWORD (+536, 4byte) st.134 = 値 / 値 = st.134 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MPR_INTERFACE_0 サイズ: 552 バイト(x64)
dim st, 138 ; 4byte整数×138(構造体サイズ 552 / 4 切り上げ)
; wszInterfaceName : WCHAR (+0, 514byte) varptr(st)+0 を基点に操作(514byte:入れ子/配列)
; hInterface : HANDLE (+520, 8byte) qpoke st,520,値 / qpeek(st,520) ※IronHSPのみ。3.7/3.8は lpoke st,520,下位 : lpoke st,524,上位
; fEnabled : BOOL (+528, 4byte) st.132 = 値 / 値 = st.132 (lpoke/lpeek も可)
; dwIfType : ROUTER_INTERFACE_TYPE (+532, 4byte) st.133 = 値 / 値 = st.133 (lpoke/lpeek も可)
; dwConnectionState : ROUTER_CONNECTION_STATE (+536, 4byte) st.134 = 値 / 値 = st.134 (lpoke/lpeek も可)
; fUnReachabilityReasons : DWORD (+540, 4byte) st.135 = 値 / 値 = st.135 (lpoke/lpeek も可)
; dwLastError : DWORD (+544, 4byte) st.136 = 値 / 値 = st.136 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global MPR_INTERFACE_0
#field wchar wszInterfaceName 257
#field intptr hInterface
#field bool fEnabled
#field int dwIfType
#field int dwConnectionState
#field int fUnReachabilityReasons
#field int dwLastError
#endstruct
stdim st, MPR_INTERFACE_0 ; NSTRUCT 変数を確保
st->fEnabled = 100
mes "fEnabled=" + st->fEnabled