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

RpcRaiseException

関数
指定した例外コードのRPC例外を発生させる。
DLLRPCRT4.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

// RPCRT4.dll
#include <windows.h>

void RpcRaiseException(
    RPC_STATUS exception
);

パラメーター

名前方向
exceptionRPC_STATUSin

戻り値の型: void

各言語での呼び出し定義

// RPCRT4.dll
#include <windows.h>

void RpcRaiseException(
    RPC_STATUS exception
);
[DllImport("RPCRT4.dll", ExactSpelling = true)]
static extern void RpcRaiseException(
    int exception   // RPC_STATUS
);
<DllImport("RPCRT4.dll", ExactSpelling:=True)>
Public Shared Sub RpcRaiseException(
    exception As Integer   ' RPC_STATUS
)
End Sub
' exception : RPC_STATUS
Declare PtrSafe Sub RpcRaiseException Lib "rpcrt4" ( _
    ByVal exception As Long)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

RpcRaiseException = ctypes.windll.rpcrt4.RpcRaiseException
RpcRaiseException.restype = None
RpcRaiseException.argtypes = [
    ctypes.c_int,  # exception : RPC_STATUS
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('RPCRT4.dll')
RpcRaiseException = Fiddle::Function.new(
  lib['RpcRaiseException'],
  [
    Fiddle::TYPE_INT,  # exception : RPC_STATUS
  ],
  Fiddle::TYPE_VOID)
#[link(name = "rpcrt4")]
extern "system" {
    fn RpcRaiseException(
        exception: i32  // RPC_STATUS
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("RPCRT4.dll")]
public static extern void RpcRaiseException(int exception);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RPCRT4_RpcRaiseException' -Namespace Win32 -PassThru
# $api::RpcRaiseException(exception)
#uselib "RPCRT4.dll"
#func global RpcRaiseException "RpcRaiseException" sptr
; RpcRaiseException exception
; exception : RPC_STATUS -> "sptr"
#uselib "RPCRT4.dll"
#func global RpcRaiseException "RpcRaiseException" int
; RpcRaiseException exception
; exception : RPC_STATUS -> "int"
; void RpcRaiseException(RPC_STATUS exception)
#uselib "RPCRT4.dll"
#func global RpcRaiseException "RpcRaiseException" int
; RpcRaiseException exception
; exception : RPC_STATUS -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
	procRpcRaiseException = rpcrt4.NewProc("RpcRaiseException")
)

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