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

WerReportSubmit

関数
作成したWERレポートをサーバーへ送信する。
DLLwer.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

HRESULT WerReportSubmit(
    HREPORT hReportHandle,
    WER_CONSENT consent,
    WER_SUBMIT_FLAGS dwFlags,
    WER_SUBMIT_RESULT* pSubmitResult   // optional
);

パラメーター

名前方向
hReportHandleHREPORTin
consentWER_CONSENTin
dwFlagsWER_SUBMIT_FLAGSin
pSubmitResultWER_SUBMIT_RESULT*outoptional

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT WerReportSubmit(
    HREPORT hReportHandle,
    WER_CONSENT consent,
    WER_SUBMIT_FLAGS dwFlags,
    WER_SUBMIT_RESULT* pSubmitResult   // optional
);
[DllImport("wer.dll", ExactSpelling = true)]
static extern int WerReportSubmit(
    IntPtr hReportHandle,   // HREPORT
    int consent,   // WER_CONSENT
    uint dwFlags,   // WER_SUBMIT_FLAGS
    IntPtr pSubmitResult   // WER_SUBMIT_RESULT* optional, out
);
<DllImport("wer.dll", ExactSpelling:=True)>
Public Shared Function WerReportSubmit(
    hReportHandle As IntPtr,   ' HREPORT
    consent As Integer,   ' WER_CONSENT
    dwFlags As UInteger,   ' WER_SUBMIT_FLAGS
    pSubmitResult As IntPtr   ' WER_SUBMIT_RESULT* optional, out
) As Integer
End Function
' hReportHandle : HREPORT
' consent : WER_CONSENT
' dwFlags : WER_SUBMIT_FLAGS
' pSubmitResult : WER_SUBMIT_RESULT* optional, out
Declare PtrSafe Function WerReportSubmit Lib "wer" ( _
    ByVal hReportHandle As LongPtr, _
    ByVal consent As Long, _
    ByVal dwFlags As Long, _
    ByVal pSubmitResult As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WerReportSubmit = ctypes.windll.wer.WerReportSubmit
WerReportSubmit.restype = ctypes.c_int
WerReportSubmit.argtypes = [
    wintypes.HANDLE,  # hReportHandle : HREPORT
    ctypes.c_int,  # consent : WER_CONSENT
    wintypes.DWORD,  # dwFlags : WER_SUBMIT_FLAGS
    ctypes.c_void_p,  # pSubmitResult : WER_SUBMIT_RESULT* optional, out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('wer.dll')
WerReportSubmit = Fiddle::Function.new(
  lib['WerReportSubmit'],
  [
    Fiddle::TYPE_VOIDP,  # hReportHandle : HREPORT
    Fiddle::TYPE_INT,  # consent : WER_CONSENT
    -Fiddle::TYPE_INT,  # dwFlags : WER_SUBMIT_FLAGS
    Fiddle::TYPE_VOIDP,  # pSubmitResult : WER_SUBMIT_RESULT* optional, out
  ],
  Fiddle::TYPE_INT)
#[link(name = "wer")]
extern "system" {
    fn WerReportSubmit(
        hReportHandle: *mut core::ffi::c_void,  // HREPORT
        consent: i32,  // WER_CONSENT
        dwFlags: u32,  // WER_SUBMIT_FLAGS
        pSubmitResult: *mut i32  // WER_SUBMIT_RESULT* optional, out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("wer.dll")]
public static extern int WerReportSubmit(IntPtr hReportHandle, int consent, uint dwFlags, IntPtr pSubmitResult);
"@
$api = Add-Type -MemberDefinition $sig -Name 'wer_WerReportSubmit' -Namespace Win32 -PassThru
# $api::WerReportSubmit(hReportHandle, consent, dwFlags, pSubmitResult)
#uselib "wer.dll"
#func global WerReportSubmit "WerReportSubmit" sptr, sptr, sptr, sptr
; WerReportSubmit hReportHandle, consent, dwFlags, pSubmitResult   ; 戻り値は stat
; hReportHandle : HREPORT -> "sptr"
; consent : WER_CONSENT -> "sptr"
; dwFlags : WER_SUBMIT_FLAGS -> "sptr"
; pSubmitResult : WER_SUBMIT_RESULT* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "wer.dll"
#cfunc global WerReportSubmit "WerReportSubmit" sptr, int, int, int
; res = WerReportSubmit(hReportHandle, consent, dwFlags, pSubmitResult)
; hReportHandle : HREPORT -> "sptr"
; consent : WER_CONSENT -> "int"
; dwFlags : WER_SUBMIT_FLAGS -> "int"
; pSubmitResult : WER_SUBMIT_RESULT* optional, out -> "int"
; HRESULT WerReportSubmit(HREPORT hReportHandle, WER_CONSENT consent, WER_SUBMIT_FLAGS dwFlags, WER_SUBMIT_RESULT* pSubmitResult)
#uselib "wer.dll"
#cfunc global WerReportSubmit "WerReportSubmit" intptr, int, int, int
; res = WerReportSubmit(hReportHandle, consent, dwFlags, pSubmitResult)
; hReportHandle : HREPORT -> "intptr"
; consent : WER_CONSENT -> "int"
; dwFlags : WER_SUBMIT_FLAGS -> "int"
; pSubmitResult : WER_SUBMIT_RESULT* optional, out -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	wer = windows.NewLazySystemDLL("wer.dll")
	procWerReportSubmit = wer.NewProc("WerReportSubmit")
)

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