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