Win32 API 日本語リファレンス
ホームSystem.Rpc › RpcSsSetClientAllocFree

RpcSsSetClientAllocFree

関数
RPCクライアントの割り当て/解放関数を設定する。
DLLRPCRT4.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

// RPCRT4.dll
#include <windows.h>

void RpcSsSetClientAllocFree(
    RPC_CLIENT_ALLOC ClientAlloc,
    RPC_CLIENT_FREE ClientFree
);

パラメーター

名前方向
ClientAllocRPC_CLIENT_ALLOCin
ClientFreeRPC_CLIENT_FREEin

戻り値の型: void

各言語での呼び出し定義

// RPCRT4.dll
#include <windows.h>

void RpcSsSetClientAllocFree(
    RPC_CLIENT_ALLOC ClientAlloc,
    RPC_CLIENT_FREE ClientFree
);
[DllImport("RPCRT4.dll", ExactSpelling = true)]
static extern void RpcSsSetClientAllocFree(
    IntPtr ClientAlloc,   // RPC_CLIENT_ALLOC
    IntPtr ClientFree   // RPC_CLIENT_FREE
);
<DllImport("RPCRT4.dll", ExactSpelling:=True)>
Public Shared Sub RpcSsSetClientAllocFree(
    ClientAlloc As IntPtr,   ' RPC_CLIENT_ALLOC
    ClientFree As IntPtr   ' RPC_CLIENT_FREE
)
End Sub
' ClientAlloc : RPC_CLIENT_ALLOC
' ClientFree : RPC_CLIENT_FREE
Declare PtrSafe Sub RpcSsSetClientAllocFree Lib "rpcrt4" ( _
    ByVal ClientAlloc As LongPtr, _
    ByVal ClientFree As LongPtr)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

RpcSsSetClientAllocFree = ctypes.windll.rpcrt4.RpcSsSetClientAllocFree
RpcSsSetClientAllocFree.restype = None
RpcSsSetClientAllocFree.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')
RpcSsSetClientAllocFree = Fiddle::Function.new(
  lib['RpcSsSetClientAllocFree'],
  [
    Fiddle::TYPE_VOIDP,  # ClientAlloc : RPC_CLIENT_ALLOC
    Fiddle::TYPE_VOIDP,  # ClientFree : RPC_CLIENT_FREE
  ],
  Fiddle::TYPE_VOID)
#[link(name = "rpcrt4")]
extern "system" {
    fn RpcSsSetClientAllocFree(
        ClientAlloc: *const core::ffi::c_void,  // RPC_CLIENT_ALLOC
        ClientFree: *const core::ffi::c_void  // RPC_CLIENT_FREE
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("RPCRT4.dll")]
public static extern void RpcSsSetClientAllocFree(IntPtr ClientAlloc, IntPtr ClientFree);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RPCRT4_RpcSsSetClientAllocFree' -Namespace Win32 -PassThru
# $api::RpcSsSetClientAllocFree(ClientAlloc, ClientFree)
#uselib "RPCRT4.dll"
#func global RpcSsSetClientAllocFree "RpcSsSetClientAllocFree" sptr, sptr
; RpcSsSetClientAllocFree ClientAlloc, ClientFree
; ClientAlloc : RPC_CLIENT_ALLOC -> "sptr"
; ClientFree : RPC_CLIENT_FREE -> "sptr"
#uselib "RPCRT4.dll"
#func global RpcSsSetClientAllocFree "RpcSsSetClientAllocFree" sptr, sptr
; RpcSsSetClientAllocFree ClientAlloc, ClientFree
; ClientAlloc : RPC_CLIENT_ALLOC -> "sptr"
; ClientFree : RPC_CLIENT_FREE -> "sptr"
; void RpcSsSetClientAllocFree(RPC_CLIENT_ALLOC ClientAlloc, RPC_CLIENT_FREE ClientFree)
#uselib "RPCRT4.dll"
#func global RpcSsSetClientAllocFree "RpcSsSetClientAllocFree" intptr, intptr
; RpcSsSetClientAllocFree 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")
	procRpcSsSetClientAllocFree = rpcrt4.NewProc("RpcSsSetClientAllocFree")
)

// ClientAlloc (RPC_CLIENT_ALLOC), ClientFree (RPC_CLIENT_FREE)
r1, _, err := procRpcSsSetClientAllocFree.Call(
	uintptr(ClientAlloc),
	uintptr(ClientFree),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // void
procedure RpcSsSetClientAllocFree(
  ClientAlloc: Pointer;   // RPC_CLIENT_ALLOC
  ClientFree: Pointer   // RPC_CLIENT_FREE
); stdcall;
  external 'RPCRT4.dll' name 'RpcSsSetClientAllocFree';
result := DllCall("RPCRT4\RpcSsSetClientAllocFree"
    , "Ptr", ClientAlloc   ; RPC_CLIENT_ALLOC
    , "Ptr", ClientFree   ; RPC_CLIENT_FREE
    , "Int")   ; return: void
●RpcSsSetClientAllocFree(ClientAlloc, ClientFree) = DLL("RPCRT4.dll", "int RpcSsSetClientAllocFree(void*, void*)")
# 呼び出し: RpcSsSetClientAllocFree(ClientAlloc, ClientFree)
# ClientAlloc : RPC_CLIENT_ALLOC -> "void*"
# ClientFree : RPC_CLIENT_FREE -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。