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

ClusterRegReadBatchReplyNextCommand

関数
読み取りバッチ応答から次のコマンド結果を取得する。
DLLCLUSAPI.dll呼出規約winapi対応OSwindowsserver2012

シグネチャ

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

INT ClusterRegReadBatchReplyNextCommand(
    HREGREADBATCHREPLY hRegReadBatchReply,
    CLUSTER_READ_BATCH_COMMAND* pBatchCommand
);

パラメーター

名前方向説明
hRegReadBatchReplyHREGREADBATCHREPLYin結果を反復する対象の読み取りバッチ応答ハンドル。
pBatchCommandCLUSTER_READ_BATCH_COMMAND*out次の読み取り結果を受け取るCLUSTER_READ_BATCH_COMMAND構造体ポインタ。

戻り値の型: INT

各言語での呼び出し定義

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

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

ClusterRegReadBatchReplyNextCommand = ctypes.windll.clusapi.ClusterRegReadBatchReplyNextCommand
ClusterRegReadBatchReplyNextCommand.restype = ctypes.c_int
ClusterRegReadBatchReplyNextCommand.argtypes = [
    ctypes.c_ssize_t,  # hRegReadBatchReply : HREGREADBATCHREPLY
    ctypes.c_void_p,  # pBatchCommand : CLUSTER_READ_BATCH_COMMAND* out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	clusapi = windows.NewLazySystemDLL("CLUSAPI.dll")
	procClusterRegReadBatchReplyNextCommand = clusapi.NewProc("ClusterRegReadBatchReplyNextCommand")
)

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

extern "clusapi" fn ClusterRegReadBatchReplyNextCommand(
    hRegReadBatchReply: isize, // HREGREADBATCHREPLY
    pBatchCommand: [*c]CLUSTER_READ_BATCH_COMMAND // CLUSTER_READ_BATCH_COMMAND* out
) callconv(std.os.windows.WINAPI) i32;
proc ClusterRegReadBatchReplyNextCommand(
    hRegReadBatchReply: int,  # HREGREADBATCHREPLY
    pBatchCommand: ptr CLUSTER_READ_BATCH_COMMAND  # CLUSTER_READ_BATCH_COMMAND* out
): int32 {.importc: "ClusterRegReadBatchReplyNextCommand", stdcall, dynlib: "CLUSAPI.dll".}
pragma(lib, "clusapi");
extern(Windows)
int ClusterRegReadBatchReplyNextCommand(
    ptrdiff_t hRegReadBatchReply,   // HREGREADBATCHREPLY
    CLUSTER_READ_BATCH_COMMAND* pBatchCommand   // CLUSTER_READ_BATCH_COMMAND* out
);
ccall((:ClusterRegReadBatchReplyNextCommand, "CLUSAPI.dll"), stdcall, Int32,
      (Int, Ptr{CLUSTER_READ_BATCH_COMMAND}),
      hRegReadBatchReply, pBatchCommand)
# hRegReadBatchReply : HREGREADBATCHREPLY -> Int
# pBatchCommand : CLUSTER_READ_BATCH_COMMAND* out -> Ptr{CLUSTER_READ_BATCH_COMMAND}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t ClusterRegReadBatchReplyNextCommand(
    intptr_t hRegReadBatchReply,
    void* pBatchCommand);
]]
local clusapi = ffi.load("clusapi")
-- clusapi.ClusterRegReadBatchReplyNextCommand(hRegReadBatchReply, pBatchCommand)
-- hRegReadBatchReply : HREGREADBATCHREPLY
-- pBatchCommand : CLUSTER_READ_BATCH_COMMAND* out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('CLUSAPI.dll');
const ClusterRegReadBatchReplyNextCommand = lib.func('__stdcall', 'ClusterRegReadBatchReplyNextCommand', 'int32_t', ['intptr_t', 'void *']);
// ClusterRegReadBatchReplyNextCommand(hRegReadBatchReply, pBatchCommand)
// hRegReadBatchReply : HREGREADBATCHREPLY -> 'intptr_t'
// pBatchCommand : CLUSTER_READ_BATCH_COMMAND* out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("CLUSAPI.dll", {
  ClusterRegReadBatchReplyNextCommand: { parameters: ["isize", "pointer"], result: "i32" },
});
// lib.symbols.ClusterRegReadBatchReplyNextCommand(hRegReadBatchReply, pBatchCommand)
// hRegReadBatchReply : HREGREADBATCHREPLY -> "isize"
// pBatchCommand : CLUSTER_READ_BATCH_COMMAND* out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t ClusterRegReadBatchReplyNextCommand(
    intptr_t hRegReadBatchReply,
    void* pBatchCommand);
