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

RpcSsAllocate

関数
RPCスタブメモリ管理でメモリを割り当てる。
DLLRPCRT4.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

void* RpcSsAllocate(
    UINT_PTR Size
);

パラメーター

名前方向
SizeUINT_PTRin

戻り値の型: void*

各言語での呼び出し定義

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

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

RpcSsAllocate = ctypes.windll.rpcrt4.RpcSsAllocate
RpcSsAllocate.restype = ctypes.c_void_p
RpcSsAllocate.argtypes = [
    ctypes.c_size_t,  # Size : UINT_PTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('RPCRT4.dll')
RpcSsAllocate = Fiddle::Function.new(
  lib['RpcSsAllocate'],
  [
    Fiddle::TYPE_UINTPTR_T,  # Size : UINT_PTR
  ],
  Fiddle::TYPE_VOIDP)
#[link(name = "rpcrt4")]
extern "system" {
    fn RpcSsAllocate(
        Size: usize  // UINT_PTR
    ) -> *mut ();
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("RPCRT4.dll")]
public static extern IntPtr RpcSsAllocate(UIntPtr Size);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RPCRT4_RpcSsAllocate' -Namespace Win32 -PassThru
# $api::RpcSsAllocate(Size)
#uselib "RPCRT4.dll"
#func global RpcSsAllocate "RpcSsAllocate" sptr
; RpcSsAllocate Size   ; 戻り値は stat
; Size : UINT_PTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "RPCRT4.dll"
#cfunc global RpcSsAllocate "RpcSsAllocate" sptr
; res = RpcSsAllocate(Size)
; Size : UINT_PTR -> "sptr"
; void* RpcSsAllocate(UINT_PTR Size)
#uselib "RPCRT4.dll"
#cfunc global RpcSsAllocate "RpcSsAllocate" intptr
; res = RpcSsAllocate(Size)
; Size : UINT_PTR -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	rpcrt4 = windows.NewLazySystemDLL("RPCRT4.dll")
	procRpcSsAllocate = rpcrt4.NewProc("RpcSsAllocate")
)

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