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

SYMBOL_INFO_PACKAGEW

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

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

フィールド

フィールドサイズx64x86説明
siSYMBOL_INFOW88+0+0SYMBOL_INFOW 本体を保持する。
nameWCHAR4002+88+88シンボル名格納用の追加ワイド文字バッファ。

各言語での定義

#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;

// SYMBOL_INFO_PACKAGEW  (x64 4096 / x86 4096 バイト)
typedef struct SYMBOL_INFO_PACKAGEW {
    SYMBOL_INFOW si;
    WCHAR name[2001];
} SYMBOL_INFO_PACKAGEW;
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;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SYMBOL_INFO_PACKAGEW
{
    public SYMBOL_INFOW si;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 2001)] 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

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SYMBOL_INFO_PACKAGEW
    Public si As SYMBOL_INFOW
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=2001)> 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),
    ]

class SYMBOL_INFO_PACKAGEW(ctypes.Structure):
    _fields_ = [
        ("si", SYMBOL_INFOW),
        ("name", ctypes.c_wchar * 2001),
    ]
#[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],
}

#[repr(C)]
pub struct SYMBOL_INFO_PACKAGEW {
    pub si: SYMBOL_INFOW,
    pub name: [u16; 2001],
}
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_INFO_PACKAGEW struct {
	si SYMBOL_INFOW
	name [2001]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;

  SYMBOL_INFO_PACKAGEW = record
    si: SYMBOL_INFOW;
    name: array[0..2000] 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,
};

const SYMBOL_INFO_PACKAGEW = extern struct {
    si: SYMBOL_INFOW,
    name: [2001]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]

  SYMBOL_INFO_PACKAGEW {.bycopy.} = object
    si: SYMBOL_INFOW
    name: array[2001, 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;
}

struct SYMBOL_INFO_PACKAGEW
{
    SYMBOL_INFOW si;
    wchar[2001] 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_INFO_PACKAGEW サイズ: 4096 バイト(x64)
dim st, 1024    ; 4byte整数×1024(構造体サイズ 4096 / 4 切り上げ)
; si : SYMBOL_INFOW (+0, 88byte)  varptr(st)+0 を基点に操作(88byte:入れ子/配列)
; name : WCHAR (+88, 4002byte)  varptr(st)+88 を基点に操作(4002byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#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

#defstruct global SYMBOL_INFO_PACKAGEW
    #field SYMBOL_INFOW si
    #field wchar name 2001
#endstruct

stdim st, SYMBOL_INFO_PACKAGEW        ; NSTRUCT 変数を確保