ホーム › Networking.Clustering › ClusterRegCloseReadBatchEx
ClusterRegCloseReadBatchEx
関数フラグ指定で読み取りバッチを閉じ応答を取得する。
シグネチャ
// CLUSAPI.dll
#include <windows.h>
INT ClusterRegCloseReadBatchEx(
HREGREADBATCH hRegReadBatch,
DWORD flags,
HREGREADBATCHREPLY* phRegReadBatchReply
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hRegReadBatch | HREGREADBATCH | in | 閉じて実行する対象の読み取りバッチハンドル。 |
| flags | DWORD | in | 読み取りバッチの閉鎖動作を制御するフラグ。 |
| phRegReadBatchReply | HREGREADBATCHREPLY* | out | 読み取り結果を含む応答ハンドルを受け取るポインタ。 |
戻り値の型: INT
各言語での呼び出し定義
// CLUSAPI.dll
#include <windows.h>
INT ClusterRegCloseReadBatchEx(
HREGREADBATCH hRegReadBatch,
DWORD flags,
HREGREADBATCHREPLY* phRegReadBatchReply
);[DllImport("CLUSAPI.dll", ExactSpelling = true)]
static extern int ClusterRegCloseReadBatchEx(
IntPtr hRegReadBatch, // HREGREADBATCH
uint flags, // DWORD
out IntPtr phRegReadBatchReply // HREGREADBATCHREPLY* out
);<DllImport("CLUSAPI.dll", ExactSpelling:=True)>
Public Shared Function ClusterRegCloseReadBatchEx(
hRegReadBatch As IntPtr, ' HREGREADBATCH
flags As UInteger, ' DWORD
<Out> ByRef phRegReadBatchReply As IntPtr ' HREGREADBATCHREPLY* out
) As Integer
End Function' hRegReadBatch : HREGREADBATCH
' flags : DWORD
' phRegReadBatchReply : HREGREADBATCHREPLY* out
Declare PtrSafe Function ClusterRegCloseReadBatchEx Lib "clusapi" ( _
ByVal hRegReadBatch As LongPtr, _
ByVal flags As Long, _
ByRef phRegReadBatchReply As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ClusterRegCloseReadBatchEx = ctypes.windll.clusapi.ClusterRegCloseReadBatchEx
ClusterRegCloseReadBatchEx.restype = ctypes.c_int
ClusterRegCloseReadBatchEx.argtypes = [
ctypes.c_ssize_t, # hRegReadBatch : HREGREADBATCH
wintypes.DWORD, # flags : DWORD
ctypes.c_void_p, # phRegReadBatchReply : HREGREADBATCHREPLY* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('CLUSAPI.dll')
ClusterRegCloseReadBatchEx = Fiddle::Function.new(
lib['ClusterRegCloseReadBatchEx'],
[
Fiddle::TYPE_INTPTR_T, # hRegReadBatch : HREGREADBATCH
-Fiddle::TYPE_INT, # flags : DWORD
Fiddle::TYPE_VOIDP, # phRegReadBatchReply : HREGREADBATCHREPLY* out
],
Fiddle::TYPE_INT)#[link(name = "clusapi")]
extern "system" {
fn ClusterRegCloseReadBatchEx(
hRegReadBatch: isize, // HREGREADBATCH
flags: u32, // DWORD
phRegReadBatchReply: *mut isize // HREGREADBATCHREPLY* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("CLUSAPI.dll")]
public static extern int ClusterRegCloseReadBatchEx(IntPtr hRegReadBatch, uint flags, out IntPtr phRegReadBatchReply);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CLUSAPI_ClusterRegCloseReadBatchEx' -Namespace Win32 -PassThru
# $api::ClusterRegCloseReadBatchEx(hRegReadBatch, flags, phRegReadBatchReply)#uselib "CLUSAPI.dll"
#func global ClusterRegCloseReadBatchEx "ClusterRegCloseReadBatchEx" sptr, sptr, sptr
; ClusterRegCloseReadBatchEx hRegReadBatch, flags, varptr(phRegReadBatchReply) ; 戻り値は stat
; hRegReadBatch : HREGREADBATCH -> "sptr"
; flags : DWORD -> "sptr"
; phRegReadBatchReply : HREGREADBATCHREPLY* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "CLUSAPI.dll" #cfunc global ClusterRegCloseReadBatchEx "ClusterRegCloseReadBatchEx" sptr, int, var ; res = ClusterRegCloseReadBatchEx(hRegReadBatch, flags, phRegReadBatchReply) ; hRegReadBatch : HREGREADBATCH -> "sptr" ; flags : DWORD -> "int" ; phRegReadBatchReply : HREGREADBATCHREPLY* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "CLUSAPI.dll" #cfunc global ClusterRegCloseReadBatchEx "ClusterRegCloseReadBatchEx" sptr, int, sptr ; res = ClusterRegCloseReadBatchEx(hRegReadBatch, flags, varptr(phRegReadBatchReply)) ; hRegReadBatch : HREGREADBATCH -> "sptr" ; flags : DWORD -> "int" ; phRegReadBatchReply : HREGREADBATCHREPLY* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT ClusterRegCloseReadBatchEx(HREGREADBATCH hRegReadBatch, DWORD flags, HREGREADBATCHREPLY* phRegReadBatchReply) #uselib "CLUSAPI.dll" #cfunc global ClusterRegCloseReadBatchEx "ClusterRegCloseReadBatchEx" intptr, int, var ; res = ClusterRegCloseReadBatchEx(hRegReadBatch, flags, phRegReadBatchReply) ; hRegReadBatch : HREGREADBATCH -> "intptr" ; flags : DWORD -> "int" ; phRegReadBatchReply : HREGREADBATCHREPLY* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT ClusterRegCloseReadBatchEx(HREGREADBATCH hRegReadBatch, DWORD flags, HREGREADBATCHREPLY* phRegReadBatchReply) #uselib "CLUSAPI.dll" #cfunc global ClusterRegCloseReadBatchEx "ClusterRegCloseReadBatchEx" intptr, int, intptr ; res = ClusterRegCloseReadBatchEx(hRegReadBatch, flags, varptr(phRegReadBatchReply)) ; hRegReadBatch : HREGREADBATCH -> "intptr" ; flags : DWORD -> "int" ; phRegReadBatchReply : HREGREADBATCHREPLY* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
clusapi = windows.NewLazySystemDLL("CLUSAPI.dll")
procClusterRegCloseReadBatchEx = clusapi.NewProc("ClusterRegCloseReadBatchEx")
)
// hRegReadBatch (HREGREADBATCH), flags (DWORD), phRegReadBatchReply (HREGREADBATCHREPLY* out)
r1, _, err := procClusterRegCloseReadBatchEx.Call(
uintptr(hRegReadBatch),
uintptr(flags),
uintptr(phRegReadBatchReply),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction ClusterRegCloseReadBatchEx(
hRegReadBatch: NativeInt; // HREGREADBATCH
flags: DWORD; // DWORD
phRegReadBatchReply: Pointer // HREGREADBATCHREPLY* out
): Integer; stdcall;
external 'CLUSAPI.dll' name 'ClusterRegCloseReadBatchEx';result := DllCall("CLUSAPI\ClusterRegCloseReadBatchEx"
, "Ptr", hRegReadBatch ; HREGREADBATCH
, "UInt", flags ; DWORD
, "Ptr", phRegReadBatchReply ; HREGREADBATCHREPLY* out
, "Int") ; return: INT●ClusterRegCloseReadBatchEx(hRegReadBatch, flags, phRegReadBatchReply) = DLL("CLUSAPI.dll", "int ClusterRegCloseReadBatchEx(int, dword, void*)")
# 呼び出し: ClusterRegCloseReadBatchEx(hRegReadBatch, flags, phRegReadBatchReply)
# hRegReadBatch : HREGREADBATCH -> "int"
# flags : DWORD -> "dword"
# phRegReadBatchReply : HREGREADBATCHREPLY* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "clusapi" fn ClusterRegCloseReadBatchEx(
hRegReadBatch: isize, // HREGREADBATCH
flags: u32, // DWORD
phRegReadBatchReply: [*c]isize // HREGREADBATCHREPLY* out
) callconv(std.os.windows.WINAPI) i32;proc ClusterRegCloseReadBatchEx(
hRegReadBatch: int, # HREGREADBATCH
flags: uint32, # DWORD
phRegReadBatchReply: ptr int # HREGREADBATCHREPLY* out
): int32 {.importc: "ClusterRegCloseReadBatchEx", stdcall, dynlib: "CLUSAPI.dll".}pragma(lib, "clusapi");
extern(Windows)
int ClusterRegCloseReadBatchEx(
ptrdiff_t hRegReadBatch, // HREGREADBATCH
uint flags, // DWORD
ptrdiff_t* phRegReadBatchReply // HREGREADBATCHREPLY* out
);ccall((:ClusterRegCloseReadBatchEx, "CLUSAPI.dll"), stdcall, Int32,
(Int, UInt32, Ptr{Int}),
hRegReadBatch, flags, phRegReadBatchReply)
# hRegReadBatch : HREGREADBATCH -> Int
# flags : DWORD -> UInt32
# phRegReadBatchReply : HREGREADBATCHREPLY* out -> Ptr{Int}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t ClusterRegCloseReadBatchEx(
intptr_t hRegReadBatch,
uint32_t flags,
intptr_t* phRegReadBatchReply);
]]
local clusapi = ffi.load("clusapi")
-- clusapi.ClusterRegCloseReadBatchEx(hRegReadBatch, flags, phRegReadBatchReply)
-- hRegReadBatch : HREGREADBATCH
-- flags : DWORD
-- phRegReadBatchReply : HREGREADBATCHREPLY* out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('CLUSAPI.dll');
const ClusterRegCloseReadBatchEx = lib.func('__stdcall', 'ClusterRegCloseReadBatchEx', 'int32_t', ['intptr_t', 'uint32_t', 'intptr_t *']);
// ClusterRegCloseReadBatchEx(hRegReadBatch, flags, phRegReadBatchReply)
// hRegReadBatch : HREGREADBATCH -> 'intptr_t'
// flags : DWORD -> 'uint32_t'
// phRegReadBatchReply : HREGREADBATCHREPLY* out -> 'intptr_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("CLUSAPI.dll", {
ClusterRegCloseReadBatchEx: { parameters: ["isize", "u32", "pointer"], result: "i32" },
});
// lib.symbols.ClusterRegCloseReadBatchEx(hRegReadBatch, flags, phRegReadBatchReply)
// hRegReadBatch : HREGREADBATCH -> "isize"
// flags : DWORD -> "u32"
// phRegReadBatchReply : HREGREADBATCHREPLY* out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t ClusterRegCloseReadBatchEx(
intptr_t hRegReadBatch,
uint32_t flags,
intptr_t* phRegReadBatchReply);
C, "CLUSAPI.dll");
// $ffi->ClusterRegCloseReadBatchEx(hRegReadBatch, flags, phRegReadBatchReply);
// hRegReadBatch : HREGREADBATCH
// flags : DWORD
// phRegReadBatchReply : HREGREADBATCHREPLY* 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 ClusterRegCloseReadBatchEx(
long hRegReadBatch, // HREGREADBATCH
int flags, // DWORD
LongByReference phRegReadBatchReply // HREGREADBATCHREPLY* out
);
}@[Link("clusapi")]
lib LibCLUSAPI
fun ClusterRegCloseReadBatchEx = ClusterRegCloseReadBatchEx(
hRegReadBatch : LibC::SSizeT, # HREGREADBATCH
flags : UInt32, # DWORD
phRegReadBatchReply : LibC::SSizeT* # HREGREADBATCHREPLY* out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef ClusterRegCloseReadBatchExNative = Int32 Function(IntPtr, Uint32, Pointer<IntPtr>);
typedef ClusterRegCloseReadBatchExDart = int Function(int, int, Pointer<IntPtr>);
final ClusterRegCloseReadBatchEx = DynamicLibrary.open('CLUSAPI.dll')
.lookupFunction<ClusterRegCloseReadBatchExNative, ClusterRegCloseReadBatchExDart>('ClusterRegCloseReadBatchEx');
// hRegReadBatch : HREGREADBATCH -> IntPtr
// flags : DWORD -> Uint32
// phRegReadBatchReply : HREGREADBATCHREPLY* out -> Pointer<IntPtr>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function ClusterRegCloseReadBatchEx(
hRegReadBatch: NativeInt; // HREGREADBATCH
flags: DWORD; // DWORD
phRegReadBatchReply: Pointer // HREGREADBATCHREPLY* out
): Integer; stdcall;
external 'CLUSAPI.dll' name 'ClusterRegCloseReadBatchEx';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "ClusterRegCloseReadBatchEx"
c_ClusterRegCloseReadBatchEx :: CIntPtr -> Word32 -> Ptr CIntPtr -> IO Int32
-- hRegReadBatch : HREGREADBATCH -> CIntPtr
-- flags : DWORD -> Word32
-- phRegReadBatchReply : HREGREADBATCHREPLY* out -> Ptr CIntPtr
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let clusterregclosereadbatchex =
foreign "ClusterRegCloseReadBatchEx"
(intptr_t @-> uint32_t @-> (ptr intptr_t) @-> returning int32_t)
(* hRegReadBatch : HREGREADBATCH -> intptr_t *)
(* flags : DWORD -> uint32_t *)
(* phRegReadBatchReply : HREGREADBATCHREPLY* out -> (ptr intptr_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library clusapi (t "CLUSAPI.dll"))
(cffi:use-foreign-library clusapi)
(cffi:defcfun ("ClusterRegCloseReadBatchEx" cluster-reg-close-read-batch-ex :convention :stdcall) :int32
(h-reg-read-batch :int64) ; HREGREADBATCH
(flags :uint32) ; DWORD
(ph-reg-read-batch-reply :pointer)) ; HREGREADBATCHREPLY* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $ClusterRegCloseReadBatchEx = Win32::API::More->new('CLUSAPI',
'int ClusterRegCloseReadBatchEx(LPARAM hRegReadBatch, DWORD flags, LPVOID phRegReadBatchReply)');
# my $ret = $ClusterRegCloseReadBatchEx->Call($hRegReadBatch, $flags, $phRegReadBatchReply);
# hRegReadBatch : HREGREADBATCH -> LPARAM
# flags : DWORD -> DWORD
# phRegReadBatchReply : HREGREADBATCHREPLY* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
類似 API
- f ClusterRegCloseReadBatch — 読み取りバッチを閉じて応答を取得する。