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