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