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

STACK_SRC_INFO

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

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

フィールド

フィールドサイズx64x86説明
ImagePathLPWSTR8/4+0+0モジュールのイメージファイルパス(ワイド文字列)。
ModuleNameLPWSTR8/4+8+4モジュール名(ワイド文字列)。
FunctionLPWSTR8/4+16+8関数名(ワイド文字列)。
DisplacementDWORD4+24+12関数先頭からの変位(バイト)。
RowDWORD4+28+16対応するソースコードの行番号。
ColumnDWORD4+32+20対応するソースコードの列番号。

各言語での定義

#include <windows.h>

// STACK_SRC_INFO  (x64 40 / x86 24 バイト)
typedef struct STACK_SRC_INFO {
    LPWSTR ImagePath;
    LPWSTR ModuleName;
    LPWSTR Function;
    DWORD Displacement;
    DWORD Row;
    DWORD Column;
} STACK_SRC_INFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct STACK_SRC_INFO
{
    public IntPtr ImagePath;
    public IntPtr ModuleName;
    public IntPtr Function;
    public uint Displacement;
    public uint Row;
    public uint Column;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure STACK_SRC_INFO
    Public ImagePath As IntPtr
    Public ModuleName As IntPtr
    Public Function As IntPtr
    Public Displacement As UInteger
    Public Row As UInteger
    Public Column As UInteger
End Structure
import ctypes
from ctypes import wintypes

class STACK_SRC_INFO(ctypes.Structure):
    _fields_ = [
        ("ImagePath", ctypes.c_void_p),
        ("ModuleName", ctypes.c_void_p),
        ("Function", ctypes.c_void_p),
        ("Displacement", wintypes.DWORD),
        ("Row", wintypes.DWORD),
        ("Column", wintypes.DWORD),
    ]
#[repr(C)]
pub struct STACK_SRC_INFO {
    pub ImagePath: *mut core::ffi::c_void,
    pub ModuleName: *mut core::ffi::c_void,
    pub Function: *mut core::ffi::c_void,
    pub Displacement: u32,
    pub Row: u32,
    pub Column: u32,
}
import "golang.org/x/sys/windows"

type STACK_SRC_INFO struct {
	ImagePath uintptr
	ModuleName uintptr
	Function uintptr
	Displacement uint32
	Row uint32
	Column uint32
}
type
  STACK_SRC_INFO = record
    ImagePath: Pointer;
    ModuleName: Pointer;
    Function: Pointer;
    Displacement: DWORD;
    Row: DWORD;
    Column: DWORD;
  end;
const STACK_SRC_INFO = extern struct {
    ImagePath: ?*anyopaque,
    ModuleName: ?*anyopaque,
    Function: ?*anyopaque,
    Displacement: u32,
    Row: u32,
    Column: u32,
};
type
  STACK_SRC_INFO {.bycopy.} = object
    ImagePath: pointer
    ModuleName: pointer
    Function: pointer
    Displacement: uint32
    Row: uint32
    Column: uint32
struct STACK_SRC_INFO
{
    void* ImagePath;
    void* ModuleName;
    void* Function;
    uint Displacement;
    uint Row;
    uint Column;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; STACK_SRC_INFO サイズ: 24 バイト(x86)
dim st, 6    ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; ImagePath : LPWSTR (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; ModuleName : LPWSTR (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; Function : LPWSTR (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; Displacement : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; Row : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; Column : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; STACK_SRC_INFO サイズ: 40 バイト(x64)
dim st, 10    ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; ImagePath : LPWSTR (+0, 8byte)  qpoke st,0,値 / qpeek(st,0)  ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; ModuleName : LPWSTR (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; Function : LPWSTR (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; Displacement : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; Row : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; Column : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global STACK_SRC_INFO
    #field intptr ImagePath
    #field intptr ModuleName
    #field intptr Function
    #field int Displacement
    #field int Row
    #field int Column
#endstruct

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