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

AddClusterGroupDependencyEx

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

シグネチャ

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

DWORD AddClusterGroupDependencyEx(
    HGROUP hDependentGroup,
    HGROUP hProviderGroup,
    LPCWSTR lpszReason   // optional
);

パラメーター

名前方向
hDependentGroupHGROUPin
hProviderGroupHGROUPin
lpszReasonLPCWSTRinoptional

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD AddClusterGroupDependencyEx(
    HGROUP hDependentGroup,
    HGROUP hProviderGroup,
    LPCWSTR lpszReason   // optional
);
[DllImport("CLUSAPI.dll", ExactSpelling = true)]
static extern uint AddClusterGroupDependencyEx(
    IntPtr hDependentGroup,   // HGROUP
    IntPtr hProviderGroup,   // HGROUP
    [MarshalAs(UnmanagedType.LPWStr)] string lpszReason   // LPCWSTR optional
);
<DllImport("CLUSAPI.dll", ExactSpelling:=True)>
Public Shared Function AddClusterGroupDependencyEx(
    hDependentGroup As IntPtr,   ' HGROUP
    hProviderGroup As IntPtr,   ' HGROUP
    <MarshalAs(UnmanagedType.LPWStr)> lpszReason As String   ' LPCWSTR optional
) As UInteger
End Function
' hDependentGroup : HGROUP
' hProviderGroup : HGROUP
' lpszReason : LPCWSTR optional
Declare PtrSafe Function AddClusterGroupDependencyEx Lib "clusapi" ( _
    ByVal hDependentGroup As LongPtr, _
    ByVal hProviderGroup 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

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

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

var (
	clusapi = windows.NewLazySystemDLL("CLUSAPI.dll")
	procAddClusterGroupDependencyEx = clusapi.NewProc("AddClusterGroupDependencyEx")
)

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