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

IMAGE_FUNCTION_ENTRY64

構造体
サイズx64: 24 バイト / x86: 24 バイトパッキング4

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

フィールド

フィールドサイズx64x86説明
StartingAddressULONGLONG8+0+0関数の開始アドレス(64ビット)。
EndingAddressULONGLONG8+8+8関数の終了アドレス(64ビット)。
Anonymous_Anonymous_e__Union8+16+16プロローグ終了位置またはアンワインド情報を格納する共用体。

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

フィールドサイズx64x86
EndOfPrologueULONGLONG8+0+0
UnwindInfoAddressULONGLONG8+0+0

各言語での定義

#include <windows.h>

// IMAGE_FUNCTION_ENTRY64  (x64 24 / x86 24 バイト)
#pragma pack(push, 4)
typedef struct IMAGE_FUNCTION_ENTRY64 {
    ULONGLONG StartingAddress;
    ULONGLONG EndingAddress;
    _Anonymous_e__Union Anonymous;
} IMAGE_FUNCTION_ENTRY64;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 4, CharSet = CharSet.Unicode)]
public struct IMAGE_FUNCTION_ENTRY64
{
    public ulong StartingAddress;
    public ulong EndingAddress;
    public _Anonymous_e__Union Anonymous;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=4, CharSet:=CharSet.Unicode)>
Public Structure IMAGE_FUNCTION_ENTRY64
    Public StartingAddress As ULong
    Public EndingAddress As ULong
    Public Anonymous As _Anonymous_e__Union
End Structure
import ctypes
from ctypes import wintypes

class IMAGE_FUNCTION_ENTRY64(ctypes.Structure):
    _pack_ = 4
    _fields_ = [
        ("StartingAddress", ctypes.c_ulonglong),
        ("EndingAddress", ctypes.c_ulonglong),
        ("Anonymous", _Anonymous_e__Union),
    ]
#[repr(C, packed(4))]
pub struct IMAGE_FUNCTION_ENTRY64 {
    pub StartingAddress: u64,
    pub EndingAddress: u64,
    pub Anonymous: _Anonymous_e__Union,
}
import "golang.org/x/sys/windows"

type IMAGE_FUNCTION_ENTRY64 struct {
	StartingAddress uint64
	EndingAddress uint64
	Anonymous _Anonymous_e__Union
}
type
  IMAGE_FUNCTION_ENTRY64 = packed record
    StartingAddress: UInt64;
    EndingAddress: UInt64;
    Anonymous: _Anonymous_e__Union;
  end;
const IMAGE_FUNCTION_ENTRY64 = extern struct {
    StartingAddress: u64,
    EndingAddress: u64,
    Anonymous: _Anonymous_e__Union,
};
type
  IMAGE_FUNCTION_ENTRY64 {.packed.} = object
    StartingAddress: uint64
    EndingAddress: uint64
    Anonymous: _Anonymous_e__Union
align(4)
struct IMAGE_FUNCTION_ENTRY64
{
    ulong StartingAddress;
    ulong EndingAddress;
    _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_FUNCTION_ENTRY64 サイズ: 24 バイト(x64)
dim st, 6    ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; StartingAddress : ULONGLONG (+0, 8byte)  qpoke st,0,値 / qpeek(st,0)  ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; EndingAddress : ULONGLONG (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; Anonymous : _Anonymous_e__Union (+16, 8byte)  varptr(st)+16 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global IMAGE_FUNCTION_ENTRY64, pack=4
    #field int64 StartingAddress
    #field int64 EndingAddress
    #field byte Anonymous 8
#endstruct

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