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

AddClusterGroupToGroupSetDependencyEx

関数
理由を付与してグループからグループセットへの依存関係を追加する。
DLLCLUSAPI.dll呼出規約winapi

シグネチャ

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

DWORD AddClusterGroupToGroupSetDependencyEx(
    HGROUP hDependentGroup,
    HGROUPSET hProviderGroupSet,
    LPCWSTR lpszReason   // optional
);

パラメーター

名前方向
hDependentGroupHGROUPin
hProviderGroupSetHGROUPSETin
lpszReasonLPCWSTRinoptional

戻り値の型: DWORD

各言語での呼び出し定義

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

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

AddClusterGroupToGroupSetDependencyEx = ctypes.windll.clusapi.AddClusterGroupToGroupSetDependencyEx
AddClusterGroupToGroupSetDependencyEx.restype = wintypes.DWORD
AddClusterGroupToGroupSetDependencyEx.argtypes = [
    ctypes.c_ssize_t,  # hDependentGroup : HGROUP
    ctypes.c_ssize_t,  # hProviderGroupSet : HGROUPSET
    wintypes.LPCWSTR,  # lpszReason : LPCWSTR optional
]
require 'fiddle'
require 'fiddle/import'

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

var (
	clusapi = windows.NewLazySystemDLL("CLUSAPI.dll")
	procAddClusterGroupToGroupSetDependencyEx = clusapi.NewProc("AddClusterGroupToGroupSetDependencyEx")
)

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