ホーム › NetworkManagement.QoS › TC_IFC_DESCRIPTOR
TC_IFC_DESCRIPTOR
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Length | DWORD | 4 | +0 | +0 | この構造体のバイト長。 |
| pInterfaceName | LPWSTR | 8/4 | +8 | +4 | ネットワークインターフェイス名を表すワイド文字列。 |
| pInterfaceID | LPWSTR | 8/4 | +16 | +8 | インターフェイスIDを表すワイド文字列。 |
| AddressListDesc | ADDRESS_LIST_DESCRIPTOR | 16 | +24 | +12 | インターフェイスのアドレスリストを示すADDRESS_LIST_DESCRIPTOR。 |
各言語での定義
#include <windows.h>
// NETWORK_ADDRESS (x64 6 / x86 6 バイト)
typedef struct NETWORK_ADDRESS {
WORD AddressLength;
WORD AddressType;
BYTE Address[1];
} NETWORK_ADDRESS;
// NETWORK_ADDRESS_LIST (x64 12 / x86 12 バイト)
typedef struct NETWORK_ADDRESS_LIST {
INT AddressCount;
WORD AddressType;
NETWORK_ADDRESS Address[1];
} NETWORK_ADDRESS_LIST;
// ADDRESS_LIST_DESCRIPTOR (x64 16 / x86 16 バイト)
typedef struct ADDRESS_LIST_DESCRIPTOR {
DWORD MediaType;
NETWORK_ADDRESS_LIST AddressList;
} ADDRESS_LIST_DESCRIPTOR;
// TC_IFC_DESCRIPTOR (x64 40 / x86 28 バイト)
typedef struct TC_IFC_DESCRIPTOR {
DWORD Length;
LPWSTR pInterfaceName;
LPWSTR pInterfaceID;
ADDRESS_LIST_DESCRIPTOR AddressListDesc;
} TC_IFC_DESCRIPTOR;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NETWORK_ADDRESS
{
public ushort AddressLength;
public ushort AddressType;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public byte[] Address;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NETWORK_ADDRESS_LIST
{
public int AddressCount;
public ushort AddressType;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public NETWORK_ADDRESS[] Address;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct ADDRESS_LIST_DESCRIPTOR
{
public uint MediaType;
public NETWORK_ADDRESS_LIST AddressList;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct TC_IFC_DESCRIPTOR
{
public uint Length;
public IntPtr pInterfaceName;
public IntPtr pInterfaceID;
public ADDRESS_LIST_DESCRIPTOR AddressListDesc;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NETWORK_ADDRESS
Public AddressLength As UShort
Public AddressType As UShort
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public Address() As Byte
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NETWORK_ADDRESS_LIST
Public AddressCount As Integer
Public AddressType As UShort
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public Address() As NETWORK_ADDRESS
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure ADDRESS_LIST_DESCRIPTOR
Public MediaType As UInteger
Public AddressList As NETWORK_ADDRESS_LIST
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure TC_IFC_DESCRIPTOR
Public Length As UInteger
Public pInterfaceName As IntPtr
Public pInterfaceID As IntPtr
Public AddressListDesc As ADDRESS_LIST_DESCRIPTOR
End Structureimport ctypes
from ctypes import wintypes
class NETWORK_ADDRESS(ctypes.Structure):
_fields_ = [
("AddressLength", ctypes.c_ushort),
("AddressType", ctypes.c_ushort),
("Address", ctypes.c_ubyte * 1),
]
class NETWORK_ADDRESS_LIST(ctypes.Structure):
_fields_ = [
("AddressCount", ctypes.c_int),
("AddressType", ctypes.c_ushort),
("Address", NETWORK_ADDRESS * 1),
]
class ADDRESS_LIST_DESCRIPTOR(ctypes.Structure):
_fields_ = [
("MediaType", wintypes.DWORD),
("AddressList", NETWORK_ADDRESS_LIST),
]
class TC_IFC_DESCRIPTOR(ctypes.Structure):
_fields_ = [
("Length", wintypes.DWORD),
("pInterfaceName", ctypes.c_void_p),
("pInterfaceID", ctypes.c_void_p),
("AddressListDesc", ADDRESS_LIST_DESCRIPTOR),
]#[repr(C)]
pub struct NETWORK_ADDRESS {
pub AddressLength: u16,
pub AddressType: u16,
pub Address: [u8; 1],
}
#[repr(C)]
pub struct NETWORK_ADDRESS_LIST {
pub AddressCount: i32,
pub AddressType: u16,
pub Address: [NETWORK_ADDRESS; 1],
}
#[repr(C)]
pub struct ADDRESS_LIST_DESCRIPTOR {
pub MediaType: u32,
pub AddressList: NETWORK_ADDRESS_LIST,
}
#[repr(C)]
pub struct TC_IFC_DESCRIPTOR {
pub Length: u32,
pub pInterfaceName: *mut core::ffi::c_void,
pub pInterfaceID: *mut core::ffi::c_void,
pub AddressListDesc: ADDRESS_LIST_DESCRIPTOR,
}import "golang.org/x/sys/windows"
type NETWORK_ADDRESS struct {
AddressLength uint16
AddressType uint16
Address [1]byte
}
type NETWORK_ADDRESS_LIST struct {
AddressCount int32
AddressType uint16
Address [1]NETWORK_ADDRESS
}
type ADDRESS_LIST_DESCRIPTOR struct {
MediaType uint32
AddressList NETWORK_ADDRESS_LIST
}
type TC_IFC_DESCRIPTOR struct {
Length uint32
pInterfaceName uintptr
pInterfaceID uintptr
AddressListDesc ADDRESS_LIST_DESCRIPTOR
}type
NETWORK_ADDRESS = record
AddressLength: Word;
AddressType: Word;
Address: array[0..0] of Byte;
end;
NETWORK_ADDRESS_LIST = record
AddressCount: Integer;
AddressType: Word;
Address: array[0..0] of NETWORK_ADDRESS;
end;
ADDRESS_LIST_DESCRIPTOR = record
MediaType: DWORD;
AddressList: NETWORK_ADDRESS_LIST;
end;
TC_IFC_DESCRIPTOR = record
Length: DWORD;
pInterfaceName: Pointer;
pInterfaceID: Pointer;
AddressListDesc: ADDRESS_LIST_DESCRIPTOR;
end;const NETWORK_ADDRESS = extern struct {
AddressLength: u16,
AddressType: u16,
Address: [1]u8,
};
const NETWORK_ADDRESS_LIST = extern struct {
AddressCount: i32,
AddressType: u16,
Address: [1]NETWORK_ADDRESS,
};
const ADDRESS_LIST_DESCRIPTOR = extern struct {
MediaType: u32,
AddressList: NETWORK_ADDRESS_LIST,
};
const TC_IFC_DESCRIPTOR = extern struct {
Length: u32,
pInterfaceName: ?*anyopaque,
pInterfaceID: ?*anyopaque,
AddressListDesc: ADDRESS_LIST_DESCRIPTOR,
};type
NETWORK_ADDRESS {.bycopy.} = object
AddressLength: uint16
AddressType: uint16
Address: array[1, uint8]
NETWORK_ADDRESS_LIST {.bycopy.} = object
AddressCount: int32
AddressType: uint16
Address: array[1, NETWORK_ADDRESS]
ADDRESS_LIST_DESCRIPTOR {.bycopy.} = object
MediaType: uint32
AddressList: NETWORK_ADDRESS_LIST
TC_IFC_DESCRIPTOR {.bycopy.} = object
Length: uint32
pInterfaceName: pointer
pInterfaceID: pointer
AddressListDesc: ADDRESS_LIST_DESCRIPTORstruct NETWORK_ADDRESS
{
ushort AddressLength;
ushort AddressType;
ubyte[1] Address;
}
struct NETWORK_ADDRESS_LIST
{
int AddressCount;
ushort AddressType;
NETWORK_ADDRESS[1] Address;
}
struct ADDRESS_LIST_DESCRIPTOR
{
uint MediaType;
NETWORK_ADDRESS_LIST AddressList;
}
struct TC_IFC_DESCRIPTOR
{
uint Length;
void* pInterfaceName;
void* pInterfaceID;
ADDRESS_LIST_DESCRIPTOR AddressListDesc;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; TC_IFC_DESCRIPTOR サイズ: 28 バイト(x86)
dim st, 7 ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; Length : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; pInterfaceName : LPWSTR (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; pInterfaceID : LPWSTR (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; AddressListDesc : ADDRESS_LIST_DESCRIPTOR (+12, 16byte) varptr(st)+12 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; TC_IFC_DESCRIPTOR サイズ: 40 バイト(x64)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; Length : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; pInterfaceName : LPWSTR (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; pInterfaceID : LPWSTR (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; AddressListDesc : ADDRESS_LIST_DESCRIPTOR (+24, 16byte) varptr(st)+24 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global NETWORK_ADDRESS
#field short AddressLength
#field short AddressType
#field byte Address 1
#endstruct
#defstruct global NETWORK_ADDRESS_LIST
#field int AddressCount
#field short AddressType
#field NETWORK_ADDRESS Address 1
#endstruct
#defstruct global ADDRESS_LIST_DESCRIPTOR
#field int MediaType
#field NETWORK_ADDRESS_LIST AddressList
#endstruct
#defstruct global TC_IFC_DESCRIPTOR
#field int Length
#field intptr pInterfaceName
#field intptr pInterfaceID
#field ADDRESS_LIST_DESCRIPTOR AddressListDesc
#endstruct
stdim st, TC_IFC_DESCRIPTOR ; NSTRUCT 変数を確保
st->Length = 100
mes "Length=" + st->Length