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