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

OnlineClusterGroupEx2

関数
理由付きでクラスターグループをオンラインにする。
DLLCLUSAPI.dll呼出規約winapi

シグネチャ

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

DWORD OnlineClusterGroupEx2(
    HGROUP hGroup,
    HNODE hDestinationNode,   // optional
    DWORD dwOnlineFlags,
    BYTE* lpInBuffer,   // optional
    DWORD cbInBufferSize,
    LPCWSTR lpszReason   // optional
);

パラメーター

名前方向
hGroupHGROUPin
hDestinationNodeHNODEinoptional
dwOnlineFlagsDWORDin
lpInBufferBYTE*inoptional
cbInBufferSizeDWORDin
lpszReasonLPCWSTRinoptional

戻り値の型: DWORD

各言語での呼び出し定義

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

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

OnlineClusterGroupEx2 = ctypes.windll.clusapi.OnlineClusterGroupEx2
OnlineClusterGroupEx2.restype = wintypes.DWORD
OnlineClusterGroupEx2.argtypes = [
    ctypes.c_ssize_t,  # hGroup : HGROUP
    ctypes.c_ssize_t,  # hDestinationNode : HNODE optional
    wintypes.DWORD,  # dwOnlineFlags : DWORD
    ctypes.POINTER(ctypes.c_ubyte),  # lpInBuffer : BYTE* optional
    wintypes.DWORD,  # cbInBufferSize : DWORD
    wintypes.LPCWSTR,  # lpszReason : LPCWSTR optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('CLUSAPI.dll')
OnlineClusterGroupEx2 = Fiddle::Function.new(
  lib['OnlineClusterGroupEx2'],
  [
    Fiddle::TYPE_INTPTR_T,  # hGroup : HGROUP
    Fiddle::TYPE_INTPTR_T,  # hDestinationNode : HNODE optional
    -Fiddle::TYPE_INT,  # dwOnlineFlags : DWORD
    Fiddle::TYPE_VOIDP,  # lpInBuffer : BYTE* optional
    -Fiddle::TYPE_INT,  # cbInBufferSize : DWORD
    Fiddle::TYPE_VOIDP,  # lpszReason : LPCWSTR optional
  ],
  -Fiddle::TYPE_INT)
#[link(name = "clusapi")]
extern "system" {
    fn OnlineClusterGroupEx2(
        hGroup: isize,  // HGROUP
        hDestinationNode: isize,  // HNODE optional
        dwOnlineFlags: u32,  // DWORD
        lpInBuffer: *mut u8,  // BYTE* optional
        cbInBufferSize: 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 OnlineClusterGroupEx2(IntPtr hGroup, IntPtr hDestinationNode, uint dwOnlineFlags, IntPtr lpInBuffer, uint cbInBufferSize, [MarshalAs(UnmanagedType.LPWStr)] string lpszReason);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CLUSAPI_OnlineClusterGroupEx2' -Namespace Win32 -PassThru
# $api::OnlineClusterGroupEx2(hGroup, hDestinationNode, dwOnlineFlags, lpInBuffer, cbInBufferSize, lpszReason)
#uselib "CLUSAPI.dll"
#func global OnlineClusterGroupEx2 "OnlineClusterGroupEx2" sptr, sptr, sptr, sptr, sptr, sptr
; OnlineClusterGroupEx2 hGroup, hDestinationNode, dwOnlineFlags, varptr(lpInBuffer), cbInBufferSize, lpszReason   ; 戻り値は stat
; hGroup : HGROUP -> "sptr"
; hDestinationNode : HNODE optional -> "sptr"
; dwOnlineFlags : DWORD -> "sptr"
; lpInBuffer : BYTE* optional -> "sptr"
; cbInBufferSize : DWORD -> "sptr"
; lpszReason : LPCWSTR optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "CLUSAPI.dll"
#cfunc global OnlineClusterGroupEx2 "OnlineClusterGroupEx2" sptr, sptr, int, var, int, wstr
; res = OnlineClusterGroupEx2(hGroup, hDestinationNode, dwOnlineFlags, lpInBuffer, cbInBufferSize, lpszReason)
; hGroup : HGROUP -> "sptr"
; hDestinationNode : HNODE optional -> "sptr"
; dwOnlineFlags : DWORD -> "int"
; lpInBuffer : BYTE* optional -> "var"
; cbInBufferSize : DWORD -> "int"
; lpszReason : LPCWSTR optional -> "wstr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD OnlineClusterGroupEx2(HGROUP hGroup, HNODE hDestinationNode, DWORD dwOnlineFlags, BYTE* lpInBuffer, DWORD cbInBufferSize, LPCWSTR lpszReason)
#uselib "CLUSAPI.dll"
#cfunc global OnlineClusterGroupEx2 "OnlineClusterGroupEx2" intptr, intptr, int, var, int, wstr
; res = OnlineClusterGroupEx2(hGroup, hDestinationNode, dwOnlineFlags, lpInBuffer, cbInBufferSize, lpszReason)
; hGroup : HGROUP -> "intptr"
; hDestinationNode : HNODE optional -> "intptr"
; dwOnlineFlags : DWORD -> "int"
; lpInBuffer : BYTE* optional -> "var"
; cbInBufferSize : DWORD -> "int"
; lpszReason : LPCWSTR optional -> "wstr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	clusapi = windows.NewLazySystemDLL("CLUSAPI.dll")
	procOnlineClusterGroupEx2 = clusapi.NewProc("OnlineClusterGroupEx2")
)

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