ホーム › System.Rpc › MesIncrementalHandleReset
MesIncrementalHandleReset
関数増分シリアル化ハンドルを再利用のため再設定する。
シグネチャ
// RPCRT4.dll
#include <windows.h>
RPC_STATUS MesIncrementalHandleReset(
void* Handle,
void* UserState,
MIDL_ES_ALLOC AllocFn,
MIDL_ES_WRITE WriteFn,
MIDL_ES_READ ReadFn,
MIDL_ES_CODE Operation
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| Handle | void* | inout | 再設定する既存のインクリメンタルシリアライズハンドル。 |
| UserState | void* | inout | ユーザー定義の状態を保持するポインタ。コールバックに引き渡される。NULL可。 |
| AllocFn | MIDL_ES_ALLOC | in | エンコード時に使用するMIDL_ES_ALLOCコールバック。デコード時はNULL可。 |
| WriteFn | MIDL_ES_WRITE | in | エンコード時に使用するMIDL_ES_WRITEコールバック。デコード時はNULL可。 |
| ReadFn | MIDL_ES_READ | in | デコード時に使用するMIDL_ES_READコールバック。エンコード時はNULL可。 |
| Operation | MIDL_ES_CODE | in | 操作種別を示すMIDL_ES_CODE列挙値。エンコードかデコードかを指定する。 |
戻り値の型: RPC_STATUS
各言語での呼び出し定義
// RPCRT4.dll
#include <windows.h>
RPC_STATUS MesIncrementalHandleReset(
void* Handle,
void* UserState,
MIDL_ES_ALLOC AllocFn,
MIDL_ES_WRITE WriteFn,
MIDL_ES_READ ReadFn,
MIDL_ES_CODE Operation
);[DllImport("RPCRT4.dll", ExactSpelling = true)]
static extern int MesIncrementalHandleReset(
IntPtr Handle, // void* in/out
IntPtr UserState, // void* in/out
IntPtr AllocFn, // MIDL_ES_ALLOC
IntPtr WriteFn, // MIDL_ES_WRITE
IntPtr ReadFn, // MIDL_ES_READ
int Operation // MIDL_ES_CODE
);<DllImport("RPCRT4.dll", ExactSpelling:=True)>
Public Shared Function MesIncrementalHandleReset(
Handle As IntPtr, ' void* in/out
UserState As IntPtr, ' void* in/out
AllocFn As IntPtr, ' MIDL_ES_ALLOC
WriteFn As IntPtr, ' MIDL_ES_WRITE
ReadFn As IntPtr, ' MIDL_ES_READ
Operation As Integer ' MIDL_ES_CODE
) As Integer
End Function' Handle : void* in/out
' UserState : void* in/out
' AllocFn : MIDL_ES_ALLOC
' WriteFn : MIDL_ES_WRITE
' ReadFn : MIDL_ES_READ
' Operation : MIDL_ES_CODE
Declare PtrSafe Function MesIncrementalHandleReset Lib "rpcrt4" ( _
ByVal Handle As LongPtr, _
ByVal UserState As LongPtr, _
ByVal AllocFn As LongPtr, _
ByVal WriteFn As LongPtr, _
ByVal ReadFn As LongPtr, _
ByVal Operation As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
MesIncrementalHandleReset = ctypes.windll.rpcrt4.MesIncrementalHandleReset
MesIncrementalHandleReset.restype = ctypes.c_int
MesIncrementalHandleReset.argtypes = [
ctypes.POINTER(None), # Handle : void* in/out
ctypes.POINTER(None), # UserState : void* in/out
ctypes.c_void_p, # AllocFn : MIDL_ES_ALLOC
ctypes.c_void_p, # WriteFn : MIDL_ES_WRITE
ctypes.c_void_p, # ReadFn : MIDL_ES_READ
ctypes.c_int, # Operation : MIDL_ES_CODE
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('RPCRT4.dll')
MesIncrementalHandleReset = Fiddle::Function.new(
lib['MesIncrementalHandleReset'],
[
Fiddle::TYPE_VOIDP, # Handle : void* in/out
Fiddle::TYPE_VOIDP, # UserState : void* in/out
Fiddle::TYPE_VOIDP, # AllocFn : MIDL_ES_ALLOC
Fiddle::TYPE_VOIDP, # WriteFn : MIDL_ES_WRITE
Fiddle::TYPE_VOIDP, # ReadFn : MIDL_ES_READ
Fiddle::TYPE_INT, # Operation : MIDL_ES_CODE
],
Fiddle::TYPE_INT)#[link(name = "rpcrt4")]
extern "system" {
fn MesIncrementalHandleReset(
Handle: *mut (), // void* in/out
UserState: *mut (), // void* in/out
AllocFn: *const core::ffi::c_void, // MIDL_ES_ALLOC
WriteFn: *const core::ffi::c_void, // MIDL_ES_WRITE
ReadFn: *const core::ffi::c_void, // MIDL_ES_READ
Operation: i32 // MIDL_ES_CODE
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("RPCRT4.dll")]
public static extern int MesIncrementalHandleReset(IntPtr Handle, IntPtr UserState, IntPtr AllocFn, IntPtr WriteFn, IntPtr ReadFn, int Operation);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RPCRT4_MesIncrementalHandleReset' -Namespace Win32 -PassThru
# $api::MesIncrementalHandleReset(Handle, UserState, AllocFn, WriteFn, ReadFn, Operation)#uselib "RPCRT4.dll"
#func global MesIncrementalHandleReset "MesIncrementalHandleReset" sptr, sptr, sptr, sptr, sptr, sptr
; MesIncrementalHandleReset Handle, UserState, AllocFn, WriteFn, ReadFn, Operation ; 戻り値は stat
; Handle : void* in/out -> "sptr"
; UserState : void* in/out -> "sptr"
; AllocFn : MIDL_ES_ALLOC -> "sptr"
; WriteFn : MIDL_ES_WRITE -> "sptr"
; ReadFn : MIDL_ES_READ -> "sptr"
; Operation : MIDL_ES_CODE -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "RPCRT4.dll"
#cfunc global MesIncrementalHandleReset "MesIncrementalHandleReset" sptr, sptr, sptr, sptr, sptr, int
; res = MesIncrementalHandleReset(Handle, UserState, AllocFn, WriteFn, ReadFn, Operation)
; Handle : void* in/out -> "sptr"
; UserState : void* in/out -> "sptr"
; AllocFn : MIDL_ES_ALLOC -> "sptr"
; WriteFn : MIDL_ES_WRITE -> "sptr"
; ReadFn : MIDL_ES_READ -> "sptr"
; Operation : MIDL_ES_CODE -> "int"; RPC_STATUS MesIncrementalHandleReset(void* Handle, void* UserState, MIDL_ES_ALLOC AllocFn, MIDL_ES_WRITE WriteFn, MIDL_ES_READ ReadFn, MIDL_ES_CODE Operation)
#uselib "RPCRT4.dll"
#cfunc global MesIncrementalHandleReset "MesIncrementalHandleReset" intptr, intptr, intptr, intptr, intptr, int
; res = MesIncrementalHandleReset(Handle, UserState, AllocFn, WriteFn, ReadFn, Operation)
; Handle : void* in/out -> "intptr"
; UserState : void* in/out -> "intptr"
; AllocFn : MIDL_ES_ALLOC -> "intptr"
; WriteFn : MIDL_ES_WRITE -> "intptr"
; ReadFn : MIDL_ES_READ -> "intptr"
; Operation : MIDL_ES_CODE -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
procMesIncrementalHandleReset = rpcrt4.NewProc("MesIncrementalHandleReset")
)
// Handle (void* in/out), UserState (void* in/out), AllocFn (MIDL_ES_ALLOC), WriteFn (MIDL_ES_WRITE), ReadFn (MIDL_ES_READ), Operation (MIDL_ES_CODE)
r1, _, err := procMesIncrementalHandleReset.Call(
uintptr(Handle),
uintptr(UserState),
uintptr(AllocFn),
uintptr(WriteFn),
uintptr(ReadFn),
uintptr(Operation),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // RPC_STATUSfunction MesIncrementalHandleReset(
Handle: Pointer; // void* in/out
UserState: Pointer; // void* in/out
AllocFn: Pointer; // MIDL_ES_ALLOC
WriteFn: Pointer; // MIDL_ES_WRITE
ReadFn: Pointer; // MIDL_ES_READ
Operation: Integer // MIDL_ES_CODE
): Integer; stdcall;
external 'RPCRT4.dll' name 'MesIncrementalHandleReset';result := DllCall("RPCRT4\MesIncrementalHandleReset"
, "Ptr", Handle ; void* in/out
, "Ptr", UserState ; void* in/out
, "Ptr", AllocFn ; MIDL_ES_ALLOC
, "Ptr", WriteFn ; MIDL_ES_WRITE
, "Ptr", ReadFn ; MIDL_ES_READ
, "Int", Operation ; MIDL_ES_CODE
, "Int") ; return: RPC_STATUS●MesIncrementalHandleReset(Handle, UserState, AllocFn, WriteFn, ReadFn, Operation) = DLL("RPCRT4.dll", "int MesIncrementalHandleReset(void*, void*, void*, void*, void*, int)")
# 呼び出し: MesIncrementalHandleReset(Handle, UserState, AllocFn, WriteFn, ReadFn, Operation)
# Handle : void* in/out -> "void*"
# UserState : void* in/out -> "void*"
# AllocFn : MIDL_ES_ALLOC -> "void*"
# WriteFn : MIDL_ES_WRITE -> "void*"
# ReadFn : MIDL_ES_READ -> "void*"
# Operation : MIDL_ES_CODE -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "rpcrt4" fn MesIncrementalHandleReset(
Handle: ?*anyopaque, // void* in/out
UserState: ?*anyopaque, // void* in/out
AllocFn: ?*anyopaque, // MIDL_ES_ALLOC
WriteFn: ?*anyopaque, // MIDL_ES_WRITE
ReadFn: ?*anyopaque, // MIDL_ES_READ
Operation: i32 // MIDL_ES_CODE
) callconv(std.os.windows.WINAPI) i32;proc MesIncrementalHandleReset(
Handle: pointer, # void* in/out
UserState: pointer, # void* in/out
AllocFn: pointer, # MIDL_ES_ALLOC
WriteFn: pointer, # MIDL_ES_WRITE
ReadFn: pointer, # MIDL_ES_READ
Operation: int32 # MIDL_ES_CODE
): int32 {.importc: "MesIncrementalHandleReset", stdcall, dynlib: "RPCRT4.dll".}pragma(lib, "rpcrt4");
extern(Windows)
int MesIncrementalHandleReset(
void* Handle, // void* in/out
void* UserState, // void* in/out
void* AllocFn, // MIDL_ES_ALLOC
void* WriteFn, // MIDL_ES_WRITE
void* ReadFn, // MIDL_ES_READ
int Operation // MIDL_ES_CODE
);ccall((:MesIncrementalHandleReset, "RPCRT4.dll"), stdcall, Int32,
(Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Int32),
Handle, UserState, AllocFn, WriteFn, ReadFn, Operation)
# Handle : void* in/out -> Ptr{Cvoid}
# UserState : void* in/out -> Ptr{Cvoid}
# AllocFn : MIDL_ES_ALLOC -> Ptr{Cvoid}
# WriteFn : MIDL_ES_WRITE -> Ptr{Cvoid}
# ReadFn : MIDL_ES_READ -> Ptr{Cvoid}
# Operation : MIDL_ES_CODE -> Int32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t MesIncrementalHandleReset(
void* Handle,
void* UserState,
void* AllocFn,
void* WriteFn,
void* ReadFn,
int32_t Operation);
]]
local rpcrt4 = ffi.load("rpcrt4")
-- rpcrt4.MesIncrementalHandleReset(Handle, UserState, AllocFn, WriteFn, ReadFn, Operation)
-- Handle : void* in/out
-- UserState : void* in/out
-- AllocFn : MIDL_ES_ALLOC
-- WriteFn : MIDL_ES_WRITE
-- ReadFn : MIDL_ES_READ
-- Operation : MIDL_ES_CODE
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('RPCRT4.dll');
const MesIncrementalHandleReset = lib.func('__stdcall', 'MesIncrementalHandleReset', 'int32_t', ['void *', 'void *', 'void *', 'void *', 'void *', 'int32_t']);
// MesIncrementalHandleReset(Handle, UserState, AllocFn, WriteFn, ReadFn, Operation)
// Handle : void* in/out -> 'void *'
// UserState : void* in/out -> 'void *'
// AllocFn : MIDL_ES_ALLOC -> 'void *'
// WriteFn : MIDL_ES_WRITE -> 'void *'
// ReadFn : MIDL_ES_READ -> 'void *'
// Operation : MIDL_ES_CODE -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
// コールバック(関数ポインタ)は koffi.proto/koffi.register で型を定義して渡す(素の void* では JS 関数を渡せない)。const lib = Deno.dlopen("RPCRT4.dll", {
MesIncrementalHandleReset: { parameters: ["pointer", "pointer", "pointer", "pointer", "pointer", "i32"], result: "i32" },
});
// lib.symbols.MesIncrementalHandleReset(Handle, UserState, AllocFn, WriteFn, ReadFn, Operation)
// Handle : void* in/out -> "pointer"
// UserState : void* in/out -> "pointer"
// AllocFn : MIDL_ES_ALLOC -> "pointer"
// WriteFn : MIDL_ES_WRITE -> "pointer"
// ReadFn : MIDL_ES_READ -> "pointer"
// Operation : MIDL_ES_CODE -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t MesIncrementalHandleReset(
void* Handle,
void* UserState,
void* AllocFn,
void* WriteFn,
void* ReadFn,
int32_t Operation);
C, "RPCRT4.dll");
// $ffi->MesIncrementalHandleReset(Handle, UserState, AllocFn, WriteFn, ReadFn, Operation);
// Handle : void* in/out
// UserState : void* in/out
// AllocFn : MIDL_ES_ALLOC
// WriteFn : MIDL_ES_WRITE
// ReadFn : MIDL_ES_READ
// Operation : MIDL_ES_CODE
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Rpcrt4 extends StdCallLibrary {
Rpcrt4 INSTANCE = Native.load("rpcrt4", Rpcrt4.class);
int MesIncrementalHandleReset(
Pointer Handle, // void* in/out
Pointer UserState, // void* in/out
Callback AllocFn, // MIDL_ES_ALLOC
Callback WriteFn, // MIDL_ES_WRITE
Callback ReadFn, // MIDL_ES_READ
int Operation // MIDL_ES_CODE
);
}@[Link("rpcrt4")]
lib LibRPCRT4
fun MesIncrementalHandleReset = MesIncrementalHandleReset(
Handle : Void*, # void* in/out
UserState : Void*, # void* in/out
AllocFn : Void*, # MIDL_ES_ALLOC
WriteFn : Void*, # MIDL_ES_WRITE
ReadFn : Void*, # MIDL_ES_READ
Operation : Int32 # MIDL_ES_CODE
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef MesIncrementalHandleResetNative = Int32 Function(Pointer<Void>, Pointer<Void>, Pointer<Void>, Pointer<Void>, Pointer<Void>, Int32);
typedef MesIncrementalHandleResetDart = int Function(Pointer<Void>, Pointer<Void>, Pointer<Void>, Pointer<Void>, Pointer<Void>, int);
final MesIncrementalHandleReset = DynamicLibrary.open('RPCRT4.dll')
.lookupFunction<MesIncrementalHandleResetNative, MesIncrementalHandleResetDart>('MesIncrementalHandleReset');
// Handle : void* in/out -> Pointer<Void>
// UserState : void* in/out -> Pointer<Void>
// AllocFn : MIDL_ES_ALLOC -> Pointer<Void>
// WriteFn : MIDL_ES_WRITE -> Pointer<Void>
// ReadFn : MIDL_ES_READ -> Pointer<Void>
// Operation : MIDL_ES_CODE -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function MesIncrementalHandleReset(
Handle: Pointer; // void* in/out
UserState: Pointer; // void* in/out
AllocFn: Pointer; // MIDL_ES_ALLOC
WriteFn: Pointer; // MIDL_ES_WRITE
ReadFn: Pointer; // MIDL_ES_READ
Operation: Integer // MIDL_ES_CODE
): Integer; stdcall;
external 'RPCRT4.dll' name 'MesIncrementalHandleReset';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "MesIncrementalHandleReset"
c_MesIncrementalHandleReset :: Ptr () -> Ptr () -> Ptr () -> Ptr () -> Ptr () -> Int32 -> IO Int32
-- Handle : void* in/out -> Ptr ()
-- UserState : void* in/out -> Ptr ()
-- AllocFn : MIDL_ES_ALLOC -> Ptr ()
-- WriteFn : MIDL_ES_WRITE -> Ptr ()
-- ReadFn : MIDL_ES_READ -> Ptr ()
-- Operation : MIDL_ES_CODE -> Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let mesincrementalhandlereset =
foreign "MesIncrementalHandleReset"
((ptr void) @-> (ptr void) @-> (ptr void) @-> (ptr void) @-> (ptr void) @-> int32_t @-> returning int32_t)
(* Handle : void* in/out -> (ptr void) *)
(* UserState : void* in/out -> (ptr void) *)
(* AllocFn : MIDL_ES_ALLOC -> (ptr void) *)
(* WriteFn : MIDL_ES_WRITE -> (ptr void) *)
(* ReadFn : MIDL_ES_READ -> (ptr void) *)
(* Operation : MIDL_ES_CODE -> int32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library rpcrt4 (t "RPCRT4.dll"))
(cffi:use-foreign-library rpcrt4)
(cffi:defcfun ("MesIncrementalHandleReset" mes-incremental-handle-reset :convention :stdcall) :int32
(handle :pointer) ; void* in/out
(user-state :pointer) ; void* in/out
(alloc-fn :pointer) ; MIDL_ES_ALLOC
(write-fn :pointer) ; MIDL_ES_WRITE
(read-fn :pointer) ; MIDL_ES_READ
(operation :int32)) ; MIDL_ES_CODE
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $MesIncrementalHandleReset = Win32::API::More->new('RPCRT4',
'int MesIncrementalHandleReset(LPVOID Handle, LPVOID UserState, LPVOID AllocFn, LPVOID WriteFn, LPVOID ReadFn, int Operation)');
# my $ret = $MesIncrementalHandleReset->Call($Handle, $UserState, $AllocFn, $WriteFn, $ReadFn, $Operation);
# Handle : void* in/out -> LPVOID
# UserState : void* in/out -> LPVOID
# AllocFn : MIDL_ES_ALLOC -> LPVOID
# WriteFn : MIDL_ES_WRITE -> LPVOID
# ReadFn : MIDL_ES_READ -> LPVOID
# Operation : MIDL_ES_CODE -> int
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# コールバック(関数ポインタ)は Perl sub を直接渡せません。Win32::API::Callback を使用してください。