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

DdqCloseSession

関数
診断データクエリのセッションを閉じる。
DLLDiagnosticDataQuery.dll呼出規約winapi対応OSWindows 10 以降

シグネチャ

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

HRESULT DdqCloseSession(
    HDIAGNOSTIC_DATA_QUERY_SESSION hSession
);

パラメーター

名前方向
hSessionHDIAGNOSTIC_DATA_QUERY_SESSIONin

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

DdqCloseSession = ctypes.windll.diagnosticdataquery.DdqCloseSession
DdqCloseSession.restype = ctypes.c_int
DdqCloseSession.argtypes = [
    wintypes.HANDLE,  # hSession : HDIAGNOSTIC_DATA_QUERY_SESSION
]
require 'fiddle'
require 'fiddle/import'

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

var (
	diagnosticdataquery = windows.NewLazySystemDLL("DiagnosticDataQuery.dll")
	procDdqCloseSession = diagnosticdataquery.NewProc("DdqCloseSession")
)

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