ホーム › System.Rpc › RpcAsyncAbortCall
RpcAsyncAbortCall
関数非同期RPC呼び出しを指定例外コードで強制中断する。
シグネチャ
// RPCRT4.dll
#include <windows.h>
RPC_STATUS RpcAsyncAbortCall(
RPC_ASYNC_STATE* pAsync,
DWORD ExceptionCode
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pAsync | RPC_ASYNC_STATE* | inout |
| ExceptionCode | DWORD | in |
戻り値の型: RPC_STATUS
各言語での呼び出し定義
// RPCRT4.dll
#include <windows.h>
RPC_STATUS RpcAsyncAbortCall(
RPC_ASYNC_STATE* pAsync,
DWORD ExceptionCode
);[DllImport("RPCRT4.dll", ExactSpelling = true)]
static extern int RpcAsyncAbortCall(
IntPtr pAsync, // RPC_ASYNC_STATE* in/out
uint ExceptionCode // DWORD
);<DllImport("RPCRT4.dll", ExactSpelling:=True)>
Public Shared Function RpcAsyncAbortCall(
pAsync As IntPtr, ' RPC_ASYNC_STATE* in/out
ExceptionCode As UInteger ' DWORD
) As Integer
End Function' pAsync : RPC_ASYNC_STATE* in/out
' ExceptionCode : DWORD
Declare PtrSafe Function RpcAsyncAbortCall Lib "rpcrt4" ( _
ByVal pAsync As LongPtr, _
ByVal ExceptionCode As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
RpcAsyncAbortCall = ctypes.windll.rpcrt4.RpcAsyncAbortCall
RpcAsyncAbortCall.restype = ctypes.c_int
RpcAsyncAbortCall.argtypes = [
ctypes.c_void_p, # pAsync : RPC_ASYNC_STATE* in/out
wintypes.DWORD, # ExceptionCode : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('RPCRT4.dll')
RpcAsyncAbortCall = Fiddle::Function.new(
lib['RpcAsyncAbortCall'],
[
Fiddle::TYPE_VOIDP, # pAsync : RPC_ASYNC_STATE* in/out
-Fiddle::TYPE_INT, # ExceptionCode : DWORD
],
Fiddle::TYPE_INT)#[link(name = "rpcrt4")]
extern "system" {
fn RpcAsyncAbortCall(
pAsync: *mut RPC_ASYNC_STATE, // RPC_ASYNC_STATE* in/out
ExceptionCode: u32 // DWORD
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("RPCRT4.dll")]
public static extern int RpcAsyncAbortCall(IntPtr pAsync, uint ExceptionCode);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RPCRT4_RpcAsyncAbortCall' -Namespace Win32 -PassThru
# $api::RpcAsyncAbortCall(pAsync, ExceptionCode)#uselib "RPCRT4.dll"
#func global RpcAsyncAbortCall "RpcAsyncAbortCall" sptr, sptr
; RpcAsyncAbortCall varptr(pAsync), ExceptionCode ; 戻り値は stat
; pAsync : RPC_ASYNC_STATE* in/out -> "sptr"
; ExceptionCode : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "RPCRT4.dll" #cfunc global RpcAsyncAbortCall "RpcAsyncAbortCall" var, int ; res = RpcAsyncAbortCall(pAsync, ExceptionCode) ; pAsync : RPC_ASYNC_STATE* in/out -> "var" ; ExceptionCode : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "RPCRT4.dll" #cfunc global RpcAsyncAbortCall "RpcAsyncAbortCall" sptr, int ; res = RpcAsyncAbortCall(varptr(pAsync), ExceptionCode) ; pAsync : RPC_ASYNC_STATE* in/out -> "sptr" ; ExceptionCode : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; RPC_STATUS RpcAsyncAbortCall(RPC_ASYNC_STATE* pAsync, DWORD ExceptionCode) #uselib "RPCRT4.dll" #cfunc global RpcAsyncAbortCall "RpcAsyncAbortCall" var, int ; res = RpcAsyncAbortCall(pAsync, ExceptionCode) ; pAsync : RPC_ASYNC_STATE* in/out -> "var" ; ExceptionCode : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; RPC_STATUS RpcAsyncAbortCall(RPC_ASYNC_STATE* pAsync, DWORD ExceptionCode) #uselib "RPCRT4.dll" #cfunc global RpcAsyncAbortCall "RpcAsyncAbortCall" intptr, int ; res = RpcAsyncAbortCall(varptr(pAsync), ExceptionCode) ; pAsync : RPC_ASYNC_STATE* in/out -> "intptr" ; ExceptionCode : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
procRpcAsyncAbortCall = rpcrt4.NewProc("RpcAsyncAbortCall")
)
// pAsync (RPC_ASYNC_STATE* in/out), ExceptionCode (DWORD)
r1, _, err := procRpcAsyncAbortCall.Call(
uintptr(pAsync),
uintptr(ExceptionCode),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // RPC_STATUSfunction RpcAsyncAbortCall(
pAsync: Pointer; // RPC_ASYNC_STATE* in/out
ExceptionCode: DWORD // DWORD
): Integer; stdcall;
external 'RPCRT4.dll' name 'RpcAsyncAbortCall';result := DllCall("RPCRT4\RpcAsyncAbortCall"
, "Ptr", pAsync ; RPC_ASYNC_STATE* in/out
, "UInt", ExceptionCode ; DWORD
, "Int") ; return: RPC_STATUS●RpcAsyncAbortCall(pAsync, ExceptionCode) = DLL("RPCRT4.dll", "int RpcAsyncAbortCall(void*, dword)")
# 呼び出し: RpcAsyncAbortCall(pAsync, ExceptionCode)
# pAsync : RPC_ASYNC_STATE* in/out -> "void*"
# ExceptionCode : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。