ホーム › System.Rpc › RpcSmSetClientAllocFree
RpcSmSetClientAllocFree
関数RPCクライアントの割り当て/解放関数を設定する。
シグネチャ
// RPCRT4.dll
#include <windows.h>
RPC_STATUS RpcSmSetClientAllocFree(
RPC_CLIENT_ALLOC ClientAlloc,
RPC_CLIENT_FREE ClientFree
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| ClientAlloc | RPC_CLIENT_ALLOC | in |
| ClientFree | RPC_CLIENT_FREE | in |
戻り値の型: RPC_STATUS
各言語での呼び出し定義
// RPCRT4.dll
#include <windows.h>
RPC_STATUS RpcSmSetClientAllocFree(
RPC_CLIENT_ALLOC ClientAlloc,
RPC_CLIENT_FREE ClientFree
);[DllImport("RPCRT4.dll", ExactSpelling = true)]
static extern int RpcSmSetClientAllocFree(
IntPtr ClientAlloc, // RPC_CLIENT_ALLOC
IntPtr ClientFree // RPC_CLIENT_FREE
);<DllImport("RPCRT4.dll", ExactSpelling:=True)>
Public Shared Function RpcSmSetClientAllocFree(
ClientAlloc As IntPtr, ' RPC_CLIENT_ALLOC
ClientFree As IntPtr ' RPC_CLIENT_FREE
) As Integer
End Function' ClientAlloc : RPC_CLIENT_ALLOC
' ClientFree : RPC_CLIENT_FREE
Declare PtrSafe Function RpcSmSetClientAllocFree Lib "rpcrt4" ( _
ByVal ClientAlloc As LongPtr, _
ByVal ClientFree As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
RpcSmSetClientAllocFree = ctypes.windll.rpcrt4.RpcSmSetClientAllocFree
RpcSmSetClientAllocFree.restype = ctypes.c_int
RpcSmSetClientAllocFree.argtypes = [
ctypes.c_void_p, # ClientAlloc : RPC_CLIENT_ALLOC
ctypes.c_void_p, # ClientFree : RPC_CLIENT_FREE
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('RPCRT4.dll')
RpcSmSetClientAllocFree = Fiddle::Function.new(
lib['RpcSmSetClientAllocFree'],
[
Fiddle::TYPE_VOIDP, # ClientAlloc : RPC_CLIENT_ALLOC
Fiddle::TYPE_VOIDP, # ClientFree : RPC_CLIENT_FREE
],
Fiddle::TYPE_INT)#[link(name = "rpcrt4")]
extern "system" {
fn RpcSmSetClientAllocFree(
ClientAlloc: *const core::ffi::c_void, // RPC_CLIENT_ALLOC
ClientFree: *const core::ffi::c_void // RPC_CLIENT_FREE
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("RPCRT4.dll")]
public static extern int RpcSmSetClientAllocFree(IntPtr ClientAlloc, IntPtr ClientFree);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RPCRT4_RpcSmSetClientAllocFree' -Namespace Win32 -PassThru
# $api::RpcSmSetClientAllocFree(ClientAlloc, ClientFree)#uselib "RPCRT4.dll"
#func global RpcSmSetClientAllocFree "RpcSmSetClientAllocFree" sptr, sptr
; RpcSmSetClientAllocFree ClientAlloc, ClientFree ; 戻り値は stat
; ClientAlloc : RPC_CLIENT_ALLOC -> "sptr"
; ClientFree : RPC_CLIENT_FREE -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "RPCRT4.dll"
#cfunc global RpcSmSetClientAllocFree "RpcSmSetClientAllocFree" sptr, sptr
; res = RpcSmSetClientAllocFree(ClientAlloc, ClientFree)
; ClientAlloc : RPC_CLIENT_ALLOC -> "sptr"
; ClientFree : RPC_CLIENT_FREE -> "sptr"; RPC_STATUS RpcSmSetClientAllocFree(RPC_CLIENT_ALLOC ClientAlloc, RPC_CLIENT_FREE ClientFree)
#uselib "RPCRT4.dll"
#cfunc global RpcSmSetClientAllocFree "RpcSmSetClientAllocFree" intptr, intptr
; res = RpcSmSetClientAllocFree(ClientAlloc, ClientFree)
; ClientAlloc : RPC_CLIENT_ALLOC -> "intptr"
; ClientFree : RPC_CLIENT_FREE -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
procRpcSmSetClientAllocFree = rpcrt4.NewProc("RpcSmSetClientAllocFree")
)
// ClientAlloc (RPC_CLIENT_ALLOC), ClientFree (RPC_CLIENT_FREE)
r1, _, err := procRpcSmSetClientAllocFree.Call(
uintptr(ClientAlloc),
uintptr(ClientFree),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // RPC_STATUSfunction RpcSmSetClientAllocFree(
ClientAlloc: Pointer; // RPC_CLIENT_ALLOC
ClientFree: Pointer // RPC_CLIENT_FREE
): Integer; stdcall;
external 'RPCRT4.dll' name 'RpcSmSetClientAllocFree';result := DllCall("RPCRT4\RpcSmSetClientAllocFree"
, "Ptr", ClientAlloc ; RPC_CLIENT_ALLOC
, "Ptr", ClientFree ; RPC_CLIENT_FREE
, "Int") ; return: RPC_STATUS●RpcSmSetClientAllocFree(ClientAlloc, ClientFree) = DLL("RPCRT4.dll", "int RpcSmSetClientAllocFree(void*, void*)")
# 呼び出し: RpcSmSetClientAllocFree(ClientAlloc, ClientFree)
# ClientAlloc : RPC_CLIENT_ALLOC -> "void*"
# ClientFree : RPC_CLIENT_FREE -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。