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