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