ホーム › System.Performance › PERF_INSTANCE_DEFINITION
PERF_INSTANCE_DEFINITION
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| ByteLength | DWORD | 4 | +0 | +0 | このインスタンス定義構造体のバイト長である。 |
| ParentObjectTitleIndex | DWORD | 4 | +4 | +4 | 親オブジェクトの名前タイトルインデックスである。0で親無し。 |
| ParentObjectInstance | DWORD | 4 | +8 | +8 | 親オブジェクト内での親インスタンスのインデックスである。 |
| UniqueID | INT | 4 | +12 | +12 | インスタンスを一意に識別するID(名前で識別する場合はPERF_NO_UNIQUE_ID)である。 |
| NameOffset | DWORD | 4 | +16 | +16 | 構造体先頭からインスタンス名文字列までのオフセットである。 |
| NameLength | DWORD | 4 | +20 | +20 | インスタンス名のバイト長(終端含む)である。 |
各言語での定義
#include <windows.h>
// PERF_INSTANCE_DEFINITION (x64 24 / x86 24 バイト)
typedef struct PERF_INSTANCE_DEFINITION {
DWORD ByteLength;
DWORD ParentObjectTitleIndex;
DWORD ParentObjectInstance;
INT UniqueID;
DWORD NameOffset;
DWORD NameLength;
} PERF_INSTANCE_DEFINITION;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PERF_INSTANCE_DEFINITION
{
public uint ByteLength;
public uint ParentObjectTitleIndex;
public uint ParentObjectInstance;
public int UniqueID;
public uint NameOffset;
public uint NameLength;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PERF_INSTANCE_DEFINITION
Public ByteLength As UInteger
Public ParentObjectTitleIndex As UInteger
Public ParentObjectInstance As UInteger
Public UniqueID As Integer
Public NameOffset As UInteger
Public NameLength As UInteger
End Structureimport ctypes
from ctypes import wintypes
class PERF_INSTANCE_DEFINITION(ctypes.Structure):
_fields_ = [
("ByteLength", wintypes.DWORD),
("ParentObjectTitleIndex", wintypes.DWORD),
("ParentObjectInstance", wintypes.DWORD),
("UniqueID", ctypes.c_int),
("NameOffset", wintypes.DWORD),
("NameLength", wintypes.DWORD),
]#[repr(C)]
pub struct PERF_INSTANCE_DEFINITION {
pub ByteLength: u32,
pub ParentObjectTitleIndex: u32,
pub ParentObjectInstance: u32,
pub UniqueID: i32,
pub NameOffset: u32,
pub NameLength: u32,
}import "golang.org/x/sys/windows"
type PERF_INSTANCE_DEFINITION struct {
ByteLength uint32
ParentObjectTitleIndex uint32
ParentObjectInstance uint32
UniqueID int32
NameOffset uint32
NameLength uint32
}type
PERF_INSTANCE_DEFINITION = record
ByteLength: DWORD;
ParentObjectTitleIndex: DWORD;
ParentObjectInstance: DWORD;
UniqueID: Integer;
NameOffset: DWORD;
NameLength: DWORD;
end;const PERF_INSTANCE_DEFINITION = extern struct {
ByteLength: u32,
ParentObjectTitleIndex: u32,
ParentObjectInstance: u32,
UniqueID: i32,
NameOffset: u32,
NameLength: u32,
};type
PERF_INSTANCE_DEFINITION {.bycopy.} = object
ByteLength: uint32
ParentObjectTitleIndex: uint32
ParentObjectInstance: uint32
UniqueID: int32
NameOffset: uint32
NameLength: uint32struct PERF_INSTANCE_DEFINITION
{
uint ByteLength;
uint ParentObjectTitleIndex;
uint ParentObjectInstance;
int UniqueID;
uint NameOffset;
uint NameLength;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; PERF_INSTANCE_DEFINITION サイズ: 24 バイト(x64)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; ByteLength : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; ParentObjectTitleIndex : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; ParentObjectInstance : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; UniqueID : INT (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; NameOffset : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; NameLength : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global PERF_INSTANCE_DEFINITION
#field int ByteLength
#field int ParentObjectTitleIndex
#field int ParentObjectInstance
#field int UniqueID
#field int NameOffset
#field int NameLength
#endstruct
stdim st, PERF_INSTANCE_DEFINITION ; NSTRUCT 変数を確保
st->ByteLength = 100
mes "ByteLength=" + st->ByteLength