ホーム › Security.DiagnosticDataQuery › DdqGetDiagnosticRecordSummary
DdqGetDiagnosticRecordSummary
関数指定プロデューサーの診断レコードの全般統計を取得する。
シグネチャ
// DiagnosticDataQuery.dll
#include <windows.h>
HRESULT DdqGetDiagnosticRecordSummary(
HDIAGNOSTIC_DATA_QUERY_SESSION hSession,
LPCWSTR* producerNames,
DWORD producerNameCount,
DIAGNOSTIC_DATA_GENERAL_STATS* generalStats
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hSession | HDIAGNOSTIC_DATA_QUERY_SESSION | in | 対象の診断データクエリセッションのハンドル。 |
| producerNames | LPCWSTR* | in | 対象プロデューサー名の配列へのポインタ。 |
| producerNameCount | DWORD | in | producerNames配列の要素数。 |
| generalStats | DIAGNOSTIC_DATA_GENERAL_STATS* | out | 全般統計を受け取るDIAGNOSTIC_DATA_GENERAL_STATS構造体へのポインタ。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// DiagnosticDataQuery.dll
#include <windows.h>
HRESULT DdqGetDiagnosticRecordSummary(
HDIAGNOSTIC_DATA_QUERY_SESSION hSession,
LPCWSTR* producerNames,
DWORD producerNameCount,
DIAGNOSTIC_DATA_GENERAL_STATS* generalStats
);[DllImport("DiagnosticDataQuery.dll", ExactSpelling = true)]
static extern int DdqGetDiagnosticRecordSummary(
IntPtr hSession, // HDIAGNOSTIC_DATA_QUERY_SESSION
IntPtr producerNames, // LPCWSTR*
uint producerNameCount, // DWORD
IntPtr generalStats // DIAGNOSTIC_DATA_GENERAL_STATS* out
);<DllImport("DiagnosticDataQuery.dll", ExactSpelling:=True)>
Public Shared Function DdqGetDiagnosticRecordSummary(
hSession As IntPtr, ' HDIAGNOSTIC_DATA_QUERY_SESSION
producerNames As IntPtr, ' LPCWSTR*
producerNameCount As UInteger, ' DWORD
generalStats As IntPtr ' DIAGNOSTIC_DATA_GENERAL_STATS* out
) As Integer
End Function' hSession : HDIAGNOSTIC_DATA_QUERY_SESSION
' producerNames : LPCWSTR*
' producerNameCount : DWORD
' generalStats : DIAGNOSTIC_DATA_GENERAL_STATS* out
Declare PtrSafe Function DdqGetDiagnosticRecordSummary Lib "diagnosticdataquery" ( _
ByVal hSession As LongPtr, _
ByVal producerNames As LongPtr, _
ByVal producerNameCount As Long, _
ByVal generalStats As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
DdqGetDiagnosticRecordSummary = ctypes.windll.diagnosticdataquery.DdqGetDiagnosticRecordSummary
DdqGetDiagnosticRecordSummary.restype = ctypes.c_int
DdqGetDiagnosticRecordSummary.argtypes = [
wintypes.HANDLE, # hSession : HDIAGNOSTIC_DATA_QUERY_SESSION
ctypes.c_void_p, # producerNames : LPCWSTR*
wintypes.DWORD, # producerNameCount : DWORD
ctypes.c_void_p, # generalStats : DIAGNOSTIC_DATA_GENERAL_STATS* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('DiagnosticDataQuery.dll')
DdqGetDiagnosticRecordSummary = Fiddle::Function.new(
lib['DdqGetDiagnosticRecordSummary'],
[
Fiddle::TYPE_VOIDP, # hSession : HDIAGNOSTIC_DATA_QUERY_SESSION
Fiddle::TYPE_VOIDP, # producerNames : LPCWSTR*
-Fiddle::TYPE_INT, # producerNameCount : DWORD
Fiddle::TYPE_VOIDP, # generalStats : DIAGNOSTIC_DATA_GENERAL_STATS* out
],
Fiddle::TYPE_INT)#[link(name = "diagnosticdataquery")]
extern "system" {
fn DdqGetDiagnosticRecordSummary(
hSession: *mut core::ffi::c_void, // HDIAGNOSTIC_DATA_QUERY_SESSION
producerNames: *const *const u16, // LPCWSTR*
producerNameCount: u32, // DWORD
generalStats: *mut DIAGNOSTIC_DATA_GENERAL_STATS // DIAGNOSTIC_DATA_GENERAL_STATS* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("DiagnosticDataQuery.dll")]
public static extern int DdqGetDiagnosticRecordSummary(IntPtr hSession, IntPtr producerNames, uint producerNameCount, IntPtr generalStats);
"@
$api = Add-Type -MemberDefinition $sig -Name 'DiagnosticDataQuery_DdqGetDiagnosticRecordSummary' -Namespace Win32 -PassThru
# $api::DdqGetDiagnosticRecordSummary(hSession, producerNames, producerNameCount, generalStats)#uselib "DiagnosticDataQuery.dll"
#func global DdqGetDiagnosticRecordSummary "DdqGetDiagnosticRecordSummary" sptr, sptr, sptr, sptr
; DdqGetDiagnosticRecordSummary hSession, varptr(producerNames), producerNameCount, varptr(generalStats) ; 戻り値は stat
; hSession : HDIAGNOSTIC_DATA_QUERY_SESSION -> "sptr"
; producerNames : LPCWSTR* -> "sptr"
; producerNameCount : DWORD -> "sptr"
; generalStats : DIAGNOSTIC_DATA_GENERAL_STATS* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "DiagnosticDataQuery.dll" #cfunc global DdqGetDiagnosticRecordSummary "DdqGetDiagnosticRecordSummary" sptr, var, int, var ; res = DdqGetDiagnosticRecordSummary(hSession, producerNames, producerNameCount, generalStats) ; hSession : HDIAGNOSTIC_DATA_QUERY_SESSION -> "sptr" ; producerNames : LPCWSTR* -> "var" ; producerNameCount : DWORD -> "int" ; generalStats : DIAGNOSTIC_DATA_GENERAL_STATS* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "DiagnosticDataQuery.dll" #cfunc global DdqGetDiagnosticRecordSummary "DdqGetDiagnosticRecordSummary" sptr, sptr, int, sptr ; res = DdqGetDiagnosticRecordSummary(hSession, varptr(producerNames), producerNameCount, varptr(generalStats)) ; hSession : HDIAGNOSTIC_DATA_QUERY_SESSION -> "sptr" ; producerNames : LPCWSTR* -> "sptr" ; producerNameCount : DWORD -> "int" ; generalStats : DIAGNOSTIC_DATA_GENERAL_STATS* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT DdqGetDiagnosticRecordSummary(HDIAGNOSTIC_DATA_QUERY_SESSION hSession, LPCWSTR* producerNames, DWORD producerNameCount, DIAGNOSTIC_DATA_GENERAL_STATS* generalStats) #uselib "DiagnosticDataQuery.dll" #cfunc global DdqGetDiagnosticRecordSummary "DdqGetDiagnosticRecordSummary" intptr, var, int, var ; res = DdqGetDiagnosticRecordSummary(hSession, producerNames, producerNameCount, generalStats) ; hSession : HDIAGNOSTIC_DATA_QUERY_SESSION -> "intptr" ; producerNames : LPCWSTR* -> "var" ; producerNameCount : DWORD -> "int" ; generalStats : DIAGNOSTIC_DATA_GENERAL_STATS* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT DdqGetDiagnosticRecordSummary(HDIAGNOSTIC_DATA_QUERY_SESSION hSession, LPCWSTR* producerNames, DWORD producerNameCount, DIAGNOSTIC_DATA_GENERAL_STATS* generalStats) #uselib "DiagnosticDataQuery.dll" #cfunc global DdqGetDiagnosticRecordSummary "DdqGetDiagnosticRecordSummary" intptr, intptr, int, intptr ; res = DdqGetDiagnosticRecordSummary(hSession, varptr(producerNames), producerNameCount, varptr(generalStats)) ; hSession : HDIAGNOSTIC_DATA_QUERY_SESSION -> "intptr" ; producerNames : LPCWSTR* -> "intptr" ; producerNameCount : DWORD -> "int" ; generalStats : DIAGNOSTIC_DATA_GENERAL_STATS* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
diagnosticdataquery = windows.NewLazySystemDLL("DiagnosticDataQuery.dll")
procDdqGetDiagnosticRecordSummary = diagnosticdataquery.NewProc("DdqGetDiagnosticRecordSummary")
)
// hSession (HDIAGNOSTIC_DATA_QUERY_SESSION), producerNames (LPCWSTR*), producerNameCount (DWORD), generalStats (DIAGNOSTIC_DATA_GENERAL_STATS* out)
r1, _, err := procDdqGetDiagnosticRecordSummary.Call(
uintptr(hSession),
uintptr(producerNames),
uintptr(producerNameCount),
uintptr(generalStats),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction DdqGetDiagnosticRecordSummary(
hSession: THandle; // HDIAGNOSTIC_DATA_QUERY_SESSION
producerNames: PPWideChar; // LPCWSTR*
producerNameCount: DWORD; // DWORD
generalStats: Pointer // DIAGNOSTIC_DATA_GENERAL_STATS* out
): Integer; stdcall;
external 'DiagnosticDataQuery.dll' name 'DdqGetDiagnosticRecordSummary';result := DllCall("DiagnosticDataQuery\DdqGetDiagnosticRecordSummary"
, "Ptr", hSession ; HDIAGNOSTIC_DATA_QUERY_SESSION
, "Ptr", producerNames ; LPCWSTR*
, "UInt", producerNameCount ; DWORD
, "Ptr", generalStats ; DIAGNOSTIC_DATA_GENERAL_STATS* out
, "Int") ; return: HRESULT●DdqGetDiagnosticRecordSummary(hSession, producerNames, producerNameCount, generalStats) = DLL("DiagnosticDataQuery.dll", "int DdqGetDiagnosticRecordSummary(void*, void*, dword, void*)")
# 呼び出し: DdqGetDiagnosticRecordSummary(hSession, producerNames, producerNameCount, generalStats)
# hSession : HDIAGNOSTIC_DATA_QUERY_SESSION -> "void*"
# producerNames : LPCWSTR* -> "void*"
# producerNameCount : DWORD -> "dword"
# generalStats : DIAGNOSTIC_DATA_GENERAL_STATS* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "diagnosticdataquery" fn DdqGetDiagnosticRecordSummary(
hSession: ?*anyopaque, // HDIAGNOSTIC_DATA_QUERY_SESSION
producerNames: [*c][*c]u16, // LPCWSTR*
producerNameCount: u32, // DWORD
generalStats: [*c]DIAGNOSTIC_DATA_GENERAL_STATS // DIAGNOSTIC_DATA_GENERAL_STATS* out
) callconv(std.os.windows.WINAPI) i32;proc DdqGetDiagnosticRecordSummary(
hSession: pointer, # HDIAGNOSTIC_DATA_QUERY_SESSION
producerNames: ptr WideCString, # LPCWSTR*
producerNameCount: uint32, # DWORD
generalStats: ptr DIAGNOSTIC_DATA_GENERAL_STATS # DIAGNOSTIC_DATA_GENERAL_STATS* out
): int32 {.importc: "DdqGetDiagnosticRecordSummary", stdcall, dynlib: "DiagnosticDataQuery.dll".}pragma(lib, "diagnosticdataquery");
extern(Windows)
int DdqGetDiagnosticRecordSummary(
void* hSession, // HDIAGNOSTIC_DATA_QUERY_SESSION
wchar** producerNames, // LPCWSTR*
uint producerNameCount, // DWORD
DIAGNOSTIC_DATA_GENERAL_STATS* generalStats // DIAGNOSTIC_DATA_GENERAL_STATS* out
);ccall((:DdqGetDiagnosticRecordSummary, "DiagnosticDataQuery.dll"), stdcall, Int32,
(Ptr{Cvoid}, Ptr{Ptr{UInt16}}, UInt32, Ptr{DIAGNOSTIC_DATA_GENERAL_STATS}),
hSession, producerNames, producerNameCount, generalStats)
# hSession : HDIAGNOSTIC_DATA_QUERY_SESSION -> Ptr{Cvoid}
# producerNames : LPCWSTR* -> Ptr{Ptr{UInt16}}
# producerNameCount : DWORD -> UInt32
# generalStats : DIAGNOSTIC_DATA_GENERAL_STATS* out -> Ptr{DIAGNOSTIC_DATA_GENERAL_STATS}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t DdqGetDiagnosticRecordSummary(
void* hSession,
uint16_t** producerNames,
uint32_t producerNameCount,
void* generalStats);
]]
local diagnosticdataquery = ffi.load("diagnosticdataquery")
-- diagnosticdataquery.DdqGetDiagnosticRecordSummary(hSession, producerNames, producerNameCount, generalStats)
-- hSession : HDIAGNOSTIC_DATA_QUERY_SESSION
-- producerNames : LPCWSTR*
-- producerNameCount : DWORD
-- generalStats : DIAGNOSTIC_DATA_GENERAL_STATS* out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('DiagnosticDataQuery.dll');
const DdqGetDiagnosticRecordSummary = lib.func('__stdcall', 'DdqGetDiagnosticRecordSummary', 'int32_t', ['void *', 'void *', 'uint32_t', 'void *']);
// DdqGetDiagnosticRecordSummary(hSession, producerNames, producerNameCount, generalStats)
// hSession : HDIAGNOSTIC_DATA_QUERY_SESSION -> 'void *'
// producerNames : LPCWSTR* -> 'void *'
// producerNameCount : DWORD -> 'uint32_t'
// generalStats : DIAGNOSTIC_DATA_GENERAL_STATS* out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("DiagnosticDataQuery.dll", {
DdqGetDiagnosticRecordSummary: { parameters: ["pointer", "pointer", "u32", "pointer"], result: "i32" },
});
// lib.symbols.DdqGetDiagnosticRecordSummary(hSession, producerNames, producerNameCount, generalStats)
// hSession : HDIAGNOSTIC_DATA_QUERY_SESSION -> "pointer"
// producerNames : LPCWSTR* -> "pointer"
// producerNameCount : DWORD -> "u32"
// generalStats : DIAGNOSTIC_DATA_GENERAL_STATS* out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t DdqGetDiagnosticRecordSummary(
void* hSession,
uint16_t** producerNames,
uint32_t producerNameCount,
void* generalStats);
C, "DiagnosticDataQuery.dll");
// $ffi->DdqGetDiagnosticRecordSummary(hSession, producerNames, producerNameCount, generalStats);
// hSession : HDIAGNOSTIC_DATA_QUERY_SESSION
// producerNames : LPCWSTR*
// producerNameCount : DWORD
// generalStats : DIAGNOSTIC_DATA_GENERAL_STATS* out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Diagnosticdataquery extends StdCallLibrary {
Diagnosticdataquery INSTANCE = Native.load("diagnosticdataquery", Diagnosticdataquery.class);
int DdqGetDiagnosticRecordSummary(
Pointer hSession, // HDIAGNOSTIC_DATA_QUERY_SESSION
PointerByReference producerNames, // LPCWSTR*
int producerNameCount, // DWORD
Pointer generalStats // DIAGNOSTIC_DATA_GENERAL_STATS* out
);
}@[Link("diagnosticdataquery")]
lib LibDiagnosticDataQuery
fun DdqGetDiagnosticRecordSummary = DdqGetDiagnosticRecordSummary(
hSession : Void*, # HDIAGNOSTIC_DATA_QUERY_SESSION
producerNames : UInt16**, # LPCWSTR*
producerNameCount : UInt32, # DWORD
generalStats : DIAGNOSTIC_DATA_GENERAL_STATS* # DIAGNOSTIC_DATA_GENERAL_STATS* out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef DdqGetDiagnosticRecordSummaryNative = Int32 Function(Pointer<Void>, Pointer<Pointer<Utf16>>, Uint32, Pointer<Void>);
typedef DdqGetDiagnosticRecordSummaryDart = int Function(Pointer<Void>, Pointer<Pointer<Utf16>>, int, Pointer<Void>);
final DdqGetDiagnosticRecordSummary = DynamicLibrary.open('DiagnosticDataQuery.dll')
.lookupFunction<DdqGetDiagnosticRecordSummaryNative, DdqGetDiagnosticRecordSummaryDart>('DdqGetDiagnosticRecordSummary');
// hSession : HDIAGNOSTIC_DATA_QUERY_SESSION -> Pointer<Void>
// producerNames : LPCWSTR* -> Pointer<Pointer<Utf16>>
// producerNameCount : DWORD -> Uint32
// generalStats : DIAGNOSTIC_DATA_GENERAL_STATS* out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function DdqGetDiagnosticRecordSummary(
hSession: THandle; // HDIAGNOSTIC_DATA_QUERY_SESSION
producerNames: PPWideChar; // LPCWSTR*
producerNameCount: DWORD; // DWORD
generalStats: Pointer // DIAGNOSTIC_DATA_GENERAL_STATS* out
): Integer; stdcall;
external 'DiagnosticDataQuery.dll' name 'DdqGetDiagnosticRecordSummary';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "DdqGetDiagnosticRecordSummary"
c_DdqGetDiagnosticRecordSummary :: Ptr () -> Ptr CWString -> Word32 -> Ptr () -> IO Int32
-- hSession : HDIAGNOSTIC_DATA_QUERY_SESSION -> Ptr ()
-- producerNames : LPCWSTR* -> Ptr CWString
-- producerNameCount : DWORD -> Word32
-- generalStats : DIAGNOSTIC_DATA_GENERAL_STATS* out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let ddqgetdiagnosticrecordsummary =
foreign "DdqGetDiagnosticRecordSummary"
((ptr void) @-> (ptr (ptr uint16_t)) @-> uint32_t @-> (ptr void) @-> returning int32_t)
(* hSession : HDIAGNOSTIC_DATA_QUERY_SESSION -> (ptr void) *)
(* producerNames : LPCWSTR* -> (ptr (ptr uint16_t)) *)
(* producerNameCount : DWORD -> uint32_t *)
(* generalStats : DIAGNOSTIC_DATA_GENERAL_STATS* out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library diagnosticdataquery (t "DiagnosticDataQuery.dll"))
(cffi:use-foreign-library diagnosticdataquery)
(cffi:defcfun ("DdqGetDiagnosticRecordSummary" ddq-get-diagnostic-record-summary :convention :stdcall) :int32
(h-session :pointer) ; HDIAGNOSTIC_DATA_QUERY_SESSION
(producer-names :pointer) ; LPCWSTR*
(producer-name-count :uint32) ; DWORD
(general-stats :pointer)) ; DIAGNOSTIC_DATA_GENERAL_STATS* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $DdqGetDiagnosticRecordSummary = Win32::API::More->new('DiagnosticDataQuery',
'int DdqGetDiagnosticRecordSummary(HANDLE hSession, LPVOID producerNames, DWORD producerNameCount, LPVOID generalStats)');
# my $ret = $DdqGetDiagnosticRecordSummary->Call($hSession, $producerNames, $producerNameCount, $generalStats);
# hSession : HDIAGNOSTIC_DATA_QUERY_SESSION -> HANDLE
# producerNames : LPCWSTR* -> LPVOID
# producerNameCount : DWORD -> DWORD
# generalStats : DIAGNOSTIC_DATA_GENERAL_STATS* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。