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

HcsSignalProcess

関数
コンピュートシステム内のプロセスにシグナルを送る。
DLLcomputecore.dll呼出規約winapi

シグネチャ

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

HRESULT HcsSignalProcess(
    HCS_PROCESS process,
    HCS_OPERATION operation,
    LPCWSTR options   // optional
);

パラメーター

名前方向
processHCS_PROCESSin
operationHCS_OPERATIONin
optionsLPCWSTRinoptional

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

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

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

var (
	computecore = windows.NewLazySystemDLL("computecore.dll")
	procHcsSignalProcess = computecore.NewProc("HcsSignalProcess")
)

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