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

SYMBOL_INFOW

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

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

フィールド

フィールドサイズx64x86説明
SizeOfStructDWORD4+0+0この構造体のバイトサイズを示す。呼び出し前に設定する。
TypeIndexDWORD4+4+4シンボルの型インデックスを示す。
ReservedULONGLONG16+8+8予約フィールド配列。使用しない。
IndexDWORD4+24+24シンボルの一意インデックスを示す。
SizeDWORD4+28+28シンボルのバイトサイズを示す。
ModBaseULONGLONG8+32+32シンボルが属するモジュールのベースアドレスを示す。
FlagsSYMBOL_INFO_FLAGS4+40+40シンボルの属性を示すフラグ(SYMBOL_INFO_FLAGS)。
ValueULONGLONG8+48+48定数シンボル等の値を示す。
AddressULONGLONG8+56+56シンボルの仮想アドレスを示す。
RegisterDWORD4+64+64シンボルが格納されるレジスタ番号を示す。
ScopeDWORD4+68+68シンボルのスコープ識別子を示す。
TagDWORD4+72+72シンボルのタグ(SymTag)を示す。
NameLenDWORD4+76+76Name の実際の文字数を示す。
MaxNameLenDWORD4+80+80Name バッファの最大文字数を示す。
NameWCHAR2+84+84シンボル名の先頭文字。可変長のワイド文字列として続く。

各言語での定義

#include <windows.h>

// SYMBOL_INFOW  (x64 88 / x86 88 バイト)
typedef struct SYMBOL_INFOW {
    DWORD SizeOfStruct;
    DWORD TypeIndex;
    ULONGLONG Reserved[2];
    DWORD Index;
    DWORD Size;
    ULONGLONG ModBase;
    SYMBOL_INFO_FLAGS Flags;
    ULONGLONG Value;
    ULONGLONG Address;
    DWORD Register;
    DWORD Scope;
    DWORD Tag;
    DWORD NameLen;
    DWORD MaxNameLen;
    WCHAR Name[1];
} SYMBOL_INFOW;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SYMBOL_INFOW
{
    public uint SizeOfStruct;
    public uint TypeIndex;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public ulong[] Reserved;
    public uint Index;
    public uint Size;
    public ulong ModBase;
    public uint Flags;
    public ulong Value;
    public ulong Address;
    public uint Register;
    public uint Scope;
    public uint Tag;
    public uint NameLen;
    public uint MaxNameLen;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1)] public string Name;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SYMBOL_INFOW
    Public SizeOfStruct As UInteger
    Public TypeIndex As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)> Public Reserved() As ULong
    Public Index As UInteger
    Public Size As UInteger
    Public ModBase As ULong
    Public Flags As UInteger
    Public Value As ULong
    Public Address As ULong
    Public Register As UInteger
    Public Scope As UInteger
    Public Tag As UInteger
    Public NameLen As UInteger
    Public MaxNameLen As UInteger
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=1)> Public Name As String
End Structure
import ctypes
from ctypes import wintypes

class SYMBOL_INFOW(ctypes.Structure):
    _fields_ = [
        ("SizeOfStruct", wintypes.DWORD),
        ("TypeIndex", wintypes.DWORD),
        ("Reserved", ctypes.c_ulonglong * 2),
        ("Index", wintypes.DWORD),
        ("Size", wintypes.DWORD),
        ("ModBase", ctypes.c_ulonglong),
        ("Flags", wintypes.DWORD),
        ("Value", ctypes.c_ulonglong),
        ("Address", ctypes.c_ulonglong),
        ("Register", wintypes.DWORD),
        ("Scope", wintypes.DWORD),
        ("Tag", wintypes.DWORD),
        ("NameLen", wintypes.DWORD),
        ("MaxNameLen", wintypes.DWORD),
        ("Name", ctypes.c_wchar * 1),
    ]
#[repr(C)]
pub struct SYMBOL_INFOW {
    pub SizeOfStruct: u32,
    pub TypeIndex: u32,
    pub Reserved: [u64; 2],
    pub Index: u32,
    pub Size: u32,
    pub ModBase: u64,
    pub Flags: u32,
    pub Value: u64,
    pub Address: u64,
    pub Register: u32,
    pub Scope: u32,
    pub Tag: u32,
    pub NameLen: u32,
    pub MaxNameLen: u32,
    pub Name: [u16; 1],
}
import "golang.org/x/sys/windows"

