ホーム › Networking.Clustering › OnlineClusterGroupEx2
OnlineClusterGroupEx2
関数理由付きでクラスターグループをオンラインにする。
シグネチャ
// CLUSAPI.dll
#include <windows.h>
DWORD OnlineClusterGroupEx2(
HGROUP hGroup,
HNODE hDestinationNode, // optional
DWORD dwOnlineFlags,
BYTE* lpInBuffer, // optional
DWORD cbInBufferSize,
LPCWSTR lpszReason // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hGroup | HGROUP | in | オンラインにする対象クラスターグループのハンドル。 |
| hDestinationNode | HNODE | inoptional | オンライン化先の優先ノードのハンドル。任意指定でNULL可。 |
| dwOnlineFlags | DWORD | in | オンライン動作を制御するフラグ。CLUSAPI_GROUP_ONLINE_*値で指定する。 |
| lpInBuffer | BYTE* | inoptional | リソース固有の入力データを格納したバッファ。不要時はNULL。 |
| cbInBufferSize | DWORD | in | lpInBufferのバイト数。 |
| lpszReason | LPCWSTR | inoptional | 操作の理由を示すワイド文字列。監査ログ用で、NULL可。 |
戻り値の型: 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 方式にも切替可。#uselib "CLUSAPI.dll" #cfunc global OnlineClusterGroupEx2 "OnlineClusterGroupEx2" sptr, sptr, int, sptr, int, wstr ; res = OnlineClusterGroupEx2(hGroup, hDestinationNode, dwOnlineFlags, varptr(lpInBuffer), cbInBufferSize, lpszReason) ; hGroup : HGROUP -> "sptr" ; hDestinationNode : HNODE optional -> "sptr" ; dwOnlineFlags : DWORD -> "int" ; lpInBuffer : BYTE* optional -> "sptr" ; cbInBufferSize : DWORD -> "int" ; lpszReason : LPCWSTR optional -> "wstr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは 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 方式にも切替可。; DWORD OnlineClusterGroupEx2(HGROUP hGroup, HNODE hDestinationNode, DWORD dwOnlineFlags, BYTE* lpInBuffer, DWORD cbInBufferSize, LPCWSTR lpszReason) #uselib "CLUSAPI.dll" #cfunc global OnlineClusterGroupEx2 "OnlineClusterGroupEx2" intptr, intptr, int, intptr, int, wstr ; res = OnlineClusterGroupEx2(hGroup, hDestinationNode, dwOnlineFlags, varptr(lpInBuffer), cbInBufferSize, lpszReason) ; hGroup : HGROUP -> "intptr" ; hDestinationNode : HNODE optional -> "intptr" ; dwOnlineFlags : DWORD -> "int" ; lpInBuffer : BYTE* optional -> "intptr" ; cbInBufferSize : DWORD -> "int" ; lpszReason : LPCWSTR optional -> "wstr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは 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 // DWORDfunction 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)。const std = @import("std");
extern "clusapi" fn OnlineClusterGroupEx2(
hGroup: isize, // HGROUP
hDestinationNode: isize, // HNODE optional
dwOnlineFlags: u32, // DWORD
lpInBuffer: [*c]u8, // BYTE* optional
cbInBufferSize: u32, // DWORD
lpszReason: [*c]const u16 // LPCWSTR optional
) callconv(std.os.windows.WINAPI) u32;proc OnlineClusterGroupEx2(
hGroup: int, # HGROUP
hDestinationNode: int, # HNODE optional
dwOnlineFlags: uint32, # DWORD
lpInBuffer: ptr uint8, # BYTE* optional
cbInBufferSize: uint32, # DWORD
lpszReason: WideCString # LPCWSTR optional
): uint32 {.importc: "OnlineClusterGroupEx2", stdcall, dynlib: "CLUSAPI.dll".}pragma(lib, "clusapi");
extern(Windows)
uint OnlineClusterGroupEx2(
ptrdiff_t hGroup, // HGROUP
ptrdiff_t hDestinationNode, // HNODE optional
uint dwOnlineFlags, // DWORD
ubyte* lpInBuffer, // BYTE* optional
uint cbInBufferSize, // DWORD
const(wchar)* lpszReason // LPCWSTR optional
);ccall((:OnlineClusterGroupEx2, "CLUSAPI.dll"), stdcall, UInt32,
(Int, Int, UInt32, Ptr{UInt8}, UInt32, Cwstring),
hGroup, hDestinationNode, dwOnlineFlags, lpInBuffer, cbInBufferSize, lpszReason)
# hGroup : HGROUP -> Int
# hDestinationNode : HNODE optional -> Int
# dwOnlineFlags : DWORD -> UInt32
# lpInBuffer : BYTE* optional -> Ptr{UInt8}
# cbInBufferSize : DWORD -> UInt32
# lpszReason : LPCWSTR optional -> Cwstring
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
uint32_t OnlineClusterGroupEx2(
intptr_t hGroup,
intptr_t hDestinationNode,
uint32_t dwOnlineFlags,
uint8_t* lpInBuffer,
uint32_t cbInBufferSize,
const uint16_t* lpszReason);
]]
local clusapi = ffi.load("clusapi")
-- clusapi.OnlineClusterGroupEx2(hGroup, hDestinationNode, dwOnlineFlags, lpInBuffer, cbInBufferSize, lpszReason)
-- hGroup : HGROUP
-- hDestinationNode : HNODE optional
-- dwOnlineFlags : DWORD
-- lpInBuffer : BYTE* optional
-- cbInBufferSize : DWORD
-- lpszReason : LPCWSTR optional
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('CLUSAPI.dll');
const OnlineClusterGroupEx2 = lib.func('__stdcall', 'OnlineClusterGroupEx2', 'uint32_t', ['intptr_t', 'intptr_t', 'uint32_t', 'uint8_t *', 'uint32_t', 'str16']);
// OnlineClusterGroupEx2(hGroup, hDestinationNode, dwOnlineFlags, lpInBuffer, cbInBufferSize, lpszReason)
// hGroup : HGROUP -> 'intptr_t'
// hDestinationNode : HNODE optional -> 'intptr_t'
// dwOnlineFlags : DWORD -> 'uint32_t'
// lpInBuffer : BYTE* optional -> 'uint8_t *'
// cbInBufferSize : DWORD -> 'uint32_t'
// lpszReason : LPCWSTR optional -> 'str16'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("CLUSAPI.dll", {
OnlineClusterGroupEx2: { parameters: ["isize", "isize", "u32", "pointer", "u32", "buffer"], result: "u32" },
});
// lib.symbols.OnlineClusterGroupEx2(hGroup, hDestinationNode, dwOnlineFlags, lpInBuffer, cbInBufferSize, lpszReason)
// hGroup : HGROUP -> "isize"
// hDestinationNode : HNODE optional -> "isize"
// dwOnlineFlags : DWORD -> "u32"
// lpInBuffer : BYTE* optional -> "pointer"
// cbInBufferSize : DWORD -> "u32"
// lpszReason : LPCWSTR optional -> "buffer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
uint32_t OnlineClusterGroupEx2(
intptr_t hGroup,
intptr_t hDestinationNode,
uint32_t dwOnlineFlags,
uint8_t* lpInBuffer,
uint32_t cbInBufferSize,
const uint16_t* lpszReason);
C, "CLUSAPI.dll");
// $ffi->OnlineClusterGroupEx2(hGroup, hDestinationNode, dwOnlineFlags, lpInBuffer, cbInBufferSize, lpszReason);
// hGroup : HGROUP
// hDestinationNode : HNODE optional
// dwOnlineFlags : DWORD
// lpInBuffer : BYTE* optional
// cbInBufferSize : DWORD
// lpszReason : LPCWSTR optional
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Clusapi extends StdCallLibrary {
Clusapi INSTANCE = Native.load("clusapi", Clusapi.class);
int OnlineClusterGroupEx2(
long hGroup, // HGROUP
long hDestinationNode, // HNODE optional
int dwOnlineFlags, // DWORD
byte[] lpInBuffer, // BYTE* optional
int cbInBufferSize, // DWORD
WString lpszReason // LPCWSTR optional
);
}@[Link("clusapi")]
lib LibCLUSAPI
fun OnlineClusterGroupEx2 = OnlineClusterGroupEx2(
hGroup : LibC::SSizeT, # HGROUP
hDestinationNode : LibC::SSizeT, # HNODE optional
dwOnlineFlags : UInt32, # DWORD
lpInBuffer : UInt8*, # BYTE* optional
cbInBufferSize : UInt32, # DWORD
lpszReason : UInt16* # LPCWSTR optional
) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef OnlineClusterGroupEx2Native = Uint32 Function(IntPtr, IntPtr, Uint32, Pointer<Uint8>, Uint32, Pointer<Utf16>);
typedef OnlineClusterGroupEx2Dart = int Function(int, int, int, Pointer<Uint8>, int, Pointer<Utf16>);
final OnlineClusterGroupEx2 = DynamicLibrary.open('CLUSAPI.dll')
.lookupFunction<OnlineClusterGroupEx2Native, OnlineClusterGroupEx2Dart>('OnlineClusterGroupEx2');
// hGroup : HGROUP -> IntPtr
// hDestinationNode : HNODE optional -> IntPtr
// dwOnlineFlags : DWORD -> Uint32
// lpInBuffer : BYTE* optional -> Pointer<Uint8>
// cbInBufferSize : DWORD -> Uint32
// lpszReason : LPCWSTR optional -> Pointer<Utf16>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
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';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "OnlineClusterGroupEx2"
c_OnlineClusterGroupEx2 :: CIntPtr -> CIntPtr -> Word32 -> Ptr Word8 -> Word32 -> CWString -> IO Word32
-- hGroup : HGROUP -> CIntPtr
-- hDestinationNode : HNODE optional -> CIntPtr
-- dwOnlineFlags : DWORD -> Word32
-- lpInBuffer : BYTE* optional -> Ptr Word8
-- cbInBufferSize : DWORD -> Word32
-- lpszReason : LPCWSTR optional -> CWString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let onlineclustergroupex2 =
foreign "OnlineClusterGroupEx2"
(intptr_t @-> intptr_t @-> uint32_t @-> (ptr uint8_t) @-> uint32_t @-> (ptr uint16_t) @-> returning uint32_t)
(* hGroup : HGROUP -> intptr_t *)
(* hDestinationNode : HNODE optional -> intptr_t *)
(* dwOnlineFlags : DWORD -> uint32_t *)
(* lpInBuffer : BYTE* optional -> (ptr uint8_t) *)
(* cbInBufferSize : DWORD -> uint32_t *)
(* lpszReason : LPCWSTR optional -> (ptr uint16_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library clusapi (t "CLUSAPI.dll"))
(cffi:use-foreign-library clusapi)
(cffi:defcfun ("OnlineClusterGroupEx2" online-cluster-group-ex2 :convention :stdcall) :uint32
(h-group :int64) ; HGROUP
(h-destination-node :int64) ; HNODE optional
(dw-online-flags :uint32) ; DWORD
(lp-in-buffer :pointer) ; BYTE* optional
(cb-in-buffer-size :uint32) ; DWORD
(lpsz-reason (:string :encoding :utf-16le))) ; LPCWSTR optional
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $OnlineClusterGroupEx2 = Win32::API::More->new('CLUSAPI',
'DWORD OnlineClusterGroupEx2(LPARAM hGroup, LPARAM hDestinationNode, DWORD dwOnlineFlags, LPVOID lpInBuffer, DWORD cbInBufferSize, LPCWSTR lpszReason)');
# my $ret = $OnlineClusterGroupEx2->Call($hGroup, $hDestinationNode, $dwOnlineFlags, $lpInBuffer, $cbInBufferSize, $lpszReason);
# hGroup : HGROUP -> LPARAM
# hDestinationNode : HNODE optional -> LPARAM
# dwOnlineFlags : DWORD -> DWORD
# lpInBuffer : BYTE* optional -> LPVOID
# cbInBufferSize : DWORD -> DWORD
# lpszReason : LPCWSTR optional -> LPCWSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
類似 API
- f OnlineClusterGroup — クラスターグループを指定ノード上でオンラインにする。
- f OnlineClusterGroupEx — 入力バッファ指定でクラスターグループをオンラインにする。