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

WerStoreUploadReport

関数
WERストア内の指定レポートをアップロードする。
DLLwer.dll呼出規約winapi

シグネチャ

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

HRESULT WerStoreUploadReport(
    HREPORTSTORE hReportStore,
    LPCWSTR pszReportKey,
    DWORD dwFlags,
    WER_SUBMIT_RESULT* pSubmitResult   // optional
);

パラメーター

名前方向
hReportStoreHREPORTSTOREin
pszReportKeyLPCWSTRin
dwFlagsDWORDin
pSubmitResultWER_SUBMIT_RESULT*outoptional

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT WerStoreUploadReport(
    HREPORTSTORE hReportStore,
    LPCWSTR pszReportKey,
    DWORD dwFlags,
    WER_SUBMIT_RESULT* pSubmitResult   // optional
);
[DllImport("wer.dll", ExactSpelling = true)]
static extern int WerStoreUploadReport(
    IntPtr hReportStore,   // HREPORTSTORE
    [MarshalAs(UnmanagedType.LPWStr)] string pszReportKey,   // LPCWSTR
    uint dwFlags,   // DWORD
    IntPtr pSubmitResult   // WER_SUBMIT_RESULT* optional, out
);
<DllImport("wer.dll", ExactSpelling:=True)>
Public Shared Function WerStoreUploadReport(
    hReportStore As IntPtr,   ' HREPORTSTORE
    <MarshalAs(UnmanagedType.LPWStr)> pszReportKey As String,   ' LPCWSTR
    dwFlags As UInteger,   ' DWORD
    pSubmitResult As IntPtr   ' WER_SUBMIT_RESULT* optional, out
) As Integer
End Function
' hReportStore : HREPORTSTORE
' pszReportKey : LPCWSTR
' dwFlags : DWORD
' pSubmitResult : WER_SUBMIT_RESULT* optional, out
Declare PtrSafe Function WerStoreUploadReport Lib "wer" ( _
    ByVal hReportStore As LongPtr, _
    ByVal pszReportKey As LongPtr, _
    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

WerStoreUploadReport = ctypes.windll.wer.WerStoreUploadReport
WerStoreUploadReport.restype = ctypes.c_int
WerStoreUploadReport.argtypes = [
    wintypes.HANDLE,  # hReportStore : HREPORTSTORE
    wintypes.LPCWSTR,  # pszReportKey : LPCWSTR
    wintypes.DWORD,  # dwFlags : DWORD
    ctypes.c_void_p,  # pSubmitResult : WER_SUBMIT_RESULT* optional, out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('wer.dll')
WerStoreUploadReport = Fiddle::Function.new(
  lib['WerStoreUploadReport'],
  [
    Fiddle::TYPE_VOIDP,  # hReportStore : HREPORTSTORE
    Fiddle::TYPE_VOIDP,  # pszReportKey : LPCWSTR
    -Fiddle::TYPE_INT,  # dwFlags : DWORD
    Fiddle::TYPE_VOIDP,  # pSubmitResult : WER_SUBMIT_RESULT* optional, out
  ],
  Fiddle::TYPE_INT)
#[link(name = "wer")]
extern "system" {
    fn WerStoreUploadReport(
        hReportStore: *mut core::ffi::c_void,  // HREPORTSTORE
        pszReportKey: *const u16,  // LPCWSTR
        dwFlags: u32,  // DWORD
        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 WerStoreUploadReport(IntPtr hReportStore, [MarshalAs(UnmanagedType.LPWStr)] string pszReportKey, uint dwFlags, IntPtr pSubmitResult);
"@
$api = Add-Type -MemberDefinition $sig -Name 'wer_WerStoreUploadReport' -Namespace Win32 -PassThru
# $api::WerStoreUploadReport(hReportStore, pszReportKey, dwFlags, pSubmitResult)
#uselib "wer.dll"
#func global WerStoreUploadReport "WerStoreUploadReport" sptr, sptr, sptr, sptr
; WerStoreUploadReport hReportStore, pszReportKey, dwFlags, pSubmitResult   ; 戻り値は stat
; hReportStore : HREPORTSTORE -> "sptr"
; pszReportKey : LPCWSTR -> "sptr"
; dwFlags : DWORD -> "sptr"
; pSubmitResult : WER_SUBMIT_RESULT* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "wer.dll"
#cfunc global WerStoreUploadReport "WerStoreUploadReport" sptr, wstr, int, int
; res = WerStoreUploadReport(hReportStore, pszReportKey, dwFlags, pSubmitResult)
; hReportStore : HREPORTSTORE -> "sptr"
; pszReportKey : LPCWSTR -> "wstr"
; dwFlags : DWORD -> "int"
; pSubmitResult : WER_SUBMIT_RESULT* optional, out -> "int"
; HRESULT WerStoreUploadReport(HREPORTSTORE hReportStore, LPCWSTR pszReportKey, DWORD dwFlags, WER_SUBMIT_RESULT* pSubmitResult)
#uselib "wer.dll"
#cfunc global WerStoreUploadReport "WerStoreUploadReport" intptr, wstr, int, int
; res = WerStoreUploadReport(hReportStore, pszReportKey, dwFlags, pSubmitResult)
; hReportStore : HREPORTSTORE -> "intptr"
; pszReportKey : LPCWSTR -> "wstr"
; dwFlags : DWORD -> "int"
; pSubmitResult : WER_SUBMIT_RESULT* optional, out -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	wer = windows.NewLazySystemDLL("wer.dll")
	procWerStoreUploadReport = wer.NewProc("WerStoreUploadReport")
)

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