ホーム › System.ErrorReporting › WerReportSetParameter
WerReportSetParameter
関数WERレポートのパラメータ名と値を設定する。
シグネチャ
// wer.dll
#include <windows.h>
HRESULT WerReportSetParameter(
HREPORT hReportHandle,
DWORD dwparamID,
LPCWSTR pwzName, // optional
LPCWSTR pwzValue
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hReportHandle | HREPORT | in |
| dwparamID | DWORD | in |
| pwzName | LPCWSTR | inoptional |
| pwzValue | LPCWSTR | in |
戻り値の型: HRESULT
各言語での呼び出し定義
// wer.dll
#include <windows.h>
HRESULT WerReportSetParameter(
HREPORT hReportHandle,
DWORD dwparamID,
LPCWSTR pwzName, // optional
LPCWSTR pwzValue
);[DllImport("wer.dll", ExactSpelling = true)]
static extern int WerReportSetParameter(
IntPtr hReportHandle, // HREPORT
uint dwparamID, // DWORD
[MarshalAs(UnmanagedType.LPWStr)] string pwzName, // LPCWSTR optional
[MarshalAs(UnmanagedType.LPWStr)] string pwzValue // LPCWSTR
);<DllImport("wer.dll", ExactSpelling:=True)>
Public Shared Function WerReportSetParameter(
hReportHandle As IntPtr, ' HREPORT
dwparamID As UInteger, ' DWORD
<MarshalAs(UnmanagedType.LPWStr)> pwzName As String, ' LPCWSTR optional
<MarshalAs(UnmanagedType.LPWStr)> pwzValue As String ' LPCWSTR
) As Integer
End Function' hReportHandle : HREPORT
' dwparamID : DWORD
' pwzName : LPCWSTR optional
' pwzValue : LPCWSTR
Declare PtrSafe Function WerReportSetParameter Lib "wer" ( _
ByVal hReportHandle As LongPtr, _
ByVal dwparamID As Long, _
ByVal pwzName As LongPtr, _
ByVal pwzValue As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
WerReportSetParameter = ctypes.windll.wer.WerReportSetParameter
WerReportSetParameter.restype = ctypes.c_int
WerReportSetParameter.argtypes = [
wintypes.HANDLE, # hReportHandle : HREPORT
wintypes.DWORD, # dwparamID : DWORD
wintypes.LPCWSTR, # pwzName : LPCWSTR optional
wintypes.LPCWSTR, # pwzValue : LPCWSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('wer.dll')
WerReportSetParameter = Fiddle::Function.new(
lib['WerReportSetParameter'],
[
Fiddle::TYPE_VOIDP, # hReportHandle : HREPORT
-Fiddle::TYPE_INT, # dwparamID : DWORD
Fiddle::TYPE_VOIDP, # pwzName : LPCWSTR optional
Fiddle::TYPE_VOIDP, # pwzValue : LPCWSTR
],
Fiddle::TYPE_INT)#[link(name = "wer")]
extern "system" {
fn WerReportSetParameter(
hReportHandle: *mut core::ffi::c_void, // HREPORT
dwparamID: u32, // DWORD
pwzName: *const u16, // LPCWSTR optional
pwzValue: *const u16 // LPCWSTR
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("wer.dll")]
public static extern int WerReportSetParameter(IntPtr hReportHandle, uint dwparamID, [MarshalAs(UnmanagedType.LPWStr)] string pwzName, [MarshalAs(UnmanagedType.LPWStr)] string pwzValue);
"@
$api = Add-Type -MemberDefinition $sig -Name 'wer_WerReportSetParameter' -Namespace Win32 -PassThru
# $api::WerReportSetParameter(hReportHandle, dwparamID, pwzName, pwzValue)#uselib "wer.dll"
#func global WerReportSetParameter "WerReportSetParameter" sptr, sptr, sptr, sptr
; WerReportSetParameter hReportHandle, dwparamID, pwzName, pwzValue ; 戻り値は stat
; hReportHandle : HREPORT -> "sptr"
; dwparamID : DWORD -> "sptr"
; pwzName : LPCWSTR optional -> "sptr"
; pwzValue : LPCWSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "wer.dll"
#cfunc global WerReportSetParameter "WerReportSetParameter" sptr, int, wstr, wstr
; res = WerReportSetParameter(hReportHandle, dwparamID, pwzName, pwzValue)
; hReportHandle : HREPORT -> "sptr"
; dwparamID : DWORD -> "int"
; pwzName : LPCWSTR optional -> "wstr"
; pwzValue : LPCWSTR -> "wstr"; HRESULT WerReportSetParameter(HREPORT hReportHandle, DWORD dwparamID, LPCWSTR pwzName, LPCWSTR pwzValue)
#uselib "wer.dll"
#cfunc global WerReportSetParameter "WerReportSetParameter" intptr, int, wstr, wstr
; res = WerReportSetParameter(hReportHandle, dwparamID, pwzName, pwzValue)
; hReportHandle : HREPORT -> "intptr"
; dwparamID : DWORD -> "int"
; pwzName : LPCWSTR optional -> "wstr"
; pwzValue : LPCWSTR -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
wer = windows.NewLazySystemDLL("wer.dll")
procWerReportSetParameter = wer.NewProc("WerReportSetParameter")
)
// hReportHandle (HREPORT), dwparamID (DWORD), pwzName (LPCWSTR optional), pwzValue (LPCWSTR)
r1, _, err := procWerReportSetParameter.Call(
uintptr(hReportHandle),
uintptr(dwparamID),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pwzName))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pwzValue))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction WerReportSetParameter(
hReportHandle: THandle; // HREPORT
dwparamID: DWORD; // DWORD
pwzName: PWideChar; // LPCWSTR optional
pwzValue: PWideChar // LPCWSTR
): Integer; stdcall;
external 'wer.dll' name 'WerReportSetParameter';result := DllCall("wer\WerReportSetParameter"
, "Ptr", hReportHandle ; HREPORT
, "UInt", dwparamID ; DWORD
, "WStr", pwzName ; LPCWSTR optional
, "WStr", pwzValue ; LPCWSTR
, "Int") ; return: HRESULT●WerReportSetParameter(hReportHandle, dwparamID, pwzName, pwzValue) = DLL("wer.dll", "int WerReportSetParameter(void*, dword, char*, char*)")
# 呼び出し: WerReportSetParameter(hReportHandle, dwparamID, pwzName, pwzValue)
# hReportHandle : HREPORT -> "void*"
# dwparamID : DWORD -> "dword"
# pwzName : LPCWSTR optional -> "char*"
# pwzValue : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。