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