ホーム › Devices.DeviceAndDriverInstallation › CM_Register_Device_Driver
CM_Register_Device_Driver
関数デバイスノードにデバイスドライバーを登録する。
シグネチャ
// CFGMGR32.dll
#include <windows.h>
CONFIGRET CM_Register_Device_Driver(
DWORD dnDevInst,
DWORD ulFlags
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| dnDevInst | DWORD | in |
| ulFlags | DWORD | in |
戻り値の型: CONFIGRET
各言語での呼び出し定義
// CFGMGR32.dll
#include <windows.h>
CONFIGRET CM_Register_Device_Driver(
DWORD dnDevInst,
DWORD ulFlags
);[DllImport("CFGMGR32.dll", ExactSpelling = true)]
static extern uint CM_Register_Device_Driver(
uint dnDevInst, // DWORD
uint ulFlags // DWORD
);<DllImport("CFGMGR32.dll", ExactSpelling:=True)>
Public Shared Function CM_Register_Device_Driver(
dnDevInst As UInteger, ' DWORD
ulFlags As UInteger ' DWORD
) As UInteger
End Function' dnDevInst : DWORD
' ulFlags : DWORD
Declare PtrSafe Function CM_Register_Device_Driver Lib "cfgmgr32" ( _
ByVal dnDevInst 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_Register_Device_Driver = ctypes.windll.cfgmgr32.CM_Register_Device_Driver
CM_Register_Device_Driver.restype = wintypes.DWORD
CM_Register_Device_Driver.argtypes = [
wintypes.DWORD, # dnDevInst : DWORD
wintypes.DWORD, # ulFlags : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('CFGMGR32.dll')
CM_Register_Device_Driver = Fiddle::Function.new(
lib['CM_Register_Device_Driver'],
[
-Fiddle::TYPE_INT, # dnDevInst : DWORD
-Fiddle::TYPE_INT, # ulFlags : DWORD
],
-Fiddle::TYPE_INT)#[link(name = "cfgmgr32")]
extern "system" {
fn CM_Register_Device_Driver(
dnDevInst: u32, // DWORD
ulFlags: u32 // DWORD
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("CFGMGR32.dll")]
public static extern uint CM_Register_Device_Driver(uint dnDevInst, uint ulFlags);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CFGMGR32_CM_Register_Device_Driver' -Namespace Win32 -PassThru
# $api::CM_Register_Device_Driver(dnDevInst, ulFlags)#uselib "CFGMGR32.dll"
#func global CM_Register_Device_Driver "CM_Register_Device_Driver" sptr, sptr
; CM_Register_Device_Driver dnDevInst, ulFlags ; 戻り値は stat
; dnDevInst : DWORD -> "sptr"
; ulFlags : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "CFGMGR32.dll"
#cfunc global CM_Register_Device_Driver "CM_Register_Device_Driver" int, int
; res = CM_Register_Device_Driver(dnDevInst, ulFlags)
; dnDevInst : DWORD -> "int"
; ulFlags : DWORD -> "int"; CONFIGRET CM_Register_Device_Driver(DWORD dnDevInst, DWORD ulFlags)
#uselib "CFGMGR32.dll"
#cfunc global CM_Register_Device_Driver "CM_Register_Device_Driver" int, int
; res = CM_Register_Device_Driver(dnDevInst, ulFlags)
; dnDevInst : DWORD -> "int"
; ulFlags : DWORD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
cfgmgr32 = windows.NewLazySystemDLL("CFGMGR32.dll")
procCM_Register_Device_Driver = cfgmgr32.NewProc("CM_Register_Device_Driver")
)
// dnDevInst (DWORD), ulFlags (DWORD)
r1, _, err := procCM_Register_Device_Driver.Call(
uintptr(dnDevInst),
uintptr(ulFlags),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // CONFIGRETfunction CM_Register_Device_Driver(
dnDevInst: DWORD; // DWORD
ulFlags: DWORD // DWORD
): DWORD; stdcall;
external 'CFGMGR32.dll' name 'CM_Register_Device_Driver';result := DllCall("CFGMGR32\CM_Register_Device_Driver"
, "UInt", dnDevInst ; DWORD
, "UInt", ulFlags ; DWORD
, "UInt") ; return: CONFIGRET●CM_Register_Device_Driver(dnDevInst, ulFlags) = DLL("CFGMGR32.dll", "dword CM_Register_Device_Driver(dword, dword)")
# 呼び出し: CM_Register_Device_Driver(dnDevInst, ulFlags)
# dnDevInst : DWORD -> "dword"
# ulFlags : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。