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

ClusterAddGroupToGroupSetWithDomainsEx

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

シグネチャ

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

DWORD ClusterAddGroupToGroupSetWithDomainsEx(
    HGROUPSET hGroupSet,
    HGROUP hGroup,
    DWORD faultDomain,
    DWORD updateDomain,
    LPCWSTR lpszReason   // optional
);

パラメーター

名前方向
hGroupSetHGROUPSETin
hGroupHGROUPin
faultDomainDWORDin
updateDomainDWORDin
lpszReasonLPCWSTRinoptional

戻り値の型: DWORD

各言語での呼び出し定義

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

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

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

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

var (
	clusapi = windows.NewLazySystemDLL("CLUSAPI.dll")
	procClusterAddGroupToGroupSetWithDomainsEx = clusapi.NewProc("ClusterAddGroupToGroupSetWithDomainsEx")
)

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