ホーム › System.Diagnostics.Debug › TerminateProcessOnMemoryExhaustion
TerminateProcessOnMemoryExhaustion
関数メモリ枯渇時にプロセスを終了させる。
シグネチャ
// api-ms-win-core-errorhandling-l1-1-3.dll
#include <windows.h>
void TerminateProcessOnMemoryExhaustion(
UINT_PTR FailedAllocationSize
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| FailedAllocationSize | UINT_PTR | in |
戻り値の型: void
各言語での呼び出し定義
// api-ms-win-core-errorhandling-l1-1-3.dll
#include <windows.h>
void TerminateProcessOnMemoryExhaustion(
UINT_PTR FailedAllocationSize
);[DllImport("api-ms-win-core-errorhandling-l1-1-3.dll", ExactSpelling = true)]
static extern void TerminateProcessOnMemoryExhaustion(
UIntPtr FailedAllocationSize // UINT_PTR
);<DllImport("api-ms-win-core-errorhandling-l1-1-3.dll", ExactSpelling:=True)>
Public Shared Sub TerminateProcessOnMemoryExhaustion(
FailedAllocationSize As UIntPtr ' UINT_PTR
)
End Sub' FailedAllocationSize : UINT_PTR
Declare PtrSafe Sub TerminateProcessOnMemoryExhaustion Lib "api-ms-win-core-errorhandling-l1-1-3" ( _
ByVal FailedAllocationSize As LongPtr)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
TerminateProcessOnMemoryExhaustion = ctypes.windll.LoadLibrary("api-ms-win-core-errorhandling-l1-1-3.dll").TerminateProcessOnMemoryExhaustion
TerminateProcessOnMemoryExhaustion.restype = None
TerminateProcessOnMemoryExhaustion.argtypes = [
ctypes.c_size_t, # FailedAllocationSize : UINT_PTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('api-ms-win-core-errorhandling-l1-1-3.dll')
TerminateProcessOnMemoryExhaustion = Fiddle::Function.new(
lib['TerminateProcessOnMemoryExhaustion'],
[
Fiddle::TYPE_UINTPTR_T, # FailedAllocationSize : UINT_PTR
],
Fiddle::TYPE_VOID)#[link(name = "api-ms-win-core-errorhandling-l1-1-3")]
extern "system" {
fn TerminateProcessOnMemoryExhaustion(
FailedAllocationSize: usize // UINT_PTR
);
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("api-ms-win-core-errorhandling-l1-1-3.dll")]
public static extern void TerminateProcessOnMemoryExhaustion(UIntPtr FailedAllocationSize);
"@
$api = Add-Type -MemberDefinition $sig -Name 'api-ms-win-core-errorhandling-l1-1-3_TerminateProcessOnMemoryExhaustion' -Namespace Win32 -PassThru
# $api::TerminateProcessOnMemoryExhaustion(FailedAllocationSize)#uselib "api-ms-win-core-errorhandling-l1-1-3.dll"
#func global TerminateProcessOnMemoryExhaustion "TerminateProcessOnMemoryExhaustion" sptr
; TerminateProcessOnMemoryExhaustion FailedAllocationSize
; FailedAllocationSize : UINT_PTR -> "sptr"#uselib "api-ms-win-core-errorhandling-l1-1-3.dll"
#func global TerminateProcessOnMemoryExhaustion "TerminateProcessOnMemoryExhaustion" sptr
; TerminateProcessOnMemoryExhaustion FailedAllocationSize
; FailedAllocationSize : UINT_PTR -> "sptr"; void TerminateProcessOnMemoryExhaustion(UINT_PTR FailedAllocationSize)
#uselib "api-ms-win-core-errorhandling-l1-1-3.dll"
#func global TerminateProcessOnMemoryExhaustion "TerminateProcessOnMemoryExhaustion" intptr
; TerminateProcessOnMemoryExhaustion FailedAllocationSize
; FailedAllocationSize : UINT_PTR -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
api_ms_win_core_errorhandling_l1_1_3 = windows.NewLazySystemDLL("api-ms-win-core-errorhandling-l1-1-3.dll")
procTerminateProcessOnMemoryExhaustion = api_ms_win_core_errorhandling_l1_1_3.NewProc("TerminateProcessOnMemoryExhaustion")
)
// FailedAllocationSize (UINT_PTR)
r1, _, err := procTerminateProcessOnMemoryExhaustion.Call(
uintptr(FailedAllocationSize),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // voidprocedure TerminateProcessOnMemoryExhaustion(
FailedAllocationSize: NativeUInt // UINT_PTR
); stdcall;
external 'api-ms-win-core-errorhandling-l1-1-3.dll' name 'TerminateProcessOnMemoryExhaustion';result := DllCall("api-ms-win-core-errorhandling-l1-1-3\TerminateProcessOnMemoryExhaustion"
, "UPtr", FailedAllocationSize ; UINT_PTR
, "Int") ; return: void●TerminateProcessOnMemoryExhaustion(FailedAllocationSize) = DLL("api-ms-win-core-errorhandling-l1-1-3.dll", "int TerminateProcessOnMemoryExhaustion(int)")
# 呼び出し: TerminateProcessOnMemoryExhaustion(FailedAllocationSize)
# FailedAllocationSize : UINT_PTR -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。