ホーム › Security.DiagnosticDataQuery › DdqGetDiagnosticRecordProducerAtIndex
DdqGetDiagnosticRecordProducerAtIndex
関数指定インデックスの診断レコードプロデューサーを取得する。
シグネチャ
// DiagnosticDataQuery.dll
#include <windows.h>
HRESULT DdqGetDiagnosticRecordProducerAtIndex(
HDIAGNOSTIC_EVENT_PRODUCER_DESCRIPTION hProducerDescription,
DWORD index,
DIAGNOSTIC_DATA_EVENT_PRODUCER_DESCRIPTION* producerDescription
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hProducerDescription | HDIAGNOSTIC_EVENT_PRODUCER_DESCRIPTION | in | 対象のイベントプロデューサー記述ハンドル。 |
| index | DWORD | in | 取得するプロデューサーの0始まりインデックス。 |
| producerDescription | DIAGNOSTIC_DATA_EVENT_PRODUCER_DESCRIPTION* | out | 指定インデックスのプロデューサー記述を受け取るDIAGNOSTIC_DATA_EVENT_PRODUCER_DESCRIPTIONへのポインタ。 |
戻り値の型: 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 方式にも切替可。#uselib "DiagnosticDataQuery.dll" #cfunc global DdqGetDiagnosticRecordProducerAtIndex "DdqGetDiagnosticRecordProducerAtIndex" sptr, int, sptr ; res = DdqGetDiagnosticRecordProducerAtIndex(hProducerDescription, index, varptr(producerDescription)) ; hProducerDescription : HDIAGNOSTIC_EVENT_PRODUCER_DESCRIPTION -> "sptr" ; index : DWORD -> "int" ; producerDescription : DIAGNOSTIC_DATA_EVENT_PRODUCER_DESCRIPTION* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは 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 方式にも切替可。; HRESULT DdqGetDiagnosticRecordProducerAtIndex(HDIAGNOSTIC_EVENT_PRODUCER_DESCRIPTION hProducerDescription, DWORD index, DIAGNOSTIC_DATA_EVENT_PRODUCER_DESCRIPTION* producerDescription) #uselib "DiagnosticDataQuery.dll" #cfunc global DdqGetDiagnosticRecordProducerAtIndex "DdqGetDiagnosticRecordProducerAtIndex" intptr, int, intptr ; res = DdqGetDiagnosticRecordProducerAtIndex(hProducerDescription, index, varptr(producerDescription)) ; hProducerDescription : HDIAGNOSTIC_EVENT_PRODUCER_DESCRIPTION -> "intptr" ; index : DWORD -> "int" ; producerDescription : DIAGNOSTIC_DATA_EVENT_PRODUCER_DESCRIPTION* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは 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 // HRESULTfunction 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)。const std = @import("std");
extern "diagnosticdataquery" fn DdqGetDiagnosticRecordProducerAtIndex(
hProducerDescription: ?*anyopaque, // HDIAGNOSTIC_EVENT_PRODUCER_DESCRIPTION
index: u32, // DWORD
producerDescription: [*c]DIAGNOSTIC_DATA_EVENT_PRODUCER_DESCRIPTION // DIAGNOSTIC_DATA_EVENT_PRODUCER_DESCRIPTION* out
) callconv(std.os.windows.WINAPI) i32;proc DdqGetDiagnosticRecordProducerAtIndex(
hProducerDescription: pointer, # HDIAGNOSTIC_EVENT_PRODUCER_DESCRIPTION
index: uint32, # DWORD
producerDescription: ptr DIAGNOSTIC_DATA_EVENT_PRODUCER_DESCRIPTION # DIAGNOSTIC_DATA_EVENT_PRODUCER_DESCRIPTION* out
): int32 {.importc: "DdqGetDiagnosticRecordProducerAtIndex", stdcall, dynlib: "DiagnosticDataQuery.dll".}pragma(lib, "diagnosticdataquery");
extern(Windows)
int DdqGetDiagnosticRecordProducerAtIndex(
void* hProducerDescription, // HDIAGNOSTIC_EVENT_PRODUCER_DESCRIPTION
uint index, // DWORD
DIAGNOSTIC_DATA_EVENT_PRODUCER_DESCRIPTION* producerDescription // DIAGNOSTIC_DATA_EVENT_PRODUCER_DESCRIPTION* out
);ccall((:DdqGetDiagnosticRecordProducerAtIndex, "DiagnosticDataQuery.dll"), stdcall, Int32,
(Ptr{Cvoid}, UInt32, Ptr{DIAGNOSTIC_DATA_EVENT_PRODUCER_DESCRIPTION}),
hProducerDescription, index, producerDescription)
# hProducerDescription : HDIAGNOSTIC_EVENT_PRODUCER_DESCRIPTION -> Ptr{Cvoid}
# index : DWORD -> UInt32
# producerDescription : DIAGNOSTIC_DATA_EVENT_PRODUCER_DESCRIPTION* out -> Ptr{DIAGNOSTIC_DATA_EVENT_PRODUCER_DESCRIPTION}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t DdqGetDiagnosticRecordProducerAtIndex(
void* hProducerDescription,
uint32_t index,
void* producerDescription);
]]
local diagnosticdataquery = ffi.load("diagnosticdataquery")
-- diagnosticdataquery.DdqGetDiagnosticRecordProducerAtIndex(hProducerDescription, index, producerDescription)
-- hProducerDescription : HDIAGNOSTIC_EVENT_PRODUCER_DESCRIPTION
-- index : DWORD
-- producerDescription : DIAGNOSTIC_DATA_EVENT_PRODUCER_DESCRIPTION* out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('DiagnosticDataQuery.dll');
const DdqGetDiagnosticRecordProducerAtIndex = lib.func('__stdcall', 'DdqGetDiagnosticRecordProducerAtIndex', 'int32_t', ['void *', 'uint32_t', 'void *']);
// DdqGetDiagnosticRecordProducerAtIndex(hProducerDescription, index, producerDescription)
// hProducerDescription : HDIAGNOSTIC_EVENT_PRODUCER_DESCRIPTION -> 'void *'
// index : DWORD -> 'uint32_t'
// producerDescription : DIAGNOSTIC_DATA_EVENT_PRODUCER_DESCRIPTION* out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("DiagnosticDataQuery.dll", {
DdqGetDiagnosticRecordProducerAtIndex: { parameters: ["pointer", "u32", "pointer"], result: "i32" },
});
// lib.symbols.DdqGetDiagnosticRecordProducerAtIndex(hProducerDescription, index, producerDescription)
// hProducerDescription : HDIAGNOSTIC_EVENT_PRODUCER_DESCRIPTION -> "pointer"
// index : DWORD -> "u32"
// producerDescription : DIAGNOSTIC_DATA_EVENT_PRODUCER_DESCRIPTION* out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t DdqGetDiagnosticRecordProducerAtIndex(
void* hProducerDescription,
uint32_t index,
void* producerDescription);
C, "DiagnosticDataQuery.dll");
// $ffi->DdqGetDiagnosticRecordProducerAtIndex(hProducerDescription, index, producerDescription);
// hProducerDescription : HDIAGNOSTIC_EVENT_PRODUCER_DESCRIPTION
// index : DWORD
// producerDescription : DIAGNOSTIC_DATA_EVENT_PRODUCER_DESCRIPTION* 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 DdqGetDiagnosticRecordProducerAtIndex(
Pointer hProducerDescription, // HDIAGNOSTIC_EVENT_PRODUCER_DESCRIPTION
int index, // DWORD
Pointer producerDescription // DIAGNOSTIC_DATA_EVENT_PRODUCER_DESCRIPTION* out
);
}@[Link("diagnosticdataquery")]
lib LibDiagnosticDataQuery
fun DdqGetDiagnosticRecordProducerAtIndex = DdqGetDiagnosticRecordProducerAtIndex(
hProducerDescription : Void*, # HDIAGNOSTIC_EVENT_PRODUCER_DESCRIPTION
index : UInt32, # DWORD
producerDescription : DIAGNOSTIC_DATA_EVENT_PRODUCER_DESCRIPTION* # DIAGNOSTIC_DATA_EVENT_PRODUCER_DESCRIPTION* out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef DdqGetDiagnosticRecordProducerAtIndexNative = Int32 Function(Pointer<Void>, Uint32, Pointer<Void>);
typedef DdqGetDiagnosticRecordProducerAtIndexDart = int Function(Pointer<Void>, int, Pointer<Void>);
final DdqGetDiagnosticRecordProducerAtIndex = DynamicLibrary.open('DiagnosticDataQuery.dll')
.lookupFunction<DdqGetDiagnosticRecordProducerAtIndexNative, DdqGetDiagnosticRecordProducerAtIndexDart>('DdqGetDiagnosticRecordProducerAtIndex');
// hProducerDescription : HDIAGNOSTIC_EVENT_PRODUCER_DESCRIPTION -> Pointer<Void>
// index : DWORD -> Uint32
// producerDescription : DIAGNOSTIC_DATA_EVENT_PRODUCER_DESCRIPTION* out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
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';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "DdqGetDiagnosticRecordProducerAtIndex"
c_DdqGetDiagnosticRecordProducerAtIndex :: Ptr () -> Word32 -> Ptr () -> IO Int32
-- hProducerDescription : HDIAGNOSTIC_EVENT_PRODUCER_DESCRIPTION -> Ptr ()
-- index : DWORD -> Word32
-- producerDescription : DIAGNOSTIC_DATA_EVENT_PRODUCER_DESCRIPTION* out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let ddqgetdiagnosticrecordproduceratindex =
foreign "DdqGetDiagnosticRecordProducerAtIndex"
((ptr void) @-> uint32_t @-> (ptr void) @-> returning int32_t)
(* hProducerDescription : HDIAGNOSTIC_EVENT_PRODUCER_DESCRIPTION -> (ptr void) *)
(* index : DWORD -> uint32_t *)
(* producerDescription : DIAGNOSTIC_DATA_EVENT_PRODUCER_DESCRIPTION* 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 ("DdqGetDiagnosticRecordProducerAtIndex" ddq-get-diagnostic-record-producer-at-index :convention :stdcall) :int32
(h-producer-description :pointer) ; HDIAGNOSTIC_EVENT_PRODUCER_DESCRIPTION
(index :uint32) ; DWORD
(producer-description :pointer)) ; DIAGNOSTIC_DATA_EVENT_PRODUCER_DESCRIPTION* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $DdqGetDiagnosticRecordProducerAtIndex = Win32::API::More->new('DiagnosticDataQuery',
'int DdqGetDiagnosticRecordProducerAtIndex(HANDLE hProducerDescription, DWORD index, LPVOID producerDescription)');
# my $ret = $DdqGetDiagnosticRecordProducerAtIndex->Call($hProducerDescription, $index, $producerDescription);
# hProducerDescription : HDIAGNOSTIC_EVENT_PRODUCER_DESCRIPTION -> HANDLE
# index : DWORD -> DWORD
# producerDescription : DIAGNOSTIC_DATA_EVENT_PRODUCER_DESCRIPTION* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。