ホーム › Networking.Clustering › GetClusterKey
GetClusterKey
関数クラスター全体のレジストリキーを開いて取得する。
シグネチャ
// CLUSAPI.dll
#include <windows.h>
HKEY GetClusterKey(
HCLUSTER hCluster,
DWORD samDesired
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hCluster | HCLUSTER | in |
| samDesired | DWORD | in |
戻り値の型: HKEY
各言語での呼び出し定義
// CLUSAPI.dll
#include <windows.h>
HKEY GetClusterKey(
HCLUSTER hCluster,
DWORD samDesired
);[DllImport("CLUSAPI.dll", SetLastError = true, ExactSpelling = true)]
static extern IntPtr GetClusterKey(
IntPtr hCluster, // HCLUSTER
uint samDesired // DWORD
);<DllImport("CLUSAPI.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function GetClusterKey(
hCluster As IntPtr, ' HCLUSTER
samDesired As UInteger ' DWORD
) As IntPtr
End Function' hCluster : HCLUSTER
' samDesired : DWORD
Declare PtrSafe Function GetClusterKey Lib "clusapi" ( _
ByVal hCluster 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
GetClusterKey = ctypes.windll.clusapi.GetClusterKey
GetClusterKey.restype = ctypes.c_void_p
GetClusterKey.argtypes = [
ctypes.c_ssize_t, # hCluster : HCLUSTER
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')
GetClusterKey = Fiddle::Function.new(
lib['GetClusterKey'],
[
Fiddle::TYPE_INTPTR_T, # hCluster : HCLUSTER
-Fiddle::TYPE_INT, # samDesired : DWORD
],
Fiddle::TYPE_VOIDP)#[link(name = "clusapi")]
extern "system" {
fn GetClusterKey(
hCluster: isize, // HCLUSTER
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 GetClusterKey(IntPtr hCluster, uint samDesired);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CLUSAPI_GetClusterKey' -Namespace Win32 -PassThru
# $api::GetClusterKey(hCluster, samDesired)#uselib "CLUSAPI.dll"
#func global GetClusterKey "GetClusterKey" sptr, sptr
; GetClusterKey hCluster, samDesired ; 戻り値は stat
; hCluster : HCLUSTER -> "sptr"
; samDesired : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "CLUSAPI.dll"
#cfunc global GetClusterKey "GetClusterKey" sptr, int
; res = GetClusterKey(hCluster, samDesired)
; hCluster : HCLUSTER -> "sptr"
; samDesired : DWORD -> "int"; HKEY GetClusterKey(HCLUSTER hCluster, DWORD samDesired)
#uselib "CLUSAPI.dll"
#cfunc global GetClusterKey "GetClusterKey" intptr, int
; res = GetClusterKey(hCluster, samDesired)
; hCluster : HCLUSTER -> "intptr"
; samDesired : DWORD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
clusapi = windows.NewLazySystemDLL("CLUSAPI.dll")
procGetClusterKey = clusapi.NewProc("GetClusterKey")
)
// hCluster (HCLUSTER), samDesired (DWORD)
r1, _, err := procGetClusterKey.Call(
uintptr(hCluster),
uintptr(samDesired),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HKEYfunction GetClusterKey(
hCluster: NativeInt; // HCLUSTER
samDesired: DWORD // DWORD
): THandle; stdcall;
external 'CLUSAPI.dll' name 'GetClusterKey';result := DllCall("CLUSAPI\GetClusterKey"
, "Ptr", hCluster ; HCLUSTER
, "UInt", samDesired ; DWORD
, "Ptr") ; return: HKEY●GetClusterKey(hCluster, samDesired) = DLL("CLUSAPI.dll", "void* GetClusterKey(int, dword)")
# 呼び出し: GetClusterKey(hCluster, samDesired)
# hCluster : HCLUSTER -> "int"
# samDesired : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。