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

WHvRegisterPartitionDoorbellEvent

関数
パーティションにドアベルイベントを登録する。
DLLWinHvPlatform.dll呼出規約winapi

シグネチャ

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

HRESULT WHvRegisterPartitionDoorbellEvent(
    WHV_PARTITION_HANDLE Partition,
    const WHV_DOORBELL_MATCH_DATA* MatchData,
    HANDLE EventHandle
);

パラメーター

名前方向
PartitionWHV_PARTITION_HANDLEin
MatchDataWHV_DOORBELL_MATCH_DATA*in
EventHandleHANDLEin

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

WHvRegisterPartitionDoorbellEvent = ctypes.windll.winhvplatform.WHvRegisterPartitionDoorbellEvent
WHvRegisterPartitionDoorbellEvent.restype = ctypes.c_int
WHvRegisterPartitionDoorbellEvent.argtypes = [
    ctypes.c_ssize_t,  # Partition : WHV_PARTITION_HANDLE
    ctypes.c_void_p,  # MatchData : WHV_DOORBELL_MATCH_DATA*
    wintypes.HANDLE,  # EventHandle : HANDLE
]
require 'fiddle'
require 'fiddle/import'

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

var (
	winhvplatform = windows.NewLazySystemDLL("WinHvPlatform.dll")
	procWHvRegisterPartitionDoorbellEvent = winhvplatform.NewProc("WHvRegisterPartitionDoorbellEvent")
)

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