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

DdqGetDiagnosticRecordTagDistribution

関数
指定プロデューサーの診断レコードタグ分布を取得する。
DLLDiagnosticDataQuery.dll呼出規約winapi対応OSWindows 10 以降

シグネチャ

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

HRESULT DdqGetDiagnosticRecordTagDistribution(
    HDIAGNOSTIC_DATA_QUERY_SESSION hSession,
    LPCWSTR* producerNames,
    DWORD producerNameCount,
    DIAGNOSTIC_DATA_EVENT_TAG_STATS** tagStats,
    DWORD* statCount
);

パラメーター

名前方向
hSessionHDIAGNOSTIC_DATA_QUERY_SESSIONin
producerNamesLPCWSTR*in
producerNameCountDWORDin
tagStatsDIAGNOSTIC_DATA_EVENT_TAG_STATS**out
statCountDWORD*out

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

DdqGetDiagnosticRecordTagDistribution = ctypes.windll.diagnosticdataquery.DdqGetDiagnosticRecordTagDistribution
DdqGetDiagnosticRecordTagDistribution.restype = ctypes.c_int
DdqGetDiagnosticRecordTagDistribution.argtypes = [
    wintypes.HANDLE,  # hSession : HDIAGNOSTIC_DATA_QUERY_SESSION
    ctypes.c_void_p,  # producerNames : LPCWSTR*
    wintypes.DWORD,  # producerNameCount : DWORD
    ctypes.c_void_p,  # tagStats : DIAGNOSTIC_DATA_EVENT_TAG_STATS** out
    ctypes.POINTER(wintypes.DWORD),  # statCount : DWORD* out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	diagnosticdataquery = windows.NewLazySystemDLL("DiagnosticDataQuery.dll")
	procDdqGetDiagnosticRecordTagDistribution = diagnosticdataquery.NewProc("DdqGetDiagnosticRecordTagDistribution")
)

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