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