Win32 API 日本語リファレンス
ホームNetworking.Clustering › ClusterRegCloseBatch

ClusterRegCloseBatch

関数
クラスタレジストリバッチを確定または破棄して閉じる。
DLLCLUSAPI.dll呼出規約winapi対応OSwindowsserver2008

シグネチャ

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

INT ClusterRegCloseBatch(
    HREGBATCH hRegBatch,
    BOOL bCommit,
    INT* failedCommandNumber   // optional
);

パラメーター

名前方向
hRegBatchHREGBATCHin
bCommitBOOLin
failedCommandNumberINT*outoptional

戻り値の型: INT

各言語での呼び出し定義

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

INT ClusterRegCloseBatch(
    HREGBATCH hRegBatch,
    BOOL bCommit,
    INT* failedCommandNumber   // optional
);
[DllImport("CLUSAPI.dll", ExactSpelling = true)]
static extern int ClusterRegCloseBatch(
    IntPtr hRegBatch,   // HREGBATCH
    bool bCommit,   // BOOL
    IntPtr failedCommandNumber   // INT* optional, out
);
<DllImport("CLUSAPI.dll", ExactSpelling:=True)>
Public Shared Function ClusterRegCloseBatch(
    hRegBatch As IntPtr,   ' HREGBATCH
    bCommit As Boolean,   ' BOOL
    failedCommandNumber As IntPtr   ' INT* optional, out
) As Integer
End Function
' hRegBatch : HREGBATCH
' bCommit : BOOL
' failedCommandNumber : INT* optional, out
Declare PtrSafe Function ClusterRegCloseBatch Lib "clusapi" ( _
    ByVal hRegBatch As LongPtr, _
    ByVal bCommit As Long, _
    ByVal failedCommandNumber As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ClusterRegCloseBatch = ctypes.windll.clusapi.ClusterRegCloseBatch
ClusterRegCloseBatch.restype = ctypes.c_int
ClusterRegCloseBatch.argtypes = [
    ctypes.c_ssize_t,  # hRegBatch : HREGBATCH
    wintypes.BOOL,  # bCommit : BOOL
    ctypes.POINTER(ctypes.c_int),  # failedCommandNumber : INT* optional, out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('CLUSAPI.dll')
ClusterRegCloseBatch = Fiddle::Function.new(
  lib['ClusterRegCloseBatch'],
  [
    Fiddle::TYPE_INTPTR_T,  # hRegBatch : HREGBATCH
    Fiddle::TYPE_INT,  # bCommit : BOOL
    Fiddle::TYPE_VOIDP,  # failedCommandNumber : INT* optional, out
  ],
  Fiddle::TYPE_INT)
#[link(name = "clusapi")]
extern "system" {
    fn ClusterRegCloseBatch(
        hRegBatch: isize,  // HREGBATCH
        bCommit: i32,  // BOOL
        failedCommandNumber: *mut i32  // INT* optional, out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("CLUSAPI.dll")]
public static extern int ClusterRegCloseBatch(IntPtr hRegBatch, bool bCommit, IntPtr failedCommandNumber);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CLUSAPI_ClusterRegCloseBatch' -Namespace Win32 -PassThru
# $api::ClusterRegCloseBatch(hRegBatch, bCommit, failedCommandNumber)
#uselib "CLUSAPI.dll"
#func global ClusterRegCloseBatch "ClusterRegCloseBatch" sptr, sptr, sptr
; ClusterRegCloseBatch hRegBatch, bCommit, varptr(failedCommandNumber)   ; 戻り値は stat
; hRegBatch : HREGBATCH -> "sptr"
; bCommit : BOOL -> "sptr"
; failedCommandNumber : INT* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "CLUSAPI.dll"
#cfunc global ClusterRegCloseBatch "ClusterRegCloseBatch" sptr, int, var
; res = ClusterRegCloseBatch(hRegBatch, bCommit, failedCommandNumber)
; hRegBatch : HREGBATCH -> "sptr"
; bCommit : BOOL -> "int"
; failedCommandNumber : INT* optional, out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; INT ClusterRegCloseBatch(HREGBATCH hRegBatch, BOOL bCommit, INT* failedCommandNumber)
#uselib "CLUSAPI.dll"
#cfunc global ClusterRegCloseBatch "ClusterRegCloseBatch" intptr, int, var
; res = ClusterRegCloseBatch(hRegBatch, bCommit, failedCommandNumber)
; hRegBatch : HREGBATCH -> "intptr"
; bCommit : BOOL -> "int"
; failedCommandNumber : INT* optional, out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	clusapi = windows.NewLazySystemDLL("CLUSAPI.dll")
	procClusterRegCloseBatch = clusapi.NewProc("ClusterRegCloseBatch")
)

// hRegBatch (HREGBATCH), bCommit (BOOL), failedCommandNumber (INT* optional, out)
r1, _, err := procClusterRegCloseBatch.Call(
	uintptr(hRegBatch),
	uintptr(bCommit),
	uintptr(failedCommandNumber),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT
function ClusterRegCloseBatch(
  hRegBatch: NativeInt;   // HREGBATCH
  bCommit: BOOL;   // BOOL
  failedCommandNumber: Pointer   // INT* optional, out
): Integer; stdcall;
  external 'CLUSAPI.dll' name 'ClusterRegCloseBatch';
result := DllCall("CLUSAPI\ClusterRegCloseBatch"
    , "Ptr", hRegBatch   ; HREGBATCH
    , "Int", bCommit   ; BOOL
    , "Ptr", failedCommandNumber   ; INT* optional, out
    , "Int")   ; return: INT
●ClusterRegCloseBatch(hRegBatch, bCommit, failedCommandNumber) = DLL("CLUSAPI.dll", "int ClusterRegCloseBatch(int, bool, void*)")
# 呼び出し: ClusterRegCloseBatch(hRegBatch, bCommit, failedCommandNumber)
# hRegBatch : HREGBATCH -> "int"
# bCommit : BOOL -> "bool"
# failedCommandNumber : INT* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。