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

HcsGetOperationProperties

関数
HCS操作のプロパティを取得する。
DLLcomputecore.dll呼出規約winapi

シグネチャ

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

HRESULT HcsGetOperationProperties(
    HCS_OPERATION operation,
    LPCWSTR options,
    LPWSTR* resultDocument
);

パラメーター

名前方向
operationHCS_OPERATIONin
optionsLPCWSTRin
resultDocumentLPWSTR*out

戻り値の型: 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 方式にも切替可。
出力引数:
; 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 方式にも切替可。
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   // HRESULT
function 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)。