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

GetClusterNetInterfaceState

関数
クラスターネットワークインターフェイスの状態を取得する。
DLLCLUSAPI.dll呼出規約winapiSetLastErrorあり対応OSwindowsserver2008

シグネチャ

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

CLUSTER_NETINTERFACE_STATE GetClusterNetInterfaceState(
    HNETINTERFACE hNetInterface
);

パラメーター

名前方向
hNetInterfaceHNETINTERFACEin

戻り値の型: CLUSTER_NETINTERFACE_STATE

各言語での呼び出し定義

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

CLUSTER_NETINTERFACE_STATE GetClusterNetInterfaceState(
    HNETINTERFACE hNetInterface
);
[DllImport("CLUSAPI.dll", SetLastError = true, ExactSpelling = true)]
static extern int GetClusterNetInterfaceState(
    IntPtr hNetInterface   // HNETINTERFACE
);
<DllImport("CLUSAPI.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function GetClusterNetInterfaceState(
    hNetInterface As IntPtr   ' HNETINTERFACE
) As Integer
End Function
' hNetInterface : HNETINTERFACE
Declare PtrSafe Function GetClusterNetInterfaceState Lib "clusapi" ( _
    ByVal hNetInterface As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GetClusterNetInterfaceState = ctypes.windll.clusapi.GetClusterNetInterfaceState
GetClusterNetInterfaceState.restype = ctypes.c_int
GetClusterNetInterfaceState.argtypes = [
    ctypes.c_ssize_t,  # hNetInterface : HNETINTERFACE
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('CLUSAPI.dll')
GetClusterNetInterfaceState = Fiddle::Function.new(
  lib['GetClusterNetInterfaceState'],
  [
    Fiddle::TYPE_INTPTR_T,  # hNetInterface : HNETINTERFACE
  ],
  Fiddle::TYPE_INT)
#[link(name = "clusapi")]
extern "system" {
    fn GetClusterNetInterfaceState(
        hNetInterface: isize  // HNETINTERFACE
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("CLUSAPI.dll", SetLastError = true)]
public static extern int GetClusterNetInterfaceState(IntPtr hNetInterface);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CLUSAPI_GetClusterNetInterfaceState' -Namespace Win32 -PassThru
# $api::GetClusterNetInterfaceState(hNetInterface)
#uselib "CLUSAPI.dll"
#func global GetClusterNetInterfaceState "GetClusterNetInterfaceState" sptr
; GetClusterNetInterfaceState hNetInterface   ; 戻り値は stat
; hNetInterface : HNETINTERFACE -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "CLUSAPI.dll"
#cfunc global GetClusterNetInterfaceState "GetClusterNetInterfaceState" sptr
; res = GetClusterNetInterfaceState(hNetInterface)
; hNetInterface : HNETINTERFACE -> "sptr"
; CLUSTER_NETINTERFACE_STATE GetClusterNetInterfaceState(HNETINTERFACE hNetInterface)
#uselib "CLUSAPI.dll"
#cfunc global GetClusterNetInterfaceState "GetClusterNetInterfaceState" intptr
; res = GetClusterNetInterfaceState(hNetInterface)
; hNetInterface : HNETINTERFACE -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	clusapi = windows.NewLazySystemDLL("CLUSAPI.dll")
	procGetClusterNetInterfaceState = clusapi.NewProc("GetClusterNetInterfaceState")
)

// hNetInterface (HNETINTERFACE)
r1, _, err := procGetClusterNetInterfaceState.Call(
	uintptr(hNetInterface),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // CLUSTER_NETINTERFACE_STATE
function GetClusterNetInterfaceState(
  hNetInterface: NativeInt   // HNETINTERFACE
): Integer; stdcall;
  external 'CLUSAPI.dll' name 'GetClusterNetInterfaceState';
result := DllCall("CLUSAPI\GetClusterNetInterfaceState"
    , "Ptr", hNetInterface   ; HNETINTERFACE
    , "Int")   ; return: CLUSTER_NETINTERFACE_STATE
●GetClusterNetInterfaceState(hNetInterface) = DLL("CLUSAPI.dll", "int GetClusterNetInterfaceState(int)")
# 呼び出し: GetClusterNetInterfaceState(hNetInterface)
# hNetInterface : HNETINTERFACE -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。