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

ClusterRegReadBatchAddCommand

関数
読み取りバッチに値取得コマンドを追加する。
DLLCLUSAPI.dll呼出規約winapi対応OSwindowsserver2012

シグネチャ

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

INT ClusterRegReadBatchAddCommand(
    HREGREADBATCH hRegReadBatch,
    LPCWSTR wzSubkeyName,
    LPCWSTR wzValueName
);

パラメーター

名前方向
hRegReadBatchHREGREADBATCHin
wzSubkeyNameLPCWSTRin
wzValueNameLPCWSTRin

戻り値の型: INT

各言語での呼び出し定義

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

INT ClusterRegReadBatchAddCommand(
    HREGREADBATCH hRegReadBatch,
    LPCWSTR wzSubkeyName,
    LPCWSTR wzValueName
);
[DllImport("CLUSAPI.dll", ExactSpelling = true)]
static extern int ClusterRegReadBatchAddCommand(
    IntPtr hRegReadBatch,   // HREGREADBATCH
    [MarshalAs(UnmanagedType.LPWStr)] string wzSubkeyName,   // LPCWSTR
    [MarshalAs(UnmanagedType.LPWStr)] string wzValueName   // LPCWSTR
);
<DllImport("CLUSAPI.dll", ExactSpelling:=True)>
Public Shared Function ClusterRegReadBatchAddCommand(
    hRegReadBatch As IntPtr,   ' HREGREADBATCH
    <MarshalAs(UnmanagedType.LPWStr)> wzSubkeyName As String,   ' LPCWSTR
    <MarshalAs(UnmanagedType.LPWStr)> wzValueName As String   ' LPCWSTR
) As Integer
End Function
' hRegReadBatch : HREGREADBATCH
' wzSubkeyName : LPCWSTR
' wzValueName : LPCWSTR
Declare PtrSafe Function ClusterRegReadBatchAddCommand Lib "clusapi" ( _
    ByVal hRegReadBatch As LongPtr, _
    ByVal wzSubkeyName As LongPtr, _
    ByVal wzValueName As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ClusterRegReadBatchAddCommand = ctypes.windll.clusapi.ClusterRegReadBatchAddCommand
ClusterRegReadBatchAddCommand.restype = ctypes.c_int
ClusterRegReadBatchAddCommand.argtypes = [
    ctypes.c_ssize_t,  # hRegReadBatch : HREGREADBATCH
    wintypes.LPCWSTR,  # wzSubkeyName : LPCWSTR
    wintypes.LPCWSTR,  # wzValueName : LPCWSTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('CLUSAPI.dll')
ClusterRegReadBatchAddCommand = Fiddle::Function.new(
  lib['ClusterRegReadBatchAddCommand'],
  [
    Fiddle::TYPE_INTPTR_T,  # hRegReadBatch : HREGREADBATCH
    Fiddle::TYPE_VOIDP,  # wzSubkeyName : LPCWSTR
    Fiddle::TYPE_VOIDP,  # wzValueName : LPCWSTR
  ],
  Fiddle::TYPE_INT)
#[link(name = "clusapi")]
extern "system" {
    fn ClusterRegReadBatchAddCommand(
        hRegReadBatch: isize,  // HREGREADBATCH
        wzSubkeyName: *const u16,  // LPCWSTR
        wzValueName: *const u16  // LPCWSTR
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("CLUSAPI.dll")]
public static extern int ClusterRegReadBatchAddCommand(IntPtr hRegReadBatch, [MarshalAs(UnmanagedType.LPWStr)] string wzSubkeyName, [MarshalAs(UnmanagedType.LPWStr)] string wzValueName);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CLUSAPI_ClusterRegReadBatchAddCommand' -Namespace Win32 -PassThru
# $api::ClusterRegReadBatchAddCommand(hRegReadBatch, wzSubkeyName, wzValueName)
#uselib "CLUSAPI.dll"
#func global ClusterRegReadBatchAddCommand "ClusterRegReadBatchAddCommand" sptr, sptr, sptr
; ClusterRegReadBatchAddCommand hRegReadBatch, wzSubkeyName, wzValueName   ; 戻り値は stat
; hRegReadBatch : HREGREADBATCH -> "sptr"
; wzSubkeyName : LPCWSTR -> "sptr"
; wzValueName : LPCWSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "CLUSAPI.dll"
#cfunc global ClusterRegReadBatchAddCommand "ClusterRegReadBatchAddCommand" sptr, wstr, wstr
; res = ClusterRegReadBatchAddCommand(hRegReadBatch, wzSubkeyName, wzValueName)
; hRegReadBatch : HREGREADBATCH -> "sptr"
; wzSubkeyName : LPCWSTR -> "wstr"
; wzValueName : LPCWSTR -> "wstr"
; INT ClusterRegReadBatchAddCommand(HREGREADBATCH hRegReadBatch, LPCWSTR wzSubkeyName, LPCWSTR wzValueName)
#uselib "CLUSAPI.dll"
#cfunc global ClusterRegReadBatchAddCommand "ClusterRegReadBatchAddCommand" intptr, wstr, wstr
; res = ClusterRegReadBatchAddCommand(hRegReadBatch, wzSubkeyName, wzValueName)
; hRegReadBatch : HREGREADBATCH -> "intptr"
; wzSubkeyName : LPCWSTR -> "wstr"
; wzValueName : LPCWSTR -> "wstr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	clusapi = windows.NewLazySystemDLL("CLUSAPI.dll")
	procClusterRegReadBatchAddCommand = clusapi.NewProc("ClusterRegReadBatchAddCommand")
)

// hRegReadBatch (HREGREADBATCH), wzSubkeyName (LPCWSTR), wzValueName (LPCWSTR)
r1, _, err := procClusterRegReadBatchAddCommand.Call(
	uintptr(hRegReadBatch),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(wzSubkeyName))),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(wzValueName))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT
function ClusterRegReadBatchAddCommand(
  hRegReadBatch: NativeInt;   // HREGREADBATCH
  wzSubkeyName: PWideChar;   // LPCWSTR
  wzValueName: PWideChar   // LPCWSTR
): Integer; stdcall;
  external 'CLUSAPI.dll' name 'ClusterRegReadBatchAddCommand';
result := DllCall("CLUSAPI\ClusterRegReadBatchAddCommand"
    , "Ptr", hRegReadBatch   ; HREGREADBATCH
    , "WStr", wzSubkeyName   ; LPCWSTR
    , "WStr", wzValueName   ; LPCWSTR
    , "Int")   ; return: INT
●ClusterRegReadBatchAddCommand(hRegReadBatch, wzSubkeyName, wzValueName) = DLL("CLUSAPI.dll", "int ClusterRegReadBatchAddCommand(int, char*, char*)")
# 呼び出し: ClusterRegReadBatchAddCommand(hRegReadBatch, wzSubkeyName, wzValueName)
# hRegReadBatch : HREGREADBATCH -> "int"
# wzSubkeyName : LPCWSTR -> "char*"
# wzValueName : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。