C, "CLUSAPI.dll");
// $ffi->ClusterRegReadBatchReplyNextCommand(hRegReadBatchReply, pBatchCommand);
// hRegReadBatchReply : HREGREADBATCHREPLY
// pBatchCommand : CLUSTER_READ_BATCH_COMMAND* 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 ClusterRegReadBatchReplyNextCommand(
        long hRegReadBatchReply,   // HREGREADBATCHREPLY
        Pointer pBatchCommand   // CLUSTER_READ_BATCH_COMMAND* out
    );
}
@[Link("clusapi")]
lib LibCLUSAPI
  fun ClusterRegReadBatchReplyNextCommand = ClusterRegReadBatchReplyNextCommand(
    hRegReadBatchReply : LibC::SSizeT,   # HREGREADBATCHREPLY
    pBatchCommand : CLUSTER_READ_BATCH_COMMAND*   # CLUSTER_READ_BATCH_COMMAND* out
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef ClusterRegReadBatchReplyNextCommandNative = Int32 Function(IntPtr, Pointer<Void>);
typedef ClusterRegReadBatchReplyNextCommandDart = int Function(int, Pointer<Void>);
final ClusterRegReadBatchReplyNextCommand = DynamicLibrary.open('CLUSAPI.dll')
    .lookupFunction<ClusterRegReadBatchReplyNextCommandNative, ClusterRegReadBatchReplyNextCommandDart>('ClusterRegReadBatchReplyNextCommand');
// hRegReadBatchReply : HREGREADBATCHREPLY -> IntPtr
// pBatchCommand : CLUSTER_READ_BATCH_COMMAND* out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function ClusterRegReadBatchReplyNextCommand(
  hRegReadBatchReply: NativeInt;   // HREGREADBATCHREPLY
  pBatchCommand: Pointer   // CLUSTER_READ_BATCH_COMMAND* out
): Integer; stdcall;
  external 'CLUSAPI.dll' name 'ClusterRegReadBatchReplyNextCommand';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "ClusterRegReadBatchReplyNextCommand"
  c_ClusterRegReadBatchReplyNextCommand :: CIntPtr -> Ptr () -> IO Int32
-- hRegReadBatchReply : HREGREADBATCHREPLY -> CIntPtr
-- pBatchCommand : CLUSTER_READ_BATCH_COMMAND* out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let clusterregreadbatchreplynextcommand =
  foreign "ClusterRegReadBatchReplyNextCommand"
    (intptr_t @-> (ptr void) @-> returning int32_t)
(* hRegReadBatchReply : HREGREADBATCHREPLY -> intptr_t *)
(* pBatchCommand : CLUSTER_READ_BATCH_COMMAND* out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library clusapi (t "CLUSAPI.dll"))
(cffi:use-foreign-library clusapi)

(cffi:defcfun ("ClusterRegReadBatchReplyNextCommand" cluster-reg-read-batch-reply-next-command :convention :stdcall) :int32
  (h-reg-read-batch-reply :int64)   ; HREGREADBATCHREPLY
  (p-batch-command :pointer))   ; CLUSTER_READ_BATCH_COMMAND* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $ClusterRegReadBatchReplyNextCommand = Win32::API::More->new('CLUSAPI',
    'int ClusterRegReadBatchReplyNextCommand(LPARAM hRegReadBatchReply, LPVOID pBatchCommand)');
# my $ret = $ClusterRegReadBatchReplyNextCommand->Call($hRegReadBatchReply, $pBatchCommand);
# hRegReadBatchReply : HREGREADBATCHREPLY -> LPARAM
# pBatchCommand : CLUSTER_READ_BATCH_COMMAND* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型