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

HcsEnumerateComputeSystemsInNamespace

関数
指定名前空間内のコンピュートシステムを列挙する。
DLLcomputecore.dll呼出規約winapi

シグネチャ

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

HRESULT HcsEnumerateComputeSystemsInNamespace(
    LPCWSTR idNamespace,
    LPCWSTR query,   // optional
    HCS_OPERATION operation
);

パラメーター

名前方向
idNamespaceLPCWSTRin
queryLPCWSTRinoptional
operationHCS_OPERATIONin

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT HcsEnumerateComputeSystemsInNamespace(
    LPCWSTR idNamespace,
    LPCWSTR query,   // optional
    HCS_OPERATION operation
);
[DllImport("computecore.dll", ExactSpelling = true)]
static extern int HcsEnumerateComputeSystemsInNamespace(
    [MarshalAs(UnmanagedType.LPWStr)] string idNamespace,   // LPCWSTR
    [MarshalAs(UnmanagedType.LPWStr)] string query,   // LPCWSTR optional
    IntPtr operation   // HCS_OPERATION
);
<DllImport("computecore.dll", ExactSpelling:=True)>
Public Shared Function HcsEnumerateComputeSystemsInNamespace(
    <MarshalAs(UnmanagedType.LPWStr)> idNamespace As String,   ' LPCWSTR
    <MarshalAs(UnmanagedType.LPWStr)> query As String,   ' LPCWSTR optional
    operation As IntPtr   ' HCS_OPERATION
) As Integer
End Function
' idNamespace : LPCWSTR
' query : LPCWSTR optional
' operation : HCS_OPERATION
Declare PtrSafe Function HcsEnumerateComputeSystemsInNamespace Lib "computecore" ( _
    ByVal idNamespace As LongPtr, _
    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

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

lib = Fiddle.dlopen('computecore.dll')
HcsEnumerateComputeSystemsInNamespace = Fiddle::Function.new(
  lib['HcsEnumerateComputeSystemsInNamespace'],
  [
    Fiddle::TYPE_VOIDP,  # idNamespace : LPCWSTR
    Fiddle::TYPE_VOIDP,  # query : LPCWSTR optional
    Fiddle::TYPE_VOIDP,  # operation : HCS_OPERATION
  ],
  Fiddle::TYPE_INT)
#[link(name = "computecore")]
extern "system" {
    fn HcsEnumerateComputeSystemsInNamespace(
        idNamespace: *const u16,  // LPCWSTR
        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 HcsEnumerateComputeSystemsInNamespace([MarshalAs(UnmanagedType.LPWStr)] string idNamespace, [MarshalAs(UnmanagedType.LPWStr)] string query, IntPtr operation);
"@
$api = Add-Type -MemberDefinition $sig -Name 'computecore_HcsEnumerateComputeSystemsInNamespace' -Namespace Win32 -PassThru
# $api::HcsEnumerateComputeSystemsInNamespace(idNamespace, query, operation)
#uselib "computecore.dll"
#func global HcsEnumerateComputeSystemsInNamespace "HcsEnumerateComputeSystemsInNamespace" sptr, sptr, sptr
; HcsEnumerateComputeSystemsInNamespace idNamespace, query, operation   ; 戻り値は stat
; idNamespace : LPCWSTR -> "sptr"
; query : LPCWSTR optional -> "sptr"
; operation : HCS_OPERATION -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "computecore.dll"
#cfunc global HcsEnumerateComputeSystemsInNamespace "HcsEnumerateComputeSystemsInNamespace" wstr, wstr, sptr
; res = HcsEnumerateComputeSystemsInNamespace(idNamespace, query, operation)
; idNamespace : LPCWSTR -> "wstr"
; query : LPCWSTR optional -> "wstr"
; operation : HCS_OPERATION -> "sptr"
; HRESULT HcsEnumerateComputeSystemsInNamespace(LPCWSTR idNamespace, LPCWSTR query, HCS_OPERATION operation)
#uselib "computecore.dll"
#cfunc global HcsEnumerateComputeSystemsInNamespace "HcsEnumerateComputeSystemsInNamespace" wstr, wstr, intptr
; res = HcsEnumerateComputeSystemsInNamespace(idNamespace, query, operation)
; idNamespace : LPCWSTR -> "wstr"
; query : LPCWSTR optional -> "wstr"
; operation : HCS_OPERATION -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	computecore = windows.NewLazySystemDLL("computecore.dll")
	procHcsEnumerateComputeSystemsInNamespace = computecore.NewProc("HcsEnumerateComputeSystemsInNamespace")
)

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