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

WerRegisterAppLocalDump

関数
アプリローカルのダンプ保存先をWERに登録する。
DLLKERNEL32.dll呼出規約winapi対応OSWindows 10 以降

シグネチャ

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

HRESULT WerRegisterAppLocalDump(
    LPCWSTR localAppDataRelativePath
);

パラメーター

名前方向
localAppDataRelativePathLPCWSTRin

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT WerRegisterAppLocalDump(
    LPCWSTR localAppDataRelativePath
);
[DllImport("KERNEL32.dll", ExactSpelling = true)]
static extern int WerRegisterAppLocalDump(
    [MarshalAs(UnmanagedType.LPWStr)] string localAppDataRelativePath   // LPCWSTR
);
<DllImport("KERNEL32.dll", ExactSpelling:=True)>
Public Shared Function WerRegisterAppLocalDump(
    <MarshalAs(UnmanagedType.LPWStr)> localAppDataRelativePath As String   ' LPCWSTR
) As Integer
End Function
' localAppDataRelativePath : LPCWSTR
Declare PtrSafe Function WerRegisterAppLocalDump Lib "kernel32" ( _
    ByVal localAppDataRelativePath As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WerRegisterAppLocalDump = ctypes.windll.kernel32.WerRegisterAppLocalDump
WerRegisterAppLocalDump.restype = ctypes.c_int
WerRegisterAppLocalDump.argtypes = [
    wintypes.LPCWSTR,  # localAppDataRelativePath : LPCWSTR
]
require 'fiddle'
require 'fiddle/import'

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

var (
	kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
	procWerRegisterAppLocalDump = kernel32.NewProc("WerRegisterAppLocalDump")
)

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