ホーム › NetworkManagement.QoS › ADDRESS_LIST_DESCRIPTOR
ADDRESS_LIST_DESCRIPTOR
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| MediaType | DWORD | 4 | +0 | +0 | アドレスリストが対応するメディア種別を示す値。 |
| AddressList | NETWORK_ADDRESS_LIST | 12 | +4 | +4 | ネットワークアドレスのリストを示すNETWORK_ADDRESS_LIST構造体。 |
各言語での定義
#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;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;
}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 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),
]#[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,
}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
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;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,
};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_LISTstruct 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;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; ADDRESS_LIST_DESCRIPTOR サイズ: 16 バイト(x64)
dim st, 4 ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; MediaType : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; AddressList : NETWORK_ADDRESS_LIST (+4, 12byte) varptr(st)+4 を基点に操作(12byte:入れ子/配列)
; ※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
stdim st, ADDRESS_LIST_DESCRIPTOR ; NSTRUCT 変数を確保
st->MediaType = 100
mes "MediaType=" + st->MediaType