Win32 API 日本語リファレンス
ホームSystem.Diagnostics.Etw › PROFILE_SOURCE_INFO

PROFILE_SOURCE_INFO

構造体
サイズx64: 32 バイト / x86: 32 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
NextEntryOffsetDWORD4+0+0次のエントリへのバイトオフセット。0で末尾。
SourceDWORD4+4+4プロファイルソースの識別子。
MinIntervalDWORD4+8+8サンプリング間隔の最小値。
MaxIntervalDWORD4+12+12サンプリング間隔の最大値。
ReservedULONGLONG8+16+16予約フィールド。0であること。
DescriptionWCHAR2+24+24ソースを説明するワイド文字列の先頭。可変長。

各言語での定義

#include <windows.h>

// PROFILE_SOURCE_INFO  (x64 32 / x86 32 バイト)
typedef struct PROFILE_SOURCE_INFO {
    DWORD NextEntryOffset;
    DWORD Source;
    DWORD MinInterval;
    DWORD MaxInterval;
    ULONGLONG Reserved;
    WCHAR Description[1];
} PROFILE_SOURCE_INFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PROFILE_SOURCE_INFO
{
    public uint NextEntryOffset;
    public uint Source;
    public uint MinInterval;
    public uint MaxInterval;
    public ulong Reserved;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1)] public string Description;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PROFILE_SOURCE_INFO
    Public NextEntryOffset As UInteger
    Public Source As UInteger
    Public MinInterval As UInteger
    Public MaxInterval As UInteger
    Public Reserved As ULong
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=1)> Public Description As String
End Structure
import ctypes
from ctypes import wintypes

class PROFILE_SOURCE_INFO(ctypes.Structure):
    _fields_ = [
        ("NextEntryOffset", wintypes.DWORD),
        ("Source", wintypes.DWORD),
        ("MinInterval", wintypes.DWORD),
        ("MaxInterval", wintypes.DWORD),
        ("Reserved", ctypes.c_ulonglong),
        ("Description", ctypes.c_wchar * 1),
    ]
#[repr(C)]
pub struct PROFILE_SOURCE_INFO {
    pub NextEntryOffset: u32,
    pub Source: u32,
    pub MinInterval: u32,
    pub MaxInterval: u32,
    pub Reserved: u64,
    pub Description: [u16; 1],
}
import "golang.org/x/sys/windows"

type PROFILE_SOURCE_INFO struct {
	NextEntryOffset uint32
	Source uint32
	MinInterval uint32
	MaxInterval uint32
	Reserved uint64
	Description [1]uint16
}
type
  PROFILE_SOURCE_INFO = record
    NextEntryOffset: DWORD;
    Source: DWORD;
    MinInterval: DWORD;
    MaxInterval: DWORD;
    Reserved: UInt64;
    Description: array[0..0] of WideChar;
  end;
const PROFILE_SOURCE_INFO = extern struct {
    NextEntryOffset: u32,
    Source: u32,
    MinInterval: u32,
    MaxInterval: u32,
    Reserved: u64,
    Description: [1]u16,
};
type
  PROFILE_SOURCE_INFO {.bycopy.} = object
    NextEntryOffset: uint32
    Source: uint32
    MinInterval: uint32
    MaxInterval: uint32
    Reserved: uint64
    Description: array[1, uint16]
struct PROFILE_SOURCE_INFO
{
    uint NextEntryOffset;
    uint Source;
    uint MinInterval;
    uint MaxInterval;
    ulong Reserved;
    wchar[1] Description;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; PROFILE_SOURCE_INFO サイズ: 32 バイト(x64)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; NextEntryOffset : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Source : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; MinInterval : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; MaxInterval : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; Reserved : ULONGLONG (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; Description : WCHAR (+24, 2byte)  varptr(st)+24 を基点に操作(2byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global PROFILE_SOURCE_INFO
    #field int NextEntryOffset
    #field int Source
    #field int MinInterval
    #field int MaxInterval
    #field int64 Reserved
    #field wchar Description 1
#endstruct

stdim st, PROFILE_SOURCE_INFO        ; NSTRUCT 変数を確保
st->NextEntryOffset = 100
mes "NextEntryOffset=" + st->NextEntryOffset