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

HcsExportLayer

関数
コンテナイメージのレイヤーをフォルダへエクスポートする。
DLLcomputestorage.dll呼出規約winapi

シグネチャ

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

HRESULT HcsExportLayer(
    LPCWSTR layerPath,
    LPCWSTR exportFolderPath,
    LPCWSTR layerData,
    LPCWSTR options
);

パラメーター

名前方向
layerPathLPCWSTRin
exportFolderPathLPCWSTRin
layerDataLPCWSTRin
optionsLPCWSTRin

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT HcsExportLayer(
    LPCWSTR layerPath,
    LPCWSTR exportFolderPath,
    LPCWSTR layerData,
    LPCWSTR options
);
[DllImport("computestorage.dll", ExactSpelling = true)]
static extern int HcsExportLayer(
    [MarshalAs(UnmanagedType.LPWStr)] string layerPath,   // LPCWSTR
    [MarshalAs(UnmanagedType.LPWStr)] string exportFolderPath,   // LPCWSTR
    [MarshalAs(UnmanagedType.LPWStr)] string layerData,   // LPCWSTR
    [MarshalAs(UnmanagedType.LPWStr)] string options   // LPCWSTR
);
<DllImport("computestorage.dll", ExactSpelling:=True)>
Public Shared Function HcsExportLayer(
    <MarshalAs(UnmanagedType.LPWStr)> layerPath As String,   ' LPCWSTR
    <MarshalAs(UnmanagedType.LPWStr)> exportFolderPath As String,   ' LPCWSTR
    <MarshalAs(UnmanagedType.LPWStr)> layerData As String,   ' LPCWSTR
    <MarshalAs(UnmanagedType.LPWStr)> options As String   ' LPCWSTR
) As Integer
End Function
' layerPath : LPCWSTR
' exportFolderPath : LPCWSTR
' layerData : LPCWSTR
' options : LPCWSTR
Declare PtrSafe Function HcsExportLayer Lib "computestorage" ( _
    ByVal layerPath As LongPtr, _
    ByVal exportFolderPath As LongPtr, _
    ByVal layerData 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

HcsExportLayer = ctypes.windll.computestorage.HcsExportLayer
HcsExportLayer.restype = ctypes.c_int
HcsExportLayer.argtypes = [
    wintypes.LPCWSTR,  # layerPath : LPCWSTR
    wintypes.LPCWSTR,  # exportFolderPath : LPCWSTR
    wintypes.LPCWSTR,  # layerData : LPCWSTR
    wintypes.LPCWSTR,  # options : LPCWSTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('computestorage.dll')
HcsExportLayer = Fiddle::Function.new(
  lib['HcsExportLayer'],
  [
    Fiddle::TYPE_VOIDP,  # layerPath : LPCWSTR
    Fiddle::TYPE_VOIDP,  # exportFolderPath : LPCWSTR
    Fiddle::TYPE_VOIDP,  # layerData : LPCWSTR
    Fiddle::TYPE_VOIDP,  # options : LPCWSTR
  ],
  Fiddle::TYPE_INT)
#[link(name = "computestorage")]
extern "system" {
    fn HcsExportLayer(
        layerPath: *const u16,  // LPCWSTR
        exportFolderPath: *const u16,  // LPCWSTR
        layerData: *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 HcsExportLayer([MarshalAs(UnmanagedType.LPWStr)] string layerPath, [MarshalAs(UnmanagedType.LPWStr)] string exportFolderPath, [MarshalAs(UnmanagedType.LPWStr)] string layerData, [MarshalAs(UnmanagedType.LPWStr)] string options);
"@
$api = Add-Type -MemberDefinition $sig -Name 'computestorage_HcsExportLayer' -Namespace Win32 -PassThru
# $api::HcsExportLayer(layerPath, exportFolderPath, layerData, options)
#uselib "computestorage.dll"
#func global HcsExportLayer "HcsExportLayer" sptr, sptr, sptr, sptr
; HcsExportLayer layerPath, exportFolderPath, layerData, options   ; 戻り値は stat
; layerPath : LPCWSTR -> "sptr"
; exportFolderPath : LPCWSTR -> "sptr"
; layerData : LPCWSTR -> "sptr"
; options : LPCWSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "computestorage.dll"
#cfunc global HcsExportLayer "HcsExportLayer" wstr, wstr, wstr, wstr
; res = HcsExportLayer(layerPath, exportFolderPath, layerData, options)
; layerPath : LPCWSTR -> "wstr"
; exportFolderPath : LPCWSTR -> "wstr"
; layerData : LPCWSTR -> "wstr"
; options : LPCWSTR -> "wstr"
; HRESULT HcsExportLayer(LPCWSTR layerPath, LPCWSTR exportFolderPath, LPCWSTR layerData, LPCWSTR options)
#uselib "computestorage.dll"
#cfunc global HcsExportLayer "HcsExportLayer" wstr, wstr, wstr, wstr
; res = HcsExportLayer(layerPath, exportFolderPath, layerData, options)
; layerPath : LPCWSTR -> "wstr"
; exportFolderPath : LPCWSTR -> "wstr"
; layerData : LPCWSTR -> "wstr"
; options : LPCWSTR -> "wstr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	computestorage = windows.NewLazySystemDLL("computestorage.dll")
	procHcsExportLayer = computestorage.NewProc("HcsExportLayer")
)

// layerPath (LPCWSTR), exportFolderPath (LPCWSTR), layerData (LPCWSTR), options (LPCWSTR)
r1, _, err := procHcsExportLayer.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(layerPath))),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(exportFolderPath))),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(layerData))),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(options))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function HcsExportLayer(
  layerPath: PWideChar;   // LPCWSTR
  exportFolderPath: PWideChar;   // LPCWSTR
  layerData: PWideChar;   // LPCWSTR
  options: PWideChar   // LPCWSTR
): Integer; stdcall;
  external 'computestorage.dll' name 'HcsExportLayer';
result := DllCall("computestorage\HcsExportLayer"
    , "WStr", layerPath   ; LPCWSTR
    , "WStr", exportFolderPath   ; LPCWSTR
    , "WStr", layerData   ; LPCWSTR
    , "WStr", options   ; LPCWSTR
    , "Int")   ; return: HRESULT
●HcsExportLayer(layerPath, exportFolderPath, layerData, options) = DLL("computestorage.dll", "int HcsExportLayer(char*, char*, char*, char*)")
# 呼び出し: HcsExportLayer(layerPath, exportFolderPath, layerData, options)
# layerPath : LPCWSTR -> "char*"
# exportFolderPath : LPCWSTR -> "char*"
# layerData : LPCWSTR -> "char*"
# options : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。