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

HcsEnumerateComputeSystems

関数
クエリに一致するコンピュートシステムを列挙する。
DLLcomputecore.dll呼出規約winapi

シグネチャ

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

HRESULT HcsEnumerateComputeSystems(
    LPCWSTR query,   // optional
    HCS_OPERATION operation
);

パラメーター

名前方向
queryLPCWSTRinoptional
operationHCS_OPERATIONin

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT HcsEnumerateComputeSystems(
    LPCWSTR query,   // optional
    HCS_OPERATION operation
);
[DllImport("computecore.dll", ExactSpelling = true)]
static extern int HcsEnumerateComputeSystems(
    [MarshalAs(UnmanagedType.LPWStr)] string query,   // LPCWSTR optional
    IntPtr operation   // HCS_OPERATION
);
<DllImport("computecore.dll", ExactSpelling:=True)>
Public Shared Function HcsEnumerateComputeSystems(
    <MarshalAs(UnmanagedType.LPWStr)> query As String,   ' LPCWSTR optional
    operation As IntPtr   ' HCS_OPERATION
) As Integer
End Function
' query : LPCWSTR optional
' operation : HCS_OPERATION
Declare PtrSafe Function HcsEnumerateComputeSystems Lib "computecore" ( _
    ByVal query As LongPtr, _
    ByVal operation As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

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

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

var (
	computecore = windows.NewLazySystemDLL("computecore.dll")
	procHcsEnumerateComputeSystems = computecore.NewProc("HcsEnumerateComputeSystems")
)

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