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

DevFreeObjectProperties

関数
取得したデバイスオブジェクトのプロパティ配列を解放する。
DLLapi-ms-win-devices-query-l1-1-0.dll呼出規約winapi

シグネチャ

// api-ms-win-devices-query-l1-1-0.dll
#include <windows.h>

void DevFreeObjectProperties(
    DWORD cPropertyCount,
    const DEVPROPERTY* pProperties
);

パラメーター

名前方向
cPropertyCountDWORDin
pPropertiesDEVPROPERTY*in

戻り値の型: void

各言語での呼び出し定義

// api-ms-win-devices-query-l1-1-0.dll
#include <windows.h>

void DevFreeObjectProperties(
    DWORD cPropertyCount,
    const DEVPROPERTY* pProperties
);
[DllImport("api-ms-win-devices-query-l1-1-0.dll", ExactSpelling = true)]
static extern void DevFreeObjectProperties(
    uint cPropertyCount,   // DWORD
    IntPtr pProperties   // DEVPROPERTY*
);
<DllImport("api-ms-win-devices-query-l1-1-0.dll", ExactSpelling:=True)>
Public Shared Sub DevFreeObjectProperties(
    cPropertyCount As UInteger,   ' DWORD
    pProperties As IntPtr   ' DEVPROPERTY*
)
End Sub
' cPropertyCount : DWORD
' pProperties : DEVPROPERTY*
Declare PtrSafe Sub DevFreeObjectProperties Lib "api-ms-win-devices-query-l1-1-0" ( _
    ByVal cPropertyCount As Long, _
    ByVal pProperties As LongPtr)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

DevFreeObjectProperties = ctypes.windll.LoadLibrary("api-ms-win-devices-query-l1-1-0.dll").DevFreeObjectProperties
DevFreeObjectProperties.restype = None
DevFreeObjectProperties.argtypes = [
    wintypes.DWORD,  # cPropertyCount : DWORD
    ctypes.c_void_p,  # pProperties : DEVPROPERTY*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('api-ms-win-devices-query-l1-1-0.dll')
DevFreeObjectProperties = Fiddle::Function.new(
  lib['DevFreeObjectProperties'],
  [
    -Fiddle::TYPE_INT,  # cPropertyCount : DWORD
    Fiddle::TYPE_VOIDP,  # pProperties : DEVPROPERTY*
  ],
  Fiddle::TYPE_VOID)
#[link(name = "api-ms-win-devices-query-l1-1-0")]
extern "system" {
    fn DevFreeObjectProperties(
        cPropertyCount: u32,  // DWORD
        pProperties: *const DEVPROPERTY  // DEVPROPERTY*
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("api-ms-win-devices-query-l1-1-0.dll")]
public static extern void DevFreeObjectProperties(uint cPropertyCount, IntPtr pProperties);
"@
$api = Add-Type -MemberDefinition $sig -Name 'api-ms-win-devices-query-l1-1-0_DevFreeObjectProperties' -Namespace Win32 -PassThru
# $api::DevFreeObjectProperties(cPropertyCount, pProperties)
#uselib "api-ms-win-devices-query-l1-1-0.dll"
#func global DevFreeObjectProperties "DevFreeObjectProperties" sptr, sptr
; DevFreeObjectProperties cPropertyCount, varptr(pProperties)
; cPropertyCount : DWORD -> "sptr"
; pProperties : DEVPROPERTY* -> "sptr"
出力引数:
#uselib "api-ms-win-devices-query-l1-1-0.dll"
#func global DevFreeObjectProperties "DevFreeObjectProperties" int, var
; DevFreeObjectProperties cPropertyCount, pProperties
; cPropertyCount : DWORD -> "int"
; pProperties : DEVPROPERTY* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; void DevFreeObjectProperties(DWORD cPropertyCount, DEVPROPERTY* pProperties)
#uselib "api-ms-win-devices-query-l1-1-0.dll"
#func global DevFreeObjectProperties "DevFreeObjectProperties" int, var
; DevFreeObjectProperties cPropertyCount, pProperties
; cPropertyCount : DWORD -> "int"
; pProperties : DEVPROPERTY* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	api_ms_win_devices_query_l1_1_0 = windows.NewLazySystemDLL("api-ms-win-devices-query-l1-1-0.dll")
	procDevFreeObjectProperties = api_ms_win_devices_query_l1_1_0.NewProc("DevFreeObjectProperties")
)

// cPropertyCount (DWORD), pProperties (DEVPROPERTY*)
r1, _, err := procDevFreeObjectProperties.Call(
	uintptr(cPropertyCount),
	uintptr(pProperties),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // void
procedure DevFreeObjectProperties(
  cPropertyCount: DWORD;   // DWORD
  pProperties: Pointer   // DEVPROPERTY*
); stdcall;
  external 'api-ms-win-devices-query-l1-1-0.dll' name 'DevFreeObjectProperties';
result := DllCall("api-ms-win-devices-query-l1-1-0\DevFreeObjectProperties"
    , "UInt", cPropertyCount   ; DWORD
    , "Ptr", pProperties   ; DEVPROPERTY*
    , "Int")   ; return: void
●DevFreeObjectProperties(cPropertyCount, pProperties) = DLL("api-ms-win-devices-query-l1-1-0.dll", "int DevFreeObjectProperties(dword, void*)")
# 呼び出し: DevFreeObjectProperties(cPropertyCount, pProperties)
# cPropertyCount : DWORD -> "dword"
# pProperties : DEVPROPERTY* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。