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