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

WerRegisterExcludedMemoryBlock

関数
ダンプから除外するメモリブロックを登録する。
DLLKERNEL32.dll呼出規約winapi対応OSWindows 10 以降

シグネチャ

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

HRESULT WerRegisterExcludedMemoryBlock(
    const void* address,
    DWORD size
);

パラメーター

名前方向
addressvoid*in
sizeDWORDin

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

WerRegisterExcludedMemoryBlock = ctypes.windll.kernel32.WerRegisterExcludedMemoryBlock
WerRegisterExcludedMemoryBlock.restype = ctypes.c_int
WerRegisterExcludedMemoryBlock.argtypes = [
    ctypes.POINTER(None),  # address : void*
    wintypes.DWORD,  # size : DWORD
]
require 'fiddle'
require 'fiddle/import'

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

var (
	kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
	procWerRegisterExcludedMemoryBlock = kernel32.NewProc("WerRegisterExcludedMemoryBlock")
)

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