ホーム › 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 | 対象レポートストアのHREPORTSTOREハンドル。 |
| pszReportKey | LPCWSTR | in | メタデータを取得するレポートのキー文字列。 |
| pReportMetadata | WER_REPORT_METADATA_V2* | out | V2形式のメタデータを受け取るWER_REPORT_METADATA_V2構造体へのポインタ。 |
戻り値の型: 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)。const std = @import("std");
extern "wer" fn WerStoreQueryReportMetadataV2(
hReportStore: ?*anyopaque, // HREPORTSTORE
pszReportKey: [*c]const u16, // LPCWSTR
pReportMetadata: [*c]WER_REPORT_METADATA_V2 // WER_REPORT_METADATA_V2* out
) callconv(std.os.windows.WINAPI) i32;proc WerStoreQueryReportMetadataV2(
hReportStore: pointer, # HREPORTSTORE
pszReportKey: WideCString, # LPCWSTR
pReportMetadata: ptr WER_REPORT_METADATA_V2 # WER_REPORT_METADATA_V2* out
): int32 {.importc: "WerStoreQueryReportMetadataV2", stdcall, dynlib: "wer.dll".}pragma(lib, "wer");
extern(Windows)
int WerStoreQueryReportMetadataV2(
void* hReportStore, // HREPORTSTORE
const(wchar)* pszReportKey, // LPCWSTR
WER_REPORT_METADATA_V2* pReportMetadata // WER_REPORT_METADATA_V2* out
);ccall((:WerStoreQueryReportMetadataV2, "wer.dll"), stdcall, Int32,
(Ptr{Cvoid}, Cwstring, Ptr{WER_REPORT_METADATA_V2}),
hReportStore, pszReportKey, pReportMetadata)
# hReportStore : HREPORTSTORE -> Ptr{Cvoid}
# pszReportKey : LPCWSTR -> Cwstring
# pReportMetadata : WER_REPORT_METADATA_V2* out -> Ptr{WER_REPORT_METADATA_V2}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t WerStoreQueryReportMetadataV2(
void* hReportStore,
const uint16_t* pszReportKey,
void* pReportMetadata);
]]
local wer = ffi.load("wer")
-- wer.WerStoreQueryReportMetadataV2(hReportStore, pszReportKey, pReportMetadata)
-- hReportStore : HREPORTSTORE
-- pszReportKey : LPCWSTR
-- pReportMetadata : WER_REPORT_METADATA_V2* out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('wer.dll');
const WerStoreQueryReportMetadataV2 = lib.func('__stdcall', 'WerStoreQueryReportMetadataV2', 'int32_t', ['void *', 'str16', 'void *']);
// WerStoreQueryReportMetadataV2(hReportStore, pszReportKey, pReportMetadata)
// hReportStore : HREPORTSTORE -> 'void *'
// pszReportKey : LPCWSTR -> 'str16'
// pReportMetadata : WER_REPORT_METADATA_V2* out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("wer.dll", {
WerStoreQueryReportMetadataV2: { parameters: ["pointer", "buffer", "pointer"], result: "i32" },
});
// lib.symbols.WerStoreQueryReportMetadataV2(hReportStore, pszReportKey, pReportMetadata)
// hReportStore : HREPORTSTORE -> "pointer"
// pszReportKey : LPCWSTR -> "buffer"
// pReportMetadata : WER_REPORT_METADATA_V2* out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t WerStoreQueryReportMetadataV2(
void* hReportStore,
const uint16_t* pszReportKey,
void* pReportMetadata);
C, "wer.dll");
// $ffi->WerStoreQueryReportMetadataV2(hReportStore, pszReportKey, pReportMetadata);
// hReportStore : HREPORTSTORE
// pszReportKey : LPCWSTR
// pReportMetadata : WER_REPORT_METADATA_V2* out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Wer extends StdCallLibrary {
Wer INSTANCE = Native.load("wer", Wer.class);
int WerStoreQueryReportMetadataV2(
Pointer hReportStore, // HREPORTSTORE
WString pszReportKey, // LPCWSTR
Pointer pReportMetadata // WER_REPORT_METADATA_V2* out
);
}@[Link("wer")]
lib Libwer
fun WerStoreQueryReportMetadataV2 = WerStoreQueryReportMetadataV2(
hReportStore : Void*, # HREPORTSTORE
pszReportKey : UInt16*, # LPCWSTR
pReportMetadata : WER_REPORT_METADATA_V2* # WER_REPORT_METADATA_V2* out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef WerStoreQueryReportMetadataV2Native = Int32 Function(Pointer<Void>, Pointer<Utf16>, Pointer<Void>);
typedef WerStoreQueryReportMetadataV2Dart = int Function(Pointer<Void>, Pointer<Utf16>, Pointer<Void>);
final WerStoreQueryReportMetadataV2 = DynamicLibrary.open('wer.dll')
.lookupFunction<WerStoreQueryReportMetadataV2Native, WerStoreQueryReportMetadataV2Dart>('WerStoreQueryReportMetadataV2');
// hReportStore : HREPORTSTORE -> Pointer<Void>
// pszReportKey : LPCWSTR -> Pointer<Utf16>
// pReportMetadata : WER_REPORT_METADATA_V2* out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function WerStoreQueryReportMetadataV2(
hReportStore: THandle; // HREPORTSTORE
pszReportKey: PWideChar; // LPCWSTR
pReportMetadata: Pointer // WER_REPORT_METADATA_V2* out
): Integer; stdcall;
external 'wer.dll' name 'WerStoreQueryReportMetadataV2';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "WerStoreQueryReportMetadataV2"
c_WerStoreQueryReportMetadataV2 :: Ptr () -> CWString -> Ptr () -> IO Int32
-- hReportStore : HREPORTSTORE -> Ptr ()
-- pszReportKey : LPCWSTR -> CWString
-- pReportMetadata : WER_REPORT_METADATA_V2* out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let werstorequeryreportmetadatav2 =
foreign "WerStoreQueryReportMetadataV2"
((ptr void) @-> (ptr uint16_t) @-> (ptr void) @-> returning int32_t)
(* hReportStore : HREPORTSTORE -> (ptr void) *)
(* pszReportKey : LPCWSTR -> (ptr uint16_t) *)
(* pReportMetadata : WER_REPORT_METADATA_V2* out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library wer (t "wer.dll"))
(cffi:use-foreign-library wer)
(cffi:defcfun ("WerStoreQueryReportMetadataV2" wer-store-query-report-metadata-v2 :convention :stdcall) :int32
(h-report-store :pointer) ; HREPORTSTORE
(psz-report-key (:string :encoding :utf-16le)) ; LPCWSTR
(p-report-metadata :pointer)) ; WER_REPORT_METADATA_V2* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $WerStoreQueryReportMetadataV2 = Win32::API::More->new('wer',
'int WerStoreQueryReportMetadataV2(HANDLE hReportStore, LPCWSTR pszReportKey, LPVOID pReportMetadata)');
# my $ret = $WerStoreQueryReportMetadataV2->Call($hReportStore, $pszReportKey, $pReportMetadata);
# hReportStore : HREPORTSTORE -> HANDLE
# pszReportKey : LPCWSTR -> LPCWSTR
# pReportMetadata : WER_REPORT_METADATA_V2* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
類似 API
- f WerStoreQueryReportMetadataV1 — WERレポートのメタデータをV1形式で取得する。
- f WerStoreQueryReportMetadataV3 — WERレポートのメタデータをV3形式で取得する。