ホーム › System.Hypervisor › WHvCreateNotificationPort
WHvCreateNotificationPort
関数パーティションに通知ポートを作成する。
シグネチャ
// WinHvPlatform.dll
#include <windows.h>
HRESULT WHvCreateNotificationPort(
WHV_PARTITION_HANDLE Partition,
const WHV_NOTIFICATION_PORT_PARAMETERS* Parameters,
HANDLE EventHandle,
void** PortHandle
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| Partition | WHV_PARTITION_HANDLE | in |
| Parameters | WHV_NOTIFICATION_PORT_PARAMETERS* | in |
| EventHandle | HANDLE | in |
| PortHandle | void** | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// WinHvPlatform.dll
#include <windows.h>
HRESULT WHvCreateNotificationPort(
WHV_PARTITION_HANDLE Partition,
const WHV_NOTIFICATION_PORT_PARAMETERS* Parameters,
HANDLE EventHandle,
void** PortHandle
);[DllImport("WinHvPlatform.dll", ExactSpelling = true)]
static extern int WHvCreateNotificationPort(
IntPtr Partition, // WHV_PARTITION_HANDLE
IntPtr Parameters, // WHV_NOTIFICATION_PORT_PARAMETERS*
IntPtr EventHandle, // HANDLE
IntPtr PortHandle // void** out
);<DllImport("WinHvPlatform.dll", ExactSpelling:=True)>
Public Shared Function WHvCreateNotificationPort(
Partition As IntPtr, ' WHV_PARTITION_HANDLE
Parameters As IntPtr, ' WHV_NOTIFICATION_PORT_PARAMETERS*
EventHandle As IntPtr, ' HANDLE
PortHandle As IntPtr ' void** out
) As Integer
End Function' Partition : WHV_PARTITION_HANDLE
' Parameters : WHV_NOTIFICATION_PORT_PARAMETERS*
' EventHandle : HANDLE
' PortHandle : void** out
Declare PtrSafe Function WHvCreateNotificationPort Lib "winhvplatform" ( _
ByVal Partition As LongPtr, _
ByVal Parameters As LongPtr, _
ByVal EventHandle As LongPtr, _
ByVal PortHandle As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
WHvCreateNotificationPort = ctypes.windll.winhvplatform.WHvCreateNotificationPort
WHvCreateNotificationPort.restype = ctypes.c_int
WHvCreateNotificationPort.argtypes = [
ctypes.c_ssize_t, # Partition : WHV_PARTITION_HANDLE
ctypes.c_void_p, # Parameters : WHV_NOTIFICATION_PORT_PARAMETERS*
wintypes.HANDLE, # EventHandle : HANDLE
ctypes.c_void_p, # PortHandle : void** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('WinHvPlatform.dll')
WHvCreateNotificationPort = Fiddle::Function.new(
lib['WHvCreateNotificationPort'],
[
Fiddle::TYPE_INTPTR_T, # Partition : WHV_PARTITION_HANDLE
Fiddle::TYPE_VOIDP, # Parameters : WHV_NOTIFICATION_PORT_PARAMETERS*
Fiddle::TYPE_VOIDP, # EventHandle : HANDLE
Fiddle::TYPE_VOIDP, # PortHandle : void** out
],
Fiddle::TYPE_INT)#[link(name = "winhvplatform")]
extern "system" {
fn WHvCreateNotificationPort(
Partition: isize, // WHV_PARTITION_HANDLE
Parameters: *const WHV_NOTIFICATION_PORT_PARAMETERS, // WHV_NOTIFICATION_PORT_PARAMETERS*
EventHandle: *mut core::ffi::c_void, // HANDLE
PortHandle: *mut *mut () // void** out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("WinHvPlatform.dll")]
public static extern int WHvCreateNotificationPort(IntPtr Partition, IntPtr Parameters, IntPtr EventHandle, IntPtr PortHandle);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WinHvPlatform_WHvCreateNotificationPort' -Namespace Win32 -PassThru
# $api::WHvCreateNotificationPort(Partition, Parameters, EventHandle, PortHandle)#uselib "WinHvPlatform.dll"
#func global WHvCreateNotificationPort "WHvCreateNotificationPort" sptr, sptr, sptr, sptr
; WHvCreateNotificationPort Partition, varptr(Parameters), EventHandle, PortHandle ; 戻り値は stat
; Partition : WHV_PARTITION_HANDLE -> "sptr"
; Parameters : WHV_NOTIFICATION_PORT_PARAMETERS* -> "sptr"
; EventHandle : HANDLE -> "sptr"
; PortHandle : void** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "WinHvPlatform.dll" #cfunc global WHvCreateNotificationPort "WHvCreateNotificationPort" sptr, var, sptr, sptr ; res = WHvCreateNotificationPort(Partition, Parameters, EventHandle, PortHandle) ; Partition : WHV_PARTITION_HANDLE -> "sptr" ; Parameters : WHV_NOTIFICATION_PORT_PARAMETERS* -> "var" ; EventHandle : HANDLE -> "sptr" ; PortHandle : void** out -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "WinHvPlatform.dll" #cfunc global WHvCreateNotificationPort "WHvCreateNotificationPort" sptr, sptr, sptr, sptr ; res = WHvCreateNotificationPort(Partition, varptr(Parameters), EventHandle, PortHandle) ; Partition : WHV_PARTITION_HANDLE -> "sptr" ; Parameters : WHV_NOTIFICATION_PORT_PARAMETERS* -> "sptr" ; EventHandle : HANDLE -> "sptr" ; PortHandle : void** out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT WHvCreateNotificationPort(WHV_PARTITION_HANDLE Partition, WHV_NOTIFICATION_PORT_PARAMETERS* Parameters, HANDLE EventHandle, void** PortHandle) #uselib "WinHvPlatform.dll" #cfunc global WHvCreateNotificationPort "WHvCreateNotificationPort" intptr, var, intptr, intptr ; res = WHvCreateNotificationPort(Partition, Parameters, EventHandle, PortHandle) ; Partition : WHV_PARTITION_HANDLE -> "intptr" ; Parameters : WHV_NOTIFICATION_PORT_PARAMETERS* -> "var" ; EventHandle : HANDLE -> "intptr" ; PortHandle : void** out -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT WHvCreateNotificationPort(WHV_PARTITION_HANDLE Partition, WHV_NOTIFICATION_PORT_PARAMETERS* Parameters, HANDLE EventHandle, void** PortHandle) #uselib "WinHvPlatform.dll" #cfunc global WHvCreateNotificationPort "WHvCreateNotificationPort" intptr, intptr, intptr, intptr ; res = WHvCreateNotificationPort(Partition, varptr(Parameters), EventHandle, PortHandle) ; Partition : WHV_PARTITION_HANDLE -> "intptr" ; Parameters : WHV_NOTIFICATION_PORT_PARAMETERS* -> "intptr" ; EventHandle : HANDLE -> "intptr" ; PortHandle : void** out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
winhvplatform = windows.NewLazySystemDLL("WinHvPlatform.dll")
procWHvCreateNotificationPort = winhvplatform.NewProc("WHvCreateNotificationPort")
)
// Partition (WHV_PARTITION_HANDLE), Parameters (WHV_NOTIFICATION_PORT_PARAMETERS*), EventHandle (HANDLE), PortHandle (void** out)
r1, _, err := procWHvCreateNotificationPort.Call(
uintptr(Partition),
uintptr(Parameters),
uintptr(EventHandle),
uintptr(PortHandle),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction WHvCreateNotificationPort(
Partition: NativeInt; // WHV_PARTITION_HANDLE
Parameters: Pointer; // WHV_NOTIFICATION_PORT_PARAMETERS*
EventHandle: THandle; // HANDLE
PortHandle: Pointer // void** out
): Integer; stdcall;
external 'WinHvPlatform.dll' name 'WHvCreateNotificationPort';result := DllCall("WinHvPlatform\WHvCreateNotificationPort"
, "Ptr", Partition ; WHV_PARTITION_HANDLE
, "Ptr", Parameters ; WHV_NOTIFICATION_PORT_PARAMETERS*
, "Ptr", EventHandle ; HANDLE
, "Ptr", PortHandle ; void** out
, "Int") ; return: HRESULT●WHvCreateNotificationPort(Partition, Parameters, EventHandle, PortHandle) = DLL("WinHvPlatform.dll", "int WHvCreateNotificationPort(int, void*, void*, void*)")
# 呼び出し: WHvCreateNotificationPort(Partition, Parameters, EventHandle, PortHandle)
# Partition : WHV_PARTITION_HANDLE -> "int"
# Parameters : WHV_NOTIFICATION_PORT_PARAMETERS* -> "void*"
# EventHandle : HANDLE -> "void*"
# PortHandle : void** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。