ホーム › System.Hypervisor › WHvEmulatorCreateEmulator
WHvEmulatorCreateEmulator
関数命令エミュレータのインスタンスを作成する。
シグネチャ
// WinHvEmulation.dll
#include <windows.h>
HRESULT WHvEmulatorCreateEmulator(
const WHV_EMULATOR_CALLBACKS* Callbacks,
void** Emulator
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| Callbacks | WHV_EMULATOR_CALLBACKS* | in |
| Emulator | void** | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// WinHvEmulation.dll
#include <windows.h>
HRESULT WHvEmulatorCreateEmulator(
const WHV_EMULATOR_CALLBACKS* Callbacks,
void** Emulator
);[DllImport("WinHvEmulation.dll", ExactSpelling = true)]
static extern int WHvEmulatorCreateEmulator(
IntPtr Callbacks, // WHV_EMULATOR_CALLBACKS*
IntPtr Emulator // void** out
);<DllImport("WinHvEmulation.dll", ExactSpelling:=True)>
Public Shared Function WHvEmulatorCreateEmulator(
Callbacks As IntPtr, ' WHV_EMULATOR_CALLBACKS*
Emulator As IntPtr ' void** out
) As Integer
End Function' Callbacks : WHV_EMULATOR_CALLBACKS*
' Emulator : void** out
Declare PtrSafe Function WHvEmulatorCreateEmulator Lib "winhvemulation" ( _
ByVal Callbacks As LongPtr, _
ByVal Emulator As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
WHvEmulatorCreateEmulator = ctypes.windll.winhvemulation.WHvEmulatorCreateEmulator
WHvEmulatorCreateEmulator.restype = ctypes.c_int
WHvEmulatorCreateEmulator.argtypes = [
ctypes.c_void_p, # Callbacks : WHV_EMULATOR_CALLBACKS*
ctypes.c_void_p, # Emulator : void** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('WinHvEmulation.dll')
WHvEmulatorCreateEmulator = Fiddle::Function.new(
lib['WHvEmulatorCreateEmulator'],
[
Fiddle::TYPE_VOIDP, # Callbacks : WHV_EMULATOR_CALLBACKS*
Fiddle::TYPE_VOIDP, # Emulator : void** out
],
Fiddle::TYPE_INT)#[link(name = "winhvemulation")]
extern "system" {
fn WHvEmulatorCreateEmulator(
Callbacks: *const WHV_EMULATOR_CALLBACKS, // WHV_EMULATOR_CALLBACKS*
Emulator: *mut *mut () // void** out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("WinHvEmulation.dll")]
public static extern int WHvEmulatorCreateEmulator(IntPtr Callbacks, IntPtr Emulator);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WinHvEmulation_WHvEmulatorCreateEmulator' -Namespace Win32 -PassThru
# $api::WHvEmulatorCreateEmulator(Callbacks, Emulator)#uselib "WinHvEmulation.dll"
#func global WHvEmulatorCreateEmulator "WHvEmulatorCreateEmulator" sptr, sptr
; WHvEmulatorCreateEmulator varptr(Callbacks), Emulator ; 戻り値は stat
; Callbacks : WHV_EMULATOR_CALLBACKS* -> "sptr"
; Emulator : void** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "WinHvEmulation.dll" #cfunc global WHvEmulatorCreateEmulator "WHvEmulatorCreateEmulator" var, sptr ; res = WHvEmulatorCreateEmulator(Callbacks, Emulator) ; Callbacks : WHV_EMULATOR_CALLBACKS* -> "var" ; Emulator : void** out -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "WinHvEmulation.dll" #cfunc global WHvEmulatorCreateEmulator "WHvEmulatorCreateEmulator" sptr, sptr ; res = WHvEmulatorCreateEmulator(varptr(Callbacks), Emulator) ; Callbacks : WHV_EMULATOR_CALLBACKS* -> "sptr" ; Emulator : void** out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT WHvEmulatorCreateEmulator(WHV_EMULATOR_CALLBACKS* Callbacks, void** Emulator) #uselib "WinHvEmulation.dll" #cfunc global WHvEmulatorCreateEmulator "WHvEmulatorCreateEmulator" var, intptr ; res = WHvEmulatorCreateEmulator(Callbacks, Emulator) ; Callbacks : WHV_EMULATOR_CALLBACKS* -> "var" ; Emulator : void** out -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT WHvEmulatorCreateEmulator(WHV_EMULATOR_CALLBACKS* Callbacks, void** Emulator) #uselib "WinHvEmulation.dll" #cfunc global WHvEmulatorCreateEmulator "WHvEmulatorCreateEmulator" intptr, intptr ; res = WHvEmulatorCreateEmulator(varptr(Callbacks), Emulator) ; Callbacks : WHV_EMULATOR_CALLBACKS* -> "intptr" ; Emulator : void** out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
winhvemulation = windows.NewLazySystemDLL("WinHvEmulation.dll")
procWHvEmulatorCreateEmulator = winhvemulation.NewProc("WHvEmulatorCreateEmulator")
)
// Callbacks (WHV_EMULATOR_CALLBACKS*), Emulator (void** out)
r1, _, err := procWHvEmulatorCreateEmulator.Call(
uintptr(Callbacks),
uintptr(Emulator),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction WHvEmulatorCreateEmulator(
Callbacks: Pointer; // WHV_EMULATOR_CALLBACKS*
Emulator: Pointer // void** out
): Integer; stdcall;
external 'WinHvEmulation.dll' name 'WHvEmulatorCreateEmulator';result := DllCall("WinHvEmulation\WHvEmulatorCreateEmulator"
, "Ptr", Callbacks ; WHV_EMULATOR_CALLBACKS*
, "Ptr", Emulator ; void** out
, "Int") ; return: HRESULT●WHvEmulatorCreateEmulator(Callbacks, Emulator) = DLL("WinHvEmulation.dll", "int WHvEmulatorCreateEmulator(void*, void*)")
# 呼び出し: WHvEmulatorCreateEmulator(Callbacks, Emulator)
# Callbacks : WHV_EMULATOR_CALLBACKS* -> "void*"
# Emulator : void** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。