ホーム › NetworkManagement.IpHelper › IP_ADAPTER_ADDRESSES_LH
IP_ADAPTER_ADDRESSES_LH
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Anonymous1 | _Anonymous1_e__Union | 8 | +0 | +0 | LengthとIfIndexを保持する匿名共用体である。 |
| Next | IP_ADAPTER_ADDRESSES_LH* | 8/4 | +8 | +8 | 連結リスト上の次のアダプタ要素を指すポインタである。末尾はNULL。 |
| AdapterName | LPSTR | 8/4 | +16 | +12 | アダプタを一意に識別するANSI文字列(GUID形式)へのポインタである。 |
| FirstUnicastAddress | IP_ADAPTER_UNICAST_ADDRESS_LH* | 8/4 | +24 | +16 | ユニキャストアドレス連結リストの先頭要素へのポインタである。 |
| FirstAnycastAddress | IP_ADAPTER_ANYCAST_ADDRESS_XP* | 8/4 | +32 | +20 | エニーキャストアドレス連結リストの先頭要素へのポインタである。 |
| FirstMulticastAddress | IP_ADAPTER_MULTICAST_ADDRESS_XP* | 8/4 | +40 | +24 | マルチキャストアドレス連結リストの先頭要素へのポインタである。 |
| FirstDnsServerAddress | IP_ADAPTER_DNS_SERVER_ADDRESS_XP* | 8/4 | +48 | +28 | DNSサーバーアドレス連結リストの先頭要素へのポインタである。 |
| DnsSuffix | LPWSTR | 8/4 | +56 | +32 | アダプタ固有のDNSサフィックスを指すワイド文字列ポインタである。 |
| Description | LPWSTR | 8/4 | +64 | +36 | アダプタの説明文を指すワイド文字列ポインタである。 |
| FriendlyName | LPWSTR | 8/4 | +72 | +40 | ユーザー向けのアダプタ表示名を指すワイド文字列ポインタである。 |
| PhysicalAddress | BYTE | 8 | +80 | +44 | アダプタの物理(MAC)アドレスを保持するバイト配列である。 |
| PhysicalAddressLength | DWORD | 4 | +88 | +52 | PhysicalAddressの有効長(バイト数)である。 |
| Anonymous2 | _Anonymous2_e__Union | 8/4 | +96 | +56 | Flags(DdnsEnabled等のビットフラグ)を保持する匿名共用体である。 |
| Mtu | DWORD | 4 | +104 | +60 | インタフェースの最大伝送単位(MTU)をバイト単位で示す。 |
| IfType | DWORD | 4 | +108 | +64 | インタフェースの種別(IANA ifType値)を示す。 |
| OperStatus | IF_OPER_STATUS | 4 | +112 | +68 | インタフェースの運用状態(IF_OPER_STATUS)を示す。 |
| Ipv6IfIndex | DWORD | 4 | +116 | +72 | このアダプタのIPv6インタフェースインデックスである。 |
| ZoneIndices | DWORD | 64 | +120 | +76 | 各IPv6スコープレベルに対応するゾーンインデックスの配列である。 |
| FirstPrefix | IP_ADAPTER_PREFIX_XP* | 8/4 | +184 | +140 | アダプタに関連付けられたプレフィックス連結リストの先頭要素である。 |
| TransmitLinkSpeed | ULONGLONG | 8 | +192 | +144 | 送信リンク速度をビット毎秒で示す。 |
| ReceiveLinkSpeed | ULONGLONG | 8 | +200 | +152 | 受信リンク速度をビット毎秒で示す。 |
| FirstWinsServerAddress | IP_ADAPTER_WINS_SERVER_ADDRESS_LH* | 8/4 | +208 | +160 | WINSサーバーアドレス連結リストの先頭要素へのポインタである。 |
| FirstGatewayAddress | IP_ADAPTER_GATEWAY_ADDRESS_LH* | 8/4 | +216 | +164 | ゲートウェイアドレス連結リストの先頭要素へのポインタである。 |
| Ipv4Metric | DWORD | 4 | +224 | +168 | IPv4インタフェースのメトリック値である。 |
| Ipv6Metric | DWORD | 4 | +228 | +172 | IPv6インタフェースのメトリック値である。 |
| Luid | NET_LUID_LH | 8 | +232 | +176 | インタフェースのローカル一意識別子(NET_LUID_LH)である。 |
| Dhcpv4Server | SOCKET_ADDRESS | 16/8 | +240 | +184 | IPv4 DHCPサーバーのアドレスを保持するSOCKET_ADDRESSである。 |
| CompartmentId | NET_IF_COMPARTMENT_ID | 4 | +256 | +192 | インタフェースが属するルーティングコンパートメントのIDである。 |
| NetworkGuid | GUID | 16 | +260 | +196 | このインタフェースが接続するネットワークのGUIDである。 |
| ConnectionType | NET_IF_CONNECTION_TYPE | 4 | +276 | +212 | 接続種別(専用/要求時/パッシブ等)を示す列挙値である。 |
| TunnelType | TUNNEL_TYPE | 4 | +280 | +216 | トンネルの種別(該当する場合)を示す列挙値である。 |
| Dhcpv6Server | SOCKET_ADDRESS | 16/8 | +288 | +220 | IPv6 DHCPサーバーのアドレスを保持するSOCKET_ADDRESSである。 |
| Dhcpv6ClientDuid | BYTE | 130 | +304 | +228 | DHCPv6クライアントのDUIDを保持するバイト配列である。 |
| Dhcpv6ClientDuidLength | DWORD | 4 | +436 | +360 | Dhcpv6ClientDuidの有効長(バイト数)である。 |
| Dhcpv6Iaid | DWORD | 4 | +440 | +364 | DHCPv6のIA(Identity Association)識別子である。 |
| FirstDnsSuffix | IP_ADAPTER_DNS_SUFFIX* | 8/4 | +448 | +368 | DNSサフィックス連結リストの先頭要素へのポインタである。 |
共用体: _Anonymous1_e__Union x64 8B / x86 8B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| Alignment | ULONGLONG | 8 | +0 | +0 |
| Anonymous | _Anonymous_e__Struct | 8/4 | +0 | +0 |
共用体: _Anonymous2_e__Union x64 8B / x86 4B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| Flags | DWORD | 4 | +0 | +0 |
| Anonymous | _Anonymous_e__Struct | 8/4 | +0 | +0 |
各言語での定義
#include <windows.h>
// NET_LUID_LH (x64 8 / x86 8 バイト)
typedef struct NET_LUID_LH {
ULONGLONG Value;
_Info_e__Struct Info;
} NET_LUID_LH;
// SOCKET_ADDRESS (x64 16 / x86 8 バイト)
typedef struct SOCKET_ADDRESS {
SOCKADDR* lpSockaddr;
INT iSockaddrLength;
} SOCKET_ADDRESS;
// IP_ADAPTER_ADDRESSES_LH (x64 456 / x86 376 バイト)
typedef struct IP_ADAPTER_ADDRESSES_LH {
_Anonymous1_e__Union Anonymous1;
IP_ADAPTER_ADDRESSES_LH* Next;
LPSTR AdapterName;
IP_ADAPTER_UNICAST_ADDRESS_LH* FirstUnicastAddress;
IP_ADAPTER_ANYCAST_ADDRESS_XP* FirstAnycastAddress;
IP_ADAPTER_MULTICAST_ADDRESS_XP* FirstMulticastAddress;
IP_ADAPTER_DNS_SERVER_ADDRESS_XP* FirstDnsServerAddress;
LPWSTR DnsSuffix;
LPWSTR Description;
LPWSTR FriendlyName;
BYTE PhysicalAddress[8];
DWORD PhysicalAddressLength;
_Anonymous2_e__Union Anonymous2;
DWORD Mtu;
DWORD IfType;
IF_OPER_STATUS OperStatus;
DWORD Ipv6IfIndex;
DWORD ZoneIndices[16];
IP_ADAPTER_PREFIX_XP* FirstPrefix;
ULONGLONG TransmitLinkSpeed;
ULONGLONG ReceiveLinkSpeed;
IP_ADAPTER_WINS_SERVER_ADDRESS_LH* FirstWinsServerAddress;
IP_ADAPTER_GATEWAY_ADDRESS_LH* FirstGatewayAddress;
DWORD Ipv4Metric;
DWORD Ipv6Metric;
NET_LUID_LH Luid;
SOCKET_ADDRESS Dhcpv4Server;
NET_IF_COMPARTMENT_ID CompartmentId;
GUID NetworkGuid;
NET_IF_CONNECTION_TYPE ConnectionType;
TUNNEL_TYPE TunnelType;
SOCKET_ADDRESS Dhcpv6Server;
BYTE Dhcpv6ClientDuid[130];
DWORD Dhcpv6ClientDuidLength;
DWORD Dhcpv6Iaid;
IP_ADAPTER_DNS_SUFFIX* FirstDnsSuffix;
} IP_ADAPTER_ADDRESSES_LH;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NET_LUID_LH
{
public ulong Value;
public _Info_e__Struct Info;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SOCKET_ADDRESS
{
public IntPtr lpSockaddr;
public int iSockaddrLength;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct IP_ADAPTER_ADDRESSES_LH
{
public _Anonymous1_e__Union Anonymous1;
public IntPtr Next;
public IntPtr AdapterName;
public IntPtr FirstUnicastAddress;
public IntPtr FirstAnycastAddress;
public IntPtr FirstMulticastAddress;
public IntPtr FirstDnsServerAddress;
public IntPtr DnsSuffix;
public IntPtr Description;
public IntPtr FriendlyName;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] PhysicalAddress;
public uint PhysicalAddressLength;
public _Anonymous2_e__Union Anonymous2;
public uint Mtu;
public uint IfType;
public int OperStatus;
public uint Ipv6IfIndex;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public uint[] ZoneIndices;
public IntPtr FirstPrefix;
public ulong TransmitLinkSpeed;
public ulong ReceiveLinkSpeed;
public IntPtr FirstWinsServerAddress;
public IntPtr FirstGatewayAddress;
public uint Ipv4Metric;
public uint Ipv6Metric;
public NET_LUID_LH Luid;
public SOCKET_ADDRESS Dhcpv4Server;
public uint CompartmentId;
public Guid NetworkGuid;
public int ConnectionType;
public int TunnelType;
public SOCKET_ADDRESS Dhcpv6Server;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 130)] public byte[] Dhcpv6ClientDuid;
public uint Dhcpv6ClientDuidLength;
public uint Dhcpv6Iaid;
public IntPtr FirstDnsSuffix;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NET_LUID_LH
Public Value As ULong
Public Info As _Info_e__Struct
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SOCKET_ADDRESS
Public lpSockaddr As IntPtr
Public iSockaddrLength As Integer
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure IP_ADAPTER_ADDRESSES_LH
Public Anonymous1 As _Anonymous1_e__Union
Public Next As IntPtr
Public AdapterName As IntPtr
Public FirstUnicastAddress As IntPtr
Public FirstAnycastAddress As IntPtr
Public FirstMulticastAddress As IntPtr
Public FirstDnsServerAddress As IntPtr
Public DnsSuffix As IntPtr
Public Description As IntPtr
Public FriendlyName As IntPtr
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)> Public PhysicalAddress() As Byte
Public PhysicalAddressLength As UInteger
Public Anonymous2 As _Anonymous2_e__Union
Public Mtu As UInteger
Public IfType As UInteger
Public OperStatus As Integer
Public Ipv6IfIndex As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=16)> Public ZoneIndices() As UInteger
Public FirstPrefix As IntPtr
Public TransmitLinkSpeed As ULong
Public ReceiveLinkSpeed As ULong
Public FirstWinsServerAddress As IntPtr
Public FirstGatewayAddress As IntPtr
Public Ipv4Metric As UInteger
Public Ipv6Metric As UInteger
Public Luid As NET_LUID_LH
Public Dhcpv4Server As SOCKET_ADDRESS
Public CompartmentId As UInteger
Public NetworkGuid As Guid
Public ConnectionType As Integer
Public TunnelType As Integer
Public Dhcpv6Server As SOCKET_ADDRESS
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=130)> Public Dhcpv6ClientDuid() As Byte
Public Dhcpv6ClientDuidLength As UInteger
Public Dhcpv6Iaid As UInteger
Public FirstDnsSuffix As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class NET_LUID_LH(ctypes.Structure):
_fields_ = [
("Value", ctypes.c_ulonglong),
("Info", _Info_e__Struct),
]
class SOCKET_ADDRESS(ctypes.Structure):
_fields_ = [
("lpSockaddr", ctypes.c_void_p),
("iSockaddrLength", ctypes.c_int),
]
class IP_ADAPTER_ADDRESSES_LH(ctypes.Structure):
_fields_ = [
("Anonymous1", _Anonymous1_e__Union),
("Next", ctypes.c_void_p),
("AdapterName", ctypes.c_void_p),
("FirstUnicastAddress", ctypes.c_void_p),
("FirstAnycastAddress", ctypes.c_void_p),
("FirstMulticastAddress", ctypes.c_void_p),
("FirstDnsServerAddress", ctypes.c_void_p),
("DnsSuffix", ctypes.c_void_p),
("Description", ctypes.c_void_p),
("FriendlyName", ctypes.c_void_p),
("PhysicalAddress", ctypes.c_ubyte * 8),
("PhysicalAddressLength", wintypes.DWORD),
("Anonymous2", _Anonymous2_e__Union),
("Mtu", wintypes.DWORD),
("IfType", wintypes.DWORD),
("OperStatus", ctypes.c_int),
("Ipv6IfIndex", wintypes.DWORD),
("ZoneIndices", wintypes.DWORD * 16),
("FirstPrefix", ctypes.c_void_p),
("TransmitLinkSpeed", ctypes.c_ulonglong),
("ReceiveLinkSpeed", ctypes.c_ulonglong),
("FirstWinsServerAddress", ctypes.c_void_p),
("FirstGatewayAddress", ctypes.c_void_p),
("Ipv4Metric", wintypes.DWORD),
("Ipv6Metric", wintypes.DWORD),
("Luid", NET_LUID_LH),
("Dhcpv4Server", SOCKET_ADDRESS),
("CompartmentId", wintypes.DWORD),
("NetworkGuid", GUID),
("ConnectionType", ctypes.c_int),
("TunnelType", ctypes.c_int),
("Dhcpv6Server", SOCKET_ADDRESS),
("Dhcpv6ClientDuid", ctypes.c_ubyte * 130),
("Dhcpv6ClientDuidLength", wintypes.DWORD),
("Dhcpv6Iaid", wintypes.DWORD),
("FirstDnsSuffix", ctypes.c_void_p),
]#[repr(C)]
pub struct NET_LUID_LH {
pub Value: u64,
pub Info: _Info_e__Struct,
}
#[repr(C)]
pub struct SOCKET_ADDRESS {
pub lpSockaddr: *mut core::ffi::c_void,
pub iSockaddrLength: i32,
}
#[repr(C)]
pub struct IP_ADAPTER_ADDRESSES_LH {
pub Anonymous1: _Anonymous1_e__Union,
pub Next: *mut core::ffi::c_void,
pub AdapterName: *mut core::ffi::c_void,
pub FirstUnicastAddress: *mut core::ffi::c_void,
pub FirstAnycastAddress: *mut core::ffi::c_void,
pub FirstMulticastAddress: *mut core::ffi::c_void,
pub FirstDnsServerAddress: *mut core::ffi::c_void,
pub DnsSuffix: *mut core::ffi::c_void,
pub Description: *mut core::ffi::c_void,
pub FriendlyName: *mut core::ffi::c_void,
pub PhysicalAddress: [u8; 8],
pub PhysicalAddressLength: u32,
pub Anonymous2: _Anonymous2_e__Union,
pub Mtu: u32,
pub IfType: u32,
pub OperStatus: i32,
pub Ipv6IfIndex: u32,
pub ZoneIndices: [u32; 16],
pub FirstPrefix: *mut core::ffi::c_void,
pub TransmitLinkSpeed: u64,
pub ReceiveLinkSpeed: u64,
pub FirstWinsServerAddress: *mut core::ffi::c_void,
pub FirstGatewayAddress: *mut core::ffi::c_void,
pub Ipv4Metric: u32,
pub Ipv6Metric: u32,
pub Luid: NET_LUID_LH,
pub Dhcpv4Server: SOCKET_ADDRESS,
pub CompartmentId: u32,
pub NetworkGuid: GUID,
pub ConnectionType: i32,
pub TunnelType: i32,
pub Dhcpv6Server: SOCKET_ADDRESS,
pub Dhcpv6ClientDuid: [u8; 130],
pub Dhcpv6ClientDuidLength: u32,
pub Dhcpv6Iaid: u32,
pub FirstDnsSuffix: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type NET_LUID_LH struct {
Value uint64
Info _Info_e__Struct
}
type SOCKET_ADDRESS struct {
lpSockaddr uintptr
iSockaddrLength int32
}
type IP_ADAPTER_ADDRESSES_LH struct {
Anonymous1 _Anonymous1_e__Union
Next uintptr
AdapterName uintptr
FirstUnicastAddress uintptr
FirstAnycastAddress uintptr
FirstMulticastAddress uintptr
FirstDnsServerAddress uintptr
DnsSuffix uintptr
Description uintptr
FriendlyName uintptr
PhysicalAddress [8]byte
PhysicalAddressLength uint32
Anonymous2 _Anonymous2_e__Union
Mtu uint32
IfType uint32
OperStatus int32
Ipv6IfIndex uint32
ZoneIndices [16]uint32
FirstPrefix uintptr
TransmitLinkSpeed uint64
ReceiveLinkSpeed uint64
FirstWinsServerAddress uintptr
FirstGatewayAddress uintptr
Ipv4Metric uint32
Ipv6Metric uint32
Luid NET_LUID_LH
Dhcpv4Server SOCKET_ADDRESS
CompartmentId uint32
NetworkGuid windows.GUID
ConnectionType int32
TunnelType int32
Dhcpv6Server SOCKET_ADDRESS
Dhcpv6ClientDuid [130]byte
Dhcpv6ClientDuidLength uint32
Dhcpv6Iaid uint32
FirstDnsSuffix uintptr
}type
NET_LUID_LH = record
Value: UInt64;
Info: _Info_e__Struct;
end;
SOCKET_ADDRESS = record
lpSockaddr: Pointer;
iSockaddrLength: Integer;
end;
IP_ADAPTER_ADDRESSES_LH = record
Anonymous1: _Anonymous1_e__Union;
Next: Pointer;
AdapterName: Pointer;
FirstUnicastAddress: Pointer;
FirstAnycastAddress: Pointer;
FirstMulticastAddress: Pointer;
FirstDnsServerAddress: Pointer;
DnsSuffix: Pointer;
Description: Pointer;
FriendlyName: Pointer;
PhysicalAddress: array[0..7] of Byte;
PhysicalAddressLength: DWORD;
Anonymous2: _Anonymous2_e__Union;
Mtu: DWORD;
IfType: DWORD;
OperStatus: Integer;
Ipv6IfIndex: DWORD;
ZoneIndices: array[0..15] of DWORD;
FirstPrefix: Pointer;
TransmitLinkSpeed: UInt64;
ReceiveLinkSpeed: UInt64;
FirstWinsServerAddress: Pointer;
FirstGatewayAddress: Pointer;
Ipv4Metric: DWORD;
Ipv6Metric: DWORD;
Luid: NET_LUID_LH;
Dhcpv4Server: SOCKET_ADDRESS;
CompartmentId: DWORD;
NetworkGuid: TGUID;
ConnectionType: Integer;
TunnelType: Integer;
Dhcpv6Server: SOCKET_ADDRESS;
Dhcpv6ClientDuid: array[0..129] of Byte;
Dhcpv6ClientDuidLength: DWORD;
Dhcpv6Iaid: DWORD;
FirstDnsSuffix: Pointer;
end;const NET_LUID_LH = extern struct {
Value: u64,
Info: _Info_e__Struct,
};
const SOCKET_ADDRESS = extern struct {
lpSockaddr: ?*anyopaque,
iSockaddrLength: i32,
};
const IP_ADAPTER_ADDRESSES_LH = extern struct {
Anonymous1: _Anonymous1_e__Union,
Next: ?*anyopaque,
AdapterName: ?*anyopaque,
FirstUnicastAddress: ?*anyopaque,
FirstAnycastAddress: ?*anyopaque,
FirstMulticastAddress: ?*anyopaque,
FirstDnsServerAddress: ?*anyopaque,
DnsSuffix: ?*anyopaque,
Description: ?*anyopaque,
FriendlyName: ?*anyopaque,
PhysicalAddress: [8]u8,
PhysicalAddressLength: u32,
Anonymous2: _Anonymous2_e__Union,
Mtu: u32,
IfType: u32,
OperStatus: i32,
Ipv6IfIndex: u32,
ZoneIndices: [16]u32,
FirstPrefix: ?*anyopaque,
TransmitLinkSpeed: u64,
ReceiveLinkSpeed: u64,
FirstWinsServerAddress: ?*anyopaque,
FirstGatewayAddress: ?*anyopaque,
Ipv4Metric: u32,
Ipv6Metric: u32,
Luid: NET_LUID_LH,
Dhcpv4Server: SOCKET_ADDRESS,
CompartmentId: u32,
NetworkGuid: GUID,
ConnectionType: i32,
TunnelType: i32,
Dhcpv6Server: SOCKET_ADDRESS,
Dhcpv6ClientDuid: [130]u8,
Dhcpv6ClientDuidLength: u32,
Dhcpv6Iaid: u32,
FirstDnsSuffix: ?*anyopaque,
};type
NET_LUID_LH {.bycopy.} = object
Value: uint64
Info: _Info_e__Struct
SOCKET_ADDRESS {.bycopy.} = object
lpSockaddr: pointer
iSockaddrLength: int32
IP_ADAPTER_ADDRESSES_LH {.bycopy.} = object
Anonymous1: _Anonymous1_e__Union
Next: pointer
AdapterName: pointer
FirstUnicastAddress: pointer
FirstAnycastAddress: pointer
FirstMulticastAddress: pointer
FirstDnsServerAddress: pointer
DnsSuffix: pointer
Description: pointer
FriendlyName: pointer
PhysicalAddress: array[8, uint8]
PhysicalAddressLength: uint32
Anonymous2: _Anonymous2_e__Union
Mtu: uint32
IfType: uint32
OperStatus: int32
Ipv6IfIndex: uint32
ZoneIndices: array[16, uint32]
FirstPrefix: pointer
TransmitLinkSpeed: uint64
ReceiveLinkSpeed: uint64
FirstWinsServerAddress: pointer
FirstGatewayAddress: pointer
Ipv4Metric: uint32
Ipv6Metric: uint32
Luid: NET_LUID_LH
Dhcpv4Server: SOCKET_ADDRESS
CompartmentId: uint32
NetworkGuid: GUID
ConnectionType: int32
TunnelType: int32
Dhcpv6Server: SOCKET_ADDRESS
Dhcpv6ClientDuid: array[130, uint8]
Dhcpv6ClientDuidLength: uint32
Dhcpv6Iaid: uint32
FirstDnsSuffix: pointerstruct NET_LUID_LH
{
ulong Value;
_Info_e__Struct Info;
}
struct SOCKET_ADDRESS
{
void* lpSockaddr;
int iSockaddrLength;
}
struct IP_ADAPTER_ADDRESSES_LH
{
_Anonymous1_e__Union Anonymous1;
void* Next;
void* AdapterName;
void* FirstUnicastAddress;
void* FirstAnycastAddress;
void* FirstMulticastAddress;
void* FirstDnsServerAddress;
void* DnsSuffix;
void* Description;
void* FriendlyName;
ubyte[8] PhysicalAddress;
uint PhysicalAddressLength;
_Anonymous2_e__Union Anonymous2;
uint Mtu;
uint IfType;
int OperStatus;
uint Ipv6IfIndex;
uint[16] ZoneIndices;
void* FirstPrefix;
ulong TransmitLinkSpeed;
ulong ReceiveLinkSpeed;
void* FirstWinsServerAddress;
void* FirstGatewayAddress;
uint Ipv4Metric;
uint Ipv6Metric;
NET_LUID_LH Luid;
SOCKET_ADDRESS Dhcpv4Server;
uint CompartmentId;
GUID NetworkGuid;
int ConnectionType;
int TunnelType;
SOCKET_ADDRESS Dhcpv6Server;
ubyte[130] Dhcpv6ClientDuid;
uint Dhcpv6ClientDuidLength;
uint Dhcpv6Iaid;
void* FirstDnsSuffix;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; IP_ADAPTER_ADDRESSES_LH サイズ: 376 バイト(x86)
dim st, 94 ; 4byte整数×94(構造体サイズ 376 / 4 切り上げ)
; Anonymous1 : _Anonymous1_e__Union (+0, 8byte) varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; Next : IP_ADAPTER_ADDRESSES_LH* (+8, 4byte) varptr(st)+8 を基点に操作(4byte:入れ子/配列)
; AdapterName : LPSTR (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; FirstUnicastAddress : IP_ADAPTER_UNICAST_ADDRESS_LH* (+16, 4byte) varptr(st)+16 を基点に操作(4byte:入れ子/配列)
; FirstAnycastAddress : IP_ADAPTER_ANYCAST_ADDRESS_XP* (+20, 4byte) varptr(st)+20 を基点に操作(4byte:入れ子/配列)
; FirstMulticastAddress : IP_ADAPTER_MULTICAST_ADDRESS_XP* (+24, 4byte) varptr(st)+24 を基点に操作(4byte:入れ子/配列)
; FirstDnsServerAddress : IP_ADAPTER_DNS_SERVER_ADDRESS_XP* (+28, 4byte) varptr(st)+28 を基点に操作(4byte:入れ子/配列)
; DnsSuffix : LPWSTR (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; Description : LPWSTR (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; FriendlyName : LPWSTR (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; PhysicalAddress : BYTE (+44, 8byte) varptr(st)+44 を基点に操作(8byte:入れ子/配列)
; PhysicalAddressLength : DWORD (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; Anonymous2 : _Anonymous2_e__Union (+56, 4byte) varptr(st)+56 を基点に操作(4byte:入れ子/配列)
; Mtu : DWORD (+60, 4byte) st.15 = 値 / 値 = st.15 (lpoke/lpeek も可)
; IfType : DWORD (+64, 4byte) st.16 = 値 / 値 = st.16 (lpoke/lpeek も可)
; OperStatus : IF_OPER_STATUS (+68, 4byte) st.17 = 値 / 値 = st.17 (lpoke/lpeek も可)
; Ipv6IfIndex : DWORD (+72, 4byte) st.18 = 値 / 値 = st.18 (lpoke/lpeek も可)
; ZoneIndices : DWORD (+76, 64byte) varptr(st)+76 を基点に操作(64byte:入れ子/配列)
; FirstPrefix : IP_ADAPTER_PREFIX_XP* (+140, 4byte) varptr(st)+140 を基点に操作(4byte:入れ子/配列)
; TransmitLinkSpeed : ULONGLONG (+144, 8byte) qpoke st,144,値 / qpeek(st,144) ※IronHSPのみ。3.7/3.8は lpoke st,144,下位 : lpoke st,148,上位
; ReceiveLinkSpeed : ULONGLONG (+152, 8byte) qpoke st,152,値 / qpeek(st,152) ※IronHSPのみ。3.7/3.8は lpoke st,152,下位 : lpoke st,156,上位
; FirstWinsServerAddress : IP_ADAPTER_WINS_SERVER_ADDRESS_LH* (+160, 4byte) varptr(st)+160 を基点に操作(4byte:入れ子/配列)
; FirstGatewayAddress : IP_ADAPTER_GATEWAY_ADDRESS_LH* (+164, 4byte) varptr(st)+164 を基点に操作(4byte:入れ子/配列)
; Ipv4Metric : DWORD (+168, 4byte) st.42 = 値 / 値 = st.42 (lpoke/lpeek も可)
; Ipv6Metric : DWORD (+172, 4byte) st.43 = 値 / 値 = st.43 (lpoke/lpeek も可)
; Luid : NET_LUID_LH (+176, 8byte) varptr(st)+176 を基点に操作(8byte:入れ子/配列)
; Dhcpv4Server : SOCKET_ADDRESS (+184, 8byte) varptr(st)+184 を基点に操作(8byte:入れ子/配列)
; CompartmentId : NET_IF_COMPARTMENT_ID (+192, 4byte) st.48 = 値 / 値 = st.48 (lpoke/lpeek も可)
; NetworkGuid : GUID (+196, 16byte) varptr(st)+196 を基点に操作(16byte:入れ子/配列)
; ConnectionType : NET_IF_CONNECTION_TYPE (+212, 4byte) st.53 = 値 / 値 = st.53 (lpoke/lpeek も可)
; TunnelType : TUNNEL_TYPE (+216, 4byte) st.54 = 値 / 値 = st.54 (lpoke/lpeek も可)
; Dhcpv6Server : SOCKET_ADDRESS (+220, 8byte) varptr(st)+220 を基点に操作(8byte:入れ子/配列)
; Dhcpv6ClientDuid : BYTE (+228, 130byte) varptr(st)+228 を基点に操作(130byte:入れ子/配列)
; Dhcpv6ClientDuidLength : DWORD (+360, 4byte) st.90 = 値 / 値 = st.90 (lpoke/lpeek も可)
; Dhcpv6Iaid : DWORD (+364, 4byte) st.91 = 値 / 値 = st.91 (lpoke/lpeek も可)
; FirstDnsSuffix : IP_ADAPTER_DNS_SUFFIX* (+368, 4byte) varptr(st)+368 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; IP_ADAPTER_ADDRESSES_LH サイズ: 456 バイト(x64)
dim st, 114 ; 4byte整数×114(構造体サイズ 456 / 4 切り上げ)
; Anonymous1 : _Anonymous1_e__Union (+0, 8byte) varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; Next : IP_ADAPTER_ADDRESSES_LH* (+8, 8byte) varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; AdapterName : LPSTR (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; FirstUnicastAddress : IP_ADAPTER_UNICAST_ADDRESS_LH* (+24, 8byte) varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; FirstAnycastAddress : IP_ADAPTER_ANYCAST_ADDRESS_XP* (+32, 8byte) varptr(st)+32 を基点に操作(8byte:入れ子/配列)
; FirstMulticastAddress : IP_ADAPTER_MULTICAST_ADDRESS_XP* (+40, 8byte) varptr(st)+40 を基点に操作(8byte:入れ子/配列)
; FirstDnsServerAddress : IP_ADAPTER_DNS_SERVER_ADDRESS_XP* (+48, 8byte) varptr(st)+48 を基点に操作(8byte:入れ子/配列)
; DnsSuffix : LPWSTR (+56, 8byte) qpoke st,56,値 / qpeek(st,56) ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; Description : LPWSTR (+64, 8byte) qpoke st,64,値 / qpeek(st,64) ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; FriendlyName : LPWSTR (+72, 8byte) qpoke st,72,値 / qpeek(st,72) ※IronHSPのみ。3.7/3.8は lpoke st,72,下位 : lpoke st,76,上位
; PhysicalAddress : BYTE (+80, 8byte) varptr(st)+80 を基点に操作(8byte:入れ子/配列)
; PhysicalAddressLength : DWORD (+88, 4byte) st.22 = 値 / 値 = st.22 (lpoke/lpeek も可)
; Anonymous2 : _Anonymous2_e__Union (+96, 8byte) varptr(st)+96 を基点に操作(8byte:入れ子/配列)
; Mtu : DWORD (+104, 4byte) st.26 = 値 / 値 = st.26 (lpoke/lpeek も可)
; IfType : DWORD (+108, 4byte) st.27 = 値 / 値 = st.27 (lpoke/lpeek も可)
; OperStatus : IF_OPER_STATUS (+112, 4byte) st.28 = 値 / 値 = st.28 (lpoke/lpeek も可)
; Ipv6IfIndex : DWORD (+116, 4byte) st.29 = 値 / 値 = st.29 (lpoke/lpeek も可)
; ZoneIndices : DWORD (+120, 64byte) varptr(st)+120 を基点に操作(64byte:入れ子/配列)
; FirstPrefix : IP_ADAPTER_PREFIX_XP* (+184, 8byte) varptr(st)+184 を基点に操作(8byte:入れ子/配列)
; TransmitLinkSpeed : ULONGLONG (+192, 8byte) qpoke st,192,値 / qpeek(st,192) ※IronHSPのみ。3.7/3.8は lpoke st,192,下位 : lpoke st,196,上位
; ReceiveLinkSpeed : ULONGLONG (+200, 8byte) qpoke st,200,値 / qpeek(st,200) ※IronHSPのみ。3.7/3.8は lpoke st,200,下位 : lpoke st,204,上位
; FirstWinsServerAddress : IP_ADAPTER_WINS_SERVER_ADDRESS_LH* (+208, 8byte) varptr(st)+208 を基点に操作(8byte:入れ子/配列)
; FirstGatewayAddress : IP_ADAPTER_GATEWAY_ADDRESS_LH* (+216, 8byte) varptr(st)+216 を基点に操作(8byte:入れ子/配列)
; Ipv4Metric : DWORD (+224, 4byte) st.56 = 値 / 値 = st.56 (lpoke/lpeek も可)
; Ipv6Metric : DWORD (+228, 4byte) st.57 = 値 / 値 = st.57 (lpoke/lpeek も可)
; Luid : NET_LUID_LH (+232, 8byte) varptr(st)+232 を基点に操作(8byte:入れ子/配列)
; Dhcpv4Server : SOCKET_ADDRESS (+240, 16byte) varptr(st)+240 を基点に操作(16byte:入れ子/配列)
; CompartmentId : NET_IF_COMPARTMENT_ID (+256, 4byte) st.64 = 値 / 値 = st.64 (lpoke/lpeek も可)
; NetworkGuid : GUID (+260, 16byte) varptr(st)+260 を基点に操作(16byte:入れ子/配列)
; ConnectionType : NET_IF_CONNECTION_TYPE (+276, 4byte) st.69 = 値 / 値 = st.69 (lpoke/lpeek も可)
; TunnelType : TUNNEL_TYPE (+280, 4byte) st.70 = 値 / 値 = st.70 (lpoke/lpeek も可)
; Dhcpv6Server : SOCKET_ADDRESS (+288, 16byte) varptr(st)+288 を基点に操作(16byte:入れ子/配列)
; Dhcpv6ClientDuid : BYTE (+304, 130byte) varptr(st)+304 を基点に操作(130byte:入れ子/配列)
; Dhcpv6ClientDuidLength : DWORD (+436, 4byte) st.109 = 値 / 値 = st.109 (lpoke/lpeek も可)
; Dhcpv6Iaid : DWORD (+440, 4byte) st.110 = 値 / 値 = st.110 (lpoke/lpeek も可)
; FirstDnsSuffix : IP_ADAPTER_DNS_SUFFIX* (+448, 8byte) varptr(st)+448 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global SOCKET_ADDRESS
#field intptr lpSockaddr
#field int iSockaddrLength
#endstruct
#defstruct global GUID, pack=1
#field int Data1
#field short Data2
#field short Data3
#field byte Data4 8
#endstruct
#defstruct global IP_ADAPTER_ADDRESSES_LH
#field byte Anonymous1 8
#field intptr Next
#field intptr AdapterName
#field intptr FirstUnicastAddress
#field intptr FirstAnycastAddress
#field intptr FirstMulticastAddress
#field intptr FirstDnsServerAddress
#field intptr DnsSuffix
#field intptr Description
#field intptr FriendlyName
#field byte PhysicalAddress 8
#field int PhysicalAddressLength
#field byte Anonymous2 8
#field int Mtu
#field int IfType
#field int OperStatus
#field int Ipv6IfIndex
#field int ZoneIndices 16
#field intptr FirstPrefix
#field int64 TransmitLinkSpeed
#field int64 ReceiveLinkSpeed
#field intptr FirstWinsServerAddress
#field intptr FirstGatewayAddress
#field int Ipv4Metric
#field int Ipv6Metric
#field byte Luid 8
#field SOCKET_ADDRESS Dhcpv4Server
#field int CompartmentId
#field GUID NetworkGuid
#field int ConnectionType
#field int TunnelType
#field SOCKET_ADDRESS Dhcpv6Server
#field byte Dhcpv6ClientDuid 130
#field int Dhcpv6ClientDuidLength
#field int Dhcpv6Iaid
#field intptr FirstDnsSuffix
#endstruct
stdim st, IP_ADAPTER_ADDRESSES_LH ; NSTRUCT 変数を確保
st->PhysicalAddressLength = 100
mes "PhysicalAddressLength=" + st->PhysicalAddressLength
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。