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

HcsGetLayerVhdMountPath

関数
レイヤーVHDのマウントパスを取得する。
DLLcomputestorage.dll呼出規約winapi

シグネチャ

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

HRESULT HcsGetLayerVhdMountPath(
    HANDLE vhdHandle,
    LPWSTR* mountPath
);

パラメーター

名前方向
vhdHandleHANDLEin
mountPathLPWSTR*out

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

HcsGetLayerVhdMountPath = ctypes.windll.computestorage.HcsGetLayerVhdMountPath
HcsGetLayerVhdMountPath.restype = ctypes.c_int
HcsGetLayerVhdMountPath.argtypes = [
    wintypes.HANDLE,  # vhdHandle : HANDLE
    ctypes.c_void_p,  # mountPath : LPWSTR* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('computestorage.dll')
HcsGetLayerVhdMountPath = Fiddle::Function.new(
  lib['HcsGetLayerVhdMountPath'],
  [
    Fiddle::TYPE_VOIDP,  # vhdHandle : HANDLE
    Fiddle::TYPE_VOIDP,  # mountPath : LPWSTR* out
  ],
  Fiddle::TYPE_INT)
#[link(name = "computestorage")]
extern "system" {
    fn HcsGetLayerVhdMountPath(
        vhdHandle: *mut core::ffi::c_void,  // HANDLE
        mountPath: *mut *mut u16  // LPWSTR* out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("computestorage.dll")]
public static extern int HcsGetLayerVhdMountPath(IntPtr vhdHandle, IntPtr mountPath);
"@
$api = Add-Type -MemberDefinition $sig -Name 'computestorage_HcsGetLayerVhdMountPath' -Namespace Win32 -PassThru
# $api::HcsGetLayerVhdMountPath(vhdHandle, mountPath)
#uselib "computestorage.dll"
#func global HcsGetLayerVhdMountPath "HcsGetLayerVhdMountPath" sptr, sptr
; HcsGetLayerVhdMountPath vhdHandle, varptr(mountPath)   ; 戻り値は stat
; vhdHandle : HANDLE -> "sptr"
; mountPath : LPWSTR* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "computestorage.dll"
#cfunc global HcsGetLayerVhdMountPath "HcsGetLayerVhdMountPath" sptr, var
; res = HcsGetLayerVhdMountPath(vhdHandle, mountPath)
; vhdHandle : HANDLE -> "sptr"
; mountPath : LPWSTR* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT HcsGetLayerVhdMountPath(HANDLE vhdHandle, LPWSTR* mountPath)
#uselib "computestorage.dll"
#cfunc global HcsGetLayerVhdMountPath "HcsGetLayerVhdMountPath" intptr, var
; res = HcsGetLayerVhdMountPath(vhdHandle, mountPath)
; vhdHandle : HANDLE -> "intptr"
; mountPath : LPWSTR* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	computestorage = windows.NewLazySystemDLL("computestorage.dll")
	procHcsGetLayerVhdMountPath = computestorage.NewProc("HcsGetLayerVhdMountPath")
)

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