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

DdqGetDiagnosticRecordProducerAtIndex

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

シグネチャ

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

HRESULT DdqGetDiagnosticRecordProducerAtIndex(
    HDIAGNOSTIC_EVENT_PRODUCER_DESCRIPTION hProducerDescription,
    DWORD index,
    DIAGNOSTIC_DATA_EVENT_PRODUCER_DESCRIPTION* producerDescription
);

パラメーター

名前方向
hProducerDescriptionHDIAGNOSTIC_EVENT_PRODUCER_DESCRIPTIONin
indexDWORDin
producerDescriptionDIAGNOSTIC_DATA_EVENT_PRODUCER_DESCRIPTION*out

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

DdqGetDiagnosticRecordProducerAtIndex = ctypes.windll.diagnosticdataquery.DdqGetDiagnosticRecordProducerAtIndex
DdqGetDiagnosticRecordProducerAtIndex.restype = ctypes.c_int
DdqGetDiagnosticRecordProducerAtIndex.argtypes = [
    wintypes.HANDLE,  # hProducerDescription : HDIAGNOSTIC_EVENT_PRODUCER_DESCRIPTION
    wintypes.DWORD,  # index : DWORD
    ctypes.c_void_p,  # producerDescription : DIAGNOSTIC_DATA_EVENT_PRODUCER_DESCRIPTION* out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	diagnosticdataquery = windows.NewLazySystemDLL("DiagnosticDataQuery.dll")
	procDdqGetDiagnosticRecordProducerAtIndex = diagnosticdataquery.NewProc("DdqGetDiagnosticRecordProducerAtIndex")
)

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