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

ResumeClusterNodeEx2

関数
理由付きでクラスターノードを再開しフェイルバックを制御する。
DLLCLUSAPI.dll呼出規約winapi

シグネチャ

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

DWORD ResumeClusterNodeEx2(
    HNODE hNode,
    CLUSTER_NODE_RESUME_FAILBACK_TYPE eResumeFailbackType,
    DWORD dwResumeFlagsReserved,
    LPCWSTR lpszReason   // optional
);

パラメーター

名前方向
hNodeHNODEin
eResumeFailbackTypeCLUSTER_NODE_RESUME_FAILBACK_TYPEin
dwResumeFlagsReservedDWORDin
lpszReasonLPCWSTRinoptional

戻り値の型: DWORD

各言語での呼び出し定義

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

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

ResumeClusterNodeEx2 = ctypes.windll.clusapi.ResumeClusterNodeEx2
ResumeClusterNodeEx2.restype = wintypes.DWORD
ResumeClusterNodeEx2.argtypes = [
    ctypes.c_ssize_t,  # hNode : HNODE
    ctypes.c_int,  # eResumeFailbackType : CLUSTER_NODE_RESUME_FAILBACK_TYPE
    wintypes.DWORD,  # dwResumeFlagsReserved : DWORD
    wintypes.LPCWSTR,  # lpszReason : LPCWSTR optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('CLUSAPI.dll')
ResumeClusterNodeEx2 = Fiddle::Function.new(
  lib['ResumeClusterNodeEx2'],
  [
    Fiddle::TYPE_INTPTR_T,  # hNode : HNODE
    Fiddle::TYPE_INT,  # eResumeFailbackType : CLUSTER_NODE_RESUME_FAILBACK_TYPE
    -Fiddle::TYPE_INT,  # dwResumeFlagsReserved : DWORD
    Fiddle::TYPE_VOIDP,  # lpszReason : LPCWSTR optional
  ],
  -Fiddle::TYPE_INT)
#[link(name = "clusapi")]
extern "system" {
    fn ResumeClusterNodeEx2(
        hNode: isize,  // HNODE
        eResumeFailbackType: i32,  // CLUSTER_NODE_RESUME_FAILBACK_TYPE
        dwResumeFlagsReserved: 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 ResumeClusterNodeEx2(IntPtr hNode, int eResumeFailbackType, uint dwResumeFlagsReserved, [MarshalAs(UnmanagedType.LPWStr)] string lpszReason);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CLUSAPI_ResumeClusterNodeEx2' -Namespace Win32 -PassThru
# $api::ResumeClusterNodeEx2(hNode, eResumeFailbackType, dwResumeFlagsReserved, lpszReason)
#uselib "CLUSAPI.dll"
#func global ResumeClusterNodeEx2 "ResumeClusterNodeEx2" sptr, sptr, sptr, sptr
; ResumeClusterNodeEx2 hNode, eResumeFailbackType, dwResumeFlagsReserved, lpszReason   ; 戻り値は stat
; hNode : HNODE -> "sptr"
; eResumeFailbackType : CLUSTER_NODE_RESUME_FAILBACK_TYPE -> "sptr"
; dwResumeFlagsReserved : DWORD -> "sptr"
; lpszReason : LPCWSTR optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "CLUSAPI.dll"
#cfunc global ResumeClusterNodeEx2 "ResumeClusterNodeEx2" sptr, int, int, wstr
; res = ResumeClusterNodeEx2(hNode, eResumeFailbackType, dwResumeFlagsReserved, lpszReason)
; hNode : HNODE -> "sptr"
; eResumeFailbackType : CLUSTER_NODE_RESUME_FAILBACK_TYPE -> "int"
; dwResumeFlagsReserved : DWORD -> "int"
; lpszReason : LPCWSTR optional -> "wstr"
; DWORD ResumeClusterNodeEx2(HNODE hNode, CLUSTER_NODE_RESUME_FAILBACK_TYPE eResumeFailbackType, DWORD dwResumeFlagsReserved, LPCWSTR lpszReason)
#uselib "CLUSAPI.dll"
#cfunc global ResumeClusterNodeEx2 "ResumeClusterNodeEx2" intptr, int, int, wstr
; res = ResumeClusterNodeEx2(hNode, eResumeFailbackType, dwResumeFlagsReserved, lpszReason)
; hNode : HNODE -> "intptr"
; eResumeFailbackType : CLUSTER_NODE_RESUME_FAILBACK_TYPE -> "int"
; dwResumeFlagsReserved : DWORD -> "int"
; lpszReason : LPCWSTR optional -> "wstr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	clusapi = windows.NewLazySystemDLL("CLUSAPI.dll")
	procResumeClusterNodeEx2 = clusapi.NewProc("ResumeClusterNodeEx2")
)

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