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

WerStoreGetSizeOnDisk

関数
WERストアのディスク使用サイズを取得する。
DLLwer.dll呼出規約winapi

シグネチャ

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

HRESULT WerStoreGetSizeOnDisk(
    HREPORTSTORE hReportStore,
    ULONGLONG* pqwSizeInBytes
);

パラメーター

名前方向
hReportStoreHREPORTSTOREin
pqwSizeInBytesULONGLONG*out

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

WerStoreGetSizeOnDisk = ctypes.windll.wer.WerStoreGetSizeOnDisk
WerStoreGetSizeOnDisk.restype = ctypes.c_int
WerStoreGetSizeOnDisk.argtypes = [
    wintypes.HANDLE,  # hReportStore : HREPORTSTORE
    ctypes.POINTER(ctypes.c_ulonglong),  # pqwSizeInBytes : ULONGLONG* out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	wer = windows.NewLazySystemDLL("wer.dll")
	procWerStoreGetSizeOnDisk = wer.NewProc("WerStoreGetSizeOnDisk")
)

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