ホーム › System.ErrorReporting › WerRegisterRuntimeExceptionModule
WerRegisterRuntimeExceptionModule
関数WERのランタイム例外処理モジュールを登録する。
シグネチャ
// KERNEL32.dll
#include <windows.h>
HRESULT WerRegisterRuntimeExceptionModule(
LPCWSTR pwszOutOfProcessCallbackDll,
void* pContext
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pwszOutOfProcessCallbackDll | LPCWSTR | in |
| pContext | void* | in |
戻り値の型: HRESULT
各言語での呼び出し定義
// KERNEL32.dll
#include <windows.h>
HRESULT WerRegisterRuntimeExceptionModule(
LPCWSTR pwszOutOfProcessCallbackDll,
void* pContext
);[DllImport("KERNEL32.dll", ExactSpelling = true)]
static extern int WerRegisterRuntimeExceptionModule(
[MarshalAs(UnmanagedType.LPWStr)] string pwszOutOfProcessCallbackDll, // LPCWSTR
IntPtr pContext // void*
);<DllImport("KERNEL32.dll", ExactSpelling:=True)>
Public Shared Function WerRegisterRuntimeExceptionModule(
<MarshalAs(UnmanagedType.LPWStr)> pwszOutOfProcessCallbackDll As String, ' LPCWSTR
pContext As IntPtr ' void*
) As Integer
End Function' pwszOutOfProcessCallbackDll : LPCWSTR
' pContext : void*
Declare PtrSafe Function WerRegisterRuntimeExceptionModule Lib "kernel32" ( _
ByVal pwszOutOfProcessCallbackDll As LongPtr, _
ByVal pContext As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
WerRegisterRuntimeExceptionModule = ctypes.windll.kernel32.WerRegisterRuntimeExceptionModule
WerRegisterRuntimeExceptionModule.restype = ctypes.c_int
WerRegisterRuntimeExceptionModule.argtypes = [
wintypes.LPCWSTR, # pwszOutOfProcessCallbackDll : LPCWSTR
ctypes.POINTER(None), # pContext : void*
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('KERNEL32.dll')
WerRegisterRuntimeExceptionModule = Fiddle::Function.new(
lib['WerRegisterRuntimeExceptionModule'],
[
Fiddle::TYPE_VOIDP, # pwszOutOfProcessCallbackDll : LPCWSTR
Fiddle::TYPE_VOIDP, # pContext : void*
],
Fiddle::TYPE_INT)#[link(name = "kernel32")]
extern "system" {
fn WerRegisterRuntimeExceptionModule(
pwszOutOfProcessCallbackDll: *const u16, // LPCWSTR
pContext: *mut () // void*
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("KERNEL32.dll")]
public static extern int WerRegisterRuntimeExceptionModule([MarshalAs(UnmanagedType.LPWStr)] string pwszOutOfProcessCallbackDll, IntPtr pContext);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_WerRegisterRuntimeExceptionModule' -Namespace Win32 -PassThru
# $api::WerRegisterRuntimeExceptionModule(pwszOutOfProcessCallbackDll, pContext)#uselib "KERNEL32.dll"
#func global WerRegisterRuntimeExceptionModule "WerRegisterRuntimeExceptionModule" sptr, sptr
; WerRegisterRuntimeExceptionModule pwszOutOfProcessCallbackDll, pContext ; 戻り値は stat
; pwszOutOfProcessCallbackDll : LPCWSTR -> "sptr"
; pContext : void* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "KERNEL32.dll"
#cfunc global WerRegisterRuntimeExceptionModule "WerRegisterRuntimeExceptionModule" wstr, sptr
; res = WerRegisterRuntimeExceptionModule(pwszOutOfProcessCallbackDll, pContext)
; pwszOutOfProcessCallbackDll : LPCWSTR -> "wstr"
; pContext : void* -> "sptr"; HRESULT WerRegisterRuntimeExceptionModule(LPCWSTR pwszOutOfProcessCallbackDll, void* pContext)
#uselib "KERNEL32.dll"
#cfunc global WerRegisterRuntimeExceptionModule "WerRegisterRuntimeExceptionModule" wstr, intptr
; res = WerRegisterRuntimeExceptionModule(pwszOutOfProcessCallbackDll, pContext)
; pwszOutOfProcessCallbackDll : LPCWSTR -> "wstr"
; pContext : void* -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
procWerRegisterRuntimeExceptionModule = kernel32.NewProc("WerRegisterRuntimeExceptionModule")
)
// pwszOutOfProcessCallbackDll (LPCWSTR), pContext (void*)
r1, _, err := procWerRegisterRuntimeExceptionModule.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pwszOutOfProcessCallbackDll))),
uintptr(pContext),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction WerRegisterRuntimeExceptionModule(
pwszOutOfProcessCallbackDll: PWideChar; // LPCWSTR
pContext: Pointer // void*
): Integer; stdcall;
external 'KERNEL32.dll' name 'WerRegisterRuntimeExceptionModule';result := DllCall("KERNEL32\WerRegisterRuntimeExceptionModule"
, "WStr", pwszOutOfProcessCallbackDll ; LPCWSTR
, "Ptr", pContext ; void*
, "Int") ; return: HRESULT●WerRegisterRuntimeExceptionModule(pwszOutOfProcessCallbackDll, pContext) = DLL("KERNEL32.dll", "int WerRegisterRuntimeExceptionModule(char*, void*)")
# 呼び出し: WerRegisterRuntimeExceptionModule(pwszOutOfProcessCallbackDll, pContext)
# pwszOutOfProcessCallbackDll : LPCWSTR -> "char*"
# pContext : void* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。