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

ClusterRegEnumValue

関数
クラスタレジストリキー配下の値をインデックス順に列挙する。
DLLCLUSAPI.dll呼出規約winapi対応OSwindowsserver2008

シグネチャ

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

DWORD ClusterRegEnumValue(
    HKEY hKey,
    DWORD dwIndex,
    LPWSTR lpszValueName,
    DWORD* lpcchValueName,
    DWORD* lpdwType,   // optional
    BYTE* lpData,   // optional
    DWORD* lpcbData   // optional
);

パラメーター

名前方向
hKeyHKEYin
dwIndexDWORDin
lpszValueNameLPWSTRout
lpcchValueNameDWORD*inout
lpdwTypeDWORD*outoptional
lpDataBYTE*outoptional
lpcbDataDWORD*inoutoptional

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD ClusterRegEnumValue(
    HKEY hKey,
    DWORD dwIndex,
    LPWSTR lpszValueName,
    DWORD* lpcchValueName,
    DWORD* lpdwType,   // optional
    BYTE* lpData,   // optional
    DWORD* lpcbData   // optional
);
[DllImport("CLUSAPI.dll", ExactSpelling = true)]
static extern uint ClusterRegEnumValue(
    IntPtr hKey,   // HKEY
    uint dwIndex,   // DWORD
    [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder lpszValueName,   // LPWSTR out
    ref uint lpcchValueName,   // DWORD* in/out
    IntPtr lpdwType,   // DWORD* optional, out
    IntPtr lpData,   // BYTE* optional, out
    IntPtr lpcbData   // DWORD* optional, in/out
);
<DllImport("CLUSAPI.dll", ExactSpelling:=True)>
Public Shared Function ClusterRegEnumValue(
    hKey As IntPtr,   ' HKEY
    dwIndex As UInteger,   ' DWORD
    <MarshalAs(UnmanagedType.LPWStr)> lpszValueName As System.Text.StringBuilder,   ' LPWSTR out
    ByRef lpcchValueName As UInteger,   ' DWORD* in/out
    lpdwType As IntPtr,   ' DWORD* optional, out
    lpData As IntPtr,   ' BYTE* optional, out
    lpcbData As IntPtr   ' DWORD* optional, in/out
) As UInteger
End Function
' hKey : HKEY
' dwIndex : DWORD
' lpszValueName : LPWSTR out
' lpcchValueName : DWORD* in/out
' lpdwType : DWORD* optional, out
' lpData : BYTE* optional, out
' lpcbData : DWORD* optional, in/out
Declare PtrSafe Function ClusterRegEnumValue Lib "clusapi" ( _
    ByVal hKey As LongPtr, _
    ByVal dwIndex As Long, _
    ByVal lpszValueName As LongPtr, _
    ByRef lpcchValueName As Long, _
    ByVal lpdwType As LongPtr, _
    ByVal lpData As LongPtr, _
    ByVal lpcbData As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ClusterRegEnumValue = ctypes.windll.clusapi.ClusterRegEnumValue
ClusterRegEnumValue.restype = wintypes.DWORD
ClusterRegEnumValue.argtypes = [
    wintypes.HANDLE,  # hKey : HKEY
    wintypes.DWORD,  # dwIndex : DWORD
    wintypes.LPWSTR,  # lpszValueName : LPWSTR out
    ctypes.POINTER(wintypes.DWORD),  # lpcchValueName : DWORD* in/out
    ctypes.POINTER(wintypes.DWORD),  # lpdwType : DWORD* optional, out
    ctypes.POINTER(ctypes.c_ubyte),  # lpData : BYTE* optional, out
    ctypes.POINTER(wintypes.DWORD),  # lpcbData : DWORD* optional, in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('CLUSAPI.dll')
ClusterRegEnumValue = Fiddle::Function.new(
  lib['ClusterRegEnumValue'],
  [
    Fiddle::TYPE_VOIDP,  # hKey : HKEY
    -Fiddle::TYPE_INT,  # dwIndex : DWORD
    Fiddle::TYPE_VOIDP,  # lpszValueName : LPWSTR out
    Fiddle::TYPE_VOIDP,  # lpcchValueName : DWORD* in/out
    Fiddle::TYPE_VOIDP,  # lpdwType : DWORD* optional, out
    Fiddle::TYPE_VOIDP,  # lpData : BYTE* optional, out
    Fiddle::TYPE_VOIDP,  # lpcbData : DWORD* optional, in/out
  ],
  -Fiddle::TYPE_INT)
#[link(name = "clusapi")]
extern "system" {
    fn ClusterRegEnumValue(
        hKey: *mut core::ffi::c_void,  // HKEY
        dwIndex: u32,  // DWORD
        lpszValueName: *mut u16,  // LPWSTR out
        lpcchValueName: *mut u32,  // DWORD* in/out
        lpdwType: *mut u32,  // DWORD* optional, out
        lpData: *mut u8,  // BYTE* optional, out
        lpcbData: *mut u32  // DWORD* optional, in/out
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("CLUSAPI.dll")]
public static extern uint ClusterRegEnumValue(IntPtr hKey, uint dwIndex, [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder lpszValueName, ref uint lpcchValueName, IntPtr lpdwType, IntPtr lpData, IntPtr lpcbData);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CLUSAPI_ClusterRegEnumValue' -Namespace Win32 -PassThru
# $api::ClusterRegEnumValue(hKey, dwIndex, lpszValueName, lpcchValueName, lpdwType, lpData, lpcbData)
#uselib "CLUSAPI.dll"
#func global ClusterRegEnumValue "ClusterRegEnumValue" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; ClusterRegEnumValue hKey, dwIndex, varptr(lpszValueName), varptr(lpcchValueName), varptr(lpdwType), varptr(lpData), varptr(lpcbData)   ; 戻り値は stat
; hKey : HKEY -> "sptr"
; dwIndex : DWORD -> "sptr"
; lpszValueName : LPWSTR out -> "sptr"
; lpcchValueName : DWORD* in/out -> "sptr"
; lpdwType : DWORD* optional, out -> "sptr"
; lpData : BYTE* optional, out -> "sptr"
; lpcbData : DWORD* optional, in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "CLUSAPI.dll"
#cfunc global ClusterRegEnumValue "ClusterRegEnumValue" sptr, int, var, var, var, var, var
; res = ClusterRegEnumValue(hKey, dwIndex, lpszValueName, lpcchValueName, lpdwType, lpData, lpcbData)
; hKey : HKEY -> "sptr"
; dwIndex : DWORD -> "int"
; lpszValueName : LPWSTR out -> "var"
; lpcchValueName : DWORD* in/out -> "var"
; lpdwType : DWORD* optional, out -> "var"
; lpData : BYTE* optional, out -> "var"
; lpcbData : DWORD* optional, in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD ClusterRegEnumValue(HKEY hKey, DWORD dwIndex, LPWSTR lpszValueName, DWORD* lpcchValueName, DWORD* lpdwType, BYTE* lpData, DWORD* lpcbData)
#uselib "CLUSAPI.dll"
#cfunc global ClusterRegEnumValue "ClusterRegEnumValue" intptr, int, var, var, var, var, var
; res = ClusterRegEnumValue(hKey, dwIndex, lpszValueName, lpcchValueName, lpdwType, lpData, lpcbData)
; hKey : HKEY -> "intptr"
; dwIndex : DWORD -> "int"
; lpszValueName : LPWSTR out -> "var"
; lpcchValueName : DWORD* in/out -> "var"
; lpdwType : DWORD* optional, out -> "var"
; lpData : BYTE* optional, out -> "var"
; lpcbData : DWORD* optional, in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	clusapi = windows.NewLazySystemDLL("CLUSAPI.dll")
	procClusterRegEnumValue = clusapi.NewProc("ClusterRegEnumValue")
)

// hKey (HKEY), dwIndex (DWORD), lpszValueName (LPWSTR out), lpcchValueName (DWORD* in/out), lpdwType (DWORD* optional, out), lpData (BYTE* optional, out), lpcbData (DWORD* optional, in/out)
r1, _, err := procClusterRegEnumValue.Call(
	uintptr(hKey),
	uintptr(dwIndex),
	uintptr(lpszValueName),
	uintptr(lpcchValueName),
	uintptr(lpdwType),
	uintptr(lpData),
	uintptr(lpcbData),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function ClusterRegEnumValue(
  hKey: THandle;   // HKEY
  dwIndex: DWORD;   // DWORD
  lpszValueName: PWideChar;   // LPWSTR out
  lpcchValueName: Pointer;   // DWORD* in/out
  lpdwType: Pointer;   // DWORD* optional, out
  lpData: Pointer;   // BYTE* optional, out
  lpcbData: Pointer   // DWORD* optional, in/out
): DWORD; stdcall;
  external 'CLUSAPI.dll' name 'ClusterRegEnumValue';
result := DllCall("CLUSAPI\ClusterRegEnumValue"
    , "Ptr", hKey   ; HKEY
    , "UInt", dwIndex   ; DWORD
    , "Ptr", lpszValueName   ; LPWSTR out
    , "Ptr", lpcchValueName   ; DWORD* in/out
    , "Ptr", lpdwType   ; DWORD* optional, out
    , "Ptr", lpData   ; BYTE* optional, out
    , "Ptr", lpcbData   ; DWORD* optional, in/out
    , "UInt")   ; return: DWORD
●ClusterRegEnumValue(hKey, dwIndex, lpszValueName, lpcchValueName, lpdwType, lpData, lpcbData) = DLL("CLUSAPI.dll", "dword ClusterRegEnumValue(void*, dword, char*, void*, void*, void*, void*)")
# 呼び出し: ClusterRegEnumValue(hKey, dwIndex, lpszValueName, lpcchValueName, lpdwType, lpData, lpcbData)
# hKey : HKEY -> "void*"
# dwIndex : DWORD -> "dword"
# lpszValueName : LPWSTR out -> "char*"
# lpcchValueName : DWORD* in/out -> "void*"
# lpdwType : DWORD* optional, out -> "void*"
# lpData : BYTE* optional, out -> "void*"
# lpcbData : DWORD* optional, in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。