ホーム › System.Hypervisor › WHvMapVpciDeviceInterrupt
WHvMapVpciDeviceInterrupt
関数仮想PCIデバイスの割り込みをマップしMSI情報を取得する。
シグネチャ
// WinHvPlatform.dll
#include <windows.h>
HRESULT WHvMapVpciDeviceInterrupt(
WHV_PARTITION_HANDLE Partition,
ULONGLONG LogicalDeviceId,
DWORD Index,
DWORD MessageCount,
const WHV_VPCI_INTERRUPT_TARGET* Target,
ULONGLONG* MsiAddress,
DWORD* MsiData
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| Partition | WHV_PARTITION_HANDLE | in |
| LogicalDeviceId | ULONGLONG | in |
| Index | DWORD | in |
| MessageCount | DWORD | in |
| Target | WHV_VPCI_INTERRUPT_TARGET* | in |
| MsiAddress | ULONGLONG* | out |
| MsiData | DWORD* | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// WinHvPlatform.dll
#include <windows.h>
HRESULT WHvMapVpciDeviceInterrupt(
WHV_PARTITION_HANDLE Partition,
ULONGLONG LogicalDeviceId,
DWORD Index,
DWORD MessageCount,
const WHV_VPCI_INTERRUPT_TARGET* Target,
ULONGLONG* MsiAddress,
DWORD* MsiData
);[DllImport("WinHvPlatform.dll", ExactSpelling = true)]
static extern int WHvMapVpciDeviceInterrupt(
IntPtr Partition, // WHV_PARTITION_HANDLE
ulong LogicalDeviceId, // ULONGLONG
uint Index, // DWORD
uint MessageCount, // DWORD
IntPtr Target, // WHV_VPCI_INTERRUPT_TARGET*
out ulong MsiAddress, // ULONGLONG* out
out uint MsiData // DWORD* out
);<DllImport("WinHvPlatform.dll", ExactSpelling:=True)>
Public Shared Function WHvMapVpciDeviceInterrupt(
Partition As IntPtr, ' WHV_PARTITION_HANDLE
LogicalDeviceId As ULong, ' ULONGLONG
Index As UInteger, ' DWORD
MessageCount As UInteger, ' DWORD
Target As IntPtr, ' WHV_VPCI_INTERRUPT_TARGET*
<Out> ByRef MsiAddress As ULong, ' ULONGLONG* out
<Out> ByRef MsiData As UInteger ' DWORD* out
) As Integer
End Function' Partition : WHV_PARTITION_HANDLE
' LogicalDeviceId : ULONGLONG
' Index : DWORD
' MessageCount : DWORD
' Target : WHV_VPCI_INTERRUPT_TARGET*
' MsiAddress : ULONGLONG* out
' MsiData : DWORD* out
Declare PtrSafe Function WHvMapVpciDeviceInterrupt Lib "winhvplatform" ( _
ByVal Partition As LongPtr, _
ByVal LogicalDeviceId As LongLong, _
ByVal Index As Long, _
ByVal MessageCount As Long, _
ByVal Target As LongPtr, _
ByRef MsiAddress As LongLong, _
ByRef MsiData As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
WHvMapVpciDeviceInterrupt = ctypes.windll.winhvplatform.WHvMapVpciDeviceInterrupt
WHvMapVpciDeviceInterrupt.restype = ctypes.c_int
WHvMapVpciDeviceInterrupt.argtypes = [
ctypes.c_ssize_t, # Partition : WHV_PARTITION_HANDLE
ctypes.c_ulonglong, # LogicalDeviceId : ULONGLONG
wintypes.DWORD, # Index : DWORD
wintypes.DWORD, # MessageCount : DWORD
ctypes.c_void_p, # Target : WHV_VPCI_INTERRUPT_TARGET*
ctypes.POINTER(ctypes.c_ulonglong), # MsiAddress : ULONGLONG* out
ctypes.POINTER(wintypes.DWORD), # MsiData : DWORD* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('WinHvPlatform.dll')
WHvMapVpciDeviceInterrupt = Fiddle::Function.new(
lib['WHvMapVpciDeviceInterrupt'],
[
Fiddle::TYPE_INTPTR_T, # Partition : WHV_PARTITION_HANDLE
-Fiddle::TYPE_LONG_LONG, # LogicalDeviceId : ULONGLONG
-Fiddle::TYPE_INT, # Index : DWORD
-Fiddle::TYPE_INT, # MessageCount : DWORD
Fiddle::TYPE_VOIDP, # Target : WHV_VPCI_INTERRUPT_TARGET*
Fiddle::TYPE_VOIDP, # MsiAddress : ULONGLONG* out
Fiddle::TYPE_VOIDP, # MsiData : DWORD* out
],
Fiddle::TYPE_INT)#[link(name = "winhvplatform")]
extern "system" {
fn WHvMapVpciDeviceInterrupt(
Partition: isize, // WHV_PARTITION_HANDLE
LogicalDeviceId: u64, // ULONGLONG
Index: u32, // DWORD
MessageCount: u32, // DWORD
Target: *const WHV_VPCI_INTERRUPT_TARGET, // WHV_VPCI_INTERRUPT_TARGET*
MsiAddress: *mut u64, // ULONGLONG* out
MsiData: *mut u32 // DWORD* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("WinHvPlatform.dll")]
public static extern int WHvMapVpciDeviceInterrupt(IntPtr Partition, ulong LogicalDeviceId, uint Index, uint MessageCount, IntPtr Target, out ulong MsiAddress, out uint MsiData);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WinHvPlatform_WHvMapVpciDeviceInterrupt' -Namespace Win32 -PassThru
# $api::WHvMapVpciDeviceInterrupt(Partition, LogicalDeviceId, Index, MessageCount, Target, MsiAddress, MsiData)#uselib "WinHvPlatform.dll"
#func global WHvMapVpciDeviceInterrupt "WHvMapVpciDeviceInterrupt" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; WHvMapVpciDeviceInterrupt Partition, LogicalDeviceId, Index, MessageCount, varptr(Target), varptr(MsiAddress), varptr(MsiData) ; 戻り値は stat
; Partition : WHV_PARTITION_HANDLE -> "sptr"
; LogicalDeviceId : ULONGLONG -> "sptr"
; Index : DWORD -> "sptr"
; MessageCount : DWORD -> "sptr"
; Target : WHV_VPCI_INTERRUPT_TARGET* -> "sptr"
; MsiAddress : ULONGLONG* out -> "sptr"
; MsiData : DWORD* out -> "sptr"
; ※HSP3.7は int64 引数(64bit値渡し)に非対応です。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "WinHvPlatform.dll" #cfunc global WHvMapVpciDeviceInterrupt "WHvMapVpciDeviceInterrupt" sptr, int64, int, int, var, var, var ; res = WHvMapVpciDeviceInterrupt(Partition, LogicalDeviceId, Index, MessageCount, Target, MsiAddress, MsiData) ; Partition : WHV_PARTITION_HANDLE -> "sptr" ; LogicalDeviceId : ULONGLONG -> "int64" ; Index : DWORD -> "int" ; MessageCount : DWORD -> "int" ; Target : WHV_VPCI_INTERRUPT_TARGET* -> "var" ; MsiAddress : ULONGLONG* out -> "var" ; MsiData : DWORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。 ; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。#uselib "WinHvPlatform.dll" #cfunc global WHvMapVpciDeviceInterrupt "WHvMapVpciDeviceInterrupt" sptr, int64, int, int, sptr, sptr, sptr ; res = WHvMapVpciDeviceInterrupt(Partition, LogicalDeviceId, Index, MessageCount, varptr(Target), varptr(MsiAddress), varptr(MsiData)) ; Partition : WHV_PARTITION_HANDLE -> "sptr" ; LogicalDeviceId : ULONGLONG -> "int64" ; Index : DWORD -> "int" ; MessageCount : DWORD -> "int" ; Target : WHV_VPCI_INTERRUPT_TARGET* -> "sptr" ; MsiAddress : ULONGLONG* out -> "sptr" ; MsiData : DWORD* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。 ; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。
出力引数:
; HRESULT WHvMapVpciDeviceInterrupt(WHV_PARTITION_HANDLE Partition, ULONGLONG LogicalDeviceId, DWORD Index, DWORD MessageCount, WHV_VPCI_INTERRUPT_TARGET* Target, ULONGLONG* MsiAddress, DWORD* MsiData) #uselib "WinHvPlatform.dll" #cfunc global WHvMapVpciDeviceInterrupt "WHvMapVpciDeviceInterrupt" intptr, int64, int, int, var, var, var ; res = WHvMapVpciDeviceInterrupt(Partition, LogicalDeviceId, Index, MessageCount, Target, MsiAddress, MsiData) ; Partition : WHV_PARTITION_HANDLE -> "intptr" ; LogicalDeviceId : ULONGLONG -> "int64" ; Index : DWORD -> "int" ; MessageCount : DWORD -> "int" ; Target : WHV_VPCI_INTERRUPT_TARGET* -> "var" ; MsiAddress : ULONGLONG* out -> "var" ; MsiData : DWORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT WHvMapVpciDeviceInterrupt(WHV_PARTITION_HANDLE Partition, ULONGLONG LogicalDeviceId, DWORD Index, DWORD MessageCount, WHV_VPCI_INTERRUPT_TARGET* Target, ULONGLONG* MsiAddress, DWORD* MsiData) #uselib "WinHvPlatform.dll" #cfunc global WHvMapVpciDeviceInterrupt "WHvMapVpciDeviceInterrupt" intptr, int64, int, int, intptr, intptr, intptr ; res = WHvMapVpciDeviceInterrupt(Partition, LogicalDeviceId, Index, MessageCount, varptr(Target), varptr(MsiAddress), varptr(MsiData)) ; Partition : WHV_PARTITION_HANDLE -> "intptr" ; LogicalDeviceId : ULONGLONG -> "int64" ; Index : DWORD -> "int" ; MessageCount : DWORD -> "int" ; Target : WHV_VPCI_INTERRUPT_TARGET* -> "intptr" ; MsiAddress : ULONGLONG* out -> "intptr" ; MsiData : DWORD* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
winhvplatform = windows.NewLazySystemDLL("WinHvPlatform.dll")
procWHvMapVpciDeviceInterrupt = winhvplatform.NewProc("WHvMapVpciDeviceInterrupt")
)
// Partition (WHV_PARTITION_HANDLE), LogicalDeviceId (ULONGLONG), Index (DWORD), MessageCount (DWORD), Target (WHV_VPCI_INTERRUPT_TARGET*), MsiAddress (ULONGLONG* out), MsiData (DWORD* out)
r1, _, err := procWHvMapVpciDeviceInterrupt.Call(
uintptr(Partition),
uintptr(LogicalDeviceId),
uintptr(Index),
uintptr(MessageCount),
uintptr(Target),
uintptr(MsiAddress),
uintptr(MsiData),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction WHvMapVpciDeviceInterrupt(
Partition: NativeInt; // WHV_PARTITION_HANDLE
LogicalDeviceId: UInt64; // ULONGLONG
Index: DWORD; // DWORD
MessageCount: DWORD; // DWORD
Target: Pointer; // WHV_VPCI_INTERRUPT_TARGET*
MsiAddress: Pointer; // ULONGLONG* out
MsiData: Pointer // DWORD* out
): Integer; stdcall;
external 'WinHvPlatform.dll' name 'WHvMapVpciDeviceInterrupt';result := DllCall("WinHvPlatform\WHvMapVpciDeviceInterrupt"
, "Ptr", Partition ; WHV_PARTITION_HANDLE
, "Int64", LogicalDeviceId ; ULONGLONG
, "UInt", Index ; DWORD
, "UInt", MessageCount ; DWORD
, "Ptr", Target ; WHV_VPCI_INTERRUPT_TARGET*
, "Ptr", MsiAddress ; ULONGLONG* out
, "Ptr", MsiData ; DWORD* out
, "Int") ; return: HRESULT●WHvMapVpciDeviceInterrupt(Partition, LogicalDeviceId, Index, MessageCount, Target, MsiAddress, MsiData) = DLL("WinHvPlatform.dll", "int WHvMapVpciDeviceInterrupt(int, qword, dword, dword, void*, void*, void*)")
# 呼び出し: WHvMapVpciDeviceInterrupt(Partition, LogicalDeviceId, Index, MessageCount, Target, MsiAddress, MsiData)
# Partition : WHV_PARTITION_HANDLE -> "int"
# LogicalDeviceId : ULONGLONG -> "qword"
# Index : DWORD -> "dword"
# MessageCount : DWORD -> "dword"
# Target : WHV_VPCI_INTERRUPT_TARGET* -> "void*"
# MsiAddress : ULONGLONG* out -> "void*"
# MsiData : DWORD* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。