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

WHvRequestInterrupt

関数
パーティションに割り込みを要求する。
DLLWinHvPlatform.dll呼出規約winapi

シグネチャ

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

HRESULT WHvRequestInterrupt(
    WHV_PARTITION_HANDLE Partition,
    const WHV_INTERRUPT_CONTROL* Interrupt,
    DWORD InterruptControlSize
);

パラメーター

名前方向
PartitionWHV_PARTITION_HANDLEin
InterruptWHV_INTERRUPT_CONTROL*in
InterruptControlSizeDWORDin

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

WHvRequestInterrupt = ctypes.windll.winhvplatform.WHvRequestInterrupt
WHvRequestInterrupt.restype = ctypes.c_int
WHvRequestInterrupt.argtypes = [
    ctypes.c_ssize_t,  # Partition : WHV_PARTITION_HANDLE
    ctypes.c_void_p,  # Interrupt : WHV_INTERRUPT_CONTROL*
    wintypes.DWORD,  # InterruptControlSize : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('WinHvPlatform.dll')
WHvRequestInterrupt = Fiddle::Function.new(
  lib['WHvRequestInterrupt'],
  [
    Fiddle::TYPE_INTPTR_T,  # Partition : WHV_PARTITION_HANDLE
    Fiddle::TYPE_VOIDP,  # Interrupt : WHV_INTERRUPT_CONTROL*
    -Fiddle::TYPE_INT,  # InterruptControlSize : DWORD
  ],
  Fiddle::TYPE_INT)
#[link(name = "winhvplatform")]
extern "system" {
    fn WHvRequestInterrupt(
        Partition: isize,  // WHV_PARTITION_HANDLE
        Interrupt: *const WHV_INTERRUPT_CONTROL,  // WHV_INTERRUPT_CONTROL*
        InterruptControlSize: u32  // DWORD
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("WinHvPlatform.dll")]
public static extern int WHvRequestInterrupt(IntPtr Partition, IntPtr Interrupt, uint InterruptControlSize);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WinHvPlatform_WHvRequestInterrupt' -Namespace Win32 -PassThru
# $api::WHvRequestInterrupt(Partition, Interrupt, InterruptControlSize)
#uselib "WinHvPlatform.dll"
#func global WHvRequestInterrupt "WHvRequestInterrupt" sptr, sptr, sptr
; WHvRequestInterrupt Partition, varptr(Interrupt), InterruptControlSize   ; 戻り値は stat
; Partition : WHV_PARTITION_HANDLE -> "sptr"
; Interrupt : WHV_INTERRUPT_CONTROL* -> "sptr"
; InterruptControlSize : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "WinHvPlatform.dll"
#cfunc global WHvRequestInterrupt "WHvRequestInterrupt" sptr, var, int
; res = WHvRequestInterrupt(Partition, Interrupt, InterruptControlSize)
; Partition : WHV_PARTITION_HANDLE -> "sptr"
; Interrupt : WHV_INTERRUPT_CONTROL* -> "var"
; InterruptControlSize : DWORD -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT WHvRequestInterrupt(WHV_PARTITION_HANDLE Partition, WHV_INTERRUPT_CONTROL* Interrupt, DWORD InterruptControlSize)
#uselib "WinHvPlatform.dll"
#cfunc global WHvRequestInterrupt "WHvRequestInterrupt" intptr, var, int
; res = WHvRequestInterrupt(Partition, Interrupt, InterruptControlSize)
; Partition : WHV_PARTITION_HANDLE -> "intptr"
; Interrupt : WHV_INTERRUPT_CONTROL* -> "var"
; InterruptControlSize : DWORD -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	winhvplatform = windows.NewLazySystemDLL("WinHvPlatform.dll")
	procWHvRequestInterrupt = winhvplatform.NewProc("WHvRequestInterrupt")
)

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