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