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