ホーム › NetworkManagement.QoS › ENUMERATION_BUFFER
ENUMERATION_BUFFER
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Length | DWORD | 4 | +0 | +0 | このバッファのバイト長。 |
| OwnerProcessId | DWORD | 4 | +4 | +4 | フローを所有するプロセスのID。 |
| FlowNameLength | WORD | 2 | +8 | +8 | FlowNameの文字数(長さ)。 |
| FlowName | WCHAR | 512 | +10 | +10 | フロー名を格納するワイド文字配列の先頭要素。 |
| pFlow | TC_GEN_FLOW* | 8/4 | +528 | +524 | フロー仕様を示すTC_GEN_FLOWへのポインタ。 |
| NumberOfFilters | DWORD | 4 | +536 | +528 | フローに関連付けられたフィルタの数。 |
| GenericFilter | TC_GEN_FILTER | 24/16 | +544 | +532 | 関連フィルタを示すTC_GEN_FILTER群の先頭要素。 |
各言語での定義
#include <windows.h>
// TC_GEN_FILTER (x64 24 / x86 16 バイト)
typedef struct TC_GEN_FILTER {
WORD AddressType;
DWORD PatternSize;
void* Pattern;
void* Mask;
} TC_GEN_FILTER;
// ENUMERATION_BUFFER (x64 568 / x86 548 バイト)
typedef struct ENUMERATION_BUFFER {
DWORD Length;
DWORD OwnerProcessId;
WORD FlowNameLength;
WCHAR FlowName[256];
TC_GEN_FLOW* pFlow;
DWORD NumberOfFilters;
TC_GEN_FILTER GenericFilter[1];
} ENUMERATION_BUFFER;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct TC_GEN_FILTER
{
public ushort AddressType;
public uint PatternSize;
public IntPtr Pattern;
public IntPtr Mask;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct ENUMERATION_BUFFER
{
public uint Length;
public uint OwnerProcessId;
public ushort FlowNameLength;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string FlowName;
public IntPtr pFlow;
public uint NumberOfFilters;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public TC_GEN_FILTER[] GenericFilter;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure TC_GEN_FILTER
Public AddressType As UShort
Public PatternSize As UInteger
Public Pattern As IntPtr
Public Mask As IntPtr
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure ENUMERATION_BUFFER
Public Length As UInteger
Public OwnerProcessId As UInteger
Public FlowNameLength As UShort
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=256)> Public FlowName As String
Public pFlow As IntPtr
Public NumberOfFilters As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public GenericFilter() As TC_GEN_FILTER
End Structureimport ctypes
from ctypes import wintypes
class TC_GEN_FILTER(ctypes.Structure):
_fields_ = [
("AddressType", ctypes.c_ushort),
("PatternSize", wintypes.DWORD),
("Pattern", ctypes.c_void_p),
("Mask", ctypes.c_void_p),
]
class ENUMERATION_BUFFER(ctypes.Structure):
_fields_ = [
("Length", wintypes.DWORD),
("OwnerProcessId", wintypes.DWORD),
("FlowNameLength", ctypes.c_ushort),
("FlowName", ctypes.c_wchar * 256),
("pFlow", ctypes.c_void_p),
("NumberOfFilters", wintypes.DWORD),
("GenericFilter", TC_GEN_FILTER * 1),
]#[repr(C)]
pub struct TC_GEN_FILTER {
pub AddressType: u16,
pub PatternSize: u32,
pub Pattern: *mut core::ffi::c_void,
pub Mask: *mut core::ffi::c_void,
}
#[repr(C)]
pub struct ENUMERATION_BUFFER {
pub Length: u32,
pub OwnerProcessId: u32,
pub FlowNameLength: u16,
pub FlowName: [u16; 256],
pub pFlow: *mut core::ffi::c_void,
pub NumberOfFilters: u32,
pub GenericFilter: [TC_GEN_FILTER; 1],
}import "golang.org/x/sys/windows"
type TC_GEN_FILTER struct {
AddressType uint16
PatternSize uint32
Pattern uintptr
Mask uintptr
}
type ENUMERATION_BUFFER struct {
Length uint32
OwnerProcessId uint32
FlowNameLength uint16
FlowName [256]uint16
pFlow uintptr
NumberOfFilters uint32
GenericFilter [1]TC_GEN_FILTER
}type
TC_GEN_FILTER = record
AddressType: Word;
PatternSize: DWORD;
Pattern: Pointer;
Mask: Pointer;
end;
ENUMERATION_BUFFER = record
Length: DWORD;
OwnerProcessId: DWORD;
FlowNameLength: Word;
FlowName: array[0..255] of WideChar;
pFlow: Pointer;
NumberOfFilters: DWORD;
GenericFilter: array[0..0] of TC_GEN_FILTER;
end;const TC_GEN_FILTER = extern struct {
AddressType: u16,
PatternSize: u32,
Pattern: ?*anyopaque,
Mask: ?*anyopaque,
};
const ENUMERATION_BUFFER = extern struct {
Length: u32,
OwnerProcessId: u32,
FlowNameLength: u16,
FlowName: [256]u16,
pFlow: ?*anyopaque,
NumberOfFilters: u32,
GenericFilter: [1]TC_GEN_FILTER,
};type
TC_GEN_FILTER {.bycopy.} = object
AddressType: uint16
PatternSize: uint32
Pattern: pointer
Mask: pointer
ENUMERATION_BUFFER {.bycopy.} = object
Length: uint32
OwnerProcessId: uint32
FlowNameLength: uint16
FlowName: array[256, uint16]
pFlow: pointer
NumberOfFilters: uint32
GenericFilter: array[1, TC_GEN_FILTER]struct TC_GEN_FILTER
{
ushort AddressType;
uint PatternSize;
void* Pattern;
void* Mask;
}
struct ENUMERATION_BUFFER
{
uint Length;
uint OwnerProcessId;
ushort FlowNameLength;
wchar[256] FlowName;
void* pFlow;
uint NumberOfFilters;
TC_GEN_FILTER[1] GenericFilter;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; ENUMERATION_BUFFER サイズ: 548 バイト(x86)
dim st, 137 ; 4byte整数×137(構造体サイズ 548 / 4 切り上げ)
; Length : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; OwnerProcessId : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; FlowNameLength : WORD (+8, 2byte) wpoke st,8,値 / 値 = wpeek(st,8)
; FlowName : WCHAR (+10, 512byte) varptr(st)+10 を基点に操作(512byte:入れ子/配列)
; pFlow : TC_GEN_FLOW* (+524, 4byte) varptr(st)+524 を基点に操作(4byte:入れ子/配列)
; NumberOfFilters : DWORD (+528, 4byte) st.132 = 値 / 値 = st.132 (lpoke/lpeek も可)
; GenericFilter : TC_GEN_FILTER (+532, 16byte) varptr(st)+532 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; ENUMERATION_BUFFER サイズ: 568 バイト(x64)
dim st, 142 ; 4byte整数×142(構造体サイズ 568 / 4 切り上げ)
; Length : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; OwnerProcessId : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; FlowNameLength : WORD (+8, 2byte) wpoke st,8,値 / 値 = wpeek(st,8)
; FlowName : WCHAR (+10, 512byte) varptr(st)+10 を基点に操作(512byte:入れ子/配列)
; pFlow : TC_GEN_FLOW* (+528, 8byte) varptr(st)+528 を基点に操作(8byte:入れ子/配列)
; NumberOfFilters : DWORD (+536, 4byte) st.134 = 値 / 値 = st.134 (lpoke/lpeek も可)
; GenericFilter : TC_GEN_FILTER (+544, 24byte) varptr(st)+544 を基点に操作(24byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global TC_GEN_FILTER
#field short AddressType
#field int PatternSize
#field intptr Pattern
#field intptr Mask
#endstruct
#defstruct global ENUMERATION_BUFFER
#field int Length
#field int OwnerProcessId
#field short FlowNameLength
#field wchar FlowName 256
#field intptr pFlow
#field int NumberOfFilters
#field TC_GEN_FILTER GenericFilter 1
#endstruct
stdim st, ENUMERATION_BUFFER ; NSTRUCT 変数を確保
st->Length = 100
mes "Length=" + st->Length