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

DdqGetDiagnosticRecordProducerCategories

関数
指定プロデューサーの診断レコードカテゴリ記述を取得する。
DLLDiagnosticDataQuery.dll呼出規約winapi対応OSWindows 10 以降

シグネチャ

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

HRESULT DdqGetDiagnosticRecordProducerCategories(
    HDIAGNOSTIC_DATA_QUERY_SESSION hSession,
    LPCWSTR producerName,
    HDIAGNOSTIC_EVENT_CATEGORY_DESCRIPTION* hCategoryDescription
);

パラメーター

名前方向
hSessionHDIAGNOSTIC_DATA_QUERY_SESSIONin
producerNameLPCWSTRin
hCategoryDescriptionHDIAGNOSTIC_EVENT_CATEGORY_DESCRIPTION*out

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT DdqGetDiagnosticRecordProducerCategories(
    HDIAGNOSTIC_DATA_QUERY_SESSION hSession,
    LPCWSTR producerName,
    HDIAGNOSTIC_EVENT_CATEGORY_DESCRIPTION* hCategoryDescription
);
[DllImport("DiagnosticDataQuery.dll", ExactSpelling = true)]
static extern int DdqGetDiagnosticRecordProducerCategories(
    IntPtr hSession,   // HDIAGNOSTIC_DATA_QUERY_SESSION
    [MarshalAs(UnmanagedType.LPWStr)] string producerName,   // LPCWSTR
    IntPtr hCategoryDescription   // HDIAGNOSTIC_EVENT_CATEGORY_DESCRIPTION* out
);
<DllImport("DiagnosticDataQuery.dll", ExactSpelling:=True)>
Public Shared Function DdqGetDiagnosticRecordProducerCategories(
    hSession As IntPtr,   ' HDIAGNOSTIC_DATA_QUERY_SESSION
    <MarshalAs(UnmanagedType.LPWStr)> producerName As String,   ' LPCWSTR
    hCategoryDescription As IntPtr   ' HDIAGNOSTIC_EVENT_CATEGORY_DESCRIPTION* out
) As Integer
End Function
' hSession : HDIAGNOSTIC_DATA_QUERY_SESSION
' producerName : LPCWSTR
' hCategoryDescription : HDIAGNOSTIC_EVENT_CATEGORY_DESCRIPTION* out
Declare PtrSafe Function DdqGetDiagnosticRecordProducerCategories Lib "diagnosticdataquery" ( _
    ByVal hSession As LongPtr, _
    ByVal producerName As LongPtr, _
    ByVal hCategoryDescription As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

DdqGetDiagnosticRecordProducerCategories = ctypes.windll.diagnosticdataquery.DdqGetDiagnosticRecordProducerCategories
DdqGetDiagnosticRecordProducerCategories.restype = ctypes.c_int
DdqGetDiagnosticRecordProducerCategories.argtypes = [
    wintypes.HANDLE,  # hSession : HDIAGNOSTIC_DATA_QUERY_SESSION
    wintypes.LPCWSTR,  # producerName : LPCWSTR
    ctypes.c_void_p,  # hCategoryDescription : HDIAGNOSTIC_EVENT_CATEGORY_DESCRIPTION* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('DiagnosticDataQuery.dll')
DdqGetDiagnosticRecordProducerCategories = Fiddle::Function.new(
  lib['DdqGetDiagnosticRecordProducerCategories'],
  [
    Fiddle::TYPE_VOIDP,  # hSession : HDIAGNOSTIC_DATA_QUERY_SESSION
    Fiddle::TYPE_VOIDP,  # producerName : LPCWSTR
    Fiddle::TYPE_VOIDP,  # hCategoryDescription : HDIAGNOSTIC_EVENT_CATEGORY_DESCRIPTION* out
  ],
  Fiddle::TYPE_INT)
#[link(name = "diagnosticdataquery")]
extern "system" {
    fn DdqGetDiagnosticRecordProducerCategories(
        hSession: *mut core::ffi::c_void,  // HDIAGNOSTIC_DATA_QUERY_SESSION
        producerName: *const u16,  // LPCWSTR
        hCategoryDescription: *mut *mut core::ffi::c_void  // HDIAGNOSTIC_EVENT_CATEGORY_DESCRIPTION* out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("DiagnosticDataQuery.dll")]
public static extern int DdqGetDiagnosticRecordProducerCategories(IntPtr hSession, [MarshalAs(UnmanagedType.LPWStr)] string producerName, IntPtr hCategoryDescription);
"@
$api = Add-Type -MemberDefinition $sig -Name 'DiagnosticDataQuery_DdqGetDiagnosticRecordProducerCategories' -Namespace Win32 -PassThru
# $api::DdqGetDiagnosticRecordProducerCategories(hSession, producerName, hCategoryDescription)
#uselib "DiagnosticDataQuery.dll"
#func global DdqGetDiagnosticRecordProducerCategories "DdqGetDiagnosticRecordProducerCategories" sptr, sptr, sptr
; DdqGetDiagnosticRecordProducerCategories hSession, producerName, hCategoryDescription   ; 戻り値は stat
; hSession : HDIAGNOSTIC_DATA_QUERY_SESSION -> "sptr"
; producerName : LPCWSTR -> "sptr"
; hCategoryDescription : HDIAGNOSTIC_EVENT_CATEGORY_DESCRIPTION* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "DiagnosticDataQuery.dll"
#cfunc global DdqGetDiagnosticRecordProducerCategories "DdqGetDiagnosticRecordProducerCategories" sptr, wstr, sptr
; res = DdqGetDiagnosticRecordProducerCategories(hSession, producerName, hCategoryDescription)
; hSession : HDIAGNOSTIC_DATA_QUERY_SESSION -> "sptr"
; producerName : LPCWSTR -> "wstr"
; hCategoryDescription : HDIAGNOSTIC_EVENT_CATEGORY_DESCRIPTION* out -> "sptr"
; HRESULT DdqGetDiagnosticRecordProducerCategories(HDIAGNOSTIC_DATA_QUERY_SESSION hSession, LPCWSTR producerName, HDIAGNOSTIC_EVENT_CATEGORY_DESCRIPTION* hCategoryDescription)
#uselib "DiagnosticDataQuery.dll"
#cfunc global DdqGetDiagnosticRecordProducerCategories "DdqGetDiagnosticRecordProducerCategories" intptr, wstr, intptr
; res = DdqGetDiagnosticRecordProducerCategories(hSession, producerName, hCategoryDescription)
; hSession : HDIAGNOSTIC_DATA_QUERY_SESSION -> "intptr"
; producerName : LPCWSTR -> "wstr"
; hCategoryDescription : HDIAGNOSTIC_EVENT_CATEGORY_DESCRIPTION* out -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	diagnosticdataquery = windows.NewLazySystemDLL("DiagnosticDataQuery.dll")
	procDdqGetDiagnosticRecordProducerCategories = diagnosticdataquery.NewProc("DdqGetDiagnosticRecordProducerCategories")
)

// hSession (HDIAGNOSTIC_DATA_QUERY_SESSION), producerName (LPCWSTR), hCategoryDescription (HDIAGNOSTIC_EVENT_CATEGORY_DESCRIPTION* out)
r1, _, err := procDdqGetDiagnosticRecordProducerCategories.Call(
	uintptr(hSession),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(producerName))),
	uintptr(hCategoryDescription),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function DdqGetDiagnosticRecordProducerCategories(
  hSession: THandle;   // HDIAGNOSTIC_DATA_QUERY_SESSION
  producerName: PWideChar;   // LPCWSTR
  hCategoryDescription: Pointer   // HDIAGNOSTIC_EVENT_CATEGORY_DESCRIPTION* out
): Integer; stdcall;
  external 'DiagnosticDataQuery.dll' name 'DdqGetDiagnosticRecordProducerCategories';
result := DllCall("DiagnosticDataQuery\DdqGetDiagnosticRecordProducerCategories"
    , "Ptr", hSession   ; HDIAGNOSTIC_DATA_QUERY_SESSION
    , "WStr", producerName   ; LPCWSTR
    , "Ptr", hCategoryDescription   ; HDIAGNOSTIC_EVENT_CATEGORY_DESCRIPTION* out
    , "Int")   ; return: HRESULT
●DdqGetDiagnosticRecordProducerCategories(hSession, producerName, hCategoryDescription) = DLL("DiagnosticDataQuery.dll", "int DdqGetDiagnosticRecordProducerCategories(void*, char*, void*)")
# 呼び出し: DdqGetDiagnosticRecordProducerCategories(hSession, producerName, hCategoryDescription)
# hSession : HDIAGNOSTIC_DATA_QUERY_SESSION -> "void*"
# producerName : LPCWSTR -> "char*"
# hCategoryDescription : HDIAGNOSTIC_EVENT_CATEGORY_DESCRIPTION* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。