ホーム › NetworkManagement.IpHelper › IP_INTERFACE_NAME_INFO_W2KSP1
IP_INTERFACE_NAME_INFO_W2KSP1
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Index | DWORD | 4 | +0 | +0 | インタフェースのインデックス(IPアドレス割り当て対象)である。 |
| MediaType | DWORD | 4 | +4 | +4 | インタフェースのメディア種別を示す。 |
| ConnectionType | BYTE | 1 | +8 | +8 | 接続種別(専用/要求時/パッシブ)を示すバイト値である。 |
| AccessType | BYTE | 1 | +9 | +9 | アクセス種別(ブロードキャスト/ポイントツーポイント等)を示すバイト値である。 |
| DeviceGuid | GUID | 16 | +12 | +12 | 下位デバイスのGUIDである。 |
| InterfaceGuid | GUID | 16 | +28 | +28 | インタフェースのGUIDである。 |
各言語での定義
#include <windows.h>
// IP_INTERFACE_NAME_INFO_W2KSP1 (x64 44 / x86 44 バイト)
typedef struct IP_INTERFACE_NAME_INFO_W2KSP1 {
DWORD Index;
DWORD MediaType;
BYTE ConnectionType;
BYTE AccessType;
GUID DeviceGuid;
GUID InterfaceGuid;
} IP_INTERFACE_NAME_INFO_W2KSP1;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct IP_INTERFACE_NAME_INFO_W2KSP1
{
public uint Index;
public uint MediaType;
public byte ConnectionType;
public byte AccessType;
public Guid DeviceGuid;
public Guid InterfaceGuid;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure IP_INTERFACE_NAME_INFO_W2KSP1
Public Index As UInteger
Public MediaType As UInteger
Public ConnectionType As Byte
Public AccessType As Byte
Public DeviceGuid As Guid
Public InterfaceGuid As Guid
End Structureimport ctypes
from ctypes import wintypes
class IP_INTERFACE_NAME_INFO_W2KSP1(ctypes.Structure):
_fields_ = [
("Index", wintypes.DWORD),
("MediaType", wintypes.DWORD),
("ConnectionType", ctypes.c_ubyte),
("AccessType", ctypes.c_ubyte),
("DeviceGuid", GUID),
("InterfaceGuid", GUID),
]#[repr(C)]
pub struct IP_INTERFACE_NAME_INFO_W2KSP1 {
pub Index: u32,
pub MediaType: u32,
pub ConnectionType: u8,
pub AccessType: u8,
pub DeviceGuid: GUID,
pub InterfaceGuid: GUID,
}import "golang.org/x/sys/windows"
type IP_INTERFACE_NAME_INFO_W2KSP1 struct {
Index uint32
MediaType uint32
ConnectionType byte
AccessType byte
DeviceGuid windows.GUID
InterfaceGuid windows.GUID
}type
IP_INTERFACE_NAME_INFO_W2KSP1 = record
Index: DWORD;
MediaType: DWORD;
ConnectionType: Byte;
AccessType: Byte;
DeviceGuid: TGUID;
InterfaceGuid: TGUID;
end;const IP_INTERFACE_NAME_INFO_W2KSP1 = extern struct {
Index: u32,
MediaType: u32,
ConnectionType: u8,
AccessType: u8,
DeviceGuid: GUID,
InterfaceGuid: GUID,
};type
IP_INTERFACE_NAME_INFO_W2KSP1 {.bycopy.} = object
Index: uint32
MediaType: uint32
ConnectionType: uint8
AccessType: uint8
DeviceGuid: GUID
InterfaceGuid: GUIDstruct IP_INTERFACE_NAME_INFO_W2KSP1
{
uint Index;
uint MediaType;
ubyte ConnectionType;
ubyte AccessType;
GUID DeviceGuid;
GUID InterfaceGuid;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; IP_INTERFACE_NAME_INFO_W2KSP1 サイズ: 44 バイト(x64)
dim st, 11 ; 4byte整数×11(構造体サイズ 44 / 4 切り上げ)
; Index : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; MediaType : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; ConnectionType : BYTE (+8, 1byte) poke st,8,値 / 値 = peek(st,8)
; AccessType : BYTE (+9, 1byte) poke st,9,値 / 値 = peek(st,9)
; DeviceGuid : GUID (+12, 16byte) varptr(st)+12 を基点に操作(16byte:入れ子/配列)
; InterfaceGuid : GUID (+28, 16byte) varptr(st)+28 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global GUID, pack=1
#field int Data1
#field short Data2
#field short Data3
#field byte Data4 8
#endstruct
#defstruct global IP_INTERFACE_NAME_INFO_W2KSP1
#field int Index
#field int MediaType
#field byte ConnectionType
#field byte AccessType
#field GUID DeviceGuid
#field GUID InterfaceGuid
#endstruct
stdim st, IP_INTERFACE_NAME_INFO_W2KSP1 ; NSTRUCT 変数を確保
st->Index = 100
mes "Index=" + st->Index