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