ホーム › System.HostComputeSystem › HcsGetServiceProperties
HcsGetServiceProperties
関数HCSサービスのプロパティを取得する。
シグネチャ
// computecore.dll
#include <windows.h>
HRESULT HcsGetServiceProperties(
LPCWSTR propertyQuery, // optional
LPWSTR* result
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| propertyQuery | LPCWSTR | inoptional |
| result | LPWSTR* | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// computecore.dll
#include <windows.h>
HRESULT HcsGetServiceProperties(
LPCWSTR propertyQuery, // optional
LPWSTR* result
);[DllImport("computecore.dll", ExactSpelling = true)]
static extern int HcsGetServiceProperties(
[MarshalAs(UnmanagedType.LPWStr)] string propertyQuery, // LPCWSTR optional
IntPtr result // LPWSTR* out
);<DllImport("computecore.dll", ExactSpelling:=True)>
Public Shared Function HcsGetServiceProperties(
<MarshalAs(UnmanagedType.LPWStr)> propertyQuery As String, ' LPCWSTR optional
result As IntPtr ' LPWSTR* out
) As Integer
End Function' propertyQuery : LPCWSTR optional
' result : LPWSTR* out
Declare PtrSafe Function HcsGetServiceProperties Lib "computecore" ( _
ByVal propertyQuery As LongPtr, _
ByVal result As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
HcsGetServiceProperties = ctypes.windll.computecore.HcsGetServiceProperties
HcsGetServiceProperties.restype = ctypes.c_int
HcsGetServiceProperties.argtypes = [
wintypes.LPCWSTR, # propertyQuery : LPCWSTR optional
ctypes.c_void_p, # result : LPWSTR* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('computecore.dll')
HcsGetServiceProperties = Fiddle::Function.new(
lib['HcsGetServiceProperties'],
[
Fiddle::TYPE_VOIDP, # propertyQuery : LPCWSTR optional
Fiddle::TYPE_VOIDP, # result : LPWSTR* out
],
Fiddle::TYPE_INT)#[link(name = "computecore")]
extern "system" {
fn HcsGetServiceProperties(
propertyQuery: *const u16, // LPCWSTR optional
result: *mut *mut u16 // LPWSTR* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("computecore.dll")]
public static extern int HcsGetServiceProperties([MarshalAs(UnmanagedType.LPWStr)] string propertyQuery, IntPtr result);
"@
$api = Add-Type -MemberDefinition $sig -Name 'computecore_HcsGetServiceProperties' -Namespace Win32 -PassThru
# $api::HcsGetServiceProperties(propertyQuery, result)#uselib "computecore.dll"
#func global HcsGetServiceProperties "HcsGetServiceProperties" sptr, sptr
; HcsGetServiceProperties propertyQuery, varptr(result) ; 戻り値は stat
; propertyQuery : LPCWSTR optional -> "sptr"
; result : LPWSTR* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "computecore.dll" #cfunc global HcsGetServiceProperties "HcsGetServiceProperties" wstr, var ; res = HcsGetServiceProperties(propertyQuery, result) ; propertyQuery : LPCWSTR optional -> "wstr" ; result : LPWSTR* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "computecore.dll" #cfunc global HcsGetServiceProperties "HcsGetServiceProperties" wstr, sptr ; res = HcsGetServiceProperties(propertyQuery, varptr(result)) ; propertyQuery : LPCWSTR optional -> "wstr" ; result : LPWSTR* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT HcsGetServiceProperties(LPCWSTR propertyQuery, LPWSTR* result) #uselib "computecore.dll" #cfunc global HcsGetServiceProperties "HcsGetServiceProperties" wstr, var ; res = HcsGetServiceProperties(propertyQuery, result) ; propertyQuery : LPCWSTR optional -> "wstr" ; result : LPWSTR* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT HcsGetServiceProperties(LPCWSTR propertyQuery, LPWSTR* result) #uselib "computecore.dll" #cfunc global HcsGetServiceProperties "HcsGetServiceProperties" wstr, intptr ; res = HcsGetServiceProperties(propertyQuery, varptr(result)) ; propertyQuery : LPCWSTR optional -> "wstr" ; result : LPWSTR* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
computecore = windows.NewLazySystemDLL("computecore.dll")
procHcsGetServiceProperties = computecore.NewProc("HcsGetServiceProperties")
)
// propertyQuery (LPCWSTR optional), result (LPWSTR* out)
r1, _, err := procHcsGetServiceProperties.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(propertyQuery))),
uintptr(result),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction HcsGetServiceProperties(
propertyQuery: PWideChar; // LPCWSTR optional
result: PPWideChar // LPWSTR* out
): Integer; stdcall;
external 'computecore.dll' name 'HcsGetServiceProperties';result := DllCall("computecore\HcsGetServiceProperties"
, "WStr", propertyQuery ; LPCWSTR optional
, "Ptr", result ; LPWSTR* out
, "Int") ; return: HRESULT●HcsGetServiceProperties(propertyQuery, result) = DLL("computecore.dll", "int HcsGetServiceProperties(char*, void*)")
# 呼び出し: HcsGetServiceProperties(propertyQuery, result)
# propertyQuery : LPCWSTR optional -> "char*"
# result : LPWSTR* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。