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