ホーム › Devices.DeviceAndDriverInstallation › CM_Get_Version_Ex
CM_Get_Version_Ex
関数リモートマシンの構成マネージャーのバージョンを取得する。
シグネチャ
// CFGMGR32.dll
#include <windows.h>
WORD CM_Get_Version_Ex(
INT_PTR hMachine // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hMachine | INT_PTR | inoptional |
戻り値の型: WORD
各言語での呼び出し定義
// CFGMGR32.dll
#include <windows.h>
WORD CM_Get_Version_Ex(
INT_PTR hMachine // optional
);[DllImport("CFGMGR32.dll", SetLastError = true, ExactSpelling = true)]
static extern ushort CM_Get_Version_Ex(
IntPtr hMachine // INT_PTR optional
);<DllImport("CFGMGR32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function CM_Get_Version_Ex(
hMachine As IntPtr ' INT_PTR optional
) As UShort
End Function' hMachine : INT_PTR optional
Declare PtrSafe Function CM_Get_Version_Ex Lib "cfgmgr32" ( _
ByVal hMachine As LongPtr) As Integer
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
CM_Get_Version_Ex = ctypes.windll.cfgmgr32.CM_Get_Version_Ex
CM_Get_Version_Ex.restype = ctypes.c_ushort
CM_Get_Version_Ex.argtypes = [
ctypes.c_ssize_t, # hMachine : INT_PTR optional
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('CFGMGR32.dll')
CM_Get_Version_Ex = Fiddle::Function.new(
lib['CM_Get_Version_Ex'],
[
Fiddle::TYPE_INTPTR_T, # hMachine : INT_PTR optional
],
-Fiddle::TYPE_SHORT)#[link(name = "cfgmgr32")]
extern "system" {
fn CM_Get_Version_Ex(
hMachine: isize // INT_PTR optional
) -> u16;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("CFGMGR32.dll", SetLastError = true)]
public static extern ushort CM_Get_Version_Ex(IntPtr hMachine);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CFGMGR32_CM_Get_Version_Ex' -Namespace Win32 -PassThru
# $api::CM_Get_Version_Ex(hMachine)#uselib "CFGMGR32.dll"
#func global CM_Get_Version_Ex "CM_Get_Version_Ex" sptr
; CM_Get_Version_Ex hMachine ; 戻り値は stat
; hMachine : INT_PTR optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "CFGMGR32.dll"
#cfunc global CM_Get_Version_Ex "CM_Get_Version_Ex" sptr
; res = CM_Get_Version_Ex(hMachine)
; hMachine : INT_PTR optional -> "sptr"; WORD CM_Get_Version_Ex(INT_PTR hMachine)
#uselib "CFGMGR32.dll"
#cfunc global CM_Get_Version_Ex "CM_Get_Version_Ex" intptr
; res = CM_Get_Version_Ex(hMachine)
; hMachine : INT_PTR optional -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
cfgmgr32 = windows.NewLazySystemDLL("CFGMGR32.dll")
procCM_Get_Version_Ex = cfgmgr32.NewProc("CM_Get_Version_Ex")
)
// hMachine (INT_PTR optional)
r1, _, err := procCM_Get_Version_Ex.Call(
uintptr(hMachine),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // WORDfunction CM_Get_Version_Ex(
hMachine: NativeInt // INT_PTR optional
): Word; stdcall;
external 'CFGMGR32.dll' name 'CM_Get_Version_Ex';result := DllCall("CFGMGR32\CM_Get_Version_Ex"
, "Ptr", hMachine ; INT_PTR optional
, "UShort") ; return: WORD●CM_Get_Version_Ex(hMachine) = DLL("CFGMGR32.dll", "int CM_Get_Version_Ex(int)")
# 呼び出し: CM_Get_Version_Ex(hMachine)
# hMachine : INT_PTR optional -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。