Win32 API 日本語リファレンス
ホームSystem.WinRT › RoFailFastWithErrorContext

RoFailFastWithErrorContext

関数
エラーコンテキスト付きでプロセスを即時強制終了する。
DLLapi-ms-win-core-winrt-error-l1-1-0.dll呼出規約winapi対応OSwindows8.0

シグネチャ

// api-ms-win-core-winrt-error-l1-1-0.dll
#include <windows.h>

void RoFailFastWithErrorContext(
    HRESULT hrError
);

パラメーター

名前方向
hrErrorHRESULTin

戻り値の型: void

各言語での呼び出し定義

// api-ms-win-core-winrt-error-l1-1-0.dll
#include <windows.h>

void RoFailFastWithErrorContext(
    HRESULT hrError
);
[DllImport("api-ms-win-core-winrt-error-l1-1-0.dll", ExactSpelling = true)]
static extern void RoFailFastWithErrorContext(
    int hrError   // HRESULT
);
<DllImport("api-ms-win-core-winrt-error-l1-1-0.dll", ExactSpelling:=True)>
Public Shared Sub RoFailFastWithErrorContext(
    hrError As Integer   ' HRESULT
)
End Sub
' hrError : HRESULT
Declare PtrSafe Sub RoFailFastWithErrorContext Lib "api-ms-win-core-winrt-error-l1-1-0" ( _
    ByVal hrError As Long)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

RoFailFastWithErrorContext = ctypes.windll.LoadLibrary("api-ms-win-core-winrt-error-l1-1-0.dll").RoFailFastWithErrorContext
RoFailFastWithErrorContext.restype = None
RoFailFastWithErrorContext.argtypes = [
    ctypes.c_int,  # hrError : HRESULT
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('api-ms-win-core-winrt-error-l1-1-0.dll')
RoFailFastWithErrorContext = Fiddle::Function.new(
  lib['RoFailFastWithErrorContext'],
  [
    Fiddle::TYPE_INT,  # hrError : HRESULT
  ],
  Fiddle::TYPE_VOID)
#[link(name = "api-ms-win-core-winrt-error-l1-1-0")]
extern "system" {
    fn RoFailFastWithErrorContext(
        hrError: i32  // HRESULT
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("api-ms-win-core-winrt-error-l1-1-0.dll")]
public static extern void RoFailFastWithErrorContext(int hrError);
"@
$api = Add-Type -MemberDefinition $sig -Name 'api-ms-win-core-winrt-error-l1-1-0_RoFailFastWithErrorContext' -Namespace Win32 -PassThru
# $api::RoFailFastWithErrorContext(hrError)
#uselib "api-ms-win-core-winrt-error-l1-1-0.dll"
#func global RoFailFastWithErrorContext "RoFailFastWithErrorContext" sptr
; RoFailFastWithErrorContext hrError
; hrError : HRESULT -> "sptr"
#uselib "api-ms-win-core-winrt-error-l1-1-0.dll"
#func global RoFailFastWithErrorContext "RoFailFastWithErrorContext" int
; RoFailFastWithErrorContext hrError
; hrError : HRESULT -> "int"
; void RoFailFastWithErrorContext(HRESULT hrError)
#uselib "api-ms-win-core-winrt-error-l1-1-0.dll"
#func global RoFailFastWithErrorContext "RoFailFastWithErrorContext" int
; RoFailFastWithErrorContext hrError
; hrError : HRESULT -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	api_ms_win_core_winrt_error_l1_1_0 = windows.NewLazySystemDLL("api-ms-win-core-winrt-error-l1-1-0.dll")
	procRoFailFastWithErrorContext = api_ms_win_core_winrt_error_l1_1_0.NewProc("RoFailFastWithErrorContext")
)

// hrError (HRESULT)
r1, _, err := procRoFailFastWithErrorContext.Call(
	uintptr(hrError),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // void
procedure RoFailFastWithErrorContext(
  hrError: Integer   // HRESULT
); stdcall;
  external 'api-ms-win-core-winrt-error-l1-1-0.dll' name 'RoFailFastWithErrorContext';
result := DllCall("api-ms-win-core-winrt-error-l1-1-0\RoFailFastWithErrorContext"
    , "Int", hrError   ; HRESULT
    , "Int")   ; return: void
●RoFailFastWithErrorContext(hrError) = DLL("api-ms-win-core-winrt-error-l1-1-0.dll", "int RoFailFastWithErrorContext(int)")
# 呼び出し: RoFailFastWithErrorContext(hrError)
# hrError : HRESULT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。