ホーム › NetworkManagement.Ndis › NETWORK_ADDRESS_LIST
NETWORK_ADDRESS_LIST
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| AddressCount | INT | 4 | +0 | +0 | リストに含まれるアドレスの数。 |
| AddressType | WORD | 2 | +4 | +4 | リスト内アドレスの種別を示す。 |
| Address | NETWORK_ADDRESS | 6 | +6 | +6 | ネットワークアドレスを格納する可変長配列の先頭要素。 |
各言語での定義
#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;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;
}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 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),
]#[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],
}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
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;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,
};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]struct NETWORK_ADDRESS
{
ushort AddressLength;
ushort AddressType;
ubyte[1] Address;
}
struct NETWORK_ADDRESS_LIST
{
int AddressCount;
ushort AddressType;
NETWORK_ADDRESS[1] Address;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NETWORK_ADDRESS_LIST サイズ: 12 バイト(x64)
dim st, 3 ; 4byte整数×3(構造体サイズ 12 / 4 切り上げ)
; AddressCount : INT (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; AddressType : WORD (+4, 2byte) wpoke st,4,値 / 値 = wpeek(st,4)
; Address : NETWORK_ADDRESS (+6, 6byte) varptr(st)+6 を基点に操作(6byte:入れ子/配列)
; ※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
stdim st, NETWORK_ADDRESS_LIST ; NSTRUCT 変数を確保
st->AddressCount = 100
mes "AddressCount=" + st->AddressCount