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