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