ホーム › System.Hypervisor › WHvSetNotificationPortProperty
WHvSetNotificationPortProperty
関数通知ポートのプロパティを設定する。
シグネチャ
// WinHvPlatform.dll
#include <windows.h>
HRESULT WHvSetNotificationPortProperty(
WHV_PARTITION_HANDLE Partition,
void* PortHandle,
WHV_NOTIFICATION_PORT_PROPERTY_CODE PropertyCode,
ULONGLONG PropertyValue
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| Partition | WHV_PARTITION_HANDLE | in | 対象パーティションのハンドルを指定する。 |
| PortHandle | void* | in | プロパティを設定する対象の通知ポートハンドルを指定する。 |
| PropertyCode | WHV_NOTIFICATION_PORT_PROPERTY_CODE | in | 設定する通知ポートプロパティの種類を示す列挙コードを指定する。 |
| PropertyValue | ULONGLONG | in | 設定するプロパティ値を64ビット整数で指定する。 |
戻り値の型: 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 // HRESULTfunction 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)。const std = @import("std");
extern "winhvplatform" fn WHvSetNotificationPortProperty(
Partition: isize, // WHV_PARTITION_HANDLE
PortHandle: ?*anyopaque, // void*
PropertyCode: i32, // WHV_NOTIFICATION_PORT_PROPERTY_CODE
PropertyValue: u64 // ULONGLONG
) callconv(std.os.windows.WINAPI) i32;proc WHvSetNotificationPortProperty(
Partition: int, # WHV_PARTITION_HANDLE
PortHandle: pointer, # void*
PropertyCode: int32, # WHV_NOTIFICATION_PORT_PROPERTY_CODE
PropertyValue: uint64 # ULONGLONG
): int32 {.importc: "WHvSetNotificationPortProperty", stdcall, dynlib: "WinHvPlatform.dll".}pragma(lib, "winhvplatform");
extern(Windows)
int WHvSetNotificationPortProperty(
ptrdiff_t Partition, // WHV_PARTITION_HANDLE
void* PortHandle, // void*
int PropertyCode, // WHV_NOTIFICATION_PORT_PROPERTY_CODE
ulong PropertyValue // ULONGLONG
);ccall((:WHvSetNotificationPortProperty, "WinHvPlatform.dll"), stdcall, Int32,
(Int, Ptr{Cvoid}, Int32, UInt64),
Partition, PortHandle, PropertyCode, PropertyValue)
# Partition : WHV_PARTITION_HANDLE -> Int
# PortHandle : void* -> Ptr{Cvoid}
# PropertyCode : WHV_NOTIFICATION_PORT_PROPERTY_CODE -> Int32
# PropertyValue : ULONGLONG -> UInt64
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t WHvSetNotificationPortProperty(
intptr_t Partition,
void* PortHandle,
int32_t PropertyCode,
uint64_t PropertyValue);
]]
local winhvplatform = ffi.load("winhvplatform")
-- winhvplatform.WHvSetNotificationPortProperty(Partition, PortHandle, PropertyCode, PropertyValue)
-- Partition : WHV_PARTITION_HANDLE
-- PortHandle : void*
-- PropertyCode : WHV_NOTIFICATION_PORT_PROPERTY_CODE
-- PropertyValue : ULONGLONG
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('WinHvPlatform.dll');
const WHvSetNotificationPortProperty = lib.func('__stdcall', 'WHvSetNotificationPortProperty', 'int32_t', ['intptr_t', 'void *', 'int32_t', 'uint64_t']);
// WHvSetNotificationPortProperty(Partition, PortHandle, PropertyCode, PropertyValue)
// Partition : WHV_PARTITION_HANDLE -> 'intptr_t'
// PortHandle : void* -> 'void *'
// PropertyCode : WHV_NOTIFICATION_PORT_PROPERTY_CODE -> 'int32_t'
// PropertyValue : ULONGLONG -> 'uint64_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("WinHvPlatform.dll", {
WHvSetNotificationPortProperty: { parameters: ["isize", "pointer", "i32", "u64"], result: "i32" },
});
// lib.symbols.WHvSetNotificationPortProperty(Partition, PortHandle, PropertyCode, PropertyValue)
// Partition : WHV_PARTITION_HANDLE -> "isize"
// PortHandle : void* -> "pointer"
// PropertyCode : WHV_NOTIFICATION_PORT_PROPERTY_CODE -> "i32"
// PropertyValue : ULONGLONG -> "u64"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t WHvSetNotificationPortProperty(
intptr_t Partition,
void* PortHandle,
int32_t PropertyCode,
uint64_t PropertyValue);
C, "WinHvPlatform.dll");
// $ffi->WHvSetNotificationPortProperty(Partition, PortHandle, PropertyCode, PropertyValue);
// Partition : WHV_PARTITION_HANDLE
// PortHandle : void*
// PropertyCode : WHV_NOTIFICATION_PORT_PROPERTY_CODE
// PropertyValue : ULONGLONG
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Winhvplatform extends StdCallLibrary {
Winhvplatform INSTANCE = Native.load("winhvplatform", Winhvplatform.class);
int WHvSetNotificationPortProperty(
long Partition, // WHV_PARTITION_HANDLE
Pointer PortHandle, // void*
int PropertyCode, // WHV_NOTIFICATION_PORT_PROPERTY_CODE
long PropertyValue // ULONGLONG
);
}@[Link("winhvplatform")]
lib LibWinHvPlatform
fun WHvSetNotificationPortProperty = WHvSetNotificationPortProperty(
Partition : LibC::SSizeT, # WHV_PARTITION_HANDLE
PortHandle : Void*, # void*
PropertyCode : Int32, # WHV_NOTIFICATION_PORT_PROPERTY_CODE
PropertyValue : UInt64 # ULONGLONG
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef WHvSetNotificationPortPropertyNative = Int32 Function(IntPtr, Pointer<Void>, Int32, Uint64);
typedef WHvSetNotificationPortPropertyDart = int Function(int, Pointer<Void>, int, int);
final WHvSetNotificationPortProperty = DynamicLibrary.open('WinHvPlatform.dll')
.lookupFunction<WHvSetNotificationPortPropertyNative, WHvSetNotificationPortPropertyDart>('WHvSetNotificationPortProperty');
// Partition : WHV_PARTITION_HANDLE -> IntPtr
// PortHandle : void* -> Pointer<Void>
// PropertyCode : WHV_NOTIFICATION_PORT_PROPERTY_CODE -> Int32
// PropertyValue : ULONGLONG -> Uint64
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
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';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "WHvSetNotificationPortProperty"
c_WHvSetNotificationPortProperty :: CIntPtr -> Ptr () -> Int32 -> Word64 -> IO Int32
-- Partition : WHV_PARTITION_HANDLE -> CIntPtr
-- PortHandle : void* -> Ptr ()
-- PropertyCode : WHV_NOTIFICATION_PORT_PROPERTY_CODE -> Int32
-- PropertyValue : ULONGLONG -> Word64
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let whvsetnotificationportproperty =
foreign "WHvSetNotificationPortProperty"
(intptr_t @-> (ptr void) @-> int32_t @-> uint64_t @-> returning int32_t)
(* Partition : WHV_PARTITION_HANDLE -> intptr_t *)
(* PortHandle : void* -> (ptr void) *)
(* PropertyCode : WHV_NOTIFICATION_PORT_PROPERTY_CODE -> int32_t *)
(* PropertyValue : ULONGLONG -> uint64_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library winhvplatform (t "WinHvPlatform.dll"))
(cffi:use-foreign-library winhvplatform)
(cffi:defcfun ("WHvSetNotificationPortProperty" whv-set-notification-port-property :convention :stdcall) :int32
(partition :int64) ; WHV_PARTITION_HANDLE
(port-handle :pointer) ; void*
(property-code :int32) ; WHV_NOTIFICATION_PORT_PROPERTY_CODE
(property-value :uint64)) ; ULONGLONG
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $WHvSetNotificationPortProperty = Win32::API::More->new('WinHvPlatform',
'int WHvSetNotificationPortProperty(LPARAM Partition, LPVOID PortHandle, int PropertyCode, UINT64 PropertyValue)');
# my $ret = $WHvSetNotificationPortProperty->Call($Partition, $PortHandle, $PropertyCode, $PropertyValue);
# Partition : WHV_PARTITION_HANDLE -> LPARAM
# PortHandle : void* -> LPVOID
# PropertyCode : WHV_NOTIFICATION_PORT_PROPERTY_CODE -> int
# PropertyValue : ULONGLONG -> UINT64
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。