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

ClusterRegBatchAddCommand

関数
クラスタレジストリバッチにコマンドを追加する。
DLLCLUSAPI.dll呼出規約winapi対応OSwindowsserver2008

シグネチャ

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

INT ClusterRegBatchAddCommand(
    HREGBATCH hRegBatch,
    CLUSTER_REG_COMMAND dwCommand,
    LPCWSTR wzName,   // optional
    DWORD dwOptions,
    const void* lpData,   // optional
    DWORD cbData
);

パラメーター

名前方向
hRegBatchHREGBATCHin
dwCommandCLUSTER_REG_COMMANDin
wzNameLPCWSTRinoptional
dwOptionsDWORDin
lpDatavoid*inoptional
cbDataDWORDin

戻り値の型: INT

各言語での呼び出し定義

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

INT ClusterRegBatchAddCommand(
    HREGBATCH hRegBatch,
    CLUSTER_REG_COMMAND dwCommand,
    LPCWSTR wzName,   // optional
    DWORD dwOptions,
    const void* lpData,   // optional
    DWORD cbData
);
[DllImport("CLUSAPI.dll", ExactSpelling = true)]
static extern int ClusterRegBatchAddCommand(
    IntPtr hRegBatch,   // HREGBATCH
    int dwCommand,   // CLUSTER_REG_COMMAND
    [MarshalAs(UnmanagedType.LPWStr)] string wzName,   // LPCWSTR optional
    uint dwOptions,   // DWORD
    IntPtr lpData,   // void* optional
    uint cbData   // DWORD
);
<DllImport("CLUSAPI.dll", ExactSpelling:=True)>
Public Shared Function ClusterRegBatchAddCommand(
    hRegBatch As IntPtr,   ' HREGBATCH
    dwCommand As Integer,   ' CLUSTER_REG_COMMAND
    <MarshalAs(UnmanagedType.LPWStr)> wzName As String,   ' LPCWSTR optional
    dwOptions As UInteger,   ' DWORD
    lpData As IntPtr,   ' void* optional
    cbData As UInteger   ' DWORD
) As Integer
End Function
' hRegBatch : HREGBATCH
' dwCommand : CLUSTER_REG_COMMAND
' wzName : LPCWSTR optional
' dwOptions : DWORD
' lpData : void* optional
' cbData : DWORD
Declare PtrSafe Function ClusterRegBatchAddCommand Lib "clusapi" ( _
    ByVal hRegBatch As LongPtr, _
    ByVal dwCommand As Long, _
    ByVal wzName As LongPtr, _
    ByVal dwOptions As Long, _
    ByVal lpData As LongPtr, _
    ByVal cbData As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ClusterRegBatchAddCommand = ctypes.windll.clusapi.ClusterRegBatchAddCommand
ClusterRegBatchAddCommand.restype = ctypes.c_int
ClusterRegBatchAddCommand.argtypes = [
    ctypes.c_ssize_t,  # hRegBatch : HREGBATCH
    ctypes.c_int,  # dwCommand : CLUSTER_REG_COMMAND
    wintypes.LPCWSTR,  # wzName : LPCWSTR optional
    wintypes.DWORD,  # dwOptions : DWORD
    ctypes.POINTER(None),  # lpData : void* optional
    wintypes.DWORD,  # cbData : DWORD
]
require 'fiddle'
require 'fiddle/import'

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

var (
	clusapi = windows.NewLazySystemDLL("CLUSAPI.dll")
	procClusterRegBatchAddCommand = clusapi.NewProc("ClusterRegBatchAddCommand")
)

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