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

COR_PRF_FUNCTION_ARGUMENT_INFO

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

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

フィールド

フィールドサイズx64x86説明
numRangesDWORD4+0+0ranges配列に含まれる引数範囲の個数。
totalArgumentSizeDWORD4+4+4全引数の合計バイトサイズ。
rangesCOR_PRF_FUNCTION_ARGUMENT_RANGE16/8+8+8引数範囲の先頭(COR_PRF_FUNCTION_ARGUMENT_RANGE)。可変長配列が続く。

各言語での定義

#include <windows.h>

// COR_PRF_FUNCTION_ARGUMENT_RANGE  (x64 16 / x86 8 バイト)
typedef struct COR_PRF_FUNCTION_ARGUMENT_RANGE {
    UINT_PTR startAddress;
    DWORD length;
} COR_PRF_FUNCTION_ARGUMENT_RANGE;

// COR_PRF_FUNCTION_ARGUMENT_INFO  (x64 24 / x86 16 バイト)
typedef struct COR_PRF_FUNCTION_ARGUMENT_INFO {
    DWORD numRanges;
    DWORD totalArgumentSize;
    COR_PRF_FUNCTION_ARGUMENT_RANGE ranges[1];
} COR_PRF_FUNCTION_ARGUMENT_INFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct COR_PRF_FUNCTION_ARGUMENT_RANGE
{
    public UIntPtr startAddress;
    public uint length;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct COR_PRF_FUNCTION_ARGUMENT_INFO
{
    public uint numRanges;
    public uint totalArgumentSize;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public COR_PRF_FUNCTION_ARGUMENT_RANGE[] ranges;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure COR_PRF_FUNCTION_ARGUMENT_RANGE
    Public startAddress As UIntPtr
    Public length As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure COR_PRF_FUNCTION_ARGUMENT_INFO
    Public numRanges As UInteger
    Public totalArgumentSize As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public ranges() As COR_PRF_FUNCTION_ARGUMENT_RANGE
End Structure
import ctypes
from ctypes import wintypes

class COR_PRF_FUNCTION_ARGUMENT_RANGE(ctypes.Structure):
    _fields_ = [
        ("startAddress", ctypes.c_size_t),
        ("length", wintypes.DWORD),
    ]

class COR_PRF_FUNCTION_ARGUMENT_INFO(ctypes.Structure):
    _fields_ = [
        ("numRanges", wintypes.DWORD),
        ("totalArgumentSize", wintypes.DWORD),
        ("ranges", COR_PRF_FUNCTION_ARGUMENT_RANGE * 1),
    ]
#[repr(C)]
pub struct COR_PRF_FUNCTION_ARGUMENT_RANGE {
    pub startAddress: usize,
    pub length: u32,
}

#[repr(C)]
pub struct COR_PRF_FUNCTION_ARGUMENT_INFO {
    pub numRanges: u32,
    pub totalArgumentSize: u32,
    pub ranges: [COR_PRF_FUNCTION_ARGUMENT_RANGE; 1],
}
import "golang.org/x/sys/windows"

type COR_PRF_FUNCTION_ARGUMENT_RANGE struct {
	startAddress uintptr
	length uint32
}

type COR_PRF_FUNCTION_ARGUMENT_INFO struct {
	numRanges uint32
	totalArgumentSize uint32
	ranges [1]COR_PRF_FUNCTION_ARGUMENT_RANGE
}
type
  COR_PRF_FUNCTION_ARGUMENT_RANGE = record
    startAddress: NativeUInt;
    length: DWORD;
  end;

  COR_PRF_FUNCTION_ARGUMENT_INFO = record
    numRanges: DWORD;
    totalArgumentSize: DWORD;
    ranges: array[0..0] of COR_PRF_FUNCTION_ARGUMENT_RANGE;
  end;
const COR_PRF_FUNCTION_ARGUMENT_RANGE = extern struct {
    startAddress: usize,
    length: u32,
};

const COR_PRF_FUNCTION_ARGUMENT_INFO = extern struct {
    numRanges: u32,
    totalArgumentSize: u32,
    ranges: [1]COR_PRF_FUNCTION_ARGUMENT_RANGE,
};
type
  COR_PRF_FUNCTION_ARGUMENT_RANGE {.bycopy.} = object
    startAddress: uint
    length: uint32

  COR_PRF_FUNCTION_ARGUMENT_INFO {.bycopy.} = object
    numRanges: uint32
    totalArgumentSize: uint32
    ranges: array[1, COR_PRF_FUNCTION_ARGUMENT_RANGE]
struct COR_PRF_FUNCTION_ARGUMENT_RANGE
{
    size_t startAddress;
    uint length;
}

struct COR_PRF_FUNCTION_ARGUMENT_INFO
{
    uint numRanges;
    uint totalArgumentSize;
    COR_PRF_FUNCTION_ARGUMENT_RANGE[1] ranges;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; COR_PRF_FUNCTION_ARGUMENT_INFO サイズ: 16 バイト(x86)
dim st, 4    ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; numRanges : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; totalArgumentSize : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; ranges : COR_PRF_FUNCTION_ARGUMENT_RANGE (+8, 8byte)  varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; COR_PRF_FUNCTION_ARGUMENT_INFO サイズ: 24 バイト(x64)
dim st, 6    ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; numRanges : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; totalArgumentSize : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; ranges : COR_PRF_FUNCTION_ARGUMENT_RANGE (+8, 16byte)  varptr(st)+8 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global COR_PRF_FUNCTION_ARGUMENT_RANGE
    #field intptr startAddress
    #field int length
#endstruct

#defstruct global COR_PRF_FUNCTION_ARGUMENT_INFO
    #field int numRanges
    #field int totalArgumentSize
    #field COR_PRF_FUNCTION_ARGUMENT_RANGE ranges 1
#endstruct

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