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

WerRemoveExcludedApplication

関数
WERの除外アプリ登録を解除する。
DLLwer.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

HRESULT WerRemoveExcludedApplication(
    LPCWSTR pwzExeName,
    BOOL bAllUsers
);

パラメーター

名前方向
pwzExeNameLPCWSTRin
bAllUsersBOOLin

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

WerRemoveExcludedApplication = ctypes.windll.wer.WerRemoveExcludedApplication
WerRemoveExcludedApplication.restype = ctypes.c_int
WerRemoveExcludedApplication.argtypes = [
    wintypes.LPCWSTR,  # pwzExeName : LPCWSTR
    wintypes.BOOL,  # bAllUsers : BOOL
]
require 'fiddle'
require 'fiddle/import'

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

var (
	wer = windows.NewLazySystemDLL("wer.dll")
	procWerRemoveExcludedApplication = wer.NewProc("WerRemoveExcludedApplication")
)

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