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