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

HcsPauseComputeSystem

関数
コンピュートシステムを一時停止する。
DLLcomputecore.dll呼出規約winapi

シグネチャ

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

HRESULT HcsPauseComputeSystem(
    HCS_SYSTEM computeSystem,
    HCS_OPERATION operation,
    LPCWSTR options   // optional
);

パラメーター

名前方向
computeSystemHCS_SYSTEMin
operationHCS_OPERATIONin
optionsLPCWSTRinoptional

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT HcsPauseComputeSystem(
    HCS_SYSTEM computeSystem,
    HCS_OPERATION operation,
    LPCWSTR options   // optional
);
[DllImport("computecore.dll", ExactSpelling = true)]
static extern int HcsPauseComputeSystem(
    IntPtr computeSystem,   // HCS_SYSTEM
    IntPtr operation,   // HCS_OPERATION
    [MarshalAs(UnmanagedType.LPWStr)] string options   // LPCWSTR optional
);
<DllImport("computecore.dll", ExactSpelling:=True)>
Public Shared Function HcsPauseComputeSystem(
    computeSystem As IntPtr,   ' HCS_SYSTEM
    operation As IntPtr,   ' HCS_OPERATION
    <MarshalAs(UnmanagedType.LPWStr)> options As String   ' LPCWSTR optional
) As Integer
End Function
' computeSystem : HCS_SYSTEM
' operation : HCS_OPERATION
' options : LPCWSTR optional
Declare PtrSafe Function HcsPauseComputeSystem Lib "computecore" ( _
    ByVal computeSystem As LongPtr, _
    ByVal operation 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

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

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

var (
	computecore = windows.NewLazySystemDLL("computecore.dll")
	procHcsPauseComputeSystem = computecore.NewProc("HcsPauseComputeSystem")
)

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