type SYMBOL_INFOW struct {
	SizeOfStruct uint32
	TypeIndex uint32
	Reserved [2]uint64
	Index uint32
	Size uint32
	ModBase uint64
	Flags uint32
	Value uint64
	Address uint64
	Register uint32
	Scope uint32
	Tag uint32
	NameLen uint32
	MaxNameLen uint32
	Name [1]uint16
}
type
  SYMBOL_INFOW = record
    SizeOfStruct: DWORD;
    TypeIndex: DWORD;
    Reserved: array[0..1] of UInt64;
    Index: DWORD;
    Size: DWORD;
    ModBase: UInt64;
    Flags: DWORD;
    Value: UInt64;
    Address: UInt64;
    Register: DWORD;
    Scope: DWORD;
    Tag: DWORD;
    NameLen: DWORD;
    MaxNameLen: DWORD;
    Name: array[0..0] of WideChar;
  end;
const SYMBOL_INFOW = extern struct {
    SizeOfStruct: u32,
    TypeIndex: u32,
    Reserved: [2]u64,
    Index: u32,
    Size: u32,
    ModBase: u64,
    Flags: u32,
    Value: u64,
    Address: u64,
    Register: u32,
    Scope: u32,
    Tag: u32,
    NameLen: u32,
    MaxNameLen: u32,
    Name: [1]u16,
};
type
  SYMBOL_INFOW {.bycopy.} = object
    SizeOfStruct: uint32
    TypeIndex: uint32
    Reserved: array[2, uint64]
    Index: uint32
    Size: uint32
    ModBase: uint64
    Flags: uint32
    Value: uint64
    Address: uint64
    Register: uint32
    Scope: uint32
    Tag: uint32
    NameLen: uint32
    MaxNameLen: uint32
    Name: array[1, uint16]
struct SYMBOL_INFOW
{
    uint SizeOfStruct;
    uint TypeIndex;
    ulong[2] Reserved;
    uint Index;
    uint Size;
    ulong ModBase;
    uint Flags;
    ulong Value;
    ulong Address;
    uint Register;
    uint Scope;
    uint Tag;
    uint NameLen;
    uint MaxNameLen;
    wchar[1] Name;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SYMBOL_INFOW サイズ: 88 バイト(x64)
dim st, 22    ; 4byte整数×22(構造体サイズ 88 / 4 切り上げ)
; SizeOfStruct : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; TypeIndex : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; Reserved : ULONGLONG (+8, 16byte)  varptr(st)+8 を基点に操作(16byte:入れ子/配列)
; Index : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; Size : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; ModBase : ULONGLONG (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; Flags : SYMBOL_INFO_FLAGS (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; Value : ULONGLONG (+48, 8byte)  qpoke st,48,値 / qpeek(st,48)  ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; Address : ULONGLONG (+56, 8byte)  qpoke st,56,値 / qpeek(st,56)  ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; Register : DWORD (+64, 4byte)  st.16 = 値  /  値 = st.16   (lpoke/lpeek も可)
; Scope : DWORD (+68, 4byte)  st.17 = 値  /  値 = st.17   (lpoke/lpeek も可)
; Tag : DWORD (+72, 4byte)  st.18 = 値  /  値 = st.18   (lpoke/lpeek も可)
; NameLen : DWORD (+76, 4byte)  st.19 = 値  /  値 = st.19   (lpoke/lpeek も可)
; MaxNameLen : DWORD (+80, 4byte)  st.20 = 値  /  値 = st.20   (lpoke/lpeek も可)
; Name : WCHAR (+84, 2byte)  varptr(st)+84 を基点に操作(2byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SYMBOL_INFOW
    #field int SizeOfStruct
    #field int TypeIndex
    #field int64 Reserved 2
    #field int Index
    #field int Size
    #field int64 ModBase
    #field int Flags
    #field int64 Value
    #field int64 Address
    #field int Register
    #field int Scope
    #field int Tag
    #field int NameLen
    #field int MaxNameLen
    #field wchar Name 1
#endstruct

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