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

HcsCreateEmptyRuntimeStateFile

関数
空のランタイム状態ファイルを作成する。
DLLcomputecore.dll呼出規約winapi

シグネチャ

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

HRESULT HcsCreateEmptyRuntimeStateFile(
    LPCWSTR runtimeStateFilePath
);

パラメーター

名前方向
runtimeStateFilePathLPCWSTRin

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT HcsCreateEmptyRuntimeStateFile(
    LPCWSTR runtimeStateFilePath
);
[DllImport("computecore.dll", ExactSpelling = true)]
static extern int HcsCreateEmptyRuntimeStateFile(
    [MarshalAs(UnmanagedType.LPWStr)] string runtimeStateFilePath   // LPCWSTR
);
<DllImport("computecore.dll", ExactSpelling:=True)>
Public Shared Function HcsCreateEmptyRuntimeStateFile(
    <MarshalAs(UnmanagedType.LPWStr)> runtimeStateFilePath As String   ' LPCWSTR
) As Integer
End Function
' runtimeStateFilePath : LPCWSTR
Declare PtrSafe Function HcsCreateEmptyRuntimeStateFile Lib "computecore" ( _
    ByVal runtimeStateFilePath As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

HcsCreateEmptyRuntimeStateFile = ctypes.windll.computecore.HcsCreateEmptyRuntimeStateFile
HcsCreateEmptyRuntimeStateFile.restype = ctypes.c_int
HcsCreateEmptyRuntimeStateFile.argtypes = [
    wintypes.LPCWSTR,  # runtimeStateFilePath : LPCWSTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('computecore.dll')
HcsCreateEmptyRuntimeStateFile = Fiddle::Function.new(
  lib['HcsCreateEmptyRuntimeStateFile'],
  [
    Fiddle::TYPE_VOIDP,  # runtimeStateFilePath : LPCWSTR
  ],
  Fiddle::TYPE_INT)
#[link(name = "computecore")]
extern "system" {
    fn HcsCreateEmptyRuntimeStateFile(
        runtimeStateFilePath: *const u16  // LPCWSTR
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("computecore.dll")]
public static extern int HcsCreateEmptyRuntimeStateFile([MarshalAs(UnmanagedType.LPWStr)] string runtimeStateFilePath);
"@
$api = Add-Type -MemberDefinition $sig -Name 'computecore_HcsCreateEmptyRuntimeStateFile' -Namespace Win32 -PassThru
# $api::HcsCreateEmptyRuntimeStateFile(runtimeStateFilePath)
#uselib "computecore.dll"
#func global HcsCreateEmptyRuntimeStateFile "HcsCreateEmptyRuntimeStateFile" sptr
; HcsCreateEmptyRuntimeStateFile runtimeStateFilePath   ; 戻り値は stat
; runtimeStateFilePath : LPCWSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "computecore.dll"
#cfunc global HcsCreateEmptyRuntimeStateFile "HcsCreateEmptyRuntimeStateFile" wstr
; res = HcsCreateEmptyRuntimeStateFile(runtimeStateFilePath)
; runtimeStateFilePath : LPCWSTR -> "wstr"
; HRESULT HcsCreateEmptyRuntimeStateFile(LPCWSTR runtimeStateFilePath)
#uselib "computecore.dll"
#cfunc global HcsCreateEmptyRuntimeStateFile "HcsCreateEmptyRuntimeStateFile" wstr
; res = HcsCreateEmptyRuntimeStateFile(runtimeStateFilePath)
; runtimeStateFilePath : LPCWSTR -> "wstr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	computecore = windows.NewLazySystemDLL("computecore.dll")
	procHcsCreateEmptyRuntimeStateFile = computecore.NewProc("HcsCreateEmptyRuntimeStateFile")
)

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