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

WHvResetPartition

関数
ハイパーバイザーパーティションをリセットする。
DLLWinHvPlatform.dll呼出規約winapi

シグネチャ

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

HRESULT WHvResetPartition(
    WHV_PARTITION_HANDLE Partition
);

パラメーター

名前方向
PartitionWHV_PARTITION_HANDLEin

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

WHvResetPartition = ctypes.windll.winhvplatform.WHvResetPartition
WHvResetPartition.restype = ctypes.c_int
WHvResetPartition.argtypes = [
    ctypes.c_ssize_t,  # Partition : WHV_PARTITION_HANDLE
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('WinHvPlatform.dll')
WHvResetPartition = Fiddle::Function.new(
  lib['WHvResetPartition'],
  [
    Fiddle::TYPE_INTPTR_T,  # Partition : WHV_PARTITION_HANDLE
  ],
  Fiddle::TYPE_INT)
#[link(name = "winhvplatform")]
extern "system" {
    fn WHvResetPartition(
        Partition: isize  // WHV_PARTITION_HANDLE
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("WinHvPlatform.dll")]
public static extern int WHvResetPartition(IntPtr Partition);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WinHvPlatform_WHvResetPartition' -Namespace Win32 -PassThru
# $api::WHvResetPartition(Partition)
#uselib "WinHvPlatform.dll"
#func global WHvResetPartition "WHvResetPartition" sptr
; WHvResetPartition Partition   ; 戻り値は stat
; Partition : WHV_PARTITION_HANDLE -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "WinHvPlatform.dll"
#cfunc global WHvResetPartition "WHvResetPartition" sptr
; res = WHvResetPartition(Partition)
; Partition : WHV_PARTITION_HANDLE -> "sptr"
; HRESULT WHvResetPartition(WHV_PARTITION_HANDLE Partition)
#uselib "WinHvPlatform.dll"
#cfunc global WHvResetPartition "WHvResetPartition" intptr
; res = WHvResetPartition(Partition)
; Partition : WHV_PARTITION_HANDLE -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	winhvplatform = windows.NewLazySystemDLL("WinHvPlatform.dll")
	procWHvResetPartition = winhvplatform.NewProc("WHvResetPartition")
)

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