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