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

ClusterResourceControl

関数
クラスターリソースに制御コードを発行して操作を実行する。
DLLCLUSAPI.dll呼出規約winapi対応OSwindowsserver2008

シグネチャ

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

DWORD ClusterResourceControl(
    HRESOURCE hResource,
    HNODE hHostNode,   // optional
    DWORD dwControlCode,
    void* lpInBuffer,   // optional
    DWORD cbInBufferSize,
    void* lpOutBuffer,   // optional
    DWORD cbOutBufferSize,
    DWORD* lpBytesReturned   // optional
);

パラメーター

名前方向
hResourceHRESOURCEin
hHostNodeHNODEinoptional
dwControlCodeDWORDin
lpInBuffervoid*inoptional
cbInBufferSizeDWORDin
lpOutBuffervoid*outoptional
cbOutBufferSizeDWORDin
lpBytesReturnedDWORD*outoptional

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD ClusterResourceControl(
    HRESOURCE hResource,
    HNODE hHostNode,   // optional
    DWORD dwControlCode,
    void* lpInBuffer,   // optional
    DWORD cbInBufferSize,
    void* lpOutBuffer,   // optional
    DWORD cbOutBufferSize,
    DWORD* lpBytesReturned   // optional
);
[DllImport("CLUSAPI.dll", ExactSpelling = true)]
static extern uint ClusterResourceControl(
    IntPtr hResource,   // HRESOURCE
    IntPtr hHostNode,   // HNODE optional
    uint dwControlCode,   // DWORD
    IntPtr lpInBuffer,   // void* optional
    uint cbInBufferSize,   // DWORD
    IntPtr lpOutBuffer,   // void* optional, out
    uint cbOutBufferSize,   // DWORD
    IntPtr lpBytesReturned   // DWORD* optional, out
);
<DllImport("CLUSAPI.dll", ExactSpelling:=True)>
Public Shared Function ClusterResourceControl(
    hResource As IntPtr,   ' HRESOURCE
    hHostNode As IntPtr,   ' HNODE optional
    dwControlCode As UInteger,   ' DWORD
    lpInBuffer As IntPtr,   ' void* optional
    cbInBufferSize As UInteger,   ' DWORD
    lpOutBuffer As IntPtr,   ' void* optional, out
    cbOutBufferSize As UInteger,   ' DWORD
    lpBytesReturned As IntPtr   ' DWORD* optional, out
) As UInteger
End Function
' hResource : HRESOURCE
' hHostNode : HNODE optional
' dwControlCode : DWORD
' lpInBuffer : void* optional
' cbInBufferSize : DWORD
' lpOutBuffer : void* optional, out
' cbOutBufferSize : DWORD
' lpBytesReturned : DWORD* optional, out
Declare PtrSafe Function ClusterResourceControl Lib "clusapi" ( _
    ByVal hResource As LongPtr, _
    ByVal hHostNode As LongPtr, _
    ByVal dwControlCode As Long, _
    ByVal lpInBuffer As LongPtr, _
    ByVal cbInBufferSize As Long, _
    ByVal lpOutBuffer As LongPtr, _
    ByVal cbOutBufferSize As Long, _
    ByVal lpBytesReturned As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ClusterResourceControl = ctypes.windll.clusapi.ClusterResourceControl
ClusterResourceControl.restype = wintypes.DWORD
ClusterResourceControl.argtypes = [
    ctypes.c_ssize_t,  # hResource : HRESOURCE
    ctypes.c_ssize_t,  # hHostNode : HNODE optional
    wintypes.DWORD,  # dwControlCode : DWORD
    ctypes.POINTER(None),  # lpInBuffer : void* optional
    wintypes.DWORD,  # cbInBufferSize : DWORD
    ctypes.POINTER(None),  # lpOutBuffer : void* optional, out
    wintypes.DWORD,  # cbOutBufferSize : DWORD
    ctypes.POINTER(wintypes.DWORD),  # lpBytesReturned : DWORD* optional, out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('CLUSAPI.dll')
ClusterResourceControl = Fiddle::Function.new(
  lib['ClusterResourceControl'],
  [
    Fiddle::TYPE_INTPTR_T,  # hResource : HRESOURCE
    Fiddle::TYPE_INTPTR_T,  # hHostNode : HNODE optional
    -Fiddle::TYPE_INT,  # dwControlCode : DWORD
    Fiddle::TYPE_VOIDP,  # lpInBuffer : void* optional
    -Fiddle::TYPE_INT,  # cbInBufferSize : DWORD
    Fiddle::TYPE_VOIDP,  # lpOutBuffer : void* optional, out
    -Fiddle::TYPE_INT,  # cbOutBufferSize : DWORD
    Fiddle::TYPE_VOIDP,  # lpBytesReturned : DWORD* optional, out
  ],
  -Fiddle::TYPE_INT)
#[link(name = "clusapi")]
extern "system" {
    fn ClusterResourceControl(
        hResource: isize,  // HRESOURCE
        hHostNode: isize,  // HNODE optional
        dwControlCode: u32,  // DWORD
        lpInBuffer: *mut (),  // void* optional
        cbInBufferSize: u32,  // DWORD
        lpOutBuffer: *mut (),  // void* optional, out
        cbOutBufferSize: u32,  // DWORD
        lpBytesReturned: *mut u32  // DWORD* optional, out
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("CLUSAPI.dll")]
public static extern uint ClusterResourceControl(IntPtr hResource, IntPtr hHostNode, uint dwControlCode, IntPtr lpInBuffer, uint cbInBufferSize, IntPtr lpOutBuffer, uint cbOutBufferSize, IntPtr lpBytesReturned);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CLUSAPI_ClusterResourceControl' -Namespace Win32 -PassThru
# $api::ClusterResourceControl(hResource, hHostNode, dwControlCode, lpInBuffer, cbInBufferSize, lpOutBuffer, cbOutBufferSize, lpBytesReturned)
#uselib "CLUSAPI.dll"
#func global ClusterResourceControl "ClusterResourceControl" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; ClusterResourceControl hResource, hHostNode, dwControlCode, lpInBuffer, cbInBufferSize, lpOutBuffer, cbOutBufferSize, varptr(lpBytesReturned)   ; 戻り値は stat
; hResource : HRESOURCE -> "sptr"
; hHostNode : HNODE optional -> "sptr"
; dwControlCode : DWORD -> "sptr"
; lpInBuffer : void* optional -> "sptr"
; cbInBufferSize : DWORD -> "sptr"
; lpOutBuffer : void* optional, out -> "sptr"
; cbOutBufferSize : DWORD -> "sptr"
; lpBytesReturned : DWORD* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "CLUSAPI.dll"
#cfunc global ClusterResourceControl "ClusterResourceControl" sptr, sptr, int, sptr, int, sptr, int, var
; res = ClusterResourceControl(hResource, hHostNode, dwControlCode, lpInBuffer, cbInBufferSize, lpOutBuffer, cbOutBufferSize, lpBytesReturned)
; hResource : HRESOURCE -> "sptr"
; hHostNode : HNODE optional -> "sptr"
; dwControlCode : DWORD -> "int"
; lpInBuffer : void* optional -> "sptr"
; cbInBufferSize : DWORD -> "int"
; lpOutBuffer : void* optional, out -> "sptr"
; cbOutBufferSize : DWORD -> "int"
; lpBytesReturned : DWORD* optional, out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD ClusterResourceControl(HRESOURCE hResource, HNODE hHostNode, DWORD dwControlCode, void* lpInBuffer, DWORD cbInBufferSize, void* lpOutBuffer, DWORD cbOutBufferSize, DWORD* lpBytesReturned)
#uselib "CLUSAPI.dll"
#cfunc global ClusterResourceControl "ClusterResourceControl" intptr, intptr, int, intptr, int, intptr, int, var
; res = ClusterResourceControl(hResource, hHostNode, dwControlCode, lpInBuffer, cbInBufferSize, lpOutBuffer, cbOutBufferSize, lpBytesReturned)
; hResource : HRESOURCE -> "intptr"
; hHostNode : HNODE optional -> "intptr"
; dwControlCode : DWORD -> "int"
; lpInBuffer : void* optional -> "intptr"
; cbInBufferSize : DWORD -> "int"
; lpOutBuffer : void* optional, out -> "intptr"
; cbOutBufferSize : DWORD -> "int"
; lpBytesReturned : DWORD* optional, out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	clusapi = windows.NewLazySystemDLL("CLUSAPI.dll")
	procClusterResourceControl = clusapi.NewProc("ClusterResourceControl")
)

// hResource (HRESOURCE), hHostNode (HNODE optional), dwControlCode (DWORD), lpInBuffer (void* optional), cbInBufferSize (DWORD), lpOutBuffer (void* optional, out), cbOutBufferSize (DWORD), lpBytesReturned (DWORD* optional, out)
r1, _, err := procClusterResourceControl.Call(
	uintptr(hResource),
	uintptr(hHostNode),
	uintptr(dwControlCode),
	uintptr(lpInBuffer),
	uintptr(cbInBufferSize),
	uintptr(lpOutBuffer),
	uintptr(cbOutBufferSize),
	uintptr(lpBytesReturned),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function ClusterResourceControl(
  hResource: NativeInt;   // HRESOURCE
  hHostNode: NativeInt;   // HNODE optional
  dwControlCode: DWORD;   // DWORD
  lpInBuffer: Pointer;   // void* optional
  cbInBufferSize: DWORD;   // DWORD
  lpOutBuffer: Pointer;   // void* optional, out
  cbOutBufferSize: DWORD;   // DWORD
  lpBytesReturned: Pointer   // DWORD* optional, out
): DWORD; stdcall;
  external 'CLUSAPI.dll' name 'ClusterResourceControl';
result := DllCall("CLUSAPI\ClusterResourceControl"
    , "Ptr", hResource   ; HRESOURCE
    , "Ptr", hHostNode   ; HNODE optional
    , "UInt", dwControlCode   ; DWORD
    , "Ptr", lpInBuffer   ; void* optional
    , "UInt", cbInBufferSize   ; DWORD
    , "Ptr", lpOutBuffer   ; void* optional, out
    , "UInt", cbOutBufferSize   ; DWORD
    , "Ptr", lpBytesReturned   ; DWORD* optional, out
    , "UInt")   ; return: DWORD
●ClusterResourceControl(hResource, hHostNode, dwControlCode, lpInBuffer, cbInBufferSize, lpOutBuffer, cbOutBufferSize, lpBytesReturned) = DLL("CLUSAPI.dll", "dword ClusterResourceControl(int, int, dword, void*, dword, void*, dword, void*)")
# 呼び出し: ClusterResourceControl(hResource, hHostNode, dwControlCode, lpInBuffer, cbInBufferSize, lpOutBuffer, cbOutBufferSize, lpBytesReturned)
# hResource : HRESOURCE -> "int"
# hHostNode : HNODE optional -> "int"
# dwControlCode : DWORD -> "dword"
# lpInBuffer : void* optional -> "void*"
# cbInBufferSize : DWORD -> "dword"
# lpOutBuffer : void* optional, out -> "void*"
# cbOutBufferSize : DWORD -> "dword"
# lpBytesReturned : DWORD* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。