ホーム › System.Diagnostics.Debug › RtlRaiseException
RtlRaiseException
関数指定した例外レコードで例外を発生させる。
シグネチャ
// KERNEL32.dll
#include <windows.h>
void RtlRaiseException(
EXCEPTION_RECORD* ExceptionRecord
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| ExceptionRecord | EXCEPTION_RECORD* | in |
戻り値の型: void
各言語での呼び出し定義
// KERNEL32.dll
#include <windows.h>
void RtlRaiseException(
EXCEPTION_RECORD* ExceptionRecord
);[DllImport("KERNEL32.dll", ExactSpelling = true)]
static extern void RtlRaiseException(
IntPtr ExceptionRecord // EXCEPTION_RECORD*
);<DllImport("KERNEL32.dll", ExactSpelling:=True)>
Public Shared Sub RtlRaiseException(
ExceptionRecord As IntPtr ' EXCEPTION_RECORD*
)
End Sub' ExceptionRecord : EXCEPTION_RECORD*
Declare PtrSafe Sub RtlRaiseException Lib "kernel32" ( _
ByVal ExceptionRecord As LongPtr)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
RtlRaiseException = ctypes.windll.kernel32.RtlRaiseException
RtlRaiseException.restype = None
RtlRaiseException.argtypes = [
ctypes.c_void_p, # ExceptionRecord : EXCEPTION_RECORD*
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('KERNEL32.dll')
RtlRaiseException = Fiddle::Function.new(
lib['RtlRaiseException'],
[
Fiddle::TYPE_VOIDP, # ExceptionRecord : EXCEPTION_RECORD*
],
Fiddle::TYPE_VOID)#[link(name = "kernel32")]
extern "system" {
fn RtlRaiseException(
ExceptionRecord: *mut EXCEPTION_RECORD // EXCEPTION_RECORD*
);
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("KERNEL32.dll")]
public static extern void RtlRaiseException(IntPtr ExceptionRecord);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_RtlRaiseException' -Namespace Win32 -PassThru
# $api::RtlRaiseException(ExceptionRecord)#uselib "KERNEL32.dll"
#func global RtlRaiseException "RtlRaiseException" sptr
; RtlRaiseException varptr(ExceptionRecord)
; ExceptionRecord : EXCEPTION_RECORD* -> "sptr"出力引数:
#uselib "KERNEL32.dll" #func global RtlRaiseException "RtlRaiseException" var ; RtlRaiseException ExceptionRecord ; ExceptionRecord : EXCEPTION_RECORD* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "KERNEL32.dll" #func global RtlRaiseException "RtlRaiseException" sptr ; RtlRaiseException varptr(ExceptionRecord) ; ExceptionRecord : EXCEPTION_RECORD* -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; void RtlRaiseException(EXCEPTION_RECORD* ExceptionRecord) #uselib "KERNEL32.dll" #func global RtlRaiseException "RtlRaiseException" var ; RtlRaiseException ExceptionRecord ; ExceptionRecord : EXCEPTION_RECORD* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; void RtlRaiseException(EXCEPTION_RECORD* ExceptionRecord) #uselib "KERNEL32.dll" #func global RtlRaiseException "RtlRaiseException" intptr ; RtlRaiseException varptr(ExceptionRecord) ; ExceptionRecord : EXCEPTION_RECORD* -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
procRtlRaiseException = kernel32.NewProc("RtlRaiseException")
)
// ExceptionRecord (EXCEPTION_RECORD*)
r1, _, err := procRtlRaiseException.Call(
uintptr(ExceptionRecord),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // voidprocedure RtlRaiseException(
ExceptionRecord: Pointer // EXCEPTION_RECORD*
); stdcall;
external 'KERNEL32.dll' name 'RtlRaiseException';result := DllCall("KERNEL32\RtlRaiseException"
, "Ptr", ExceptionRecord ; EXCEPTION_RECORD*
, "Int") ; return: void●RtlRaiseException(ExceptionRecord) = DLL("KERNEL32.dll", "int RtlRaiseException(void*)")
# 呼び出し: RtlRaiseException(ExceptionRecord)
# ExceptionRecord : EXCEPTION_RECORD* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。