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

WHvGetVpciDeviceNotification

関数
仮想PCIデバイスの通知を取得する。
DLLWinHvPlatform.dll呼出規約winapi

シグネチャ

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

HRESULT WHvGetVpciDeviceNotification(
    WHV_PARTITION_HANDLE Partition,
    ULONGLONG LogicalDeviceId,
    WHV_VPCI_DEVICE_NOTIFICATION* Notification,
    DWORD NotificationSizeInBytes
);

パラメーター

名前方向
PartitionWHV_PARTITION_HANDLEin
LogicalDeviceIdULONGLONGin
NotificationWHV_VPCI_DEVICE_NOTIFICATION*out
NotificationSizeInBytesDWORDin

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

WHvGetVpciDeviceNotification = ctypes.windll.winhvplatform.WHvGetVpciDeviceNotification
WHvGetVpciDeviceNotification.restype = ctypes.c_int
WHvGetVpciDeviceNotification.argtypes = [
    ctypes.c_ssize_t,  # Partition : WHV_PARTITION_HANDLE
    ctypes.c_ulonglong,  # LogicalDeviceId : ULONGLONG
    ctypes.c_void_p,  # Notification : WHV_VPCI_DEVICE_NOTIFICATION* out
    wintypes.DWORD,  # NotificationSizeInBytes : DWORD
]
require 'fiddle'
require 'fiddle/import'

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

var (
	winhvplatform = windows.NewLazySystemDLL("WinHvPlatform.dll")
	procWHvGetVpciDeviceNotification = winhvplatform.NewProc("WHvGetVpciDeviceNotification")
)

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