Win32 API 日本語リファレンス
ホームSecurity.DiagnosticDataQuery › DdqGetDiagnosticReportCount

DdqGetDiagnosticReportCount

関数
診断レポートの件数を取得する。
DLLDiagnosticDataQuery.dll呼出規約winapi対応OSWindows 10 以降

シグネチャ

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

HRESULT DdqGetDiagnosticReportCount(
    HDIAGNOSTIC_REPORT hReport,
    DWORD* reportCount
);

パラメーター

名前方向
hReportHDIAGNOSTIC_REPORTin
reportCountDWORD*out

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT DdqGetDiagnosticReportCount(
    HDIAGNOSTIC_REPORT hReport,
    DWORD* reportCount
);
[DllImport("DiagnosticDataQuery.dll", ExactSpelling = true)]
static extern int DdqGetDiagnosticReportCount(
    IntPtr hReport,   // HDIAGNOSTIC_REPORT
    out uint reportCount   // DWORD* out
);
<DllImport("DiagnosticDataQuery.dll", ExactSpelling:=True)>
Public Shared Function DdqGetDiagnosticReportCount(
    hReport As IntPtr,   ' HDIAGNOSTIC_REPORT
    <Out> ByRef reportCount As UInteger   ' DWORD* out
) As Integer
End Function
' hReport : HDIAGNOSTIC_REPORT
' reportCount : DWORD* out
Declare PtrSafe Function DdqGetDiagnosticReportCount Lib "diagnosticdataquery" ( _
    ByVal hReport As LongPtr, _
    ByRef reportCount As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

DdqGetDiagnosticReportCount = ctypes.windll.diagnosticdataquery.DdqGetDiagnosticReportCount
DdqGetDiagnosticReportCount.restype = ctypes.c_int
DdqGetDiagnosticReportCount.argtypes = [
    wintypes.HANDLE,  # hReport : HDIAGNOSTIC_REPORT
    ctypes.POINTER(wintypes.DWORD),  # reportCount : DWORD* out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	diagnosticdataquery = windows.NewLazySystemDLL("DiagnosticDataQuery.dll")
	procDdqGetDiagnosticReportCount = diagnosticdataquery.NewProc("DdqGetDiagnosticReportCount")
)

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