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

WHvGetInterruptTargetVpSet

関数
割り込み送信先となる仮想プロセッサの集合を取得する。
DLLWinHvPlatform.dll呼出規約winapi

シグネチャ

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

HRESULT WHvGetInterruptTargetVpSet(
    WHV_PARTITION_HANDLE Partition,
    ULONGLONG Destination,
    WHV_INTERRUPT_DESTINATION_MODE DestinationMode,
    DWORD* TargetVps,
    DWORD VpCount,
    DWORD* TargetVpCount
);

パラメーター

名前方向
PartitionWHV_PARTITION_HANDLEin
DestinationULONGLONGin
DestinationModeWHV_INTERRUPT_DESTINATION_MODEin
TargetVpsDWORD*out
VpCountDWORDin
TargetVpCountDWORD*out

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

WHvGetInterruptTargetVpSet = ctypes.windll.winhvplatform.WHvGetInterruptTargetVpSet
WHvGetInterruptTargetVpSet.restype = ctypes.c_int
WHvGetInterruptTargetVpSet.argtypes = [
    ctypes.c_ssize_t,  # Partition : WHV_PARTITION_HANDLE
    ctypes.c_ulonglong,  # Destination : ULONGLONG
    ctypes.c_int,  # DestinationMode : WHV_INTERRUPT_DESTINATION_MODE
    ctypes.POINTER(wintypes.DWORD),  # TargetVps : DWORD* out
    wintypes.DWORD,  # VpCount : DWORD
    ctypes.POINTER(wintypes.DWORD),  # TargetVpCount : DWORD* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('WinHvPlatform.dll')
WHvGetInterruptTargetVpSet = Fiddle::Function.new(
  lib['WHvGetInterruptTargetVpSet'],
  [
    Fiddle::TYPE_INTPTR_T,  # Partition : WHV_PARTITION_HANDLE
    -Fiddle::TYPE_LONG_LONG,  # Destination : ULONGLONG
    Fiddle::TYPE_INT,  # DestinationMode : WHV_INTERRUPT_DESTINATION_MODE
    Fiddle::TYPE_VOIDP,  # TargetVps : DWORD* out
    -Fiddle::TYPE_INT,  # VpCount : DWORD
    Fiddle::TYPE_VOIDP,  # TargetVpCount : DWORD* out
  ],
  Fiddle::TYPE_INT)
#[link(name = "winhvplatform")]
extern "system" {
    fn WHvGetInterruptTargetVpSet(
        Partition: isize,  // WHV_PARTITION_HANDLE
        Destination: u64,  // ULONGLONG
        DestinationMode: i32,  // WHV_INTERRUPT_DESTINATION_MODE
        TargetVps: *mut u32,  // DWORD* out
        VpCount: u32,  // DWORD
        TargetVpCount: *mut u32  // DWORD* out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("WinHvPlatform.dll")]
public static extern int WHvGetInterruptTargetVpSet(IntPtr Partition, ulong Destination, int DestinationMode, out uint TargetVps, uint VpCount, out uint TargetVpCount);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WinHvPlatform_WHvGetInterruptTargetVpSet' -Namespace Win32 -PassThru
# $api::WHvGetInterruptTargetVpSet(Partition, Destination, DestinationMode, TargetVps, VpCount, TargetVpCount)
#uselib "WinHvPlatform.dll"
#func global WHvGetInterruptTargetVpSet "WHvGetInterruptTargetVpSet" sptr, sptr, sptr, sptr, sptr, sptr
; WHvGetInterruptTargetVpSet Partition, Destination, DestinationMode, varptr(TargetVps), VpCount, varptr(TargetVpCount)   ; 戻り値は stat
; Partition : WHV_PARTITION_HANDLE -> "sptr"
; Destination : ULONGLONG -> "sptr"
; DestinationMode : WHV_INTERRUPT_DESTINATION_MODE -> "sptr"
; TargetVps : DWORD* out -> "sptr"
; VpCount : DWORD -> "sptr"
; TargetVpCount : DWORD* out -> "sptr"
; ※HSP3.7は int64 引数(64bit値渡し)に非対応です。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "WinHvPlatform.dll"
#cfunc global WHvGetInterruptTargetVpSet "WHvGetInterruptTargetVpSet" sptr, int64, int, var, int, var
; res = WHvGetInterruptTargetVpSet(Partition, Destination, DestinationMode, TargetVps, VpCount, TargetVpCount)
; Partition : WHV_PARTITION_HANDLE -> "sptr"
; Destination : ULONGLONG -> "int64"
; DestinationMode : WHV_INTERRUPT_DESTINATION_MODE -> "int"
; TargetVps : DWORD* out -> "var"
; VpCount : DWORD -> "int"
; TargetVpCount : DWORD* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。
出力引数:
; HRESULT WHvGetInterruptTargetVpSet(WHV_PARTITION_HANDLE Partition, ULONGLONG Destination, WHV_INTERRUPT_DESTINATION_MODE DestinationMode, DWORD* TargetVps, DWORD VpCount, DWORD* TargetVpCount)
#uselib "WinHvPlatform.dll"
#cfunc global WHvGetInterruptTargetVpSet "WHvGetInterruptTargetVpSet" intptr, int64, int, var, int, var
; res = WHvGetInterruptTargetVpSet(Partition, Destination, DestinationMode, TargetVps, VpCount, TargetVpCount)
; Partition : WHV_PARTITION_HANDLE -> "intptr"
; Destination : ULONGLONG -> "int64"
; DestinationMode : WHV_INTERRUPT_DESTINATION_MODE -> "int"
; TargetVps : DWORD* out -> "var"
; VpCount : DWORD -> "int"
; TargetVpCount : DWORD* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	winhvplatform = windows.NewLazySystemDLL("WinHvPlatform.dll")
	procWHvGetInterruptTargetVpSet = winhvplatform.NewProc("WHvGetInterruptTargetVpSet")
)

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