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