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

WerStoreGetNextReportKey

関数
WERストア内の次のレポートキーを取得する。
DLLwer.dll呼出規約winapi対応OSWindows 10 以降

シグネチャ

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

HRESULT WerStoreGetNextReportKey(
    HREPORTSTORE hReportStore,
    LPCWSTR* ppszReportKey   // optional
);

パラメーター

名前方向
hReportStoreHREPORTSTOREin
ppszReportKeyLPCWSTR*outoptional

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT WerStoreGetNextReportKey(
    HREPORTSTORE hReportStore,
    LPCWSTR* ppszReportKey   // optional
);
[DllImport("wer.dll", ExactSpelling = true)]
static extern int WerStoreGetNextReportKey(
    IntPtr hReportStore,   // HREPORTSTORE
    IntPtr ppszReportKey   // LPCWSTR* optional, out
);
<DllImport("wer.dll", ExactSpelling:=True)>
Public Shared Function WerStoreGetNextReportKey(
    hReportStore As IntPtr,   ' HREPORTSTORE
    ppszReportKey As IntPtr   ' LPCWSTR* optional, out
) As Integer
End Function
' hReportStore : HREPORTSTORE
' ppszReportKey : LPCWSTR* optional, out
Declare PtrSafe Function WerStoreGetNextReportKey Lib "wer" ( _
    ByVal hReportStore As LongPtr, _
    ByVal ppszReportKey As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WerStoreGetNextReportKey = ctypes.windll.wer.WerStoreGetNextReportKey
WerStoreGetNextReportKey.restype = ctypes.c_int
WerStoreGetNextReportKey.argtypes = [
    wintypes.HANDLE,  # hReportStore : HREPORTSTORE
    ctypes.c_void_p,  # ppszReportKey : LPCWSTR* optional, out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('wer.dll')
WerStoreGetNextReportKey = Fiddle::Function.new(
  lib['WerStoreGetNextReportKey'],
  [
    Fiddle::TYPE_VOIDP,  # hReportStore : HREPORTSTORE
    Fiddle::TYPE_VOIDP,  # ppszReportKey : LPCWSTR* optional, out
  ],
  Fiddle::TYPE_INT)
#[link(name = "wer")]
extern "system" {
    fn WerStoreGetNextReportKey(
        hReportStore: *mut core::ffi::c_void,  // HREPORTSTORE
        ppszReportKey: *const *const u16  // LPCWSTR* optional, out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("wer.dll")]
public static extern int WerStoreGetNextReportKey(IntPtr hReportStore, IntPtr ppszReportKey);
"@
$api = Add-Type -MemberDefinition $sig -Name 'wer_WerStoreGetNextReportKey' -Namespace Win32 -PassThru
# $api::WerStoreGetNextReportKey(hReportStore, ppszReportKey)
#uselib "wer.dll"
#func global WerStoreGetNextReportKey "WerStoreGetNextReportKey" sptr, sptr
; WerStoreGetNextReportKey hReportStore, varptr(ppszReportKey)   ; 戻り値は stat
; hReportStore : HREPORTSTORE -> "sptr"
; ppszReportKey : LPCWSTR* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "wer.dll"
#cfunc global WerStoreGetNextReportKey "WerStoreGetNextReportKey" sptr, var
; res = WerStoreGetNextReportKey(hReportStore, ppszReportKey)
; hReportStore : HREPORTSTORE -> "sptr"
; ppszReportKey : LPCWSTR* optional, out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT WerStoreGetNextReportKey(HREPORTSTORE hReportStore, LPCWSTR* ppszReportKey)
#uselib "wer.dll"
#cfunc global WerStoreGetNextReportKey "WerStoreGetNextReportKey" intptr, var
; res = WerStoreGetNextReportKey(hReportStore, ppszReportKey)
; hReportStore : HREPORTSTORE -> "intptr"
; ppszReportKey : LPCWSTR* optional, out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	wer = windows.NewLazySystemDLL("wer.dll")
	procWerStoreGetNextReportKey = wer.NewProc("WerStoreGetNextReportKey")
)

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