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