Win32 API 日本語リファレンス
ホームNetworkManagement.QoS › TC_SUPPORTED_INFO_BUFFER

TC_SUPPORTED_INFO_BUFFER

構造体
サイズx64: 544 バイト / x86: 544 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
InstanceIDLengthWORD2+0+0InstanceIDの文字数(長さ)。
InstanceIDWCHAR512+2+2インスタンスIDを格納するワイド文字配列の先頭要素。
InterfaceLuidULONGLONG8+520+520インターフェイスを識別するLUID値。
AddrListDescADDRESS_LIST_DESCRIPTOR16+528+528インターフェイスのアドレスリストを示す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_SUPPORTED_INFO_BUFFER  (x64 544 / x86 544 バイト)
typedef struct TC_SUPPORTED_INFO_BUFFER {
    WORD InstanceIDLength;
    WCHAR InstanceID[256];
    ULONGLONG InterfaceLuid;
    ADDRESS_LIST_DESCRIPTOR AddrListDesc;
} TC_SUPPORTED_INFO_BUFFER;
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_SUPPORTED_INFO_BUFFER
{
    public ushort InstanceIDLength;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string InstanceID;
    public ulong InterfaceLuid;
    public ADDRESS_LIST_DESCRIPTOR AddrListDesc;
}
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_SUPPORTED_INFO_BUFFER
    Public InstanceIDLength As UShort
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=256)> Public InstanceID As String
    Public InterfaceLuid As ULong
    Public AddrListDesc As ADDRESS_LIST_DESCRIPTOR
End Structure
import 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_SUPPORTED_INFO_BUFFER(ctypes.Structure):
    _fields_ = [
        ("InstanceIDLength", ctypes.c_ushort),
        ("InstanceID", ctypes.c_wchar * 256),
        ("InterfaceLuid", ctypes.c_ulonglong),
        ("AddrListDesc", 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_SUPPORTED_INFO_BUFFER {
    pub InstanceIDLength: u16,
    pub InstanceID: [u16; 256],
    pub InterfaceLuid: u64,
    pub AddrListDesc: 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_SUPPORTED_INFO_BUFFER struct {
	InstanceIDLength uint16
	InstanceID [256]uint16
	InterfaceLuid uint64
	AddrListDesc 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_SUPPORTED_INFO_BUFFER = record
    InstanceIDLength: Word;
    InstanceID: array[0..255] of WideChar;
    InterfaceLuid: UInt64;
    AddrListDesc: 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_SUPPORTED_INFO_BUFFER = extern struct {
    InstanceIDLength: u16,
    InstanceID: [256]u16,
    InterfaceLuid: u64,
    AddrListDesc: 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_SUPPORTED_INFO_BUFFER {.bycopy.} = object
    InstanceIDLength: uint16
    InstanceID: array[256, uint16]
    InterfaceLuid: uint64
    AddrListDesc: ADDRESS_LIST_DESCRIPTOR
struct 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_SUPPORTED_INFO_BUFFER
{
    ushort InstanceIDLength;
    wchar[256] InstanceID;
    ulong InterfaceLuid;
    ADDRESS_LIST_DESCRIPTOR AddrListDesc;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; TC_SUPPORTED_INFO_BUFFER サイズ: 544 バイト(x64)
dim st, 136    ; 4byte整数×136(構造体サイズ 544 / 4 切り上げ)
; InstanceIDLength : WORD (+0, 2byte)  wpoke st,0,値  /  値 = wpeek(st,0)
; InstanceID : WCHAR (+2, 512byte)  varptr(st)+2 を基点に操作(512byte:入れ子/配列)
; InterfaceLuid : ULONGLONG (+520, 8byte)  qpoke st,520,値 / qpeek(st,520)  ※IronHSPのみ。3.7/3.8は lpoke st,520,下位 : lpoke st,524,上位
; AddrListDesc : ADDRESS_LIST_DESCRIPTOR (+528, 16byte)  varptr(st)+528 を基点に操作(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_SUPPORTED_INFO_BUFFER
    #field short InstanceIDLength
    #field wchar InstanceID 256
    #field int64 InterfaceLuid
    #field ADDRESS_LIST_DESCRIPTOR AddrListDesc
#endstruct

stdim st, TC_SUPPORTED_INFO_BUFFER        ; NSTRUCT 変数を確保
st->InstanceIDLength = 100
mes "InstanceIDLength=" + st->InstanceIDLength