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

ClusterAddGroupToGroupSetWithDomains

関数
障害ドメインと更新ドメインを指定してグループをグループセットに追加する。
DLLCLUSAPI.dll呼出規約winapi

シグネチャ

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

DWORD ClusterAddGroupToGroupSetWithDomains(
    HGROUPSET hGroupSet,
    HGROUP hGroup,
    DWORD faultDomain,
    DWORD updateDomain
);

パラメーター

名前方向
hGroupSetHGROUPSETin
hGroupHGROUPin
faultDomainDWORDin
updateDomainDWORDin

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD ClusterAddGroupToGroupSetWithDomains(
    HGROUPSET hGroupSet,
    HGROUP hGroup,
    DWORD faultDomain,
    DWORD updateDomain
);
[DllImport("CLUSAPI.dll", ExactSpelling = true)]
static extern uint ClusterAddGroupToGroupSetWithDomains(
    IntPtr hGroupSet,   // HGROUPSET
    IntPtr hGroup,   // HGROUP
    uint faultDomain,   // DWORD
    uint updateDomain   // DWORD
);
<DllImport("CLUSAPI.dll", ExactSpelling:=True)>
Public Shared Function ClusterAddGroupToGroupSetWithDomains(
    hGroupSet As IntPtr,   ' HGROUPSET
    hGroup As IntPtr,   ' HGROUP
    faultDomain As UInteger,   ' DWORD
    updateDomain As UInteger   ' DWORD
) As UInteger
End Function
' hGroupSet : HGROUPSET
' hGroup : HGROUP
' faultDomain : DWORD
' updateDomain : DWORD
Declare PtrSafe Function ClusterAddGroupToGroupSetWithDomains Lib "clusapi" ( _
    ByVal hGroupSet As LongPtr, _
    ByVal hGroup As LongPtr, _
    ByVal faultDomain As Long, _
    ByVal updateDomain As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ClusterAddGroupToGroupSetWithDomains = ctypes.windll.clusapi.ClusterAddGroupToGroupSetWithDomains
ClusterAddGroupToGroupSetWithDomains.restype = wintypes.DWORD
ClusterAddGroupToGroupSetWithDomains.argtypes = [
    ctypes.c_ssize_t,  # hGroupSet : HGROUPSET
    ctypes.c_ssize_t,  # hGroup : HGROUP
    wintypes.DWORD,  # faultDomain : DWORD
    wintypes.DWORD,  # updateDomain : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('CLUSAPI.dll')
ClusterAddGroupToGroupSetWithDomains = Fiddle::Function.new(
  lib['ClusterAddGroupToGroupSetWithDomains'],
  [
    Fiddle::TYPE_INTPTR_T,  # hGroupSet : HGROUPSET
    Fiddle::TYPE_INTPTR_T,  # hGroup : HGROUP
    -Fiddle::TYPE_INT,  # faultDomain : DWORD
    -Fiddle::TYPE_INT,  # updateDomain : DWORD
  ],
  -Fiddle::TYPE_INT)
#[link(name = "clusapi")]
extern "system" {
    fn ClusterAddGroupToGroupSetWithDomains(
        hGroupSet: isize,  // HGROUPSET
        hGroup: isize,  // HGROUP
        faultDomain: u32,  // DWORD
        updateDomain: u32  // DWORD
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("CLUSAPI.dll")]
public static extern uint ClusterAddGroupToGroupSetWithDomains(IntPtr hGroupSet, IntPtr hGroup, uint faultDomain, uint updateDomain);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CLUSAPI_ClusterAddGroupToGroupSetWithDomains' -Namespace Win32 -PassThru
# $api::ClusterAddGroupToGroupSetWithDomains(hGroupSet, hGroup, faultDomain, updateDomain)
#uselib "CLUSAPI.dll"
#func global ClusterAddGroupToGroupSetWithDomains "ClusterAddGroupToGroupSetWithDomains" sptr, sptr, sptr, sptr
; ClusterAddGroupToGroupSetWithDomains hGroupSet, hGroup, faultDomain, updateDomain   ; 戻り値は stat
; hGroupSet : HGROUPSET -> "sptr"
; hGroup : HGROUP -> "sptr"
; faultDomain : DWORD -> "sptr"
; updateDomain : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "CLUSAPI.dll"
#cfunc global ClusterAddGroupToGroupSetWithDomains "ClusterAddGroupToGroupSetWithDomains" sptr, sptr, int, int
; res = ClusterAddGroupToGroupSetWithDomains(hGroupSet, hGroup, faultDomain, updateDomain)
; hGroupSet : HGROUPSET -> "sptr"
; hGroup : HGROUP -> "sptr"
; faultDomain : DWORD -> "int"
; updateDomain : DWORD -> "int"
; DWORD ClusterAddGroupToGroupSetWithDomains(HGROUPSET hGroupSet, HGROUP hGroup, DWORD faultDomain, DWORD updateDomain)
#uselib "CLUSAPI.dll"
#cfunc global ClusterAddGroupToGroupSetWithDomains "ClusterAddGroupToGroupSetWithDomains" intptr, intptr, int, int
; res = ClusterAddGroupToGroupSetWithDomains(hGroupSet, hGroup, faultDomain, updateDomain)
; hGroupSet : HGROUPSET -> "intptr"
; hGroup : HGROUP -> "intptr"
; faultDomain : DWORD -> "int"
; updateDomain : DWORD -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	clusapi = windows.NewLazySystemDLL("CLUSAPI.dll")
	procClusterAddGroupToGroupSetWithDomains = clusapi.NewProc("ClusterAddGroupToGroupSetWithDomains")
)

// hGroupSet (HGROUPSET), hGroup (HGROUP), faultDomain (DWORD), updateDomain (DWORD)
r1, _, err := procClusterAddGroupToGroupSetWithDomains.Call(
	uintptr(hGroupSet),
	uintptr(hGroup),
	uintptr(faultDomain),
	uintptr(updateDomain),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function ClusterAddGroupToGroupSetWithDomains(
  hGroupSet: NativeInt;   // HGROUPSET
  hGroup: NativeInt;   // HGROUP
  faultDomain: DWORD;   // DWORD
  updateDomain: DWORD   // DWORD
): DWORD; stdcall;
  external 'CLUSAPI.dll' name 'ClusterAddGroupToGroupSetWithDomains';
result := DllCall("CLUSAPI\ClusterAddGroupToGroupSetWithDomains"
    , "Ptr", hGroupSet   ; HGROUPSET
    , "Ptr", hGroup   ; HGROUP
    , "UInt", faultDomain   ; DWORD
    , "UInt", updateDomain   ; DWORD
    , "UInt")   ; return: DWORD
●ClusterAddGroupToGroupSetWithDomains(hGroupSet, hGroup, faultDomain, updateDomain) = DLL("CLUSAPI.dll", "dword ClusterAddGroupToGroupSetWithDomains(int, int, dword, dword)")
# 呼び出し: ClusterAddGroupToGroupSetWithDomains(hGroupSet, hGroup, faultDomain, updateDomain)
# hGroupSet : HGROUPSET -> "int"
# hGroup : HGROUP -> "int"
# faultDomain : DWORD -> "dword"
# updateDomain : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。