ホーム › Devices.DeviceAndDriverInstallation › CM_Get_DevNode_Property_Keys
CM_Get_DevNode_Property_Keys
関数デバイスノードが持つプロパティキーの一覧を取得する。
シグネチャ
// CFGMGR32.dll
#include <windows.h>
CONFIGRET CM_Get_DevNode_Property_Keys(
DWORD dnDevInst,
DEVPROPKEY* PropertyKeyArray, // optional
DWORD* PropertyKeyCount,
DWORD ulFlags
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| dnDevInst | DWORD | in |
| PropertyKeyArray | DEVPROPKEY* | outoptional |
| PropertyKeyCount | DWORD* | inout |
| ulFlags | DWORD | in |
戻り値の型: CONFIGRET
各言語での呼び出し定義
// CFGMGR32.dll
#include <windows.h>
CONFIGRET CM_Get_DevNode_Property_Keys(
DWORD dnDevInst,
DEVPROPKEY* PropertyKeyArray, // optional
DWORD* PropertyKeyCount,
DWORD ulFlags
);[DllImport("CFGMGR32.dll", ExactSpelling = true)]
static extern uint CM_Get_DevNode_Property_Keys(
uint dnDevInst, // DWORD
IntPtr PropertyKeyArray, // DEVPROPKEY* optional, out
ref uint PropertyKeyCount, // DWORD* in/out
uint ulFlags // DWORD
);<DllImport("CFGMGR32.dll", ExactSpelling:=True)>
Public Shared Function CM_Get_DevNode_Property_Keys(
dnDevInst As UInteger, ' DWORD
PropertyKeyArray As IntPtr, ' DEVPROPKEY* optional, out
ByRef PropertyKeyCount As UInteger, ' DWORD* in/out
ulFlags As UInteger ' DWORD
) As UInteger
End Function' dnDevInst : DWORD
' PropertyKeyArray : DEVPROPKEY* optional, out
' PropertyKeyCount : DWORD* in/out
' ulFlags : DWORD
Declare PtrSafe Function CM_Get_DevNode_Property_Keys Lib "cfgmgr32" ( _
ByVal dnDevInst As Long, _
ByVal PropertyKeyArray As LongPtr, _
ByRef PropertyKeyCount As Long, _
ByVal ulFlags As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CM_Get_DevNode_Property_Keys = ctypes.windll.cfgmgr32.CM_Get_DevNode_Property_Keys
CM_Get_DevNode_Property_Keys.restype = wintypes.DWORD
CM_Get_DevNode_Property_Keys.argtypes = [
wintypes.DWORD, # dnDevInst : DWORD
ctypes.c_void_p, # PropertyKeyArray : DEVPROPKEY* optional, out
ctypes.POINTER(wintypes.DWORD), # PropertyKeyCount : DWORD* in/out
wintypes.DWORD, # ulFlags : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('CFGMGR32.dll')
CM_Get_DevNode_Property_Keys = Fiddle::Function.new(
lib['CM_Get_DevNode_Property_Keys'],
[
-Fiddle::TYPE_INT, # dnDevInst : DWORD
Fiddle::TYPE_VOIDP, # PropertyKeyArray : DEVPROPKEY* optional, out
Fiddle::TYPE_VOIDP, # PropertyKeyCount : DWORD* in/out
-Fiddle::TYPE_INT, # ulFlags : DWORD
],
-Fiddle::TYPE_INT)#[link(name = "cfgmgr32")]
extern "system" {
fn CM_Get_DevNode_Property_Keys(
dnDevInst: u32, // DWORD
PropertyKeyArray: *mut DEVPROPKEY, // DEVPROPKEY* optional, out
PropertyKeyCount: *mut u32, // DWORD* in/out
ulFlags: u32 // DWORD
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("CFGMGR32.dll")]
public static extern uint CM_Get_DevNode_Property_Keys(uint dnDevInst, IntPtr PropertyKeyArray, ref uint PropertyKeyCount, uint ulFlags);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CFGMGR32_CM_Get_DevNode_Property_Keys' -Namespace Win32 -PassThru
# $api::CM_Get_DevNode_Property_Keys(dnDevInst, PropertyKeyArray, PropertyKeyCount, ulFlags)#uselib "CFGMGR32.dll"
#func global CM_Get_DevNode_Property_Keys "CM_Get_DevNode_Property_Keys" sptr, sptr, sptr, sptr
; CM_Get_DevNode_Property_Keys dnDevInst, varptr(PropertyKeyArray), varptr(PropertyKeyCount), ulFlags ; 戻り値は stat
; dnDevInst : DWORD -> "sptr"
; PropertyKeyArray : DEVPROPKEY* optional, out -> "sptr"
; PropertyKeyCount : DWORD* in/out -> "sptr"
; ulFlags : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "CFGMGR32.dll" #cfunc global CM_Get_DevNode_Property_Keys "CM_Get_DevNode_Property_Keys" int, var, var, int ; res = CM_Get_DevNode_Property_Keys(dnDevInst, PropertyKeyArray, PropertyKeyCount, ulFlags) ; dnDevInst : DWORD -> "int" ; PropertyKeyArray : DEVPROPKEY* optional, out -> "var" ; PropertyKeyCount : DWORD* in/out -> "var" ; ulFlags : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "CFGMGR32.dll" #cfunc global CM_Get_DevNode_Property_Keys "CM_Get_DevNode_Property_Keys" int, sptr, sptr, int ; res = CM_Get_DevNode_Property_Keys(dnDevInst, varptr(PropertyKeyArray), varptr(PropertyKeyCount), ulFlags) ; dnDevInst : DWORD -> "int" ; PropertyKeyArray : DEVPROPKEY* optional, out -> "sptr" ; PropertyKeyCount : DWORD* in/out -> "sptr" ; ulFlags : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; CONFIGRET CM_Get_DevNode_Property_Keys(DWORD dnDevInst, DEVPROPKEY* PropertyKeyArray, DWORD* PropertyKeyCount, DWORD ulFlags) #uselib "CFGMGR32.dll" #cfunc global CM_Get_DevNode_Property_Keys "CM_Get_DevNode_Property_Keys" int, var, var, int ; res = CM_Get_DevNode_Property_Keys(dnDevInst, PropertyKeyArray, PropertyKeyCount, ulFlags) ; dnDevInst : DWORD -> "int" ; PropertyKeyArray : DEVPROPKEY* optional, out -> "var" ; PropertyKeyCount : DWORD* in/out -> "var" ; ulFlags : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; CONFIGRET CM_Get_DevNode_Property_Keys(DWORD dnDevInst, DEVPROPKEY* PropertyKeyArray, DWORD* PropertyKeyCount, DWORD ulFlags) #uselib "CFGMGR32.dll" #cfunc global CM_Get_DevNode_Property_Keys "CM_Get_DevNode_Property_Keys" int, intptr, intptr, int ; res = CM_Get_DevNode_Property_Keys(dnDevInst, varptr(PropertyKeyArray), varptr(PropertyKeyCount), ulFlags) ; dnDevInst : DWORD -> "int" ; PropertyKeyArray : DEVPROPKEY* optional, out -> "intptr" ; PropertyKeyCount : DWORD* in/out -> "intptr" ; ulFlags : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
cfgmgr32 = windows.NewLazySystemDLL("CFGMGR32.dll")
procCM_Get_DevNode_Property_Keys = cfgmgr32.NewProc("CM_Get_DevNode_Property_Keys")
)
// dnDevInst (DWORD), PropertyKeyArray (DEVPROPKEY* optional, out), PropertyKeyCount (DWORD* in/out), ulFlags (DWORD)
r1, _, err := procCM_Get_DevNode_Property_Keys.Call(
uintptr(dnDevInst),
uintptr(PropertyKeyArray),
uintptr(PropertyKeyCount),
uintptr(ulFlags),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // CONFIGRETfunction CM_Get_DevNode_Property_Keys(
dnDevInst: DWORD; // DWORD
PropertyKeyArray: Pointer; // DEVPROPKEY* optional, out
PropertyKeyCount: Pointer; // DWORD* in/out
ulFlags: DWORD // DWORD
): DWORD; stdcall;
external 'CFGMGR32.dll' name 'CM_Get_DevNode_Property_Keys';result := DllCall("CFGMGR32\CM_Get_DevNode_Property_Keys"
, "UInt", dnDevInst ; DWORD
, "Ptr", PropertyKeyArray ; DEVPROPKEY* optional, out
, "Ptr", PropertyKeyCount ; DWORD* in/out
, "UInt", ulFlags ; DWORD
, "UInt") ; return: CONFIGRET●CM_Get_DevNode_Property_Keys(dnDevInst, PropertyKeyArray, PropertyKeyCount, ulFlags) = DLL("CFGMGR32.dll", "dword CM_Get_DevNode_Property_Keys(dword, void*, void*, dword)")
# 呼び出し: CM_Get_DevNode_Property_Keys(dnDevInst, PropertyKeyArray, PropertyKeyCount, ulFlags)
# dnDevInst : DWORD -> "dword"
# PropertyKeyArray : DEVPROPKEY* optional, out -> "void*"
# PropertyKeyCount : DWORD* in/out -> "void*"
# ulFlags : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。