Win32 API 日本語リファレンス
ホームSystem.Hypervisor › WHvUnmapVpciDeviceInterrupt

WHvUnmapVpciDeviceInterrupt

関数
仮想PCIデバイスの割り込みのマップを解除する。
DLLWinHvPlatform.dll呼出規約winapi

シグネチャ

// WinHvPlatform.dll
#include <windows.h>

HRESULT WHvUnmapVpciDeviceInterrupt(
    WHV_PARTITION_HANDLE Partition,
    ULONGLONG LogicalDeviceId,
    DWORD Index
);

パラメーター

名前方向
PartitionWHV_PARTITION_HANDLEin
LogicalDeviceIdULONGLONGin
IndexDWORDin

戻り値の型: HRESULT

各言語での呼び出し定義

// WinHvPlatform.dll
#include <windows.h>

HRESULT WHvUnmapVpciDeviceInterrupt(
    WHV_PARTITION_HANDLE Partition,
    ULONGLONG LogicalDeviceId,
    DWORD Index
);
[DllImport("WinHvPlatform.dll", ExactSpelling = true)]
static extern int WHvUnmapVpciDeviceInterrupt(
    IntPtr Partition,   // WHV_PARTITION_HANDLE
    ulong LogicalDeviceId,   // ULONGLONG
    uint Index   // DWORD
);
<DllImport("WinHvPlatform.dll", ExactSpelling:=True)>
Public Shared Function WHvUnmapVpciDeviceInterrupt(
    Partition As IntPtr,   ' WHV_PARTITION_HANDLE
    LogicalDeviceId As ULong,   ' ULONGLONG
    Index As UInteger   ' DWORD
) As Integer
End Function
' Partition : WHV_PARTITION_HANDLE
' LogicalDeviceId : ULONGLONG
' Index : DWORD
Declare PtrSafe Function WHvUnmapVpciDeviceInterrupt Lib "winhvplatform" ( _
    ByVal Partition As LongPtr, _
    ByVal LogicalDeviceId As LongLong, _
    ByVal Index As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WHvUnmapVpciDeviceInterrupt = ctypes.windll.winhvplatform.WHvUnmapVpciDeviceInterrupt
WHvUnmapVpciDeviceInterrupt.restype = ctypes.c_int
WHvUnmapVpciDeviceInterrupt.argtypes = [
    ctypes.c_ssize_t,  # Partition : WHV_PARTITION_HANDLE
    ctypes.c_ulonglong,  # LogicalDeviceId : ULONGLONG
    wintypes.DWORD,  # Index : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('WinHvPlatform.dll')
WHvUnmapVpciDeviceInterrupt = Fiddle::Function.new(
  lib['WHvUnmapVpciDeviceInterrupt'],
  [
    Fiddle::TYPE_INTPTR_T,  # Partition : WHV_PARTITION_HANDLE
    -Fiddle::TYPE_LONG_LONG,  # LogicalDeviceId : ULONGLONG
    -Fiddle::TYPE_INT,  # Index : DWORD
  ],
  Fiddle::TYPE_INT)
#[link(name = "winhvplatform")]
extern "system" {
    fn WHvUnmapVpciDeviceInterrupt(
        Partition: isize,  // WHV_PARTITION_HANDLE
        LogicalDeviceId: u64,  // ULONGLONG
        Index: u32  // DWORD
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("WinHvPlatform.dll")]
public static extern int WHvUnmapVpciDeviceInterrupt(IntPtr Partition, ulong LogicalDeviceId, uint Index);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WinHvPlatform_WHvUnmapVpciDeviceInterrupt' -Namespace Win32 -PassThru
# $api::WHvUnmapVpciDeviceInterrupt(Partition, LogicalDeviceId, Index)
#uselib "WinHvPlatform.dll"
#func global WHvUnmapVpciDeviceInterrupt "WHvUnmapVpciDeviceInterrupt" sptr, sptr, sptr
; WHvUnmapVpciDeviceInterrupt Partition, LogicalDeviceId, Index   ; 戻り値は stat
; Partition : WHV_PARTITION_HANDLE -> "sptr"
; LogicalDeviceId : ULONGLONG -> "sptr"
; Index : DWORD -> "sptr"
; ※HSP3.7は int64 引数(64bit値渡し)に非対応です。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "WinHvPlatform.dll"
#cfunc global WHvUnmapVpciDeviceInterrupt "WHvUnmapVpciDeviceInterrupt" sptr, int64, int
; res = WHvUnmapVpciDeviceInterrupt(Partition, LogicalDeviceId, Index)
; Partition : WHV_PARTITION_HANDLE -> "sptr"
; LogicalDeviceId : ULONGLONG -> "int64"
; Index : DWORD -> "int"
; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。
; HRESULT WHvUnmapVpciDeviceInterrupt(WHV_PARTITION_HANDLE Partition, ULONGLONG LogicalDeviceId, DWORD Index)
#uselib "WinHvPlatform.dll"
#cfunc global WHvUnmapVpciDeviceInterrupt "WHvUnmapVpciDeviceInterrupt" intptr, int64, int
; res = WHvUnmapVpciDeviceInterrupt(Partition, LogicalDeviceId, Index)
; Partition : WHV_PARTITION_HANDLE -> "intptr"
; LogicalDeviceId : ULONGLONG -> "int64"
; Index : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	winhvplatform = windows.NewLazySystemDLL("WinHvPlatform.dll")
	procWHvUnmapVpciDeviceInterrupt = winhvplatform.NewProc("WHvUnmapVpciDeviceInterrupt")
)

// Partition (WHV_PARTITION_HANDLE), LogicalDeviceId (ULONGLONG), Index (DWORD)
r1, _, err := procWHvUnmapVpciDeviceInterrupt.Call(
	uintptr(Partition),
	uintptr(LogicalDeviceId),
	uintptr(Index),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function WHvUnmapVpciDeviceInterrupt(
  Partition: NativeInt;   // WHV_PARTITION_HANDLE
  LogicalDeviceId: UInt64;   // ULONGLONG
  Index: DWORD   // DWORD
): Integer; stdcall;
  external 'WinHvPlatform.dll' name 'WHvUnmapVpciDeviceInterrupt';
result := DllCall("WinHvPlatform\WHvUnmapVpciDeviceInterrupt"
    , "Ptr", Partition   ; WHV_PARTITION_HANDLE
    , "Int64", LogicalDeviceId   ; ULONGLONG
    , "UInt", Index   ; DWORD
    , "Int")   ; return: HRESULT
●WHvUnmapVpciDeviceInterrupt(Partition, LogicalDeviceId, Index) = DLL("WinHvPlatform.dll", "int WHvUnmapVpciDeviceInterrupt(int, qword, dword)")
# 呼び出し: WHvUnmapVpciDeviceInterrupt(Partition, LogicalDeviceId, Index)
# Partition : WHV_PARTITION_HANDLE -> "int"
# LogicalDeviceId : ULONGLONG -> "qword"
# Index : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。