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

WerUnregisterFile

関数
WERに登録したファイルの登録を解除する。
DLLKERNEL32.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

HRESULT WerUnregisterFile(
    LPCWSTR pwzFilePath
);

パラメーター

名前方向
pwzFilePathLPCWSTRin

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

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

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

var (
	kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
	procWerUnregisterFile = kernel32.NewProc("WerUnregisterFile")
)

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