ホーム › Networking.Clustering › ResUtilGetClusterRoleState
ResUtilGetClusterRoleState
関数指定クラスタロールの有効状態を取得する。
シグネチャ
// RESUTILS.dll
#include <windows.h>
CLUSTER_ROLE_STATE ResUtilGetClusterRoleState(
HCLUSTER hCluster,
CLUSTER_ROLE eClusterRole
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hCluster | HCLUSTER | in |
| eClusterRole | CLUSTER_ROLE | in |
戻り値の型: CLUSTER_ROLE_STATE
各言語での呼び出し定義
// RESUTILS.dll
#include <windows.h>
CLUSTER_ROLE_STATE ResUtilGetClusterRoleState(
HCLUSTER hCluster,
CLUSTER_ROLE eClusterRole
);[DllImport("RESUTILS.dll", SetLastError = true, ExactSpelling = true)]
static extern int ResUtilGetClusterRoleState(
IntPtr hCluster, // HCLUSTER
int eClusterRole // CLUSTER_ROLE
);<DllImport("RESUTILS.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function ResUtilGetClusterRoleState(
hCluster As IntPtr, ' HCLUSTER
eClusterRole As Integer ' CLUSTER_ROLE
) As Integer
End Function' hCluster : HCLUSTER
' eClusterRole : CLUSTER_ROLE
Declare PtrSafe Function ResUtilGetClusterRoleState Lib "resutils" ( _
ByVal hCluster As LongPtr, _
ByVal eClusterRole As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ResUtilGetClusterRoleState = ctypes.windll.resutils.ResUtilGetClusterRoleState
ResUtilGetClusterRoleState.restype = ctypes.c_int
ResUtilGetClusterRoleState.argtypes = [
ctypes.c_ssize_t, # hCluster : HCLUSTER
ctypes.c_int, # eClusterRole : CLUSTER_ROLE
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('RESUTILS.dll')
ResUtilGetClusterRoleState = Fiddle::Function.new(
lib['ResUtilGetClusterRoleState'],
[
Fiddle::TYPE_INTPTR_T, # hCluster : HCLUSTER
Fiddle::TYPE_INT, # eClusterRole : CLUSTER_ROLE
],
Fiddle::TYPE_INT)#[link(name = "resutils")]
extern "system" {
fn ResUtilGetClusterRoleState(
hCluster: isize, // HCLUSTER
eClusterRole: i32 // CLUSTER_ROLE
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("RESUTILS.dll", SetLastError = true)]
public static extern int ResUtilGetClusterRoleState(IntPtr hCluster, int eClusterRole);
"@
$api = Add-Type -MemberDefinition $sig -Name 'RESUTILS_ResUtilGetClusterRoleState' -Namespace Win32 -PassThru
# $api::ResUtilGetClusterRoleState(hCluster, eClusterRole)#uselib "RESUTILS.dll"
#func global ResUtilGetClusterRoleState "ResUtilGetClusterRoleState" sptr, sptr
; ResUtilGetClusterRoleState hCluster, eClusterRole ; 戻り値は stat
; hCluster : HCLUSTER -> "sptr"
; eClusterRole : CLUSTER_ROLE -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "RESUTILS.dll"
#cfunc global ResUtilGetClusterRoleState "ResUtilGetClusterRoleState" sptr, int
; res = ResUtilGetClusterRoleState(hCluster, eClusterRole)
; hCluster : HCLUSTER -> "sptr"
; eClusterRole : CLUSTER_ROLE -> "int"; CLUSTER_ROLE_STATE ResUtilGetClusterRoleState(HCLUSTER hCluster, CLUSTER_ROLE eClusterRole)
#uselib "RESUTILS.dll"
#cfunc global ResUtilGetClusterRoleState "ResUtilGetClusterRoleState" intptr, int
; res = ResUtilGetClusterRoleState(hCluster, eClusterRole)
; hCluster : HCLUSTER -> "intptr"
; eClusterRole : CLUSTER_ROLE -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
resutils = windows.NewLazySystemDLL("RESUTILS.dll")
procResUtilGetClusterRoleState = resutils.NewProc("ResUtilGetClusterRoleState")
)
// hCluster (HCLUSTER), eClusterRole (CLUSTER_ROLE)
r1, _, err := procResUtilGetClusterRoleState.Call(
uintptr(hCluster),
uintptr(eClusterRole),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // CLUSTER_ROLE_STATEfunction ResUtilGetClusterRoleState(
hCluster: NativeInt; // HCLUSTER
eClusterRole: Integer // CLUSTER_ROLE
): Integer; stdcall;
external 'RESUTILS.dll' name 'ResUtilGetClusterRoleState';result := DllCall("RESUTILS\ResUtilGetClusterRoleState"
, "Ptr", hCluster ; HCLUSTER
, "Int", eClusterRole ; CLUSTER_ROLE
, "Int") ; return: CLUSTER_ROLE_STATE●ResUtilGetClusterRoleState(hCluster, eClusterRole) = DLL("RESUTILS.dll", "int ResUtilGetClusterRoleState(int, int)")
# 呼び出し: ResUtilGetClusterRoleState(hCluster, eClusterRole)
# hCluster : HCLUSTER -> "int"
# eClusterRole : CLUSTER_ROLE -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。