Win32 API 日本語リファレンス
ホームNetworking.ActiveDirectory › ReallocADsMem

ReallocADsMem

関数
ADSI用メモリブロックのサイズを再確保する。
DLLACTIVEDS.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

void* ReallocADsMem(
    void* pOldMem,
    DWORD cbOld,
    DWORD cbNew
);

パラメーター

名前方向
pOldMemvoid*inout
cbOldDWORDin
cbNewDWORDin

戻り値の型: void*

各言語での呼び出し定義

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

void* ReallocADsMem(
    void* pOldMem,
    DWORD cbOld,
    DWORD cbNew
);
[DllImport("ACTIVEDS.dll", ExactSpelling = true)]
static extern IntPtr ReallocADsMem(
    IntPtr pOldMem,   // void* in/out
    uint cbOld,   // DWORD
    uint cbNew   // DWORD
);
<DllImport("ACTIVEDS.dll", ExactSpelling:=True)>
Public Shared Function ReallocADsMem(
    pOldMem As IntPtr,   ' void* in/out
    cbOld As UInteger,   ' DWORD
    cbNew As UInteger   ' DWORD
) As IntPtr
End Function
' pOldMem : void* in/out
' cbOld : DWORD
' cbNew : DWORD
Declare PtrSafe Function ReallocADsMem Lib "activeds" ( _
    ByVal pOldMem As LongPtr, _
    ByVal cbOld As Long, _
    ByVal cbNew As Long) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ReallocADsMem = ctypes.windll.activeds.ReallocADsMem
ReallocADsMem.restype = ctypes.c_void_p
ReallocADsMem.argtypes = [
    ctypes.POINTER(None),  # pOldMem : void* in/out
    wintypes.DWORD,  # cbOld : DWORD
    wintypes.DWORD,  # cbNew : DWORD
]
require 'fiddle'
require 'fiddle/import'

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

var (
	activeds = windows.NewLazySystemDLL("ACTIVEDS.dll")
	procReallocADsMem = activeds.NewProc("ReallocADsMem")
)

// pOldMem (void* in/out), cbOld (DWORD), cbNew (DWORD)
r1, _, err := procReallocADsMem.Call(
	uintptr(pOldMem),
	uintptr(cbOld),
	uintptr(cbNew),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // void*
function ReallocADsMem(
  pOldMem: Pointer;   // void* in/out
  cbOld: DWORD;   // DWORD
  cbNew: DWORD   // DWORD
): Pointer; stdcall;
  external 'ACTIVEDS.dll' name 'ReallocADsMem';
result := DllCall("ACTIVEDS\ReallocADsMem"
    , "Ptr", pOldMem   ; void* in/out
    , "UInt", cbOld   ; DWORD
    , "UInt", cbNew   ; DWORD
    , "Ptr")   ; return: void*
●ReallocADsMem(pOldMem, cbOld, cbNew) = DLL("ACTIVEDS.dll", "void* ReallocADsMem(void*, dword, dword)")
# 呼び出し: ReallocADsMem(pOldMem, cbOld, cbNew)
# pOldMem : void* in/out -> "void*"
# cbOld : DWORD -> "dword"
# cbNew : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。