ホーム › System.HostComputeSystem › HcsSetupBaseOSVolume
HcsSetupBaseOSVolume
関数指定ボリュームにベースOSレイヤーをセットアップする。
シグネチャ
// computestorage.dll
#include <windows.h>
HRESULT HcsSetupBaseOSVolume(
LPCWSTR layerPath,
LPCWSTR volumePath,
LPCWSTR options
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| layerPath | LPCWSTR | in |
| volumePath | LPCWSTR | in |
| options | LPCWSTR | in |
戻り値の型: HRESULT
各言語での呼び出し定義
// computestorage.dll
#include <windows.h>
HRESULT HcsSetupBaseOSVolume(
LPCWSTR layerPath,
LPCWSTR volumePath,
LPCWSTR options
);[DllImport("computestorage.dll", ExactSpelling = true)]
static extern int HcsSetupBaseOSVolume(
[MarshalAs(UnmanagedType.LPWStr)] string layerPath, // LPCWSTR
[MarshalAs(UnmanagedType.LPWStr)] string volumePath, // LPCWSTR
[MarshalAs(UnmanagedType.LPWStr)] string options // LPCWSTR
);<DllImport("computestorage.dll", ExactSpelling:=True)>
Public Shared Function HcsSetupBaseOSVolume(
<MarshalAs(UnmanagedType.LPWStr)> layerPath As String, ' LPCWSTR
<MarshalAs(UnmanagedType.LPWStr)> volumePath As String, ' LPCWSTR
<MarshalAs(UnmanagedType.LPWStr)> options As String ' LPCWSTR
) As Integer
End Function' layerPath : LPCWSTR
' volumePath : LPCWSTR
' options : LPCWSTR
Declare PtrSafe Function HcsSetupBaseOSVolume Lib "computestorage" ( _
ByVal layerPath As LongPtr, _
ByVal volumePath As LongPtr, _
ByVal options As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
HcsSetupBaseOSVolume = ctypes.windll.computestorage.HcsSetupBaseOSVolume
HcsSetupBaseOSVolume.restype = ctypes.c_int
HcsSetupBaseOSVolume.argtypes = [
wintypes.LPCWSTR, # layerPath : LPCWSTR
wintypes.LPCWSTR, # volumePath : LPCWSTR
wintypes.LPCWSTR, # options : LPCWSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('computestorage.dll')
HcsSetupBaseOSVolume = Fiddle::Function.new(
lib['HcsSetupBaseOSVolume'],
[
Fiddle::TYPE_VOIDP, # layerPath : LPCWSTR
Fiddle::TYPE_VOIDP, # volumePath : LPCWSTR
Fiddle::TYPE_VOIDP, # options : LPCWSTR
],
Fiddle::TYPE_INT)#[link(name = "computestorage")]
extern "system" {
fn HcsSetupBaseOSVolume(
layerPath: *const u16, // LPCWSTR
volumePath: *const u16, // LPCWSTR
options: *const u16 // LPCWSTR
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("computestorage.dll")]
public static extern int HcsSetupBaseOSVolume([MarshalAs(UnmanagedType.LPWStr)] string layerPath, [MarshalAs(UnmanagedType.LPWStr)] string volumePath, [MarshalAs(UnmanagedType.LPWStr)] string options);
"@
$api = Add-Type -MemberDefinition $sig -Name 'computestorage_HcsSetupBaseOSVolume' -Namespace Win32 -PassThru
# $api::HcsSetupBaseOSVolume(layerPath, volumePath, options)#uselib "computestorage.dll"
#func global HcsSetupBaseOSVolume "HcsSetupBaseOSVolume" sptr, sptr, sptr
; HcsSetupBaseOSVolume layerPath, volumePath, options ; 戻り値は stat
; layerPath : LPCWSTR -> "sptr"
; volumePath : LPCWSTR -> "sptr"
; options : LPCWSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "computestorage.dll"
#cfunc global HcsSetupBaseOSVolume "HcsSetupBaseOSVolume" wstr, wstr, wstr
; res = HcsSetupBaseOSVolume(layerPath, volumePath, options)
; layerPath : LPCWSTR -> "wstr"
; volumePath : LPCWSTR -> "wstr"
; options : LPCWSTR -> "wstr"; HRESULT HcsSetupBaseOSVolume(LPCWSTR layerPath, LPCWSTR volumePath, LPCWSTR options)
#uselib "computestorage.dll"
#cfunc global HcsSetupBaseOSVolume "HcsSetupBaseOSVolume" wstr, wstr, wstr
; res = HcsSetupBaseOSVolume(layerPath, volumePath, options)
; layerPath : LPCWSTR -> "wstr"
; volumePath : LPCWSTR -> "wstr"
; options : LPCWSTR -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
computestorage = windows.NewLazySystemDLL("computestorage.dll")
procHcsSetupBaseOSVolume = computestorage.NewProc("HcsSetupBaseOSVolume")
)
// layerPath (LPCWSTR), volumePath (LPCWSTR), options (LPCWSTR)
r1, _, err := procHcsSetupBaseOSVolume.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(layerPath))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(volumePath))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(options))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction HcsSetupBaseOSVolume(
layerPath: PWideChar; // LPCWSTR
volumePath: PWideChar; // LPCWSTR
options: PWideChar // LPCWSTR
): Integer; stdcall;
external 'computestorage.dll' name 'HcsSetupBaseOSVolume';result := DllCall("computestorage\HcsSetupBaseOSVolume"
, "WStr", layerPath ; LPCWSTR
, "WStr", volumePath ; LPCWSTR
, "WStr", options ; LPCWSTR
, "Int") ; return: HRESULT●HcsSetupBaseOSVolume(layerPath, volumePath, options) = DLL("computestorage.dll", "int HcsSetupBaseOSVolume(char*, char*, char*)")
# 呼び出し: HcsSetupBaseOSVolume(layerPath, volumePath, options)
# layerPath : LPCWSTR -> "char*"
# volumePath : LPCWSTR -> "char*"
# options : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。