ホーム › System.Hypervisor › HdvInitializeDeviceHostEx
HdvInitializeDeviceHostEx
関数フラグ指定でデバイスホストを初期化する拡張版である。
シグネチャ
// vmdevicehost.dll
#include <windows.h>
HRESULT HdvInitializeDeviceHostEx(
HCS_SYSTEM computeSystem,
HDV_DEVICE_HOST_FLAGS flags,
void** deviceHostHandle
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| computeSystem | HCS_SYSTEM | in |
| flags | HDV_DEVICE_HOST_FLAGS | in |
| deviceHostHandle | void** | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// vmdevicehost.dll
#include <windows.h>
HRESULT HdvInitializeDeviceHostEx(
HCS_SYSTEM computeSystem,
HDV_DEVICE_HOST_FLAGS flags,
void** deviceHostHandle
);[DllImport("vmdevicehost.dll", ExactSpelling = true)]
static extern int HdvInitializeDeviceHostEx(
IntPtr computeSystem, // HCS_SYSTEM
int flags, // HDV_DEVICE_HOST_FLAGS
IntPtr deviceHostHandle // void** out
);<DllImport("vmdevicehost.dll", ExactSpelling:=True)>
Public Shared Function HdvInitializeDeviceHostEx(
computeSystem As IntPtr, ' HCS_SYSTEM
flags As Integer, ' HDV_DEVICE_HOST_FLAGS
deviceHostHandle As IntPtr ' void** out
) As Integer
End Function' computeSystem : HCS_SYSTEM
' flags : HDV_DEVICE_HOST_FLAGS
' deviceHostHandle : void** out
Declare PtrSafe Function HdvInitializeDeviceHostEx Lib "vmdevicehost" ( _
ByVal computeSystem As LongPtr, _
ByVal flags As Long, _
ByVal deviceHostHandle As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
HdvInitializeDeviceHostEx = ctypes.windll.vmdevicehost.HdvInitializeDeviceHostEx
HdvInitializeDeviceHostEx.restype = ctypes.c_int
HdvInitializeDeviceHostEx.argtypes = [
wintypes.HANDLE, # computeSystem : HCS_SYSTEM
ctypes.c_int, # flags : HDV_DEVICE_HOST_FLAGS
ctypes.c_void_p, # deviceHostHandle : void** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('vmdevicehost.dll')
HdvInitializeDeviceHostEx = Fiddle::Function.new(
lib['HdvInitializeDeviceHostEx'],
[
Fiddle::TYPE_VOIDP, # computeSystem : HCS_SYSTEM
Fiddle::TYPE_INT, # flags : HDV_DEVICE_HOST_FLAGS
Fiddle::TYPE_VOIDP, # deviceHostHandle : void** out
],
Fiddle::TYPE_INT)#[link(name = "vmdevicehost")]
extern "system" {
fn HdvInitializeDeviceHostEx(
computeSystem: *mut core::ffi::c_void, // HCS_SYSTEM
flags: i32, // HDV_DEVICE_HOST_FLAGS
deviceHostHandle: *mut *mut () // void** out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("vmdevicehost.dll")]
public static extern int HdvInitializeDeviceHostEx(IntPtr computeSystem, int flags, IntPtr deviceHostHandle);
"@
$api = Add-Type -MemberDefinition $sig -Name 'vmdevicehost_HdvInitializeDeviceHostEx' -Namespace Win32 -PassThru
# $api::HdvInitializeDeviceHostEx(computeSystem, flags, deviceHostHandle)#uselib "vmdevicehost.dll"
#func global HdvInitializeDeviceHostEx "HdvInitializeDeviceHostEx" sptr, sptr, sptr
; HdvInitializeDeviceHostEx computeSystem, flags, deviceHostHandle ; 戻り値は stat
; computeSystem : HCS_SYSTEM -> "sptr"
; flags : HDV_DEVICE_HOST_FLAGS -> "sptr"
; deviceHostHandle : void** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "vmdevicehost.dll"
#cfunc global HdvInitializeDeviceHostEx "HdvInitializeDeviceHostEx" sptr, int, sptr
; res = HdvInitializeDeviceHostEx(computeSystem, flags, deviceHostHandle)
; computeSystem : HCS_SYSTEM -> "sptr"
; flags : HDV_DEVICE_HOST_FLAGS -> "int"
; deviceHostHandle : void** out -> "sptr"; HRESULT HdvInitializeDeviceHostEx(HCS_SYSTEM computeSystem, HDV_DEVICE_HOST_FLAGS flags, void** deviceHostHandle)
#uselib "vmdevicehost.dll"
#cfunc global HdvInitializeDeviceHostEx "HdvInitializeDeviceHostEx" intptr, int, intptr
; res = HdvInitializeDeviceHostEx(computeSystem, flags, deviceHostHandle)
; computeSystem : HCS_SYSTEM -> "intptr"
; flags : HDV_DEVICE_HOST_FLAGS -> "int"
; deviceHostHandle : void** out -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
vmdevicehost = windows.NewLazySystemDLL("vmdevicehost.dll")
procHdvInitializeDeviceHostEx = vmdevicehost.NewProc("HdvInitializeDeviceHostEx")
)
// computeSystem (HCS_SYSTEM), flags (HDV_DEVICE_HOST_FLAGS), deviceHostHandle (void** out)
r1, _, err := procHdvInitializeDeviceHostEx.Call(
uintptr(computeSystem),
uintptr(flags),
uintptr(deviceHostHandle),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction HdvInitializeDeviceHostEx(
computeSystem: THandle; // HCS_SYSTEM
flags: Integer; // HDV_DEVICE_HOST_FLAGS
deviceHostHandle: Pointer // void** out
): Integer; stdcall;
external 'vmdevicehost.dll' name 'HdvInitializeDeviceHostEx';result := DllCall("vmdevicehost\HdvInitializeDeviceHostEx"
, "Ptr", computeSystem ; HCS_SYSTEM
, "Int", flags ; HDV_DEVICE_HOST_FLAGS
, "Ptr", deviceHostHandle ; void** out
, "Int") ; return: HRESULT●HdvInitializeDeviceHostEx(computeSystem, flags, deviceHostHandle) = DLL("vmdevicehost.dll", "int HdvInitializeDeviceHostEx(void*, int, void*)")
# 呼び出し: HdvInitializeDeviceHostEx(computeSystem, flags, deviceHostHandle)
# computeSystem : HCS_SYSTEM -> "void*"
# flags : HDV_DEVICE_HOST_FLAGS -> "int"
# deviceHostHandle : void** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。