ホーム › System.ErrorReporting › WerReportAddDump
WerReportAddDump
関数WERレポートにプロセスのダンプを追加する。
シグネチャ
// wer.dll
#include <windows.h>
HRESULT WerReportAddDump(
HREPORT hReportHandle,
HANDLE hProcess,
HANDLE hThread, // optional
WER_DUMP_TYPE dumpType,
WER_EXCEPTION_INFORMATION* pExceptionParam, // optional
WER_DUMP_CUSTOM_OPTIONS* pDumpCustomOptions, // optional
DWORD dwFlags
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hReportHandle | HREPORT | in |
| hProcess | HANDLE | in |
| hThread | HANDLE | inoptional |
| dumpType | WER_DUMP_TYPE | in |
| pExceptionParam | WER_EXCEPTION_INFORMATION* | inoptional |
| pDumpCustomOptions | WER_DUMP_CUSTOM_OPTIONS* | inoptional |
| dwFlags | DWORD | in |
戻り値の型: HRESULT
各言語での呼び出し定義
// wer.dll
#include <windows.h>
HRESULT WerReportAddDump(
HREPORT hReportHandle,
HANDLE hProcess,
HANDLE hThread, // optional
WER_DUMP_TYPE dumpType,
WER_EXCEPTION_INFORMATION* pExceptionParam, // optional
WER_DUMP_CUSTOM_OPTIONS* pDumpCustomOptions, // optional
DWORD dwFlags
);[DllImport("wer.dll", ExactSpelling = true)]
static extern int WerReportAddDump(
IntPtr hReportHandle, // HREPORT
IntPtr hProcess, // HANDLE
IntPtr hThread, // HANDLE optional
int dumpType, // WER_DUMP_TYPE
IntPtr pExceptionParam, // WER_EXCEPTION_INFORMATION* optional
IntPtr pDumpCustomOptions, // WER_DUMP_CUSTOM_OPTIONS* optional
uint dwFlags // DWORD
);<DllImport("wer.dll", ExactSpelling:=True)>
Public Shared Function WerReportAddDump(
hReportHandle As IntPtr, ' HREPORT
hProcess As IntPtr, ' HANDLE
hThread As IntPtr, ' HANDLE optional
dumpType As Integer, ' WER_DUMP_TYPE
pExceptionParam As IntPtr, ' WER_EXCEPTION_INFORMATION* optional
pDumpCustomOptions As IntPtr, ' WER_DUMP_CUSTOM_OPTIONS* optional
dwFlags As UInteger ' DWORD
) As Integer
End Function' hReportHandle : HREPORT
' hProcess : HANDLE
' hThread : HANDLE optional
' dumpType : WER_DUMP_TYPE
' pExceptionParam : WER_EXCEPTION_INFORMATION* optional
' pDumpCustomOptions : WER_DUMP_CUSTOM_OPTIONS* optional
' dwFlags : DWORD
Declare PtrSafe Function WerReportAddDump Lib "wer" ( _
ByVal hReportHandle As LongPtr, _
ByVal hProcess As LongPtr, _
ByVal hThread As LongPtr, _
ByVal dumpType As Long, _
ByVal pExceptionParam As LongPtr, _
ByVal pDumpCustomOptions As LongPtr, _
ByVal dwFlags As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
WerReportAddDump = ctypes.windll.wer.WerReportAddDump
WerReportAddDump.restype = ctypes.c_int
WerReportAddDump.argtypes = [
wintypes.HANDLE, # hReportHandle : HREPORT
wintypes.HANDLE, # hProcess : HANDLE
wintypes.HANDLE, # hThread : HANDLE optional
ctypes.c_int, # dumpType : WER_DUMP_TYPE
ctypes.c_void_p, # pExceptionParam : WER_EXCEPTION_INFORMATION* optional
ctypes.c_void_p, # pDumpCustomOptions : WER_DUMP_CUSTOM_OPTIONS* optional
wintypes.DWORD, # dwFlags : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('wer.dll')
WerReportAddDump = Fiddle::Function.new(
lib['WerReportAddDump'],
[
Fiddle::TYPE_VOIDP, # hReportHandle : HREPORT
Fiddle::TYPE_VOIDP, # hProcess : HANDLE
Fiddle::TYPE_VOIDP, # hThread : HANDLE optional
Fiddle::TYPE_INT, # dumpType : WER_DUMP_TYPE
Fiddle::TYPE_VOIDP, # pExceptionParam : WER_EXCEPTION_INFORMATION* optional
Fiddle::TYPE_VOIDP, # pDumpCustomOptions : WER_DUMP_CUSTOM_OPTIONS* optional
-Fiddle::TYPE_INT, # dwFlags : DWORD
],
Fiddle::TYPE_INT)#[link(name = "wer")]
extern "system" {
fn WerReportAddDump(
hReportHandle: *mut core::ffi::c_void, // HREPORT
hProcess: *mut core::ffi::c_void, // HANDLE
hThread: *mut core::ffi::c_void, // HANDLE optional
dumpType: i32, // WER_DUMP_TYPE
pExceptionParam: *mut WER_EXCEPTION_INFORMATION, // WER_EXCEPTION_INFORMATION* optional
pDumpCustomOptions: *mut WER_DUMP_CUSTOM_OPTIONS, // WER_DUMP_CUSTOM_OPTIONS* optional
dwFlags: u32 // DWORD
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("wer.dll")]
public static extern int WerReportAddDump(IntPtr hReportHandle, IntPtr hProcess, IntPtr hThread, int dumpType, IntPtr pExceptionParam, IntPtr pDumpCustomOptions, uint dwFlags);
"@
$api = Add-Type -MemberDefinition $sig -Name 'wer_WerReportAddDump' -Namespace Win32 -PassThru
# $api::WerReportAddDump(hReportHandle, hProcess, hThread, dumpType, pExceptionParam, pDumpCustomOptions, dwFlags)#uselib "wer.dll"
#func global WerReportAddDump "WerReportAddDump" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; WerReportAddDump hReportHandle, hProcess, hThread, dumpType, varptr(pExceptionParam), varptr(pDumpCustomOptions), dwFlags ; 戻り値は stat
; hReportHandle : HREPORT -> "sptr"
; hProcess : HANDLE -> "sptr"
; hThread : HANDLE optional -> "sptr"
; dumpType : WER_DUMP_TYPE -> "sptr"
; pExceptionParam : WER_EXCEPTION_INFORMATION* optional -> "sptr"
; pDumpCustomOptions : WER_DUMP_CUSTOM_OPTIONS* optional -> "sptr"
; dwFlags : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "wer.dll" #cfunc global WerReportAddDump "WerReportAddDump" sptr, sptr, sptr, int, var, var, int ; res = WerReportAddDump(hReportHandle, hProcess, hThread, dumpType, pExceptionParam, pDumpCustomOptions, dwFlags) ; hReportHandle : HREPORT -> "sptr" ; hProcess : HANDLE -> "sptr" ; hThread : HANDLE optional -> "sptr" ; dumpType : WER_DUMP_TYPE -> "int" ; pExceptionParam : WER_EXCEPTION_INFORMATION* optional -> "var" ; pDumpCustomOptions : WER_DUMP_CUSTOM_OPTIONS* optional -> "var" ; dwFlags : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "wer.dll" #cfunc global WerReportAddDump "WerReportAddDump" sptr, sptr, sptr, int, sptr, sptr, int ; res = WerReportAddDump(hReportHandle, hProcess, hThread, dumpType, varptr(pExceptionParam), varptr(pDumpCustomOptions), dwFlags) ; hReportHandle : HREPORT -> "sptr" ; hProcess : HANDLE -> "sptr" ; hThread : HANDLE optional -> "sptr" ; dumpType : WER_DUMP_TYPE -> "int" ; pExceptionParam : WER_EXCEPTION_INFORMATION* optional -> "sptr" ; pDumpCustomOptions : WER_DUMP_CUSTOM_OPTIONS* optional -> "sptr" ; dwFlags : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT WerReportAddDump(HREPORT hReportHandle, HANDLE hProcess, HANDLE hThread, WER_DUMP_TYPE dumpType, WER_EXCEPTION_INFORMATION* pExceptionParam, WER_DUMP_CUSTOM_OPTIONS* pDumpCustomOptions, DWORD dwFlags) #uselib "wer.dll" #cfunc global WerReportAddDump "WerReportAddDump" intptr, intptr, intptr, int, var, var, int ; res = WerReportAddDump(hReportHandle, hProcess, hThread, dumpType, pExceptionParam, pDumpCustomOptions, dwFlags) ; hReportHandle : HREPORT -> "intptr" ; hProcess : HANDLE -> "intptr" ; hThread : HANDLE optional -> "intptr" ; dumpType : WER_DUMP_TYPE -> "int" ; pExceptionParam : WER_EXCEPTION_INFORMATION* optional -> "var" ; pDumpCustomOptions : WER_DUMP_CUSTOM_OPTIONS* optional -> "var" ; dwFlags : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT WerReportAddDump(HREPORT hReportHandle, HANDLE hProcess, HANDLE hThread, WER_DUMP_TYPE dumpType, WER_EXCEPTION_INFORMATION* pExceptionParam, WER_DUMP_CUSTOM_OPTIONS* pDumpCustomOptions, DWORD dwFlags) #uselib "wer.dll" #cfunc global WerReportAddDump "WerReportAddDump" intptr, intptr, intptr, int, intptr, intptr, int ; res = WerReportAddDump(hReportHandle, hProcess, hThread, dumpType, varptr(pExceptionParam), varptr(pDumpCustomOptions), dwFlags) ; hReportHandle : HREPORT -> "intptr" ; hProcess : HANDLE -> "intptr" ; hThread : HANDLE optional -> "intptr" ; dumpType : WER_DUMP_TYPE -> "int" ; pExceptionParam : WER_EXCEPTION_INFORMATION* optional -> "intptr" ; pDumpCustomOptions : WER_DUMP_CUSTOM_OPTIONS* optional -> "intptr" ; dwFlags : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
wer = windows.NewLazySystemDLL("wer.dll")
procWerReportAddDump = wer.NewProc("WerReportAddDump")
)
// hReportHandle (HREPORT), hProcess (HANDLE), hThread (HANDLE optional), dumpType (WER_DUMP_TYPE), pExceptionParam (WER_EXCEPTION_INFORMATION* optional), pDumpCustomOptions (WER_DUMP_CUSTOM_OPTIONS* optional), dwFlags (DWORD)
r1, _, err := procWerReportAddDump.Call(
uintptr(hReportHandle),
uintptr(hProcess),
uintptr(hThread),
uintptr(dumpType),
uintptr(pExceptionParam),
uintptr(pDumpCustomOptions),
uintptr(dwFlags),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction WerReportAddDump(
hReportHandle: THandle; // HREPORT
hProcess: THandle; // HANDLE
hThread: THandle; // HANDLE optional
dumpType: Integer; // WER_DUMP_TYPE
pExceptionParam: Pointer; // WER_EXCEPTION_INFORMATION* optional
pDumpCustomOptions: Pointer; // WER_DUMP_CUSTOM_OPTIONS* optional
dwFlags: DWORD // DWORD
): Integer; stdcall;
external 'wer.dll' name 'WerReportAddDump';result := DllCall("wer\WerReportAddDump"
, "Ptr", hReportHandle ; HREPORT
, "Ptr", hProcess ; HANDLE
, "Ptr", hThread ; HANDLE optional
, "Int", dumpType ; WER_DUMP_TYPE
, "Ptr", pExceptionParam ; WER_EXCEPTION_INFORMATION* optional
, "Ptr", pDumpCustomOptions ; WER_DUMP_CUSTOM_OPTIONS* optional
, "UInt", dwFlags ; DWORD
, "Int") ; return: HRESULT●WerReportAddDump(hReportHandle, hProcess, hThread, dumpType, pExceptionParam, pDumpCustomOptions, dwFlags) = DLL("wer.dll", "int WerReportAddDump(void*, void*, void*, int, void*, void*, dword)")
# 呼び出し: WerReportAddDump(hReportHandle, hProcess, hThread, dumpType, pExceptionParam, pDumpCustomOptions, dwFlags)
# hReportHandle : HREPORT -> "void*"
# hProcess : HANDLE -> "void*"
# hThread : HANDLE optional -> "void*"
# dumpType : WER_DUMP_TYPE -> "int"
# pExceptionParam : WER_EXCEPTION_INFORMATION* optional -> "void*"
# pDumpCustomOptions : WER_DUMP_CUSTOM_OPTIONS* optional -> "void*"
# dwFlags : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。