ホーム › System.HostComputeSystem › HcsSignalProcess
HcsSignalProcess
関数コンピュートシステム内のプロセスにシグナルを送る。
シグネチャ
// computecore.dll
#include <windows.h>
HRESULT HcsSignalProcess(
HCS_PROCESS process,
HCS_OPERATION operation,
LPCWSTR options // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| process | HCS_PROCESS | in | シグナルを送る対象のプロセスハンドル。 |
| operation | HCS_OPERATION | in | 処理結果を受け取る非同期HCS操作のハンドル。 |
| options | LPCWSTR | inoptional | 送信するシグナル種別等を記述したJSON文字列。 |
戻り値の型: 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 // HRESULTfunction 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)。const std = @import("std");
extern "computecore" fn HcsSignalProcess(
process: ?*anyopaque, // HCS_PROCESS
operation: ?*anyopaque, // HCS_OPERATION
options: [*c]const u16 // LPCWSTR optional
) callconv(std.os.windows.WINAPI) i32;proc HcsSignalProcess(
process: pointer, # HCS_PROCESS
operation: pointer, # HCS_OPERATION
options: WideCString # LPCWSTR optional
): int32 {.importc: "HcsSignalProcess", stdcall, dynlib: "computecore.dll".}pragma(lib, "computecore");
extern(Windows)
int HcsSignalProcess(
void* process, // HCS_PROCESS
void* operation, // HCS_OPERATION
const(wchar)* options // LPCWSTR optional
);ccall((:HcsSignalProcess, "computecore.dll"), stdcall, Int32,
(Ptr{Cvoid}, Ptr{Cvoid}, Cwstring),
process, operation, options)
# process : HCS_PROCESS -> Ptr{Cvoid}
# operation : HCS_OPERATION -> Ptr{Cvoid}
# options : LPCWSTR optional -> Cwstring
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t HcsSignalProcess(
void* process,
void* operation,
const uint16_t* options);
]]
local computecore = ffi.load("computecore")
-- computecore.HcsSignalProcess(process, operation, options)
-- process : HCS_PROCESS
-- operation : HCS_OPERATION
-- options : LPCWSTR optional
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('computecore.dll');
const HcsSignalProcess = lib.func('__stdcall', 'HcsSignalProcess', 'int32_t', ['void *', 'void *', 'str16']);
// HcsSignalProcess(process, operation, options)
// process : HCS_PROCESS -> 'void *'
// operation : HCS_OPERATION -> 'void *'
// options : LPCWSTR optional -> 'str16'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("computecore.dll", {
HcsSignalProcess: { parameters: ["pointer", "pointer", "buffer"], result: "i32" },
});
// lib.symbols.HcsSignalProcess(process, operation, options)
// process : HCS_PROCESS -> "pointer"
// operation : HCS_OPERATION -> "pointer"
// options : LPCWSTR optional -> "buffer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t HcsSignalProcess(
void* process,
void* operation,
const uint16_t* options);
C, "computecore.dll");
// $ffi->HcsSignalProcess(process, operation, options);
// process : HCS_PROCESS
// operation : HCS_OPERATION
// options : LPCWSTR optional
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Computecore extends StdCallLibrary {
Computecore INSTANCE = Native.load("computecore", Computecore.class);
int HcsSignalProcess(
Pointer process, // HCS_PROCESS
Pointer operation, // HCS_OPERATION
WString options // LPCWSTR optional
);
}@[Link("computecore")]
lib Libcomputecore
fun HcsSignalProcess = HcsSignalProcess(
process : Void*, # HCS_PROCESS
operation : Void*, # HCS_OPERATION
options : UInt16* # LPCWSTR optional
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef HcsSignalProcessNative = Int32 Function(Pointer<Void>, Pointer<Void>, Pointer<Utf16>);
typedef HcsSignalProcessDart = int Function(Pointer<Void>, Pointer<Void>, Pointer<Utf16>);
final HcsSignalProcess = DynamicLibrary.open('computecore.dll')
.lookupFunction<HcsSignalProcessNative, HcsSignalProcessDart>('HcsSignalProcess');
// process : HCS_PROCESS -> Pointer<Void>
// operation : HCS_OPERATION -> Pointer<Void>
// options : LPCWSTR optional -> Pointer<Utf16>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function HcsSignalProcess(
process: THandle; // HCS_PROCESS
operation: THandle; // HCS_OPERATION
options: PWideChar // LPCWSTR optional
): Integer; stdcall;
external 'computecore.dll' name 'HcsSignalProcess';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "HcsSignalProcess"
c_HcsSignalProcess :: Ptr () -> Ptr () -> CWString -> IO Int32
-- process : HCS_PROCESS -> Ptr ()
-- operation : HCS_OPERATION -> Ptr ()
-- options : LPCWSTR optional -> CWString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let hcssignalprocess =
foreign "HcsSignalProcess"
((ptr void) @-> (ptr void) @-> (ptr uint16_t) @-> returning int32_t)
(* process : HCS_PROCESS -> (ptr void) *)
(* operation : HCS_OPERATION -> (ptr void) *)
(* options : LPCWSTR optional -> (ptr uint16_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library computecore (t "computecore.dll"))
(cffi:use-foreign-library computecore)
(cffi:defcfun ("HcsSignalProcess" hcs-signal-process :convention :stdcall) :int32
(process :pointer) ; HCS_PROCESS
(operation :pointer) ; HCS_OPERATION
(options (:string :encoding :utf-16le))) ; LPCWSTR optional
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $HcsSignalProcess = Win32::API::More->new('computecore',
'int HcsSignalProcess(HANDLE process, HANDLE operation, LPCWSTR options)');
# my $ret = $HcsSignalProcess->Call($process, $operation, $options);
# process : HCS_PROCESS -> HANDLE
# operation : HCS_OPERATION -> HANDLE
# options : LPCWSTR optional -> LPCWSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。