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

HcsWaitForOperationResultAndProcessInfo

関数
HCS操作の完了を待ち結果とプロセス情報を取得する。
DLLcomputecore.dll呼出規約winapi

シグネチャ

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

HRESULT HcsWaitForOperationResultAndProcessInfo(
    HCS_OPERATION operation,
    DWORD timeoutMs,
    HCS_PROCESS_INFORMATION* processInformation,   // optional
    LPWSTR* resultDocument   // optional
);

パラメーター

名前方向
operationHCS_OPERATIONin
timeoutMsDWORDin
processInformationHCS_PROCESS_INFORMATION*outoptional
resultDocumentLPWSTR*outoptional

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT HcsWaitForOperationResultAndProcessInfo(
    HCS_OPERATION operation,
    DWORD timeoutMs,
    HCS_PROCESS_INFORMATION* processInformation,   // optional
    LPWSTR* resultDocument   // optional
);
[DllImport("computecore.dll", ExactSpelling = true)]
static extern int HcsWaitForOperationResultAndProcessInfo(
    IntPtr operation,   // HCS_OPERATION
    uint timeoutMs,   // DWORD
    IntPtr processInformation,   // HCS_PROCESS_INFORMATION* optional, out
    IntPtr resultDocument   // LPWSTR* optional, out
);
<DllImport("computecore.dll", ExactSpelling:=True)>
Public Shared Function HcsWaitForOperationResultAndProcessInfo(
    operation As IntPtr,   ' HCS_OPERATION
    timeoutMs As UInteger,   ' DWORD
    processInformation As IntPtr,   ' HCS_PROCESS_INFORMATION* optional, out
    resultDocument As IntPtr   ' LPWSTR* optional, out
) As Integer
End Function
' operation : HCS_OPERATION
' timeoutMs : DWORD
' processInformation : HCS_PROCESS_INFORMATION* optional, out
' resultDocument : LPWSTR* optional, out
Declare PtrSafe Function HcsWaitForOperationResultAndProcessInfo Lib "computecore" ( _
    ByVal operation As LongPtr, _
    ByVal timeoutMs As Long, _
    ByVal processInformation As LongPtr, _
    ByVal resultDocument As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

HcsWaitForOperationResultAndProcessInfo = ctypes.windll.computecore.HcsWaitForOperationResultAndProcessInfo
HcsWaitForOperationResultAndProcessInfo.restype = ctypes.c_int
HcsWaitForOperationResultAndProcessInfo.argtypes = [
    wintypes.HANDLE,  # operation : HCS_OPERATION
    wintypes.DWORD,  # timeoutMs : DWORD
    ctypes.c_void_p,  # processInformation : HCS_PROCESS_INFORMATION* optional, out
    ctypes.c_void_p,  # resultDocument : LPWSTR* optional, out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('computecore.dll')
HcsWaitForOperationResultAndProcessInfo = Fiddle::Function.new(
  lib['HcsWaitForOperationResultAndProcessInfo'],
  [
    Fiddle::TYPE_VOIDP,  # operation : HCS_OPERATION
    -Fiddle::TYPE_INT,  # timeoutMs : DWORD
    Fiddle::TYPE_VOIDP,  # processInformation : HCS_PROCESS_INFORMATION* optional, out
    Fiddle::TYPE_VOIDP,  # resultDocument : LPWSTR* optional, out
  ],
  Fiddle::TYPE_INT)
#[link(name = "computecore")]
extern "system" {
    fn HcsWaitForOperationResultAndProcessInfo(
        operation: *mut core::ffi::c_void,  // HCS_OPERATION
        timeoutMs: u32,  // DWORD
        processInformation: *mut HCS_PROCESS_INFORMATION,  // HCS_PROCESS_INFORMATION* optional, out
        resultDocument: *mut *mut u16  // LPWSTR* optional, out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("computecore.dll")]
public static extern int HcsWaitForOperationResultAndProcessInfo(IntPtr operation, uint timeoutMs, IntPtr processInformation, IntPtr resultDocument);
"@
$api = Add-Type -MemberDefinition $sig -Name 'computecore_HcsWaitForOperationResultAndProcessInfo' -Namespace Win32 -PassThru
# $api::HcsWaitForOperationResultAndProcessInfo(operation, timeoutMs, processInformation, resultDocument)
#uselib "computecore.dll"
#func global HcsWaitForOperationResultAndProcessInfo "HcsWaitForOperationResultAndProcessInfo" sptr, sptr, sptr, sptr
; HcsWaitForOperationResultAndProcessInfo operation, timeoutMs, varptr(processInformation), varptr(resultDocument)   ; 戻り値は stat
; operation : HCS_OPERATION -> "sptr"
; timeoutMs : DWORD -> "sptr"
; processInformation : HCS_PROCESS_INFORMATION* optional, out -> "sptr"
; resultDocument : LPWSTR* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "computecore.dll"
#cfunc global HcsWaitForOperationResultAndProcessInfo "HcsWaitForOperationResultAndProcessInfo" sptr, int, var, var
; res = HcsWaitForOperationResultAndProcessInfo(operation, timeoutMs, processInformation, resultDocument)
; operation : HCS_OPERATION -> "sptr"
; timeoutMs : DWORD -> "int"
; processInformation : HCS_PROCESS_INFORMATION* optional, out -> "var"
; resultDocument : LPWSTR* optional, out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT HcsWaitForOperationResultAndProcessInfo(HCS_OPERATION operation, DWORD timeoutMs, HCS_PROCESS_INFORMATION* processInformation, LPWSTR* resultDocument)
#uselib "computecore.dll"
#cfunc global HcsWaitForOperationResultAndProcessInfo "HcsWaitForOperationResultAndProcessInfo" intptr, int, var, var
; res = HcsWaitForOperationResultAndProcessInfo(operation, timeoutMs, processInformation, resultDocument)
; operation : HCS_OPERATION -> "intptr"
; timeoutMs : DWORD -> "int"
; processInformation : HCS_PROCESS_INFORMATION* optional, out -> "var"
; resultDocument : LPWSTR* optional, out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	computecore = windows.NewLazySystemDLL("computecore.dll")
	procHcsWaitForOperationResultAndProcessInfo = computecore.NewProc("HcsWaitForOperationResultAndProcessInfo")
)

// operation (HCS_OPERATION), timeoutMs (DWORD), processInformation (HCS_PROCESS_INFORMATION* optional, out), resultDocument (LPWSTR* optional, out)
r1, _, err := procHcsWaitForOperationResultAndProcessInfo.Call(
	uintptr(operation),
	uintptr(timeoutMs),
	uintptr(processInformation),
	uintptr(resultDocument),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function HcsWaitForOperationResultAndProcessInfo(
  operation: THandle;   // HCS_OPERATION
  timeoutMs: DWORD;   // DWORD
  processInformation: Pointer;   // HCS_PROCESS_INFORMATION* optional, out
  resultDocument: PPWideChar   // LPWSTR* optional, out
): Integer; stdcall;
  external 'computecore.dll' name 'HcsWaitForOperationResultAndProcessInfo';
result := DllCall("computecore\HcsWaitForOperationResultAndProcessInfo"
    , "Ptr", operation   ; HCS_OPERATION
    , "UInt", timeoutMs   ; DWORD
    , "Ptr", processInformation   ; HCS_PROCESS_INFORMATION* optional, out
    , "Ptr", resultDocument   ; LPWSTR* optional, out
    , "Int")   ; return: HRESULT
●HcsWaitForOperationResultAndProcessInfo(operation, timeoutMs, processInformation, resultDocument) = DLL("computecore.dll", "int HcsWaitForOperationResultAndProcessInfo(void*, dword, void*, void*)")
# 呼び出し: HcsWaitForOperationResultAndProcessInfo(operation, timeoutMs, processInformation, resultDocument)
# operation : HCS_OPERATION -> "void*"
# timeoutMs : DWORD -> "dword"
# processInformation : HCS_PROCESS_INFORMATION* optional, out -> "void*"
# resultDocument : LPWSTR* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。