Win32 API 日本語リファレンス
ホームDevices.DeviceAndDriverInstallation › SetupDiGetDeviceInfoListDetailA

SetupDiGetDeviceInfoListDetailA

関数
デバイス情報セットの詳細情報を取得する。
DLLSETUPAPI.dll文字セットANSI (-A)呼出規約winapiSetLastErrorあり対応OSWindows 2000 以降

シグネチャ

// SETUPAPI.dll  (ANSI / -A)
#include <windows.h>

BOOL SetupDiGetDeviceInfoListDetailA(
    HDEVINFO DeviceInfoSet,
    SP_DEVINFO_LIST_DETAIL_DATA_A* DeviceInfoSetDetailData
);

パラメーター

名前方向
DeviceInfoSetHDEVINFOin
DeviceInfoSetDetailDataSP_DEVINFO_LIST_DETAIL_DATA_A*inout

戻り値の型: BOOL

各言語での呼び出し定義

// SETUPAPI.dll  (ANSI / -A)
#include <windows.h>

BOOL SetupDiGetDeviceInfoListDetailA(
    HDEVINFO DeviceInfoSet,
    SP_DEVINFO_LIST_DETAIL_DATA_A* DeviceInfoSetDetailData
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SETUPAPI.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
static extern bool SetupDiGetDeviceInfoListDetailA(
    IntPtr DeviceInfoSet,   // HDEVINFO
    IntPtr DeviceInfoSetDetailData   // SP_DEVINFO_LIST_DETAIL_DATA_A* in/out
);
<DllImport("SETUPAPI.dll", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function SetupDiGetDeviceInfoListDetailA(
    DeviceInfoSet As IntPtr,   ' HDEVINFO
    DeviceInfoSetDetailData As IntPtr   ' SP_DEVINFO_LIST_DETAIL_DATA_A* in/out
) As Boolean
End Function
' DeviceInfoSet : HDEVINFO
' DeviceInfoSetDetailData : SP_DEVINFO_LIST_DETAIL_DATA_A* in/out
Declare PtrSafe Function SetupDiGetDeviceInfoListDetailA Lib "setupapi" ( _
    ByVal DeviceInfoSet As LongPtr, _
    ByVal DeviceInfoSetDetailData As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SetupDiGetDeviceInfoListDetailA = ctypes.windll.setupapi.SetupDiGetDeviceInfoListDetailA
SetupDiGetDeviceInfoListDetailA.restype = wintypes.BOOL
SetupDiGetDeviceInfoListDetailA.argtypes = [
    ctypes.c_ssize_t,  # DeviceInfoSet : HDEVINFO
    ctypes.c_void_p,  # DeviceInfoSetDetailData : SP_DEVINFO_LIST_DETAIL_DATA_A* in/out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('SETUPAPI.dll')
SetupDiGetDeviceInfoListDetailA = Fiddle::Function.new(
  lib['SetupDiGetDeviceInfoListDetailA'],
  [
    Fiddle::TYPE_INTPTR_T,  # DeviceInfoSet : HDEVINFO
    Fiddle::TYPE_VOIDP,  # DeviceInfoSetDetailData : SP_DEVINFO_LIST_DETAIL_DATA_A* in/out
  ],
  Fiddle::TYPE_INT)
#[link(name = "setupapi")]
extern "system" {
    fn SetupDiGetDeviceInfoListDetailA(
        DeviceInfoSet: isize,  // HDEVINFO
        DeviceInfoSetDetailData: *mut SP_DEVINFO_LIST_DETAIL_DATA_A  // SP_DEVINFO_LIST_DETAIL_DATA_A* in/out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SETUPAPI.dll", CharSet = CharSet.Ansi, SetLastError = true)]
public static extern bool SetupDiGetDeviceInfoListDetailA(IntPtr DeviceInfoSet, IntPtr DeviceInfoSetDetailData);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SETUPAPI_SetupDiGetDeviceInfoListDetailA' -Namespace Win32 -PassThru
# $api::SetupDiGetDeviceInfoListDetailA(DeviceInfoSet, DeviceInfoSetDetailData)
#uselib "SETUPAPI.dll"
#func global SetupDiGetDeviceInfoListDetailA "SetupDiGetDeviceInfoListDetailA" sptr, sptr
; SetupDiGetDeviceInfoListDetailA DeviceInfoSet, varptr(DeviceInfoSetDetailData)   ; 戻り値は stat
; DeviceInfoSet : HDEVINFO -> "sptr"
; DeviceInfoSetDetailData : SP_DEVINFO_LIST_DETAIL_DATA_A* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "SETUPAPI.dll"
#cfunc global SetupDiGetDeviceInfoListDetailA "SetupDiGetDeviceInfoListDetailA" sptr, var
; res = SetupDiGetDeviceInfoListDetailA(DeviceInfoSet, DeviceInfoSetDetailData)
; DeviceInfoSet : HDEVINFO -> "sptr"
; DeviceInfoSetDetailData : SP_DEVINFO_LIST_DETAIL_DATA_A* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; BOOL SetupDiGetDeviceInfoListDetailA(HDEVINFO DeviceInfoSet, SP_DEVINFO_LIST_DETAIL_DATA_A* DeviceInfoSetDetailData)
#uselib "SETUPAPI.dll"
#cfunc global SetupDiGetDeviceInfoListDetailA "SetupDiGetDeviceInfoListDetailA" intptr, var
; res = SetupDiGetDeviceInfoListDetailA(DeviceInfoSet, DeviceInfoSetDetailData)
; DeviceInfoSet : HDEVINFO -> "intptr"
; DeviceInfoSetDetailData : SP_DEVINFO_LIST_DETAIL_DATA_A* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	setupapi = windows.NewLazySystemDLL("SETUPAPI.dll")
	procSetupDiGetDeviceInfoListDetailA = setupapi.NewProc("SetupDiGetDeviceInfoListDetailA")
)

// DeviceInfoSet (HDEVINFO), DeviceInfoSetDetailData (SP_DEVINFO_LIST_DETAIL_DATA_A* in/out)
r1, _, err := procSetupDiGetDeviceInfoListDetailA.Call(
	uintptr(DeviceInfoSet),
	uintptr(DeviceInfoSetDetailData),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function SetupDiGetDeviceInfoListDetailA(
  DeviceInfoSet: NativeInt;   // HDEVINFO
  DeviceInfoSetDetailData: Pointer   // SP_DEVINFO_LIST_DETAIL_DATA_A* in/out
): BOOL; stdcall;
  external 'SETUPAPI.dll' name 'SetupDiGetDeviceInfoListDetailA';
result := DllCall("SETUPAPI\SetupDiGetDeviceInfoListDetailA"
    , "Ptr", DeviceInfoSet   ; HDEVINFO
    , "Ptr", DeviceInfoSetDetailData   ; SP_DEVINFO_LIST_DETAIL_DATA_A* in/out
    , "Int")   ; return: BOOL
●SetupDiGetDeviceInfoListDetailA(DeviceInfoSet, DeviceInfoSetDetailData) = DLL("SETUPAPI.dll", "bool SetupDiGetDeviceInfoListDetailA(int, void*)")
# 呼び出し: SetupDiGetDeviceInfoListDetailA(DeviceInfoSet, DeviceInfoSetDetailData)
# DeviceInfoSet : HDEVINFO -> "int"
# DeviceInfoSetDetailData : SP_DEVINFO_LIST_DETAIL_DATA_A* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。