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