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

EvictClusterNodeEx2

関数
理由付きでクラスターからノードを排除しクリーンアップ状態を返す。
DLLCLUSAPI.dll呼出規約winapi

シグネチャ

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

DWORD EvictClusterNodeEx2(
    HNODE hNode,
    DWORD dwTimeout,
    HRESULT* phrCleanupStatus,
    LPCWSTR lpszReason   // optional
);

パラメーター

名前方向
hNodeHNODEin
dwTimeoutDWORDin
phrCleanupStatusHRESULT*out
lpszReasonLPCWSTRinoptional

戻り値の型: DWORD

各言語での呼び出し定義

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

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

EvictClusterNodeEx2 = ctypes.windll.clusapi.EvictClusterNodeEx2
EvictClusterNodeEx2.restype = wintypes.DWORD
EvictClusterNodeEx2.argtypes = [
    ctypes.c_ssize_t,  # hNode : HNODE
    wintypes.DWORD,  # dwTimeout : DWORD
    ctypes.c_void_p,  # phrCleanupStatus : HRESULT* out
    wintypes.LPCWSTR,  # lpszReason : LPCWSTR optional
]
require 'fiddle'
require 'fiddle/import'

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

var (
	clusapi = windows.NewLazySystemDLL("CLUSAPI.dll")
	procEvictClusterNodeEx2 = clusapi.NewProc("EvictClusterNodeEx2")
)

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