ホーム › Networking.Clustering › ClusterRegCloseBatch
ClusterRegCloseBatch
関数クラスタレジストリバッチを確定または破棄して閉じる。
シグネチャ
// CLUSAPI.dll
#include <windows.h>
INT ClusterRegCloseBatch(
HREGBATCH hRegBatch,
BOOL bCommit,
INT* failedCommandNumber // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hRegBatch | HREGBATCH | in | 閉じる対象のバッチハンドル。 |
| bCommit | BOOL | in | TRUEで蓄積したコマンドをコミット、FALSEで破棄する。 |
| failedCommandNumber | INT* | outoptional | 失敗したコマンドの番号を受け取るINTポインタ。 |
戻り値の型: 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 方式にも切替可。#uselib "CLUSAPI.dll" #cfunc global ClusterRegCloseBatch "ClusterRegCloseBatch" sptr, int, sptr ; res = ClusterRegCloseBatch(hRegBatch, bCommit, varptr(failedCommandNumber)) ; hRegBatch : HREGBATCH -> "sptr" ; bCommit : BOOL -> "int" ; failedCommandNumber : INT* optional, out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは 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 方式にも切替可。; INT ClusterRegCloseBatch(HREGBATCH hRegBatch, BOOL bCommit, INT* failedCommandNumber) #uselib "CLUSAPI.dll" #cfunc global ClusterRegCloseBatch "ClusterRegCloseBatch" intptr, int, intptr ; res = ClusterRegCloseBatch(hRegBatch, bCommit, varptr(failedCommandNumber)) ; hRegBatch : HREGBATCH -> "intptr" ; bCommit : BOOL -> "int" ; failedCommandNumber : INT* optional, out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは 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 // INTfunction 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)。const std = @import("std");
extern "clusapi" fn ClusterRegCloseBatch(
hRegBatch: isize, // HREGBATCH
bCommit: i32, // BOOL
failedCommandNumber: [*c]i32 // INT* optional, out
) callconv(std.os.windows.WINAPI) i32;proc ClusterRegCloseBatch(
hRegBatch: int, # HREGBATCH
bCommit: int32, # BOOL
failedCommandNumber: ptr int32 # INT* optional, out
): int32 {.importc: "ClusterRegCloseBatch", stdcall, dynlib: "CLUSAPI.dll".}pragma(lib, "clusapi");
extern(Windows)
int ClusterRegCloseBatch(
ptrdiff_t hRegBatch, // HREGBATCH
int bCommit, // BOOL
int* failedCommandNumber // INT* optional, out
);ccall((:ClusterRegCloseBatch, "CLUSAPI.dll"), stdcall, Int32,
(Int, Int32, Ptr{Int32}),
hRegBatch, bCommit, failedCommandNumber)
# hRegBatch : HREGBATCH -> Int
# bCommit : BOOL -> Int32
# failedCommandNumber : INT* optional, out -> Ptr{Int32}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t ClusterRegCloseBatch(
intptr_t hRegBatch,
int32_t bCommit,
int32_t* failedCommandNumber);
]]
local clusapi = ffi.load("clusapi")
-- clusapi.ClusterRegCloseBatch(hRegBatch, bCommit, failedCommandNumber)
-- hRegBatch : HREGBATCH
-- bCommit : BOOL
-- failedCommandNumber : INT* optional, out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('CLUSAPI.dll');
const ClusterRegCloseBatch = lib.func('__stdcall', 'ClusterRegCloseBatch', 'int32_t', ['intptr_t', 'int32_t', 'int32_t *']);
// ClusterRegCloseBatch(hRegBatch, bCommit, failedCommandNumber)
// hRegBatch : HREGBATCH -> 'intptr_t'
// bCommit : BOOL -> 'int32_t'
// failedCommandNumber : INT* optional, out -> 'int32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("CLUSAPI.dll", {
ClusterRegCloseBatch: { parameters: ["isize", "i32", "pointer"], result: "i32" },
});
// lib.symbols.ClusterRegCloseBatch(hRegBatch, bCommit, failedCommandNumber)
// hRegBatch : HREGBATCH -> "isize"
// bCommit : BOOL -> "i32"
// failedCommandNumber : INT* optional, out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t ClusterRegCloseBatch(
intptr_t hRegBatch,
int32_t bCommit,
int32_t* failedCommandNumber);
C, "CLUSAPI.dll");
// $ffi->ClusterRegCloseBatch(hRegBatch, bCommit, failedCommandNumber);
// hRegBatch : HREGBATCH
// bCommit : BOOL
// failedCommandNumber : INT* optional, out
// 構造体/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 Clusapi extends StdCallLibrary {
Clusapi INSTANCE = Native.load("clusapi", Clusapi.class);
int ClusterRegCloseBatch(
long hRegBatch, // HREGBATCH
boolean bCommit, // BOOL
IntByReference failedCommandNumber // INT* optional, out
);
}@[Link("clusapi")]
lib LibCLUSAPI
fun ClusterRegCloseBatch = ClusterRegCloseBatch(
hRegBatch : LibC::SSizeT, # HREGBATCH
bCommit : Int32, # BOOL
failedCommandNumber : Int32* # INT* optional, out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef ClusterRegCloseBatchNative = Int32 Function(IntPtr, Int32, Pointer<Int32>);
typedef ClusterRegCloseBatchDart = int Function(int, int, Pointer<Int32>);
final ClusterRegCloseBatch = DynamicLibrary.open('CLUSAPI.dll')
.lookupFunction<ClusterRegCloseBatchNative, ClusterRegCloseBatchDart>('ClusterRegCloseBatch');
// hRegBatch : HREGBATCH -> IntPtr
// bCommit : BOOL -> Int32
// failedCommandNumber : INT* optional, out -> Pointer<Int32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function ClusterRegCloseBatch(
hRegBatch: NativeInt; // HREGBATCH
bCommit: BOOL; // BOOL
failedCommandNumber: Pointer // INT* optional, out
): Integer; stdcall;
external 'CLUSAPI.dll' name 'ClusterRegCloseBatch';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "ClusterRegCloseBatch"
c_ClusterRegCloseBatch :: CIntPtr -> CInt -> Ptr Int32 -> IO Int32
-- hRegBatch : HREGBATCH -> CIntPtr
-- bCommit : BOOL -> CInt
-- failedCommandNumber : INT* optional, out -> Ptr Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let clusterregclosebatch =
foreign "ClusterRegCloseBatch"
(intptr_t @-> int32_t @-> (ptr int32_t) @-> returning int32_t)
(* hRegBatch : HREGBATCH -> intptr_t *)
(* bCommit : BOOL -> int32_t *)
(* failedCommandNumber : INT* optional, out -> (ptr int32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library clusapi (t "CLUSAPI.dll"))
(cffi:use-foreign-library clusapi)
(cffi:defcfun ("ClusterRegCloseBatch" cluster-reg-close-batch :convention :stdcall) :int32
(h-reg-batch :int64) ; HREGBATCH
(b-commit :int32) ; BOOL
(failed-command-number :pointer)) ; INT* optional, out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $ClusterRegCloseBatch = Win32::API::More->new('CLUSAPI',
'int ClusterRegCloseBatch(LPARAM hRegBatch, BOOL bCommit, LPVOID failedCommandNumber)');
# my $ret = $ClusterRegCloseBatch->Call($hRegBatch, $bCommit, $failedCommandNumber);
# hRegBatch : HREGBATCH -> LPARAM
# bCommit : BOOL -> BOOL
# failedCommandNumber : INT* optional, out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
類似 API
- f ClusterRegCloseBatchEx — フラグ指定でクラスタレジストリバッチを閉じて確定する。