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

ClusterRegCloseBatchEx

関数
フラグ指定でクラスタレジストリバッチを閉じて確定する。
DLLCLUSAPI.dll呼出規約winapi対応OSwindowsserver2012

シグネチャ

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

INT ClusterRegCloseBatchEx(
    HREGBATCH hRegBatch,
    DWORD flags,
    INT* failedCommandNumber   // optional
);

パラメーター

名前方向
hRegBatchHREGBATCHin
flagsDWORDin
failedCommandNumberINT*outoptional

戻り値の型: INT

各言語での呼び出し定義

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

INT ClusterRegCloseBatchEx(
    HREGBATCH hRegBatch,
    DWORD flags,
    INT* failedCommandNumber   // optional
);
[DllImport("CLUSAPI.dll", ExactSpelling = true)]
static extern int ClusterRegCloseBatchEx(
    IntPtr hRegBatch,   // HREGBATCH
    uint flags,   // DWORD
    IntPtr failedCommandNumber   // INT* optional, out
);
<DllImport("CLUSAPI.dll", ExactSpelling:=True)>
Public Shared Function ClusterRegCloseBatchEx(
    hRegBatch As IntPtr,   ' HREGBATCH
    flags As UInteger,   ' DWORD
    failedCommandNumber As IntPtr   ' INT* optional, out
) As Integer
End Function
' hRegBatch : HREGBATCH
' flags : DWORD
' failedCommandNumber : INT* optional, out
Declare PtrSafe Function ClusterRegCloseBatchEx Lib "clusapi" ( _
    ByVal hRegBatch As LongPtr, _
    ByVal flags 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

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

lib = Fiddle.dlopen('CLUSAPI.dll')
ClusterRegCloseBatchEx = Fiddle::Function.new(
  lib['ClusterRegCloseBatchEx'],
  [
    Fiddle::TYPE_INTPTR_T,  # hRegBatch : HREGBATCH
    -Fiddle::TYPE_INT,  # flags : DWORD
    Fiddle::TYPE_VOIDP,  # failedCommandNumber : INT* optional, out
  ],
  Fiddle::TYPE_INT)
#[link(name = "clusapi")]
extern "system" {
    fn ClusterRegCloseBatchEx(
        hRegBatch: isize,  // HREGBATCH
        flags: u32,  // DWORD
        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 ClusterRegCloseBatchEx(IntPtr hRegBatch, uint flags, IntPtr failedCommandNumber);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CLUSAPI_ClusterRegCloseBatchEx' -Namespace Win32 -PassThru
# $api::ClusterRegCloseBatchEx(hRegBatch, flags, failedCommandNumber)
#uselib "CLUSAPI.dll"
#func global ClusterRegCloseBatchEx "ClusterRegCloseBatchEx" sptr, sptr, sptr
; ClusterRegCloseBatchEx hRegBatch, flags, varptr(failedCommandNumber)   ; 戻り値は stat
; hRegBatch : HREGBATCH -> "sptr"
; flags : DWORD -> "sptr"
; failedCommandNumber : INT* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "CLUSAPI.dll"
#cfunc global ClusterRegCloseBatchEx "ClusterRegCloseBatchEx" sptr, int, var
; res = ClusterRegCloseBatchEx(hRegBatch, flags, failedCommandNumber)
; hRegBatch : HREGBATCH -> "sptr"
; flags : DWORD -> "int"
; failedCommandNumber : INT* optional, out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; INT ClusterRegCloseBatchEx(HREGBATCH hRegBatch, DWORD flags, INT* failedCommandNumber)
#uselib "CLUSAPI.dll"
#cfunc global ClusterRegCloseBatchEx "ClusterRegCloseBatchEx" intptr, int, var
; res = ClusterRegCloseBatchEx(hRegBatch, flags, failedCommandNumber)
; hRegBatch : HREGBATCH -> "intptr"
; flags : DWORD -> "int"
; failedCommandNumber : INT* optional, out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	clusapi = windows.NewLazySystemDLL("CLUSAPI.dll")
	procClusterRegCloseBatchEx = clusapi.NewProc("ClusterRegCloseBatchEx")
)

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