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

HcsModifyComputeSystem

関数
コンピュートシステムの構成を変更する。
DLLcomputecore.dll呼出規約winapi

シグネチャ

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

HRESULT HcsModifyComputeSystem(
    HCS_SYSTEM computeSystem,
    HCS_OPERATION operation,
    LPCWSTR configuration,
    HANDLE identity   // optional
);

パラメーター

名前方向
computeSystemHCS_SYSTEMin
operationHCS_OPERATIONin
configurationLPCWSTRin
identityHANDLEinoptional

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

HcsModifyComputeSystem = ctypes.windll.computecore.HcsModifyComputeSystem
HcsModifyComputeSystem.restype = ctypes.c_int
HcsModifyComputeSystem.argtypes = [
    wintypes.HANDLE,  # computeSystem : HCS_SYSTEM
    wintypes.HANDLE,  # operation : HCS_OPERATION
    wintypes.LPCWSTR,  # configuration : LPCWSTR
    wintypes.HANDLE,  # identity : HANDLE optional
]
require 'fiddle'
require 'fiddle/import'

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

var (
	computecore = windows.NewLazySystemDLL("computecore.dll")
	procHcsModifyComputeSystem = computecore.NewProc("HcsModifyComputeSystem")
)

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