ホーム › Devices.DeviceAndDriverInstallation › CM_Free_Res_Des
CM_Free_Res_Des
関数論理構成からリソース記述子を削除する。
シグネチャ
// CFGMGR32.dll
#include <windows.h>
CONFIGRET CM_Free_Res_Des(
UINT_PTR* prdResDes, // optional
UINT_PTR rdResDes,
DWORD ulFlags
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| prdResDes | UINT_PTR* | outoptional |
| rdResDes | UINT_PTR | in |
| ulFlags | DWORD | in |
戻り値の型: CONFIGRET
各言語での呼び出し定義
// CFGMGR32.dll
#include <windows.h>
CONFIGRET CM_Free_Res_Des(
UINT_PTR* prdResDes, // optional
UINT_PTR rdResDes,
DWORD ulFlags
);[DllImport("CFGMGR32.dll", ExactSpelling = true)]
static extern uint CM_Free_Res_Des(
IntPtr prdResDes, // UINT_PTR* optional, out
UIntPtr rdResDes, // UINT_PTR
uint ulFlags // DWORD
);<DllImport("CFGMGR32.dll", ExactSpelling:=True)>
Public Shared Function CM_Free_Res_Des(
prdResDes As IntPtr, ' UINT_PTR* optional, out
rdResDes As UIntPtr, ' UINT_PTR
ulFlags As UInteger ' DWORD
) As UInteger
End Function' prdResDes : UINT_PTR* optional, out
' rdResDes : UINT_PTR
' ulFlags : DWORD
Declare PtrSafe Function CM_Free_Res_Des Lib "cfgmgr32" ( _
ByVal prdResDes As LongPtr, _
ByVal rdResDes As LongPtr, _
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_Free_Res_Des = ctypes.windll.cfgmgr32.CM_Free_Res_Des
CM_Free_Res_Des.restype = wintypes.DWORD
CM_Free_Res_Des.argtypes = [
ctypes.POINTER(ctypes.c_size_t), # prdResDes : UINT_PTR* optional, out
ctypes.c_size_t, # rdResDes : UINT_PTR
wintypes.DWORD, # ulFlags : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('CFGMGR32.dll')
CM_Free_Res_Des = Fiddle::Function.new(
lib['CM_Free_Res_Des'],
[
Fiddle::TYPE_VOIDP, # prdResDes : UINT_PTR* optional, out
Fiddle::TYPE_UINTPTR_T, # rdResDes : UINT_PTR
-Fiddle::TYPE_INT, # ulFlags : DWORD
],
-Fiddle::TYPE_INT)#[link(name = "cfgmgr32")]
extern "system" {
fn CM_Free_Res_Des(
prdResDes: *mut usize, // UINT_PTR* optional, out
rdResDes: usize, // UINT_PTR
ulFlags: u32 // DWORD
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("CFGMGR32.dll")]
public static extern uint CM_Free_Res_Des(IntPtr prdResDes, UIntPtr rdResDes, uint ulFlags);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CFGMGR32_CM_Free_Res_Des' -Namespace Win32 -PassThru
# $api::CM_Free_Res_Des(prdResDes, rdResDes, ulFlags)#uselib "CFGMGR32.dll"
#func global CM_Free_Res_Des "CM_Free_Res_Des" sptr, sptr, sptr
; CM_Free_Res_Des varptr(prdResDes), rdResDes, ulFlags ; 戻り値は stat
; prdResDes : UINT_PTR* optional, out -> "sptr"
; rdResDes : UINT_PTR -> "sptr"
; ulFlags : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "CFGMGR32.dll" #cfunc global CM_Free_Res_Des "CM_Free_Res_Des" var, sptr, int ; res = CM_Free_Res_Des(prdResDes, rdResDes, ulFlags) ; prdResDes : UINT_PTR* optional, out -> "var" ; rdResDes : UINT_PTR -> "sptr" ; ulFlags : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "CFGMGR32.dll" #cfunc global CM_Free_Res_Des "CM_Free_Res_Des" sptr, sptr, int ; res = CM_Free_Res_Des(varptr(prdResDes), rdResDes, ulFlags) ; prdResDes : UINT_PTR* optional, out -> "sptr" ; rdResDes : UINT_PTR -> "sptr" ; ulFlags : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; CONFIGRET CM_Free_Res_Des(UINT_PTR* prdResDes, UINT_PTR rdResDes, DWORD ulFlags) #uselib "CFGMGR32.dll" #cfunc global CM_Free_Res_Des "CM_Free_Res_Des" var, intptr, int ; res = CM_Free_Res_Des(prdResDes, rdResDes, ulFlags) ; prdResDes : UINT_PTR* optional, out -> "var" ; rdResDes : UINT_PTR -> "intptr" ; ulFlags : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; CONFIGRET CM_Free_Res_Des(UINT_PTR* prdResDes, UINT_PTR rdResDes, DWORD ulFlags) #uselib "CFGMGR32.dll" #cfunc global CM_Free_Res_Des "CM_Free_Res_Des" intptr, intptr, int ; res = CM_Free_Res_Des(varptr(prdResDes), rdResDes, ulFlags) ; prdResDes : UINT_PTR* optional, out -> "intptr" ; rdResDes : UINT_PTR -> "intptr" ; ulFlags : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
cfgmgr32 = windows.NewLazySystemDLL("CFGMGR32.dll")
procCM_Free_Res_Des = cfgmgr32.NewProc("CM_Free_Res_Des")
)
// prdResDes (UINT_PTR* optional, out), rdResDes (UINT_PTR), ulFlags (DWORD)
r1, _, err := procCM_Free_Res_Des.Call(
uintptr(prdResDes),
uintptr(rdResDes),
uintptr(ulFlags),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // CONFIGRETfunction CM_Free_Res_Des(
prdResDes: Pointer; // UINT_PTR* optional, out
rdResDes: NativeUInt; // UINT_PTR
ulFlags: DWORD // DWORD
): DWORD; stdcall;
external 'CFGMGR32.dll' name 'CM_Free_Res_Des';result := DllCall("CFGMGR32\CM_Free_Res_Des"
, "Ptr", prdResDes ; UINT_PTR* optional, out
, "UPtr", rdResDes ; UINT_PTR
, "UInt", ulFlags ; DWORD
, "UInt") ; return: CONFIGRET●CM_Free_Res_Des(prdResDes, rdResDes, ulFlags) = DLL("CFGMGR32.dll", "dword CM_Free_Res_Des(void*, int, dword)")
# 呼び出し: CM_Free_Res_Des(prdResDes, rdResDes, ulFlags)
# prdResDes : UINT_PTR* optional, out -> "void*"
# rdResDes : UINT_PTR -> "int"
# ulFlags : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。