ホーム › System.HostComputeSystem › HcsGetOperationResult
HcsGetOperationResult
関数HCS操作の結果ドキュメントを取得する。
シグネチャ
// computecore.dll
#include <windows.h>
HRESULT HcsGetOperationResult(
HCS_OPERATION operation,
LPWSTR* resultDocument // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| operation | HCS_OPERATION | in | 結果を取得する対象のHCS操作ハンドル。 |
| resultDocument | LPWSTR* | outoptional | 操作結果のJSON文書を受け取るポインタ。要解放。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// computecore.dll
#include <windows.h>
HRESULT HcsGetOperationResult(
HCS_OPERATION operation,
LPWSTR* resultDocument // optional
);[DllImport("computecore.dll", ExactSpelling = true)]
static extern int HcsGetOperationResult(
IntPtr operation, // HCS_OPERATION
IntPtr resultDocument // LPWSTR* optional, out
);<DllImport("computecore.dll", ExactSpelling:=True)>
Public Shared Function HcsGetOperationResult(
operation As IntPtr, ' HCS_OPERATION
resultDocument As IntPtr ' LPWSTR* optional, out
) As Integer
End Function' operation : HCS_OPERATION
' resultDocument : LPWSTR* optional, out
Declare PtrSafe Function HcsGetOperationResult Lib "computecore" ( _
ByVal operation 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
HcsGetOperationResult = ctypes.windll.computecore.HcsGetOperationResult
HcsGetOperationResult.restype = ctypes.c_int
HcsGetOperationResult.argtypes = [
wintypes.HANDLE, # operation : HCS_OPERATION
ctypes.c_void_p, # resultDocument : LPWSTR* optional, out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('computecore.dll')
HcsGetOperationResult = Fiddle::Function.new(
lib['HcsGetOperationResult'],
[
Fiddle::TYPE_VOIDP, # operation : HCS_OPERATION
Fiddle::TYPE_VOIDP, # resultDocument : LPWSTR* optional, out
],
Fiddle::TYPE_INT)#[link(name = "computecore")]
extern "system" {
fn HcsGetOperationResult(
operation: *mut core::ffi::c_void, // HCS_OPERATION
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 HcsGetOperationResult(IntPtr operation, IntPtr resultDocument);
"@
$api = Add-Type -MemberDefinition $sig -Name 'computecore_HcsGetOperationResult' -Namespace Win32 -PassThru
# $api::HcsGetOperationResult(operation, resultDocument)#uselib "computecore.dll"
#func global HcsGetOperationResult "HcsGetOperationResult" sptr, sptr
; HcsGetOperationResult operation, varptr(resultDocument) ; 戻り値は stat
; operation : HCS_OPERATION -> "sptr"
; resultDocument : LPWSTR* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "computecore.dll" #cfunc global HcsGetOperationResult "HcsGetOperationResult" sptr, var ; res = HcsGetOperationResult(operation, resultDocument) ; operation : HCS_OPERATION -> "sptr" ; resultDocument : LPWSTR* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "computecore.dll" #cfunc global HcsGetOperationResult "HcsGetOperationResult" sptr, sptr ; res = HcsGetOperationResult(operation, varptr(resultDocument)) ; operation : HCS_OPERATION -> "sptr" ; resultDocument : LPWSTR* optional, out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT HcsGetOperationResult(HCS_OPERATION operation, LPWSTR* resultDocument) #uselib "computecore.dll" #cfunc global HcsGetOperationResult "HcsGetOperationResult" intptr, var ; res = HcsGetOperationResult(operation, resultDocument) ; operation : HCS_OPERATION -> "intptr" ; resultDocument : LPWSTR* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT HcsGetOperationResult(HCS_OPERATION operation, LPWSTR* resultDocument) #uselib "computecore.dll" #cfunc global HcsGetOperationResult "HcsGetOperationResult" intptr, intptr ; res = HcsGetOperationResult(operation, varptr(resultDocument)) ; operation : HCS_OPERATION -> "intptr" ; resultDocument : LPWSTR* optional, out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
computecore = windows.NewLazySystemDLL("computecore.dll")
procHcsGetOperationResult = computecore.NewProc("HcsGetOperationResult")
)
// operation (HCS_OPERATION), resultDocument (LPWSTR* optional, out)
r1, _, err := procHcsGetOperationResult.Call(
uintptr(operation),
uintptr(resultDocument),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction HcsGetOperationResult(
operation: THandle; // HCS_OPERATION
resultDocument: PPWideChar // LPWSTR* optional, out
): Integer; stdcall;
external 'computecore.dll' name 'HcsGetOperationResult';result := DllCall("computecore\HcsGetOperationResult"
, "Ptr", operation ; HCS_OPERATION
, "Ptr", resultDocument ; LPWSTR* optional, out
, "Int") ; return: HRESULT●HcsGetOperationResult(operation, resultDocument) = DLL("computecore.dll", "int HcsGetOperationResult(void*, void*)")
# 呼び出し: HcsGetOperationResult(operation, resultDocument)
# operation : HCS_OPERATION -> "void*"
# resultDocument : LPWSTR* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "computecore" fn HcsGetOperationResult(
operation: ?*anyopaque, // HCS_OPERATION
resultDocument: [*c][*c]u16 // LPWSTR* optional, out
) callconv(std.os.windows.WINAPI) i32;proc HcsGetOperationResult(
operation: pointer, # HCS_OPERATION
resultDocument: ptr WideCString # LPWSTR* optional, out
): int32 {.importc: "HcsGetOperationResult", stdcall, dynlib: "computecore.dll".}pragma(lib, "computecore");
extern(Windows)
int HcsGetOperationResult(
void* operation, // HCS_OPERATION
wchar** resultDocument // LPWSTR* optional, out
);ccall((:HcsGetOperationResult, "computecore.dll"), stdcall, Int32,
(Ptr{Cvoid}, Ptr{Ptr{UInt16}}),
operation, resultDocument)
# operation : HCS_OPERATION -> Ptr{Cvoid}
# resultDocument : LPWSTR* optional, out -> Ptr{Ptr{UInt16}}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t HcsGetOperationResult(
void* operation,
uint16_t** resultDocument);
]]
local computecore = ffi.load("computecore")
-- computecore.HcsGetOperationResult(operation, resultDocument)
-- operation : HCS_OPERATION
-- resultDocument : LPWSTR* optional, out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('computecore.dll');
const HcsGetOperationResult = lib.func('__stdcall', 'HcsGetOperationResult', 'int32_t', ['void *', 'void *']);
// HcsGetOperationResult(operation, resultDocument)
// operation : HCS_OPERATION -> 'void *'
// resultDocument : LPWSTR* optional, out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("computecore.dll", {
HcsGetOperationResult: { parameters: ["pointer", "pointer"], result: "i32" },
});
// lib.symbols.HcsGetOperationResult(operation, resultDocument)
// operation : HCS_OPERATION -> "pointer"
// resultDocument : LPWSTR* optional, out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t HcsGetOperationResult(
void* operation,
uint16_t** resultDocument);
C, "computecore.dll");
// $ffi->HcsGetOperationResult(operation, resultDocument);
// operation : HCS_OPERATION
// resultDocument : LPWSTR* optional, out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Computecore extends StdCallLibrary {
Computecore INSTANCE = Native.load("computecore", Computecore.class);
int HcsGetOperationResult(
Pointer operation, // HCS_OPERATION
PointerByReference resultDocument // LPWSTR* optional, out
);
}@[Link("computecore")]
lib Libcomputecore
fun HcsGetOperationResult = HcsGetOperationResult(
operation : Void*, # HCS_OPERATION
resultDocument : UInt16** # LPWSTR* optional, out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef HcsGetOperationResultNative = Int32 Function(Pointer<Void>, Pointer<Pointer<Utf16>>);
typedef HcsGetOperationResultDart = int Function(Pointer<Void>, Pointer<Pointer<Utf16>>);
final HcsGetOperationResult = DynamicLibrary.open('computecore.dll')
.lookupFunction<HcsGetOperationResultNative, HcsGetOperationResultDart>('HcsGetOperationResult');
// operation : HCS_OPERATION -> Pointer<Void>
// resultDocument : LPWSTR* optional, out -> Pointer<Pointer<Utf16>>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function HcsGetOperationResult(
operation: THandle; // HCS_OPERATION
resultDocument: PPWideChar // LPWSTR* optional, out
): Integer; stdcall;
external 'computecore.dll' name 'HcsGetOperationResult';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "HcsGetOperationResult"
c_HcsGetOperationResult :: Ptr () -> Ptr CWString -> IO Int32
-- operation : HCS_OPERATION -> Ptr ()
-- resultDocument : LPWSTR* optional, out -> Ptr CWString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let hcsgetoperationresult =
foreign "HcsGetOperationResult"
((ptr void) @-> (ptr (ptr uint16_t)) @-> returning int32_t)
(* operation : HCS_OPERATION -> (ptr void) *)
(* resultDocument : LPWSTR* optional, out -> (ptr (ptr uint16_t)) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library computecore (t "computecore.dll"))
(cffi:use-foreign-library computecore)
(cffi:defcfun ("HcsGetOperationResult" hcs-get-operation-result :convention :stdcall) :int32
(operation :pointer) ; HCS_OPERATION
(result-document :pointer)) ; LPWSTR* optional, out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $HcsGetOperationResult = Win32::API::More->new('computecore',
'int HcsGetOperationResult(HANDLE operation, LPVOID resultDocument)');
# my $ret = $HcsGetOperationResult->Call($operation, $resultDocument);
# operation : HCS_OPERATION -> HANDLE
# resultDocument : LPWSTR* optional, out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。