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