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