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

HcsFormatWritableLayerVhd

関数
書き込み可能レイヤーのVHDをフォーマットする。
DLLcomputestorage.dll呼出規約winapi

シグネチャ

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

HRESULT HcsFormatWritableLayerVhd(
    HANDLE vhdHandle
);

パラメーター

名前方向
vhdHandleHANDLEin

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

HcsFormatWritableLayerVhd = ctypes.windll.computestorage.HcsFormatWritableLayerVhd
HcsFormatWritableLayerVhd.restype = ctypes.c_int
HcsFormatWritableLayerVhd.argtypes = [
    wintypes.HANDLE,  # vhdHandle : HANDLE
]
require 'fiddle'
require 'fiddle/import'

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

var (
	computestorage = windows.NewLazySystemDLL("computestorage.dll")
	procHcsFormatWritableLayerVhd = computestorage.NewProc("HcsFormatWritableLayerVhd")
)

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