ホーム › System.ErrorReporting › WerStoreGetNextReportKey
WerStoreGetNextReportKey
関数WERストア内の次のレポートキーを取得する。
シグネチャ
// wer.dll
#include <windows.h>
HRESULT WerStoreGetNextReportKey(
HREPORTSTORE hReportStore,
LPCWSTR* ppszReportKey // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hReportStore | HREPORTSTORE | in | 列挙対象のレポートストアHREPORTSTOREハンドル。 |
| ppszReportKey | LPCWSTR* | 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 方式にも切替可。#uselib "wer.dll" #cfunc global WerStoreGetNextReportKey "WerStoreGetNextReportKey" sptr, sptr ; res = WerStoreGetNextReportKey(hReportStore, varptr(ppszReportKey)) ; hReportStore : HREPORTSTORE -> "sptr" ; ppszReportKey : LPCWSTR* optional, out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは 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 方式にも切替可。; HRESULT WerStoreGetNextReportKey(HREPORTSTORE hReportStore, LPCWSTR* ppszReportKey) #uselib "wer.dll" #cfunc global WerStoreGetNextReportKey "WerStoreGetNextReportKey" intptr, intptr ; res = WerStoreGetNextReportKey(hReportStore, varptr(ppszReportKey)) ; hReportStore : HREPORTSTORE -> "intptr" ; ppszReportKey : LPCWSTR* optional, out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは 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 // HRESULTfunction 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)。const std = @import("std");
extern "wer" fn WerStoreGetNextReportKey(
hReportStore: ?*anyopaque, // HREPORTSTORE
ppszReportKey: [*c][*c]u16 // LPCWSTR* optional, out
) callconv(std.os.windows.WINAPI) i32;proc WerStoreGetNextReportKey(
hReportStore: pointer, # HREPORTSTORE
ppszReportKey: ptr WideCString # LPCWSTR* optional, out
): int32 {.importc: "WerStoreGetNextReportKey", stdcall, dynlib: "wer.dll".}pragma(lib, "wer");
extern(Windows)
int WerStoreGetNextReportKey(
void* hReportStore, // HREPORTSTORE
wchar** ppszReportKey // LPCWSTR* optional, out
);ccall((:WerStoreGetNextReportKey, "wer.dll"), stdcall, Int32,
(Ptr{Cvoid}, Ptr{Ptr{UInt16}}),
hReportStore, ppszReportKey)
# hReportStore : HREPORTSTORE -> Ptr{Cvoid}
# ppszReportKey : LPCWSTR* optional, out -> Ptr{Ptr{UInt16}}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t WerStoreGetNextReportKey(
void* hReportStore,
uint16_t** ppszReportKey);
]]
local wer = ffi.load("wer")
-- wer.WerStoreGetNextReportKey(hReportStore, ppszReportKey)
-- hReportStore : HREPORTSTORE
-- ppszReportKey : LPCWSTR* optional, out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('wer.dll');
const WerStoreGetNextReportKey = lib.func('__stdcall', 'WerStoreGetNextReportKey', 'int32_t', ['void *', 'void *']);
// WerStoreGetNextReportKey(hReportStore, ppszReportKey)
// hReportStore : HREPORTSTORE -> 'void *'
// ppszReportKey : LPCWSTR* optional, out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("wer.dll", {
WerStoreGetNextReportKey: { parameters: ["pointer", "pointer"], result: "i32" },
});
// lib.symbols.WerStoreGetNextReportKey(hReportStore, ppszReportKey)
// hReportStore : HREPORTSTORE -> "pointer"
// ppszReportKey : LPCWSTR* optional, out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t WerStoreGetNextReportKey(
void* hReportStore,
uint16_t** ppszReportKey);
C, "wer.dll");
// $ffi->WerStoreGetNextReportKey(hReportStore, ppszReportKey);
// hReportStore : HREPORTSTORE
// ppszReportKey : LPCWSTR* optional, 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 WerStoreGetNextReportKey(
Pointer hReportStore, // HREPORTSTORE
PointerByReference ppszReportKey // LPCWSTR* optional, out
);
}@[Link("wer")]
lib Libwer
fun WerStoreGetNextReportKey = WerStoreGetNextReportKey(
hReportStore : Void*, # HREPORTSTORE
ppszReportKey : UInt16** # LPCWSTR* optional, out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef WerStoreGetNextReportKeyNative = Int32 Function(Pointer<Void>, Pointer<Pointer<Utf16>>);
typedef WerStoreGetNextReportKeyDart = int Function(Pointer<Void>, Pointer<Pointer<Utf16>>);
final WerStoreGetNextReportKey = DynamicLibrary.open('wer.dll')
.lookupFunction<WerStoreGetNextReportKeyNative, WerStoreGetNextReportKeyDart>('WerStoreGetNextReportKey');
// hReportStore : HREPORTSTORE -> Pointer<Void>
// ppszReportKey : LPCWSTR* optional, out -> Pointer<Pointer<Utf16>>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function WerStoreGetNextReportKey(
hReportStore: THandle; // HREPORTSTORE
ppszReportKey: PPWideChar // LPCWSTR* optional, out
): Integer; stdcall;
external 'wer.dll' name 'WerStoreGetNextReportKey';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "WerStoreGetNextReportKey"
c_WerStoreGetNextReportKey :: Ptr () -> Ptr CWString -> IO Int32
-- hReportStore : HREPORTSTORE -> Ptr ()
-- ppszReportKey : LPCWSTR* optional, out -> Ptr CWString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let werstoregetnextreportkey =
foreign "WerStoreGetNextReportKey"
((ptr void) @-> (ptr (ptr uint16_t)) @-> returning int32_t)
(* hReportStore : HREPORTSTORE -> (ptr void) *)
(* ppszReportKey : LPCWSTR* optional, out -> (ptr (ptr uint16_t)) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library wer (t "wer.dll"))
(cffi:use-foreign-library wer)
(cffi:defcfun ("WerStoreGetNextReportKey" wer-store-get-next-report-key :convention :stdcall) :int32
(h-report-store :pointer) ; HREPORTSTORE
(ppsz-report-key :pointer)) ; LPCWSTR* optional, out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $WerStoreGetNextReportKey = Win32::API::More->new('wer',
'int WerStoreGetNextReportKey(HANDLE hReportStore, LPVOID ppszReportKey)');
# my $ret = $WerStoreGetNextReportKey->Call($hReportStore, $ppszReportKey);
# hReportStore : HREPORTSTORE -> HANDLE
# ppszReportKey : LPCWSTR* optional, out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。