ホーム › NetworkManagement.NetworkDiagnosticsFramework › HELPER_ATTRIBUTE
HELPER_ATTRIBUTE
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| pwszName | LPWSTR | 8/4 | +0 | +0 | ヘルパー属性の名前を表す文字列へのポインタ。 |
| type | ATTRIBUTE_TYPE | 4 | +8 | +4 | 属性値のデータ型を示す列挙値(ATTRIBUTE_TYPE)。 |
| Anonymous | _Anonymous_e__Union | 128 | +16 | +8 | 属性値を型に応じて保持する無名共用体。 |
共用体: _Anonymous_e__Union x64 128B / x86 128B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| Boolean | BOOL | 4 | +0 | +0 |
| Char | BYTE | 1 | +0 | +0 |
| Byte | BYTE | 1 | +0 | +0 |
| Short | SHORT | 2 | +0 | +0 |
| Word | WORD | 2 | +0 | +0 |
| Int | INT | 4 | +0 | +0 |
| DWord | DWORD | 4 | +0 | +0 |
| Int64 | LONGLONG | 8 | +0 | +0 |
| UInt64 | ULONGLONG | 8 | +0 | +0 |
| PWStr | LPWSTR | 8/4 | +0 | +0 |
| Guid | GUID | 16 | +0 | +0 |
| LifeTime | LIFE_TIME | 16 | +0 | +0 |
| Address | DIAG_SOCKADDR | 128 | +0 | +0 |
| OctetString | OCTET_STRING | 16/8 | +0 | +0 |
各言語での定義
#include <windows.h>
// HELPER_ATTRIBUTE (x64 144 / x86 136 バイト)
typedef struct HELPER_ATTRIBUTE {
LPWSTR pwszName;
ATTRIBUTE_TYPE type;
_Anonymous_e__Union Anonymous;
} HELPER_ATTRIBUTE;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct HELPER_ATTRIBUTE
{
public IntPtr pwszName;
public int type;
public _Anonymous_e__Union Anonymous;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure HELPER_ATTRIBUTE
Public pwszName As IntPtr
Public type As Integer
Public Anonymous As _Anonymous_e__Union
End Structureimport ctypes
from ctypes import wintypes
class HELPER_ATTRIBUTE(ctypes.Structure):
_fields_ = [
("pwszName", ctypes.c_void_p),
("type", ctypes.c_int),
("Anonymous", _Anonymous_e__Union),
]#[repr(C)]
pub struct HELPER_ATTRIBUTE {
pub pwszName: *mut core::ffi::c_void,
pub type: i32,
pub Anonymous: _Anonymous_e__Union,
}import "golang.org/x/sys/windows"
type HELPER_ATTRIBUTE struct {
pwszName uintptr
type int32
Anonymous _Anonymous_e__Union
}type
HELPER_ATTRIBUTE = record
pwszName: Pointer;
type: Integer;
Anonymous: _Anonymous_e__Union;
end;const HELPER_ATTRIBUTE = extern struct {
pwszName: ?*anyopaque,
type: i32,
Anonymous: _Anonymous_e__Union,
};type
HELPER_ATTRIBUTE {.bycopy.} = object
pwszName: pointer
type: int32
Anonymous: _Anonymous_e__Unionstruct HELPER_ATTRIBUTE
{
void* pwszName;
int type;
_Anonymous_e__Union Anonymous;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; HELPER_ATTRIBUTE サイズ: 136 バイト(x86)
dim st, 34 ; 4byte整数×34(構造体サイズ 136 / 4 切り上げ)
; pwszName : LPWSTR (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; type : ATTRIBUTE_TYPE (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; Anonymous : _Anonymous_e__Union (+8, 128byte) varptr(st)+8 を基点に操作(128byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; HELPER_ATTRIBUTE サイズ: 144 バイト(x64)
dim st, 36 ; 4byte整数×36(構造体サイズ 144 / 4 切り上げ)
; pwszName : LPWSTR (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; type : ATTRIBUTE_TYPE (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; Anonymous : _Anonymous_e__Union (+16, 128byte) varptr(st)+16 を基点に操作(128byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global HELPER_ATTRIBUTE
#field intptr pwszName
#field int type
#field byte Anonymous 128
#endstruct
stdim st, HELPER_ATTRIBUTE ; NSTRUCT 変数を確保
st->type = 100
mes "type=" + st->type
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。