ホーム › System.Diagnostics.Debug › SRCCODEINFOW
SRCCODEINFOW
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| SizeOfStruct | DWORD | 4 | +0 | +0 | この構造体のバイトサイズを示す。 |
| Key | void* | 8/4 | +8 | +4 | 内部使用の予約ポインタ。アプリは変更しない。 |
| ModBase | ULONGLONG | 8 | +16 | +8 | 対象モジュールのベースアドレスを示す。 |
| Obj | WCHAR | 522 | +24 | +16 | オブジェクトファイル名を示すワイド文字配列。 |
| FileName | WCHAR | 522 | +546 | +538 | ソースファイル名を示すワイド文字配列。 |
| LineNumber | DWORD | 4 | +1068 | +1060 | ソースコードの行番号を示す。 |
| Address | ULONGLONG | 8 | +1072 | +1064 | この行に対応する命令の仮想アドレスを示す。 |
各言語での定義
#include <windows.h>
// SRCCODEINFOW (x64 1080 / x86 1072 バイト)
typedef struct SRCCODEINFOW {
DWORD SizeOfStruct;
void* Key;
ULONGLONG ModBase;
WCHAR Obj[261];
WCHAR FileName[261];
DWORD LineNumber;
ULONGLONG Address;
} SRCCODEINFOW;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SRCCODEINFOW
{
public uint SizeOfStruct;
public IntPtr Key;
public ulong ModBase;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 261)] public string Obj;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 261)] public string FileName;
public uint LineNumber;
public ulong Address;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SRCCODEINFOW
Public SizeOfStruct As UInteger
Public Key As IntPtr
Public ModBase As ULong
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=261)> Public Obj As String
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=261)> Public FileName As String
Public LineNumber As UInteger
Public Address As ULong
End Structureimport ctypes
from ctypes import wintypes
class SRCCODEINFOW(ctypes.Structure):
_fields_ = [
("SizeOfStruct", wintypes.DWORD),
("Key", ctypes.c_void_p),
("ModBase", ctypes.c_ulonglong),
("Obj", ctypes.c_wchar * 261),
("FileName", ctypes.c_wchar * 261),
("LineNumber", wintypes.DWORD),
("Address", ctypes.c_ulonglong),
]#[repr(C)]
pub struct SRCCODEINFOW {
pub SizeOfStruct: u32,
pub Key: *mut core::ffi::c_void,
pub ModBase: u64,
pub Obj: [u16; 261],
pub FileName: [u16; 261],
pub LineNumber: u32,
pub Address: u64,
}import "golang.org/x/sys/windows"
type SRCCODEINFOW struct {
SizeOfStruct uint32
Key uintptr
ModBase uint64
Obj [261]uint16
FileName [261]uint16
LineNumber uint32
Address uint64
}type
SRCCODEINFOW = record
SizeOfStruct: DWORD;
Key: Pointer;
ModBase: UInt64;
Obj: array[0..260] of WideChar;
FileName: array[0..260] of WideChar;
LineNumber: DWORD;
Address: UInt64;
end;const SRCCODEINFOW = extern struct {
SizeOfStruct: u32,
Key: ?*anyopaque,
ModBase: u64,
Obj: [261]u16,
FileName: [261]u16,
LineNumber: u32,
Address: u64,
};type
SRCCODEINFOW {.bycopy.} = object
SizeOfStruct: uint32
Key: pointer
ModBase: uint64
Obj: array[261, uint16]
FileName: array[261, uint16]
LineNumber: uint32
Address: uint64struct SRCCODEINFOW
{
uint SizeOfStruct;
void* Key;
ulong ModBase;
wchar[261] Obj;
wchar[261] FileName;
uint LineNumber;
ulong Address;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; SRCCODEINFOW サイズ: 1072 バイト(x86)
dim st, 268 ; 4byte整数×268(構造体サイズ 1072 / 4 切り上げ)
; SizeOfStruct : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; Key : void* (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; ModBase : ULONGLONG (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; Obj : WCHAR (+16, 522byte) varptr(st)+16 を基点に操作(522byte:入れ子/配列)
; FileName : WCHAR (+538, 522byte) varptr(st)+538 を基点に操作(522byte:入れ子/配列)
; LineNumber : DWORD (+1060, 4byte) st.265 = 値 / 値 = st.265 (lpoke/lpeek も可)
; Address : ULONGLONG (+1064, 8byte) qpoke st,1064,値 / qpeek(st,1064) ※IronHSPのみ。3.7/3.8は lpoke st,1064,下位 : lpoke st,1068,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SRCCODEINFOW サイズ: 1080 バイト(x64)
dim st, 270 ; 4byte整数×270(構造体サイズ 1080 / 4 切り上げ)
; SizeOfStruct : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; Key : void* (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; ModBase : ULONGLONG (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; Obj : WCHAR (+24, 522byte) varptr(st)+24 を基点に操作(522byte:入れ子/配列)
; FileName : WCHAR (+546, 522byte) varptr(st)+546 を基点に操作(522byte:入れ子/配列)
; LineNumber : DWORD (+1068, 4byte) st.267 = 値 / 値 = st.267 (lpoke/lpeek も可)
; Address : ULONGLONG (+1072, 8byte) qpoke st,1072,値 / qpeek(st,1072) ※IronHSPのみ。3.7/3.8は lpoke st,1072,下位 : lpoke st,1076,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SRCCODEINFOW
#field int SizeOfStruct
#field intptr Key
#field int64 ModBase
#field wchar Obj 261
#field wchar FileName 261
#field int LineNumber
#field int64 Address
#endstruct
stdim st, SRCCODEINFOW ; NSTRUCT 変数を確保
st->SizeOfStruct = 100
mes "SizeOfStruct=" + st->SizeOfStruct