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

IMAGE_RUNTIME_FUNCTION_ENTRY

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

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

フィールド

フィールドサイズx64x86説明
BeginAddressDWORD4+0+0関数開始位置のRVA。
EndAddressDWORD4+4+4関数終了位置のRVA。
Anonymous_Anonymous_e__Union4+8+8アンワインド情報のRVA等を格納する共用体。

共用体: _Anonymous_e__Union x64 4B / x86 4B

フィールドサイズx64x86
UnwindInfoAddressDWORD4+0+0
UnwindDataDWORD4+0+0

各言語での定義

#include <windows.h>

// IMAGE_RUNTIME_FUNCTION_ENTRY  (x64 12 / x86 12 バイト)
typedef struct IMAGE_RUNTIME_FUNCTION_ENTRY {
    DWORD BeginAddress;
    DWORD EndAddress;
    _Anonymous_e__Union Anonymous;
} IMAGE_RUNTIME_FUNCTION_ENTRY;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct IMAGE_RUNTIME_FUNCTION_ENTRY
{
    public uint BeginAddress;
    public uint EndAddress;
    public _Anonymous_e__Union Anonymous;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure IMAGE_RUNTIME_FUNCTION_ENTRY
    Public BeginAddress As UInteger
    Public EndAddress As UInteger
    Public Anonymous As _Anonymous_e__Union
End Structure
import ctypes
from ctypes import wintypes

class IMAGE_RUNTIME_FUNCTION_ENTRY(ctypes.Structure):
    _fields_ = [
        ("BeginAddress", wintypes.DWORD),
        ("EndAddress", wintypes.DWORD),
        ("Anonymous", _Anonymous_e__Union),
    ]
#[repr(C)]
pub struct IMAGE_RUNTIME_FUNCTION_ENTRY {
    pub BeginAddress: u32,
    pub EndAddress: u32,
    pub Anonymous: _Anonymous_e__Union,
}
import "golang.org/x/sys/windows"

type IMAGE_RUNTIME_FUNCTION_ENTRY struct {
	BeginAddress uint32
	EndAddress uint32
	Anonymous _Anonymous_e__Union
}
type
  IMAGE_RUNTIME_FUNCTION_ENTRY = record
    BeginAddress: DWORD;
    EndAddress: DWORD;
    Anonymous: _Anonymous_e__Union;
  end;
const IMAGE_RUNTIME_FUNCTION_ENTRY = extern struct {
    BeginAddress: u32,
    EndAddress: u32,
    Anonymous: _Anonymous_e__Union,
};
type
  IMAGE_RUNTIME_FUNCTION_ENTRY {.bycopy.} = object
    BeginAddress: uint32
    EndAddress: uint32
    Anonymous: _Anonymous_e__Union
struct IMAGE_RUNTIME_FUNCTION_ENTRY
{
    uint BeginAddress;
    uint EndAddress;
    _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整数の配列変数で操作します。(x64 レイアウト)
; IMAGE_RUNTIME_FUNCTION_ENTRY サイズ: 12 バイト(x64)
dim st, 3    ; 4byte整数×3(構造体サイズ 12 / 4 切り上げ)
; BeginAddress : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; EndAddress : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; Anonymous : _Anonymous_e__Union (+8, 4byte)  varptr(st)+8 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global IMAGE_RUNTIME_FUNCTION_ENTRY
    #field int BeginAddress
    #field int EndAddress
    #field byte Anonymous 4
#endstruct

stdim st, IMAGE_RUNTIME_FUNCTION_ENTRY        ; NSTRUCT 変数を確保
st->BeginAddress = 100
mes "BeginAddress=" + st->BeginAddress
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。