ホーム › System.Diagnostics.Debug › SymGetScopeW
SymGetScopeW
関数指定インデックスのスコープシンボル情報を取得する(Unicode版)。
シグネチャ
// dbghelp.dll (Unicode / -W)
#include <windows.h>
BOOL SymGetScopeW(
HANDLE hProcess,
ULONGLONG BaseOfDll,
DWORD Index,
SYMBOL_INFOW* Symbol
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hProcess | HANDLE | in |
| BaseOfDll | ULONGLONG | in |
| Index | DWORD | in |
| Symbol | SYMBOL_INFOW* | inout |
戻り値の型: BOOL
各言語での呼び出し定義
// dbghelp.dll (Unicode / -W)
#include <windows.h>
BOOL SymGetScopeW(
HANDLE hProcess,
ULONGLONG BaseOfDll,
DWORD Index,
SYMBOL_INFOW* Symbol
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("dbghelp.dll", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
static extern bool SymGetScopeW(
IntPtr hProcess, // HANDLE
ulong BaseOfDll, // ULONGLONG
uint Index, // DWORD
IntPtr Symbol // SYMBOL_INFOW* in/out
);<DllImport("dbghelp.dll", CharSet:=CharSet.Unicode, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function SymGetScopeW(
hProcess As IntPtr, ' HANDLE
BaseOfDll As ULong, ' ULONGLONG
Index As UInteger, ' DWORD
Symbol As IntPtr ' SYMBOL_INFOW* in/out
) As Boolean
End Function' hProcess : HANDLE
' BaseOfDll : ULONGLONG
' Index : DWORD
' Symbol : SYMBOL_INFOW* in/out
Declare PtrSafe Function SymGetScopeW Lib "dbghelp" ( _
ByVal hProcess As LongPtr, _
ByVal BaseOfDll As LongLong, _
ByVal Index As Long, _
ByVal Symbol As LongPtr) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SymGetScopeW = ctypes.windll.dbghelp.SymGetScopeW
SymGetScopeW.restype = wintypes.BOOL
SymGetScopeW.argtypes = [
wintypes.HANDLE, # hProcess : HANDLE
ctypes.c_ulonglong, # BaseOfDll : ULONGLONG
wintypes.DWORD, # Index : DWORD
ctypes.c_void_p, # Symbol : SYMBOL_INFOW* in/out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('dbghelp.dll')
SymGetScopeW = Fiddle::Function.new(
lib['SymGetScopeW'],
[
Fiddle::TYPE_VOIDP, # hProcess : HANDLE
-Fiddle::TYPE_LONG_LONG, # BaseOfDll : ULONGLONG
-Fiddle::TYPE_INT, # Index : DWORD
Fiddle::TYPE_VOIDP, # Symbol : SYMBOL_INFOW* in/out
],
Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "dbghelp")]
extern "system" {
fn SymGetScopeW(
hProcess: *mut core::ffi::c_void, // HANDLE
BaseOfDll: u64, // ULONGLONG
Index: u32, // DWORD
Symbol: *mut SYMBOL_INFOW // SYMBOL_INFOW* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("dbghelp.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern bool SymGetScopeW(IntPtr hProcess, ulong BaseOfDll, uint Index, IntPtr Symbol);
"@
$api = Add-Type -MemberDefinition $sig -Name 'dbghelp_SymGetScopeW' -Namespace Win32 -PassThru
# $api::SymGetScopeW(hProcess, BaseOfDll, Index, Symbol)#uselib "dbghelp.dll"
#func global SymGetScopeW "SymGetScopeW" wptr, wptr, wptr, wptr
; SymGetScopeW hProcess, BaseOfDll, Index, varptr(Symbol) ; 戻り値は stat
; hProcess : HANDLE -> "wptr"
; BaseOfDll : ULONGLONG -> "wptr"
; Index : DWORD -> "wptr"
; Symbol : SYMBOL_INFOW* in/out -> "wptr"
; ※HSP3.7は int64 引数(64bit値渡し)に非対応です。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "dbghelp.dll" #cfunc global SymGetScopeW "SymGetScopeW" sptr, int64, int, var ; res = SymGetScopeW(hProcess, BaseOfDll, Index, Symbol) ; hProcess : HANDLE -> "sptr" ; BaseOfDll : ULONGLONG -> "int64" ; Index : DWORD -> "int" ; Symbol : SYMBOL_INFOW* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。 ; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。#uselib "dbghelp.dll" #cfunc global SymGetScopeW "SymGetScopeW" sptr, int64, int, sptr ; res = SymGetScopeW(hProcess, BaseOfDll, Index, varptr(Symbol)) ; hProcess : HANDLE -> "sptr" ; BaseOfDll : ULONGLONG -> "int64" ; Index : DWORD -> "int" ; Symbol : SYMBOL_INFOW* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。 ; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。
出力引数:
; BOOL SymGetScopeW(HANDLE hProcess, ULONGLONG BaseOfDll, DWORD Index, SYMBOL_INFOW* Symbol) #uselib "dbghelp.dll" #cfunc global SymGetScopeW "SymGetScopeW" intptr, int64, int, var ; res = SymGetScopeW(hProcess, BaseOfDll, Index, Symbol) ; hProcess : HANDLE -> "intptr" ; BaseOfDll : ULONGLONG -> "int64" ; Index : DWORD -> "int" ; Symbol : SYMBOL_INFOW* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL SymGetScopeW(HANDLE hProcess, ULONGLONG BaseOfDll, DWORD Index, SYMBOL_INFOW* Symbol) #uselib "dbghelp.dll" #cfunc global SymGetScopeW "SymGetScopeW" intptr, int64, int, intptr ; res = SymGetScopeW(hProcess, BaseOfDll, Index, varptr(Symbol)) ; hProcess : HANDLE -> "intptr" ; BaseOfDll : ULONGLONG -> "int64" ; Index : DWORD -> "int" ; Symbol : SYMBOL_INFOW* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
dbghelp = windows.NewLazySystemDLL("dbghelp.dll")
procSymGetScopeW = dbghelp.NewProc("SymGetScopeW")
)
// hProcess (HANDLE), BaseOfDll (ULONGLONG), Index (DWORD), Symbol (SYMBOL_INFOW* in/out)
r1, _, err := procSymGetScopeW.Call(
uintptr(hProcess),
uintptr(BaseOfDll),
uintptr(Index),
uintptr(Symbol),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction SymGetScopeW(
hProcess: THandle; // HANDLE
BaseOfDll: UInt64; // ULONGLONG
Index: DWORD; // DWORD
Symbol: Pointer // SYMBOL_INFOW* in/out
): BOOL; stdcall;
external 'dbghelp.dll' name 'SymGetScopeW';result := DllCall("dbghelp\SymGetScopeW"
, "Ptr", hProcess ; HANDLE
, "Int64", BaseOfDll ; ULONGLONG
, "UInt", Index ; DWORD
, "Ptr", Symbol ; SYMBOL_INFOW* in/out
, "Int") ; return: BOOL●SymGetScopeW(hProcess, BaseOfDll, Index, Symbol) = DLL("dbghelp.dll", "bool SymGetScopeW(void*, qword, dword, void*)")
# 呼び出し: SymGetScopeW(hProcess, BaseOfDll, Index, Symbol)
# hProcess : HANDLE -> "void*"
# BaseOfDll : ULONGLONG -> "qword"
# Index : DWORD -> "dword"
# Symbol : SYMBOL_INFOW* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。