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

CM_Detect_Resource_Conflict_Ex

関数
指定マシンでリソースの競合を検出する。
DLLCFGMGR32.dll呼出規約winapi

シグネチャ

// CFGMGR32.dll
#include <windows.h>

CONFIGRET CM_Detect_Resource_Conflict_Ex(
    DWORD dnDevInst,
    DWORD ResourceID,
    void* ResourceData,
    DWORD ResourceLen,
    BOOL* pbConflictDetected,
    DWORD ulFlags,
    INT_PTR hMachine   // optional
);

パラメーター

名前方向
dnDevInstDWORDin
ResourceIDDWORDin
ResourceDatavoid*in
ResourceLenDWORDin
pbConflictDetectedBOOL*out
ulFlagsDWORDin
hMachineINT_PTRinoptional

戻り値の型: CONFIGRET

各言語での呼び出し定義

// CFGMGR32.dll
#include <windows.h>

CONFIGRET CM_Detect_Resource_Conflict_Ex(
    DWORD dnDevInst,
    DWORD ResourceID,
    void* ResourceData,
    DWORD ResourceLen,
    BOOL* pbConflictDetected,
    DWORD ulFlags,
    INT_PTR hMachine   // optional
);
[DllImport("CFGMGR32.dll", ExactSpelling = true)]
static extern uint CM_Detect_Resource_Conflict_Ex(
    uint dnDevInst,   // DWORD
    uint ResourceID,   // DWORD
    IntPtr ResourceData,   // void*
    uint ResourceLen,   // DWORD
    out int pbConflictDetected,   // BOOL* out
    uint ulFlags,   // DWORD
    IntPtr hMachine   // INT_PTR optional
);
<DllImport("CFGMGR32.dll", ExactSpelling:=True)>
Public Shared Function CM_Detect_Resource_Conflict_Ex(
    dnDevInst As UInteger,   ' DWORD
    ResourceID As UInteger,   ' DWORD
    ResourceData As IntPtr,   ' void*
    ResourceLen As UInteger,   ' DWORD
    <Out> ByRef pbConflictDetected As Integer,   ' BOOL* out
    ulFlags As UInteger,   ' DWORD
    hMachine As IntPtr   ' INT_PTR optional
) As UInteger
End Function
' dnDevInst : DWORD
' ResourceID : DWORD
' ResourceData : void*
' ResourceLen : DWORD
' pbConflictDetected : BOOL* out
' ulFlags : DWORD
' hMachine : INT_PTR optional
Declare PtrSafe Function CM_Detect_Resource_Conflict_Ex Lib "cfgmgr32" ( _
    ByVal dnDevInst As Long, _
    ByVal ResourceID As Long, _
    ByVal ResourceData As LongPtr, _
    ByVal ResourceLen As Long, _
    ByRef pbConflictDetected As Long, _
    ByVal ulFlags As Long, _
    ByVal hMachine As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

CM_Detect_Resource_Conflict_Ex = ctypes.windll.cfgmgr32.CM_Detect_Resource_Conflict_Ex
CM_Detect_Resource_Conflict_Ex.restype = wintypes.DWORD
CM_Detect_Resource_Conflict_Ex.argtypes = [
    wintypes.DWORD,  # dnDevInst : DWORD
    wintypes.DWORD,  # ResourceID : DWORD
    ctypes.POINTER(None),  # ResourceData : void*
    wintypes.DWORD,  # ResourceLen : DWORD
    ctypes.c_void_p,  # pbConflictDetected : BOOL* out
    wintypes.DWORD,  # ulFlags : DWORD
    ctypes.c_ssize_t,  # hMachine : INT_PTR optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('CFGMGR32.dll')
CM_Detect_Resource_Conflict_Ex = Fiddle::Function.new(
  lib['CM_Detect_Resource_Conflict_Ex'],
  [
    -Fiddle::TYPE_INT,  # dnDevInst : DWORD
    -Fiddle::TYPE_INT,  # ResourceID : DWORD
    Fiddle::TYPE_VOIDP,  # ResourceData : void*
    -Fiddle::TYPE_INT,  # ResourceLen : DWORD
    Fiddle::TYPE_VOIDP,  # pbConflictDetected : BOOL* out
    -Fiddle::TYPE_INT,  # ulFlags : DWORD
    Fiddle::TYPE_INTPTR_T,  # hMachine : INT_PTR optional
  ],
  -Fiddle::TYPE_INT)
#[link(name = "cfgmgr32")]
extern "system" {
    fn CM_Detect_Resource_Conflict_Ex(
        dnDevInst: u32,  // DWORD
        ResourceID: u32,  // DWORD
        ResourceData: *mut (),  // void*
        ResourceLen: u32,  // DWORD
        pbConflictDetected: *mut i32,  // BOOL* out
        ulFlags: u32,  // DWORD
        hMachine: isize  // INT_PTR optional
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("CFGMGR32.dll")]
public static extern uint CM_Detect_Resource_Conflict_Ex(uint dnDevInst, uint ResourceID, IntPtr ResourceData, uint ResourceLen, out int pbConflictDetected, uint ulFlags, IntPtr hMachine);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CFGMGR32_CM_Detect_Resource_Conflict_Ex' -Namespace Win32 -PassThru
# $api::CM_Detect_Resource_Conflict_Ex(dnDevInst, ResourceID, ResourceData, ResourceLen, pbConflictDetected, ulFlags, hMachine)
#uselib "CFGMGR32.dll"
#func global CM_Detect_Resource_Conflict_Ex "CM_Detect_Resource_Conflict_Ex" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; CM_Detect_Resource_Conflict_Ex dnDevInst, ResourceID, ResourceData, ResourceLen, pbConflictDetected, ulFlags, hMachine   ; 戻り値は stat
; dnDevInst : DWORD -> "sptr"
; ResourceID : DWORD -> "sptr"
; ResourceData : void* -> "sptr"
; ResourceLen : DWORD -> "sptr"
; pbConflictDetected : BOOL* out -> "sptr"
; ulFlags : DWORD -> "sptr"
; hMachine : INT_PTR optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "CFGMGR32.dll"
#cfunc global CM_Detect_Resource_Conflict_Ex "CM_Detect_Resource_Conflict_Ex" int, int, sptr, int, int, int, sptr
; res = CM_Detect_Resource_Conflict_Ex(dnDevInst, ResourceID, ResourceData, ResourceLen, pbConflictDetected, ulFlags, hMachine)
; dnDevInst : DWORD -> "int"
; ResourceID : DWORD -> "int"
; ResourceData : void* -> "sptr"
; ResourceLen : DWORD -> "int"
; pbConflictDetected : BOOL* out -> "int"
; ulFlags : DWORD -> "int"
; hMachine : INT_PTR optional -> "sptr"
; CONFIGRET CM_Detect_Resource_Conflict_Ex(DWORD dnDevInst, DWORD ResourceID, void* ResourceData, DWORD ResourceLen, BOOL* pbConflictDetected, DWORD ulFlags, INT_PTR hMachine)
#uselib "CFGMGR32.dll"
#cfunc global CM_Detect_Resource_Conflict_Ex "CM_Detect_Resource_Conflict_Ex" int, int, intptr, int, int, int, intptr
; res = CM_Detect_Resource_Conflict_Ex(dnDevInst, ResourceID, ResourceData, ResourceLen, pbConflictDetected, ulFlags, hMachine)
; dnDevInst : DWORD -> "int"
; ResourceID : DWORD -> "int"
; ResourceData : void* -> "intptr"
; ResourceLen : DWORD -> "int"
; pbConflictDetected : BOOL* out -> "int"
; ulFlags : DWORD -> "int"
; hMachine : INT_PTR optional -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	cfgmgr32 = windows.NewLazySystemDLL("CFGMGR32.dll")
	procCM_Detect_Resource_Conflict_Ex = cfgmgr32.NewProc("CM_Detect_Resource_Conflict_Ex")
)

// dnDevInst (DWORD), ResourceID (DWORD), ResourceData (void*), ResourceLen (DWORD), pbConflictDetected (BOOL* out), ulFlags (DWORD), hMachine (INT_PTR optional)
r1, _, err := procCM_Detect_Resource_Conflict_Ex.Call(
	uintptr(dnDevInst),
	uintptr(ResourceID),
	uintptr(ResourceData),
	uintptr(ResourceLen),
	uintptr(pbConflictDetected),
	uintptr(ulFlags),
	uintptr(hMachine),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // CONFIGRET
function CM_Detect_Resource_Conflict_Ex(
  dnDevInst: DWORD;   // DWORD
  ResourceID: DWORD;   // DWORD
  ResourceData: Pointer;   // void*
  ResourceLen: DWORD;   // DWORD
  pbConflictDetected: Pointer;   // BOOL* out
  ulFlags: DWORD;   // DWORD
  hMachine: NativeInt   // INT_PTR optional
): DWORD; stdcall;
  external 'CFGMGR32.dll' name 'CM_Detect_Resource_Conflict_Ex';
result := DllCall("CFGMGR32\CM_Detect_Resource_Conflict_Ex"
    , "UInt", dnDevInst   ; DWORD
    , "UInt", ResourceID   ; DWORD
    , "Ptr", ResourceData   ; void*
    , "UInt", ResourceLen   ; DWORD
    , "Ptr", pbConflictDetected   ; BOOL* out
    , "UInt", ulFlags   ; DWORD
    , "Ptr", hMachine   ; INT_PTR optional
    , "UInt")   ; return: CONFIGRET
●CM_Detect_Resource_Conflict_Ex(dnDevInst, ResourceID, ResourceData, ResourceLen, pbConflictDetected, ulFlags, hMachine) = DLL("CFGMGR32.dll", "dword CM_Detect_Resource_Conflict_Ex(dword, dword, void*, dword, void*, dword, int)")
# 呼び出し: CM_Detect_Resource_Conflict_Ex(dnDevInst, ResourceID, ResourceData, ResourceLen, pbConflictDetected, ulFlags, hMachine)
# dnDevInst : DWORD -> "dword"
# ResourceID : DWORD -> "dword"
# ResourceData : void* -> "void*"
# ResourceLen : DWORD -> "dword"
# pbConflictDetected : BOOL* out -> "void*"
# ulFlags : DWORD -> "dword"
# hMachine : INT_PTR optional -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。