Win32 API 日本語リファレンス
ホームSystem.RemoteDesktop › WTSFreeMemory

WTSFreeMemory

関数
WTS関数が割り当てたメモリを解放する。
DLLWTSAPI32.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

void WTSFreeMemory(
    void* pMemory
);

パラメーター

名前方向
pMemoryvoid*inout

戻り値の型: void

各言語での呼び出し定義

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

void WTSFreeMemory(
    void* pMemory
);
[DllImport("WTSAPI32.dll", ExactSpelling = true)]
static extern void WTSFreeMemory(
    IntPtr pMemory   // void* in/out
);
<DllImport("WTSAPI32.dll", ExactSpelling:=True)>
Public Shared Sub WTSFreeMemory(
    pMemory As IntPtr   ' void* in/out
)
End Sub
' pMemory : void* in/out
Declare PtrSafe Sub WTSFreeMemory Lib "wtsapi32" ( _
    ByVal pMemory As LongPtr)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WTSFreeMemory = ctypes.windll.wtsapi32.WTSFreeMemory
WTSFreeMemory.restype = None
WTSFreeMemory.argtypes = [
    ctypes.POINTER(None),  # pMemory : void* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('WTSAPI32.dll')
WTSFreeMemory = Fiddle::Function.new(
  lib['WTSFreeMemory'],
  [
    Fiddle::TYPE_VOIDP,  # pMemory : void* in/out
  ],
  Fiddle::TYPE_VOID)
#[link(name = "wtsapi32")]
extern "system" {
    fn WTSFreeMemory(
        pMemory: *mut ()  // void* in/out
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("WTSAPI32.dll")]
public static extern void WTSFreeMemory(IntPtr pMemory);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WTSAPI32_WTSFreeMemory' -Namespace Win32 -PassThru
# $api::WTSFreeMemory(pMemory)
#uselib "WTSAPI32.dll"
#func global WTSFreeMemory "WTSFreeMemory" sptr
; WTSFreeMemory pMemory
; pMemory : void* in/out -> "sptr"
#uselib "WTSAPI32.dll"
#func global WTSFreeMemory "WTSFreeMemory" sptr
; WTSFreeMemory pMemory
; pMemory : void* in/out -> "sptr"
; void WTSFreeMemory(void* pMemory)
#uselib "WTSAPI32.dll"
#func global WTSFreeMemory "WTSFreeMemory" intptr
; WTSFreeMemory pMemory
; pMemory : void* in/out -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	wtsapi32 = windows.NewLazySystemDLL("WTSAPI32.dll")
	procWTSFreeMemory = wtsapi32.NewProc("WTSFreeMemory")
)

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