ホーム › NetworkManagement.Rras › RTM_DEST_INFO
RTM_DEST_INFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| DestHandle | INT_PTR | 8/4 | +0 | +0 | 宛先ネットワークを識別するハンドル。 |
| DestAddress | RTM_NET_ADDRESS | 20 | +8 | +4 | 宛先のネットワークアドレス(RTM_NET_ADDRESS)。 |
| LastChanged | FILETIME | 8 | +28 | +24 | この宛先情報が最後に変更された時刻(FILETIME)。 |
| BelongsToViews | DWORD | 4 | +36 | +32 | この宛先が属するビューを示すビットマスク。 |
| NumberOfViews | DWORD | 4 | +40 | +36 | ViewInfo配列に含まれるビュー固有情報の数。 |
| ViewInfo | _Anonymous_e__Struct | 40/24 | +48 | +40 | 各ビューにおける宛先固有情報を保持する可変長配列。 |
構造体: _Anonymous_e__Struct x64 40B / x86 24B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| ViewId | INT | 4 | +0 | +0 |
| NumRoutes | DWORD | 4 | +4 | +4 |
| Route | INT_PTR | 8/4 | +8 | +8 |
| Owner | INT_PTR | 8/4 | +16 | +12 |
| DestFlags | DWORD | 4 | +24 | +16 |
| HoldRoute | INT_PTR | 8/4 | +32 | +20 |
各言語での定義
#include <windows.h>
// RTM_NET_ADDRESS (x64 20 / x86 20 バイト)
typedef struct RTM_NET_ADDRESS {
WORD AddressFamily;
WORD NumBits;
BYTE AddrBits[16];
} RTM_NET_ADDRESS;
// FILETIME (x64 8 / x86 8 バイト)
typedef struct FILETIME {
DWORD dwLowDateTime;
DWORD dwHighDateTime;
} FILETIME;
// RTM_DEST_INFO (x64 88 / x86 64 バイト)
typedef struct RTM_DEST_INFO {
INT_PTR DestHandle;
RTM_NET_ADDRESS DestAddress;
FILETIME LastChanged;
DWORD BelongsToViews;
DWORD NumberOfViews;
_Anonymous_e__Struct ViewInfo[1];
} RTM_DEST_INFO;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct RTM_NET_ADDRESS
{
public ushort AddressFamily;
public ushort NumBits;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] AddrBits;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct FILETIME
{
public uint dwLowDateTime;
public uint dwHighDateTime;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct RTM_DEST_INFO
{
public IntPtr DestHandle;
public RTM_NET_ADDRESS DestAddress;
public FILETIME LastChanged;
public uint BelongsToViews;
public uint NumberOfViews;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public _Anonymous_e__Struct[] ViewInfo;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure RTM_NET_ADDRESS
Public AddressFamily As UShort
Public NumBits As UShort
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=16)> Public AddrBits() As Byte
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure FILETIME
Public dwLowDateTime As UInteger
Public dwHighDateTime As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure RTM_DEST_INFO
Public DestHandle As IntPtr
Public DestAddress As RTM_NET_ADDRESS
Public LastChanged As FILETIME
Public BelongsToViews As UInteger
Public NumberOfViews As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public ViewInfo() As _Anonymous_e__Struct
End Structureimport ctypes
from ctypes import wintypes
class RTM_NET_ADDRESS(ctypes.Structure):
_fields_ = [
("AddressFamily", ctypes.c_ushort),
("NumBits", ctypes.c_ushort),
("AddrBits", ctypes.c_ubyte * 16),
]
class FILETIME(ctypes.Structure):
_fields_ = [
("dwLowDateTime", wintypes.DWORD),
("dwHighDateTime", wintypes.DWORD),
]
class RTM_DEST_INFO(ctypes.Structure):
_fields_ = [
("DestHandle", ctypes.c_ssize_t),
("DestAddress", RTM_NET_ADDRESS),
("LastChanged", FILETIME),
("BelongsToViews", wintypes.DWORD),
("NumberOfViews", wintypes.DWORD),
("ViewInfo", _Anonymous_e__Struct * 1),
]#[repr(C)]
pub struct RTM_NET_ADDRESS {
pub AddressFamily: u16,
pub NumBits: u16,
pub AddrBits: [u8; 16],
}
#[repr(C)]
pub struct FILETIME {
pub dwLowDateTime: u32,
pub dwHighDateTime: u32,
}
#[repr(C)]
pub struct RTM_DEST_INFO {
pub DestHandle: isize,
pub DestAddress: RTM_NET_ADDRESS,
pub LastChanged: FILETIME,
pub BelongsToViews: u32,
pub NumberOfViews: u32,
pub ViewInfo: [_Anonymous_e__Struct; 1],
}import "golang.org/x/sys/windows"
type RTM_NET_ADDRESS struct {
AddressFamily uint16
NumBits uint16
AddrBits [16]byte
}
type FILETIME struct {
dwLowDateTime uint32
dwHighDateTime uint32
}
type RTM_DEST_INFO struct {
DestHandle uintptr
DestAddress RTM_NET_ADDRESS
LastChanged FILETIME
BelongsToViews uint32
NumberOfViews uint32
ViewInfo [1]_Anonymous_e__Struct
}type
RTM_NET_ADDRESS = record
AddressFamily: Word;
NumBits: Word;
AddrBits: array[0..15] of Byte;
end;
FILETIME = record
dwLowDateTime: DWORD;
dwHighDateTime: DWORD;
end;
RTM_DEST_INFO = record
DestHandle: NativeInt;
DestAddress: RTM_NET_ADDRESS;
LastChanged: FILETIME;
BelongsToViews: DWORD;
NumberOfViews: DWORD;
ViewInfo: array[0..0] of _Anonymous_e__Struct;
end;const RTM_NET_ADDRESS = extern struct {
AddressFamily: u16,
NumBits: u16,
AddrBits: [16]u8,
};
const FILETIME = extern struct {
dwLowDateTime: u32,
dwHighDateTime: u32,
};
const RTM_DEST_INFO = extern struct {
DestHandle: isize,
DestAddress: RTM_NET_ADDRESS,
LastChanged: FILETIME,
BelongsToViews: u32,
NumberOfViews: u32,
ViewInfo: [1]_Anonymous_e__Struct,
};type
RTM_NET_ADDRESS {.bycopy.} = object
AddressFamily: uint16
NumBits: uint16
AddrBits: array[16, uint8]
FILETIME {.bycopy.} = object
dwLowDateTime: uint32
dwHighDateTime: uint32
RTM_DEST_INFO {.bycopy.} = object
DestHandle: int
DestAddress: RTM_NET_ADDRESS
LastChanged: FILETIME
BelongsToViews: uint32
NumberOfViews: uint32
ViewInfo: array[1, _Anonymous_e__Struct]struct RTM_NET_ADDRESS
{
ushort AddressFamily;
ushort NumBits;
ubyte[16] AddrBits;
}
struct FILETIME
{
uint dwLowDateTime;
uint dwHighDateTime;
}
struct RTM_DEST_INFO
{
ptrdiff_t DestHandle;
RTM_NET_ADDRESS DestAddress;
FILETIME LastChanged;
uint BelongsToViews;
uint NumberOfViews;
_Anonymous_e__Struct[1] ViewInfo;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; RTM_DEST_INFO サイズ: 64 バイト(x86)
dim st, 16 ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; DestHandle : INT_PTR (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; DestAddress : RTM_NET_ADDRESS (+4, 20byte) varptr(st)+4 を基点に操作(20byte:入れ子/配列)
; LastChanged : FILETIME (+24, 8byte) varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; BelongsToViews : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; NumberOfViews : DWORD (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; ViewInfo : _Anonymous_e__Struct (+40, 24byte) varptr(st)+40 を基点に操作(24byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; RTM_DEST_INFO サイズ: 88 バイト(x64)
dim st, 22 ; 4byte整数×22(構造体サイズ 88 / 4 切り上げ)
; DestHandle : INT_PTR (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; DestAddress : RTM_NET_ADDRESS (+8, 20byte) varptr(st)+8 を基点に操作(20byte:入れ子/配列)
; LastChanged : FILETIME (+28, 8byte) varptr(st)+28 を基点に操作(8byte:入れ子/配列)
; BelongsToViews : DWORD (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; NumberOfViews : DWORD (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; ViewInfo : _Anonymous_e__Struct (+48, 40byte) varptr(st)+48 を基点に操作(40byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global RTM_NET_ADDRESS
#field short AddressFamily
#field short NumBits
#field byte AddrBits 16
#endstruct
#defstruct global FILETIME
#field int dwLowDateTime
#field int dwHighDateTime
#endstruct
#defstruct global RTM_DEST_INFO
#field intptr DestHandle
#field RTM_NET_ADDRESS DestAddress
#field FILETIME LastChanged
#field int BelongsToViews
#field int NumberOfViews
#field _Anonymous_e__Struct ViewInfo 1
#endstruct
stdim st, RTM_DEST_INFO ; NSTRUCT 変数を確保
st->DestHandle = 100
mes "DestHandle=" + st->DestHandle