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