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

AllocADsMem

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

シグネチャ

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

void* AllocADsMem(
    DWORD cb
);

パラメーター

名前方向
cbDWORDin

戻り値の型: void*

各言語での呼び出し定義

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

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

AllocADsMem = ctypes.windll.activeds.AllocADsMem
AllocADsMem.restype = ctypes.c_void_p
AllocADsMem.argtypes = [
    wintypes.DWORD,  # cb : DWORD
]
require 'fiddle'
require 'fiddle/import'

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

var (
	activeds = windows.NewLazySystemDLL("ACTIVEDS.dll")
	procAllocADsMem = activeds.NewProc("AllocADsMem")
)

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