ホーム › System.Diagnostics.Debug › SymFindDebugInfoFile
SymFindDebugInfoFile
関数コールバックを用いてデバッグ情報ファイルを検索する。
シグネチャ
// dbghelp.dll (ANSI / -A)
#include <windows.h>
HANDLE SymFindDebugInfoFile(
HANDLE hProcess,
LPCSTR FileName,
LPSTR DebugFilePath,
PFIND_DEBUG_FILE_CALLBACK Callback, // optional
void* CallerData // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hProcess | HANDLE | in |
| FileName | LPCSTR | in |
| DebugFilePath | LPSTR | out |
| Callback | PFIND_DEBUG_FILE_CALLBACK | inoptional |
| CallerData | void* | inoptional |
戻り値の型: HANDLE
各言語での呼び出し定義
// dbghelp.dll (ANSI / -A)
#include <windows.h>
HANDLE SymFindDebugInfoFile(
HANDLE hProcess,
LPCSTR FileName,
LPSTR DebugFilePath,
PFIND_DEBUG_FILE_CALLBACK Callback, // optional
void* CallerData // optional
);[DllImport("dbghelp.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
static extern IntPtr SymFindDebugInfoFile(
IntPtr hProcess, // HANDLE
[MarshalAs(UnmanagedType.LPStr)] string FileName, // LPCSTR
[MarshalAs(UnmanagedType.LPStr)] System.Text.StringBuilder DebugFilePath, // LPSTR out
IntPtr Callback, // PFIND_DEBUG_FILE_CALLBACK optional
IntPtr CallerData // void* optional
);<DllImport("dbghelp.dll", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function SymFindDebugInfoFile(
hProcess As IntPtr, ' HANDLE
<MarshalAs(UnmanagedType.LPStr)> FileName As String, ' LPCSTR
<MarshalAs(UnmanagedType.LPStr)> DebugFilePath As System.Text.StringBuilder, ' LPSTR out
Callback As IntPtr, ' PFIND_DEBUG_FILE_CALLBACK optional
CallerData As IntPtr ' void* optional
) As IntPtr
End Function' hProcess : HANDLE
' FileName : LPCSTR
' DebugFilePath : LPSTR out
' Callback : PFIND_DEBUG_FILE_CALLBACK optional
' CallerData : void* optional
Declare PtrSafe Function SymFindDebugInfoFile Lib "dbghelp" ( _
ByVal hProcess As LongPtr, _
ByVal FileName As String, _
ByVal DebugFilePath As String, _
ByVal Callback As LongPtr, _
ByVal CallerData As LongPtr) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SymFindDebugInfoFile = ctypes.windll.dbghelp.SymFindDebugInfoFile
SymFindDebugInfoFile.restype = ctypes.c_void_p
SymFindDebugInfoFile.argtypes = [
wintypes.HANDLE, # hProcess : HANDLE
wintypes.LPCSTR, # FileName : LPCSTR
wintypes.LPSTR, # DebugFilePath : LPSTR out
ctypes.c_void_p, # Callback : PFIND_DEBUG_FILE_CALLBACK optional
ctypes.POINTER(None), # CallerData : void* optional
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('dbghelp.dll')
SymFindDebugInfoFile = Fiddle::Function.new(
lib['SymFindDebugInfoFile'],
[
Fiddle::TYPE_VOIDP, # hProcess : HANDLE
Fiddle::TYPE_VOIDP, # FileName : LPCSTR
Fiddle::TYPE_VOIDP, # DebugFilePath : LPSTR out
Fiddle::TYPE_VOIDP, # Callback : PFIND_DEBUG_FILE_CALLBACK optional
Fiddle::TYPE_VOIDP, # CallerData : void* optional
],
Fiddle::TYPE_VOIDP)#[link(name = "dbghelp")]
extern "system" {
fn SymFindDebugInfoFile(
hProcess: *mut core::ffi::c_void, // HANDLE
FileName: *const u8, // LPCSTR
DebugFilePath: *mut u8, // LPSTR out
Callback: *const core::ffi::c_void, // PFIND_DEBUG_FILE_CALLBACK optional
CallerData: *mut () // void* optional
) -> *mut core::ffi::c_void;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("dbghelp.dll", CharSet = CharSet.Ansi, SetLastError = true)]
public static extern IntPtr SymFindDebugInfoFile(IntPtr hProcess, [MarshalAs(UnmanagedType.LPStr)] string FileName, [MarshalAs(UnmanagedType.LPStr)] System.Text.StringBuilder DebugFilePath, IntPtr Callback, IntPtr CallerData);
"@
$api = Add-Type -MemberDefinition $sig -Name 'dbghelp_SymFindDebugInfoFile' -Namespace Win32 -PassThru
# $api::SymFindDebugInfoFile(hProcess, FileName, DebugFilePath, Callback, CallerData)#uselib "dbghelp.dll"
#func global SymFindDebugInfoFile "SymFindDebugInfoFile" sptr, sptr, sptr, sptr, sptr
; SymFindDebugInfoFile hProcess, FileName, varptr(DebugFilePath), Callback, CallerData ; 戻り値は stat
; hProcess : HANDLE -> "sptr"
; FileName : LPCSTR -> "sptr"
; DebugFilePath : LPSTR out -> "sptr"
; Callback : PFIND_DEBUG_FILE_CALLBACK optional -> "sptr"
; CallerData : void* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "dbghelp.dll" #cfunc global SymFindDebugInfoFile "SymFindDebugInfoFile" sptr, str, var, sptr, sptr ; res = SymFindDebugInfoFile(hProcess, FileName, DebugFilePath, Callback, CallerData) ; hProcess : HANDLE -> "sptr" ; FileName : LPCSTR -> "str" ; DebugFilePath : LPSTR out -> "var" ; Callback : PFIND_DEBUG_FILE_CALLBACK optional -> "sptr" ; CallerData : void* optional -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "dbghelp.dll" #cfunc global SymFindDebugInfoFile "SymFindDebugInfoFile" sptr, str, sptr, sptr, sptr ; res = SymFindDebugInfoFile(hProcess, FileName, varptr(DebugFilePath), Callback, CallerData) ; hProcess : HANDLE -> "sptr" ; FileName : LPCSTR -> "str" ; DebugFilePath : LPSTR out -> "sptr" ; Callback : PFIND_DEBUG_FILE_CALLBACK optional -> "sptr" ; CallerData : void* optional -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HANDLE SymFindDebugInfoFile(HANDLE hProcess, LPCSTR FileName, LPSTR DebugFilePath, PFIND_DEBUG_FILE_CALLBACK Callback, void* CallerData) #uselib "dbghelp.dll" #cfunc global SymFindDebugInfoFile "SymFindDebugInfoFile" intptr, str, var, intptr, intptr ; res = SymFindDebugInfoFile(hProcess, FileName, DebugFilePath, Callback, CallerData) ; hProcess : HANDLE -> "intptr" ; FileName : LPCSTR -> "str" ; DebugFilePath : LPSTR out -> "var" ; Callback : PFIND_DEBUG_FILE_CALLBACK optional -> "intptr" ; CallerData : void* optional -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HANDLE SymFindDebugInfoFile(HANDLE hProcess, LPCSTR FileName, LPSTR DebugFilePath, PFIND_DEBUG_FILE_CALLBACK Callback, void* CallerData) #uselib "dbghelp.dll" #cfunc global SymFindDebugInfoFile "SymFindDebugInfoFile" intptr, str, intptr, intptr, intptr ; res = SymFindDebugInfoFile(hProcess, FileName, varptr(DebugFilePath), Callback, CallerData) ; hProcess : HANDLE -> "intptr" ; FileName : LPCSTR -> "str" ; DebugFilePath : LPSTR out -> "intptr" ; Callback : PFIND_DEBUG_FILE_CALLBACK optional -> "intptr" ; CallerData : void* optional -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
dbghelp = windows.NewLazySystemDLL("dbghelp.dll")
procSymFindDebugInfoFile = dbghelp.NewProc("SymFindDebugInfoFile")
)
// hProcess (HANDLE), FileName (LPCSTR), DebugFilePath (LPSTR out), Callback (PFIND_DEBUG_FILE_CALLBACK optional), CallerData (void* optional)
r1, _, err := procSymFindDebugInfoFile.Call(
uintptr(hProcess),
uintptr(unsafe.Pointer(windows.BytePtrFromString(FileName))),
uintptr(DebugFilePath),
uintptr(Callback),
uintptr(CallerData),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HANDLEfunction SymFindDebugInfoFile(
hProcess: THandle; // HANDLE
FileName: PAnsiChar; // LPCSTR
DebugFilePath: PAnsiChar; // LPSTR out
Callback: Pointer; // PFIND_DEBUG_FILE_CALLBACK optional
CallerData: Pointer // void* optional
): THandle; stdcall;
external 'dbghelp.dll' name 'SymFindDebugInfoFile';result := DllCall("dbghelp\SymFindDebugInfoFile"
, "Ptr", hProcess ; HANDLE
, "AStr", FileName ; LPCSTR
, "Ptr", DebugFilePath ; LPSTR out
, "Ptr", Callback ; PFIND_DEBUG_FILE_CALLBACK optional
, "Ptr", CallerData ; void* optional
, "Ptr") ; return: HANDLE●SymFindDebugInfoFile(hProcess, FileName, DebugFilePath, Callback, CallerData) = DLL("dbghelp.dll", "void* SymFindDebugInfoFile(void*, char*, char*, void*, void*)")
# 呼び出し: SymFindDebugInfoFile(hProcess, FileName, DebugFilePath, Callback, CallerData)
# hProcess : HANDLE -> "void*"
# FileName : LPCSTR -> "char*"
# DebugFilePath : LPSTR out -> "char*"
# Callback : PFIND_DEBUG_FILE_CALLBACK optional -> "void*"
# CallerData : void* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。