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

SetClusterGroupNodeListEx

関数
理由付きでクラスターグループの優先ノード一覧を設定する。
DLLCLUSAPI.dll呼出規約winapi

シグネチャ

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

DWORD SetClusterGroupNodeListEx(
    HGROUP hGroup,
    DWORD NodeCount,
    HNODE* NodeList,
    LPCWSTR lpszReason   // optional
);

パラメーター

名前方向
hGroupHGROUPin
NodeCountDWORDin
NodeListHNODE*in
lpszReasonLPCWSTRinoptional

戻り値の型: DWORD

各言語での呼び出し定義

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

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

SetClusterGroupNodeListEx = ctypes.windll.clusapi.SetClusterGroupNodeListEx
SetClusterGroupNodeListEx.restype = wintypes.DWORD
SetClusterGroupNodeListEx.argtypes = [
    ctypes.c_ssize_t,  # hGroup : HGROUP
    wintypes.DWORD,  # NodeCount : DWORD
    ctypes.c_void_p,  # NodeList : HNODE*
    wintypes.LPCWSTR,  # lpszReason : LPCWSTR optional
]
require 'fiddle'
require 'fiddle/import'

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

var (
	clusapi = windows.NewLazySystemDLL("CLUSAPI.dll")
	procSetClusterGroupNodeListEx = clusapi.NewProc("SetClusterGroupNodeListEx")
)

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