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

WHvSetNotificationPortProperty

関数
通知ポートのプロパティを設定する。
DLLWinHvPlatform.dll呼出規約winapi

シグネチャ

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

HRESULT WHvSetNotificationPortProperty(
    WHV_PARTITION_HANDLE Partition,
    void* PortHandle,
    WHV_NOTIFICATION_PORT_PROPERTY_CODE PropertyCode,
    ULONGLONG PropertyValue
);

パラメーター

名前方向
PartitionWHV_PARTITION_HANDLEin
PortHandlevoid*in
PropertyCodeWHV_NOTIFICATION_PORT_PROPERTY_CODEin
PropertyValueULONGLONGin

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

WHvSetNotificationPortProperty = ctypes.windll.winhvplatform.WHvSetNotificationPortProperty
WHvSetNotificationPortProperty.restype = ctypes.c_int
WHvSetNotificationPortProperty.argtypes = [
    ctypes.c_ssize_t,  # Partition : WHV_PARTITION_HANDLE
    ctypes.POINTER(None),  # PortHandle : void*
    ctypes.c_int,  # PropertyCode : WHV_NOTIFICATION_PORT_PROPERTY_CODE
    ctypes.c_ulonglong,  # PropertyValue : ULONGLONG
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('WinHvPlatform.dll')
WHvSetNotificationPortProperty = Fiddle::Function.new(
  lib['WHvSetNotificationPortProperty'],
  [
    Fiddle::TYPE_INTPTR_T,  # Partition : WHV_PARTITION_HANDLE
    Fiddle::TYPE_VOIDP,  # PortHandle : void*
    Fiddle::TYPE_INT,  # PropertyCode : WHV_NOTIFICATION_PORT_PROPERTY_CODE
    -Fiddle::TYPE_LONG_LONG,  # PropertyValue : ULONGLONG
  ],
  Fiddle::TYPE_INT)
#[link(name = "winhvplatform")]
extern "system" {
    fn WHvSetNotificationPortProperty(
        Partition: isize,  // WHV_PARTITION_HANDLE
        PortHandle: *mut (),  // void*
        PropertyCode: i32,  // WHV_NOTIFICATION_PORT_PROPERTY_CODE
        PropertyValue: u64  // ULONGLONG
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("WinHvPlatform.dll")]
public static extern int WHvSetNotificationPortProperty(IntPtr Partition, IntPtr PortHandle, int PropertyCode, ulong PropertyValue);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WinHvPlatform_WHvSetNotificationPortProperty' -Namespace Win32 -PassThru
# $api::WHvSetNotificationPortProperty(Partition, PortHandle, PropertyCode, PropertyValue)
#uselib "WinHvPlatform.dll"
#func global WHvSetNotificationPortProperty "WHvSetNotificationPortProperty" sptr, sptr, sptr, sptr
; WHvSetNotificationPortProperty Partition, PortHandle, PropertyCode, PropertyValue   ; 戻り値は stat
; Partition : WHV_PARTITION_HANDLE -> "sptr"
; PortHandle : void* -> "sptr"
; PropertyCode : WHV_NOTIFICATION_PORT_PROPERTY_CODE -> "sptr"
; PropertyValue : ULONGLONG -> "sptr"
; ※HSP3.7は int64 引数(64bit値渡し)に非対応です。
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "WinHvPlatform.dll"
#cfunc global WHvSetNotificationPortProperty "WHvSetNotificationPortProperty" sptr, sptr, int, int64
; res = WHvSetNotificationPortProperty(Partition, PortHandle, PropertyCode, PropertyValue)
; Partition : WHV_PARTITION_HANDLE -> "sptr"
; PortHandle : void* -> "sptr"
; PropertyCode : WHV_NOTIFICATION_PORT_PROPERTY_CODE -> "int"
; PropertyValue : ULONGLONG -> "int64"
; ※int64 引数の DLL 値渡しは x64 ランタイム(hsp3_64)のみ対応(x86 は未対応)。
; HRESULT WHvSetNotificationPortProperty(WHV_PARTITION_HANDLE Partition, void* PortHandle, WHV_NOTIFICATION_PORT_PROPERTY_CODE PropertyCode, ULONGLONG PropertyValue)
#uselib "WinHvPlatform.dll"
#cfunc global WHvSetNotificationPortProperty "WHvSetNotificationPortProperty" intptr, intptr, int, int64
; res = WHvSetNotificationPortProperty(Partition, PortHandle, PropertyCode, PropertyValue)
; Partition : WHV_PARTITION_HANDLE -> "intptr"
; PortHandle : void* -> "intptr"
; PropertyCode : WHV_NOTIFICATION_PORT_PROPERTY_CODE -> "int"
; PropertyValue : ULONGLONG -> "int64"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	winhvplatform = windows.NewLazySystemDLL("WinHvPlatform.dll")
	procWHvSetNotificationPortProperty = winhvplatform.NewProc("WHvSetNotificationPortProperty")
)

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