ホーム › System.Hypervisor › HdvDeliverGuestInterrupt
HdvDeliverGuestInterrupt
関数ゲストにMSI割り込みを配信する。
シグネチャ
// vmdevicehost.dll
#include <windows.h>
HRESULT HdvDeliverGuestInterrupt(
void* requestor,
ULONGLONG msiAddress,
DWORD msiData
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| requestor | void* | in | 操作を要求するデバイス等を表すリクエスタコンテキストへのポインタ。 |
| msiAddress | ULONGLONG | in | ゲストへ配信する割り込みのMSIアドレスを指定する。 |
| msiData | DWORD | in | ゲストへ配信する割り込みのMSIデータ値を指定する。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// vmdevicehost.dll
#include <windows.h>
HRESULT HdvDeliverGuestInterrupt(
void* requestor,
ULONGLONG msiAddress,
DWORD msiData
);[DllImport("vmdevicehost.dll", ExactSpelling = true)]
static extern int HdvDeliverGuestInterrupt(
IntPtr requestor, // void*
ulong msiAddress, // ULONGLONG
uint msiData // DWORD
);<DllImport("vmdevicehost.dll", ExactSpelling:=True)>
Public Shared Function HdvDeliverGuestInterrupt(
requestor As IntPtr, ' void*
msiAddress As ULong, ' ULONGLONG
msiData As UInteger ' DWORD
) As Integer
End Function' requestor : void*
' msiAddress : ULONGLONG
' msiData : DWORD
Declare PtrSafe Function HdvDeliverGuestInterrupt Lib "vmdevicehost" ( _
ByVal requestor As LongPtr, _
ByVal msiAddress As LongLong, _
ByVal msiData As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
HdvDeliverGuestInterrupt = ctypes.windll.vmdevicehost.HdvDeliverGuestInterrupt
HdvDeliverGuestInterrupt.restype = ctypes.c_int
HdvDeliverGuestInterrupt.argtypes = [
ctypes.POINTER(None), # requestor : void*
ctypes.c_ulonglong, # msiAddress : ULONGLONG
wintypes.DWORD, # msiData : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('vmdevicehost.dll')
HdvDeliverGuestInterrupt = Fiddle::Function.new(
lib['HdvDeliverGuestInterrupt'],
[
Fiddle::TYPE_VOIDP, # requestor : void*
-Fiddle::TYPE_LONG_LONG, # msiAddress : ULONGLONG
-Fiddle::TYPE_INT, # msiData : DWORD
],
Fiddle::TYPE_INT)#[link(name = "vmdevicehost")]
extern "system" {
fn HdvDeliverGuestInterrupt(
requestor: *mut (), // void*
msiAddress: u64, // ULONGLONG
msiData: u32 // DWORD
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("vmdevicehost.dll")]
public static extern int HdvDeliverGuestInterrupt(IntPtr requestor, ulong msiAddress, uint msiData);
"@
$api = Add-Type -MemberDefinition $sig -Name 'vmdevicehost_HdvDeliverGuestInterrupt' -Namespace Win32 -PassThru
# $api::HdvDeliverGuestInterrupt(requestor, msiAddress, msiData)#uselib "vmdevicehost.dll"
#func global HdvDeliverGuestInterrupt "HdvDeliverGuestInterrupt" sptr, sptr, sptr
; HdvDeliverGuestInterrupt requestor, msiAddress, msiData ; 戻り値は stat
; requestor : void* -> "sptr"
; msiAddress : ULONGLONG -> "sptr"
; msiData : DWORD -> "sptr"
; ※HSP3.7は int64 引数(64bit値渡し)に非対応です。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "vmdevicehost.dll"
#cfunc global HdvDeliverGuestInterrupt "HdvDeliverGuestInterrupt" sptr, int64, int
; res = HdvDeliverGuestInterrupt(requestor, msiAddress, msiData)
; requestor : void* -> "sptr"
; msiAddress : ULONGLONG -> "int64"
; msiData : DWORD -> "int"
; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。; HRESULT HdvDeliverGuestInterrupt(void* requestor, ULONGLONG msiAddress, DWORD msiData)
#uselib "vmdevicehost.dll"
#cfunc global HdvDeliverGuestInterrupt "HdvDeliverGuestInterrupt" intptr, int64, int
; res = HdvDeliverGuestInterrupt(requestor, msiAddress, msiData)
; requestor : void* -> "intptr"
; msiAddress : ULONGLONG -> "int64"
; msiData : DWORD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
vmdevicehost = windows.NewLazySystemDLL("vmdevicehost.dll")
procHdvDeliverGuestInterrupt = vmdevicehost.NewProc("HdvDeliverGuestInterrupt")
)
// requestor (void*), msiAddress (ULONGLONG), msiData (DWORD)
r1, _, err := procHdvDeliverGuestInterrupt.Call(
uintptr(requestor),
uintptr(msiAddress),
uintptr(msiData),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction HdvDeliverGuestInterrupt(
requestor: Pointer; // void*
msiAddress: UInt64; // ULONGLONG
msiData: DWORD // DWORD
): Integer; stdcall;
external 'vmdevicehost.dll' name 'HdvDeliverGuestInterrupt';result := DllCall("vmdevicehost\HdvDeliverGuestInterrupt"
, "Ptr", requestor ; void*
, "Int64", msiAddress ; ULONGLONG
, "UInt", msiData ; DWORD
, "Int") ; return: HRESULT●HdvDeliverGuestInterrupt(requestor, msiAddress, msiData) = DLL("vmdevicehost.dll", "int HdvDeliverGuestInterrupt(void*, qword, dword)")
# 呼び出し: HdvDeliverGuestInterrupt(requestor, msiAddress, msiData)
# requestor : void* -> "void*"
# msiAddress : ULONGLONG -> "qword"
# msiData : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "vmdevicehost" fn HdvDeliverGuestInterrupt(
requestor: ?*anyopaque, // void*
msiAddress: u64, // ULONGLONG
msiData: u32 // DWORD
) callconv(std.os.windows.WINAPI) i32;proc HdvDeliverGuestInterrupt(
requestor: pointer, # void*
msiAddress: uint64, # ULONGLONG
msiData: uint32 # DWORD
): int32 {.importc: "HdvDeliverGuestInterrupt", stdcall, dynlib: "vmdevicehost.dll".}pragma(lib, "vmdevicehost");
extern(Windows)
int HdvDeliverGuestInterrupt(
void* requestor, // void*
ulong msiAddress, // ULONGLONG
uint msiData // DWORD
);ccall((:HdvDeliverGuestInterrupt, "vmdevicehost.dll"), stdcall, Int32,
(Ptr{Cvoid}, UInt64, UInt32),
requestor, msiAddress, msiData)
# requestor : void* -> Ptr{Cvoid}
# msiAddress : ULONGLONG -> UInt64
# msiData : DWORD -> UInt32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t HdvDeliverGuestInterrupt(
void* requestor,
uint64_t msiAddress,
uint32_t msiData);
]]
local vmdevicehost = ffi.load("vmdevicehost")
-- vmdevicehost.HdvDeliverGuestInterrupt(requestor, msiAddress, msiData)
-- requestor : void*
-- msiAddress : ULONGLONG
-- msiData : DWORD
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('vmdevicehost.dll');
const HdvDeliverGuestInterrupt = lib.func('__stdcall', 'HdvDeliverGuestInterrupt', 'int32_t', ['void *', 'uint64_t', 'uint32_t']);
// HdvDeliverGuestInterrupt(requestor, msiAddress, msiData)
// requestor : void* -> 'void *'
// msiAddress : ULONGLONG -> 'uint64_t'
// msiData : DWORD -> 'uint32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("vmdevicehost.dll", {
HdvDeliverGuestInterrupt: { parameters: ["pointer", "u64", "u32"], result: "i32" },
});
// lib.symbols.HdvDeliverGuestInterrupt(requestor, msiAddress, msiData)
// requestor : void* -> "pointer"
// msiAddress : ULONGLONG -> "u64"
// msiData : DWORD -> "u32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t HdvDeliverGuestInterrupt(
void* requestor,
uint64_t msiAddress,
uint32_t msiData);
C, "vmdevicehost.dll");
// $ffi->HdvDeliverGuestInterrupt(requestor, msiAddress, msiData);
// requestor : void*
// msiAddress : ULONGLONG
// msiData : DWORD
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Vmdevicehost extends StdCallLibrary {
Vmdevicehost INSTANCE = Native.load("vmdevicehost", Vmdevicehost.class);
int HdvDeliverGuestInterrupt(
Pointer requestor, // void*
long msiAddress, // ULONGLONG
int msiData // DWORD
);
}@[Link("vmdevicehost")]
lib Libvmdevicehost
fun HdvDeliverGuestInterrupt = HdvDeliverGuestInterrupt(
requestor : Void*, # void*
msiAddress : UInt64, # ULONGLONG
msiData : UInt32 # DWORD
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef HdvDeliverGuestInterruptNative = Int32 Function(Pointer<Void>, Uint64, Uint32);
typedef HdvDeliverGuestInterruptDart = int Function(Pointer<Void>, int, int);
final HdvDeliverGuestInterrupt = DynamicLibrary.open('vmdevicehost.dll')
.lookupFunction<HdvDeliverGuestInterruptNative, HdvDeliverGuestInterruptDart>('HdvDeliverGuestInterrupt');
// requestor : void* -> Pointer<Void>
// msiAddress : ULONGLONG -> Uint64
// msiData : DWORD -> Uint32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function HdvDeliverGuestInterrupt(
requestor: Pointer; // void*
msiAddress: UInt64; // ULONGLONG
msiData: DWORD // DWORD
): Integer; stdcall;
external 'vmdevicehost.dll' name 'HdvDeliverGuestInterrupt';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "HdvDeliverGuestInterrupt"
c_HdvDeliverGuestInterrupt :: Ptr () -> Word64 -> Word32 -> IO Int32
-- requestor : void* -> Ptr ()
-- msiAddress : ULONGLONG -> Word64
-- msiData : DWORD -> Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let hdvdeliverguestinterrupt =
foreign "HdvDeliverGuestInterrupt"
((ptr void) @-> uint64_t @-> uint32_t @-> returning int32_t)
(* requestor : void* -> (ptr void) *)
(* msiAddress : ULONGLONG -> uint64_t *)
(* msiData : DWORD -> uint32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library vmdevicehost (t "vmdevicehost.dll"))
(cffi:use-foreign-library vmdevicehost)
(cffi:defcfun ("HdvDeliverGuestInterrupt" hdv-deliver-guest-interrupt :convention :stdcall) :int32
(requestor :pointer) ; void*
(msi-address :uint64) ; ULONGLONG
(msi-data :uint32)) ; DWORD
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $HdvDeliverGuestInterrupt = Win32::API::More->new('vmdevicehost',
'int HdvDeliverGuestInterrupt(LPVOID requestor, UINT64 msiAddress, DWORD msiData)');
# my $ret = $HdvDeliverGuestInterrupt->Call($requestor, $msiAddress, $msiData);
# requestor : void* -> LPVOID
# msiAddress : ULONGLONG -> UINT64
# msiData : DWORD -> DWORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。