ホーム › Devices.DeviceAndDriverInstallation › SetupDiGetDeviceInfoListDetailW
SetupDiGetDeviceInfoListDetailW
関数デバイス情報セットの詳細情報を取得する。
シグネチャ
// SETUPAPI.dll (Unicode / -W)
#include <windows.h>
BOOL SetupDiGetDeviceInfoListDetailW(
HDEVINFO DeviceInfoSet,
SP_DEVINFO_LIST_DETAIL_DATA_W* DeviceInfoSetDetailData
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| DeviceInfoSet | HDEVINFO | in |
| DeviceInfoSetDetailData | SP_DEVINFO_LIST_DETAIL_DATA_W* | inout |
戻り値の型: BOOL
各言語での呼び出し定義
// SETUPAPI.dll (Unicode / -W)
#include <windows.h>
BOOL SetupDiGetDeviceInfoListDetailW(
HDEVINFO DeviceInfoSet,
SP_DEVINFO_LIST_DETAIL_DATA_W* DeviceInfoSetDetailData
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SETUPAPI.dll", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
static extern bool SetupDiGetDeviceInfoListDetailW(
IntPtr DeviceInfoSet, // HDEVINFO
IntPtr DeviceInfoSetDetailData // SP_DEVINFO_LIST_DETAIL_DATA_W* in/out
);<DllImport("SETUPAPI.dll", CharSet:=CharSet.Unicode, SetLastError:=True, ExactSpelling:=True)>
Public Shared Function SetupDiGetDeviceInfoListDetailW(
DeviceInfoSet As IntPtr, ' HDEVINFO
DeviceInfoSetDetailData As IntPtr ' SP_DEVINFO_LIST_DETAIL_DATA_W* in/out
) As Boolean
End Function' DeviceInfoSet : HDEVINFO
' DeviceInfoSetDetailData : SP_DEVINFO_LIST_DETAIL_DATA_W* in/out
Declare PtrSafe Function SetupDiGetDeviceInfoListDetailW Lib "setupapi" ( _
ByVal DeviceInfoSet As LongPtr, _
ByVal DeviceInfoSetDetailData As LongPtr) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SetupDiGetDeviceInfoListDetailW = ctypes.windll.setupapi.SetupDiGetDeviceInfoListDetailW
SetupDiGetDeviceInfoListDetailW.restype = wintypes.BOOL
SetupDiGetDeviceInfoListDetailW.argtypes = [
ctypes.c_ssize_t, # DeviceInfoSet : HDEVINFO
ctypes.c_void_p, # DeviceInfoSetDetailData : SP_DEVINFO_LIST_DETAIL_DATA_W* in/out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('SETUPAPI.dll')
SetupDiGetDeviceInfoListDetailW = Fiddle::Function.new(
lib['SetupDiGetDeviceInfoListDetailW'],
[
Fiddle::TYPE_INTPTR_T, # DeviceInfoSet : HDEVINFO
Fiddle::TYPE_VOIDP, # DeviceInfoSetDetailData : SP_DEVINFO_LIST_DETAIL_DATA_W* in/out
],
Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "setupapi")]
extern "system" {
fn SetupDiGetDeviceInfoListDetailW(
DeviceInfoSet: isize, // HDEVINFO
DeviceInfoSetDetailData: *mut SP_DEVINFO_LIST_DETAIL_DATA_W // SP_DEVINFO_LIST_DETAIL_DATA_W* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("SETUPAPI.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern bool SetupDiGetDeviceInfoListDetailW(IntPtr DeviceInfoSet, IntPtr DeviceInfoSetDetailData);
"@
$api = Add-Type -MemberDefinition $sig -Name 'SETUPAPI_SetupDiGetDeviceInfoListDetailW' -Namespace Win32 -PassThru
# $api::SetupDiGetDeviceInfoListDetailW(DeviceInfoSet, DeviceInfoSetDetailData)#uselib "SETUPAPI.dll"
#func global SetupDiGetDeviceInfoListDetailW "SetupDiGetDeviceInfoListDetailW" wptr, wptr
; SetupDiGetDeviceInfoListDetailW DeviceInfoSet, varptr(DeviceInfoSetDetailData) ; 戻り値は stat
; DeviceInfoSet : HDEVINFO -> "wptr"
; DeviceInfoSetDetailData : SP_DEVINFO_LIST_DETAIL_DATA_W* in/out -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "SETUPAPI.dll" #cfunc global SetupDiGetDeviceInfoListDetailW "SetupDiGetDeviceInfoListDetailW" sptr, var ; res = SetupDiGetDeviceInfoListDetailW(DeviceInfoSet, DeviceInfoSetDetailData) ; DeviceInfoSet : HDEVINFO -> "sptr" ; DeviceInfoSetDetailData : SP_DEVINFO_LIST_DETAIL_DATA_W* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "SETUPAPI.dll" #cfunc global SetupDiGetDeviceInfoListDetailW "SetupDiGetDeviceInfoListDetailW" sptr, sptr ; res = SetupDiGetDeviceInfoListDetailW(DeviceInfoSet, varptr(DeviceInfoSetDetailData)) ; DeviceInfoSet : HDEVINFO -> "sptr" ; DeviceInfoSetDetailData : SP_DEVINFO_LIST_DETAIL_DATA_W* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL SetupDiGetDeviceInfoListDetailW(HDEVINFO DeviceInfoSet, SP_DEVINFO_LIST_DETAIL_DATA_W* DeviceInfoSetDetailData) #uselib "SETUPAPI.dll" #cfunc global SetupDiGetDeviceInfoListDetailW "SetupDiGetDeviceInfoListDetailW" intptr, var ; res = SetupDiGetDeviceInfoListDetailW(DeviceInfoSet, DeviceInfoSetDetailData) ; DeviceInfoSet : HDEVINFO -> "intptr" ; DeviceInfoSetDetailData : SP_DEVINFO_LIST_DETAIL_DATA_W* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL SetupDiGetDeviceInfoListDetailW(HDEVINFO DeviceInfoSet, SP_DEVINFO_LIST_DETAIL_DATA_W* DeviceInfoSetDetailData) #uselib "SETUPAPI.dll" #cfunc global SetupDiGetDeviceInfoListDetailW "SetupDiGetDeviceInfoListDetailW" intptr, intptr ; res = SetupDiGetDeviceInfoListDetailW(DeviceInfoSet, varptr(DeviceInfoSetDetailData)) ; DeviceInfoSet : HDEVINFO -> "intptr" ; DeviceInfoSetDetailData : SP_DEVINFO_LIST_DETAIL_DATA_W* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
setupapi = windows.NewLazySystemDLL("SETUPAPI.dll")
procSetupDiGetDeviceInfoListDetailW = setupapi.NewProc("SetupDiGetDeviceInfoListDetailW")
)
// DeviceInfoSet (HDEVINFO), DeviceInfoSetDetailData (SP_DEVINFO_LIST_DETAIL_DATA_W* in/out)
r1, _, err := procSetupDiGetDeviceInfoListDetailW.Call(
uintptr(DeviceInfoSet),
uintptr(DeviceInfoSetDetailData),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction SetupDiGetDeviceInfoListDetailW(
DeviceInfoSet: NativeInt; // HDEVINFO
DeviceInfoSetDetailData: Pointer // SP_DEVINFO_LIST_DETAIL_DATA_W* in/out
): BOOL; stdcall;
external 'SETUPAPI.dll' name 'SetupDiGetDeviceInfoListDetailW';result := DllCall("SETUPAPI\SetupDiGetDeviceInfoListDetailW"
, "Ptr", DeviceInfoSet ; HDEVINFO
, "Ptr", DeviceInfoSetDetailData ; SP_DEVINFO_LIST_DETAIL_DATA_W* in/out
, "Int") ; return: BOOL●SetupDiGetDeviceInfoListDetailW(DeviceInfoSet, DeviceInfoSetDetailData) = DLL("SETUPAPI.dll", "bool SetupDiGetDeviceInfoListDetailW(int, void*)")
# 呼び出し: SetupDiGetDeviceInfoListDetailW(DeviceInfoSet, DeviceInfoSetDetailData)
# DeviceInfoSet : HDEVINFO -> "int"
# DeviceInfoSetDetailData : SP_DEVINFO_LIST_DETAIL_DATA_W* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。