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

GetClusterGroupKey

関数
クラスターグループのレジストリキーを開いて取得する。
DLLCLUSAPI.dll呼出規約winapiSetLastErrorあり対応OSwindowsserver2008

シグネチャ

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

HKEY GetClusterGroupKey(
    HGROUP hGroup,
    DWORD samDesired
);

パラメーター

名前方向
hGroupHGROUPin
samDesiredDWORDin

戻り値の型: HKEY

各言語での呼び出し定義

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

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

GetClusterGroupKey = ctypes.windll.clusapi.GetClusterGroupKey
GetClusterGroupKey.restype = ctypes.c_void_p
GetClusterGroupKey.argtypes = [
    ctypes.c_ssize_t,  # hGroup : HGROUP
    wintypes.DWORD,  # samDesired : DWORD
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

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

var (
	clusapi = windows.NewLazySystemDLL("CLUSAPI.dll")
	procGetClusterGroupKey = clusapi.NewProc("GetClusterGroupKey")
)

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