ホーム › Networking.Clustering › ClusterRegEnumKey
ClusterRegEnumKey
関数クラスターレジストリキーのサブキーを列挙する。
シグネチャ
// CLUSAPI.dll
#include <windows.h>
INT ClusterRegEnumKey(
HKEY hKey,
DWORD dwIndex,
LPWSTR lpszName,
DWORD* lpcchName,
FILETIME* lpftLastWriteTime // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hKey | HKEY | in |
| dwIndex | DWORD | in |
| lpszName | LPWSTR | out |
| lpcchName | DWORD* | inout |
| lpftLastWriteTime | FILETIME* | outoptional |
戻り値の型: INT
各言語での呼び出し定義
// CLUSAPI.dll
#include <windows.h>
INT ClusterRegEnumKey(
HKEY hKey,
DWORD dwIndex,
LPWSTR lpszName,
DWORD* lpcchName,
FILETIME* lpftLastWriteTime // optional
);[DllImport("CLUSAPI.dll", ExactSpelling = true)]
static extern int ClusterRegEnumKey(
IntPtr hKey, // HKEY
uint dwIndex, // DWORD
[MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder lpszName, // LPWSTR out
ref uint lpcchName, // DWORD* in/out
IntPtr lpftLastWriteTime // FILETIME* optional, out
);<DllImport("CLUSAPI.dll", ExactSpelling:=True)>
Public Shared Function ClusterRegEnumKey(
hKey As IntPtr, ' HKEY
dwIndex As UInteger, ' DWORD
<MarshalAs(UnmanagedType.LPWStr)> lpszName As System.Text.StringBuilder, ' LPWSTR out
ByRef lpcchName As UInteger, ' DWORD* in/out
lpftLastWriteTime As IntPtr ' FILETIME* optional, out
) As Integer
End Function' hKey : HKEY
' dwIndex : DWORD
' lpszName : LPWSTR out
' lpcchName : DWORD* in/out
' lpftLastWriteTime : FILETIME* optional, out
Declare PtrSafe Function ClusterRegEnumKey Lib "clusapi" ( _
ByVal hKey As LongPtr, _
ByVal dwIndex As Long, _
ByVal lpszName As LongPtr, _
ByRef lpcchName As Long, _
ByVal lpftLastWriteTime As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ClusterRegEnumKey = ctypes.windll.clusapi.ClusterRegEnumKey
ClusterRegEnumKey.restype = ctypes.c_int
ClusterRegEnumKey.argtypes = [
wintypes.HANDLE, # hKey : HKEY
wintypes.DWORD, # dwIndex : DWORD
wintypes.LPWSTR, # lpszName : LPWSTR out
ctypes.POINTER(wintypes.DWORD), # lpcchName : DWORD* in/out
ctypes.c_void_p, # lpftLastWriteTime : FILETIME* optional, out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('CLUSAPI.dll')
ClusterRegEnumKey = Fiddle::Function.new(
lib['ClusterRegEnumKey'],
[
Fiddle::TYPE_VOIDP, # hKey : HKEY
-Fiddle::TYPE_INT, # dwIndex : DWORD
Fiddle::TYPE_VOIDP, # lpszName : LPWSTR out
Fiddle::TYPE_VOIDP, # lpcchName : DWORD* in/out
Fiddle::TYPE_VOIDP, # lpftLastWriteTime : FILETIME* optional, out
],
Fiddle::TYPE_INT)#[link(name = "clusapi")]
extern "system" {
fn ClusterRegEnumKey(
hKey: *mut core::ffi::c_void, // HKEY
dwIndex: u32, // DWORD
lpszName: *mut u16, // LPWSTR out
lpcchName: *mut u32, // DWORD* in/out
lpftLastWriteTime: *mut FILETIME // FILETIME* optional, out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("CLUSAPI.dll")]
public static extern int ClusterRegEnumKey(IntPtr hKey, uint dwIndex, [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder lpszName, ref uint lpcchName, IntPtr lpftLastWriteTime);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CLUSAPI_ClusterRegEnumKey' -Namespace Win32 -PassThru
# $api::ClusterRegEnumKey(hKey, dwIndex, lpszName, lpcchName, lpftLastWriteTime)#uselib "CLUSAPI.dll"
#func global ClusterRegEnumKey "ClusterRegEnumKey" sptr, sptr, sptr, sptr, sptr
; ClusterRegEnumKey hKey, dwIndex, varptr(lpszName), varptr(lpcchName), varptr(lpftLastWriteTime) ; 戻り値は stat
; hKey : HKEY -> "sptr"
; dwIndex : DWORD -> "sptr"
; lpszName : LPWSTR out -> "sptr"
; lpcchName : DWORD* in/out -> "sptr"
; lpftLastWriteTime : FILETIME* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "CLUSAPI.dll" #cfunc global ClusterRegEnumKey "ClusterRegEnumKey" sptr, int, var, var, var ; res = ClusterRegEnumKey(hKey, dwIndex, lpszName, lpcchName, lpftLastWriteTime) ; hKey : HKEY -> "sptr" ; dwIndex : DWORD -> "int" ; lpszName : LPWSTR out -> "var" ; lpcchName : DWORD* in/out -> "var" ; lpftLastWriteTime : FILETIME* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "CLUSAPI.dll" #cfunc global ClusterRegEnumKey "ClusterRegEnumKey" sptr, int, sptr, sptr, sptr ; res = ClusterRegEnumKey(hKey, dwIndex, varptr(lpszName), varptr(lpcchName), varptr(lpftLastWriteTime)) ; hKey : HKEY -> "sptr" ; dwIndex : DWORD -> "int" ; lpszName : LPWSTR out -> "sptr" ; lpcchName : DWORD* in/out -> "sptr" ; lpftLastWriteTime : FILETIME* optional, out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; INT ClusterRegEnumKey(HKEY hKey, DWORD dwIndex, LPWSTR lpszName, DWORD* lpcchName, FILETIME* lpftLastWriteTime) #uselib "CLUSAPI.dll" #cfunc global ClusterRegEnumKey "ClusterRegEnumKey" intptr, int, var, var, var ; res = ClusterRegEnumKey(hKey, dwIndex, lpszName, lpcchName, lpftLastWriteTime) ; hKey : HKEY -> "intptr" ; dwIndex : DWORD -> "int" ; lpszName : LPWSTR out -> "var" ; lpcchName : DWORD* in/out -> "var" ; lpftLastWriteTime : FILETIME* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; INT ClusterRegEnumKey(HKEY hKey, DWORD dwIndex, LPWSTR lpszName, DWORD* lpcchName, FILETIME* lpftLastWriteTime) #uselib "CLUSAPI.dll" #cfunc global ClusterRegEnumKey "ClusterRegEnumKey" intptr, int, intptr, intptr, intptr ; res = ClusterRegEnumKey(hKey, dwIndex, varptr(lpszName), varptr(lpcchName), varptr(lpftLastWriteTime)) ; hKey : HKEY -> "intptr" ; dwIndex : DWORD -> "int" ; lpszName : LPWSTR out -> "intptr" ; lpcchName : DWORD* in/out -> "intptr" ; lpftLastWriteTime : FILETIME* optional, out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
clusapi = windows.NewLazySystemDLL("CLUSAPI.dll")
procClusterRegEnumKey = clusapi.NewProc("ClusterRegEnumKey")
)
// hKey (HKEY), dwIndex (DWORD), lpszName (LPWSTR out), lpcchName (DWORD* in/out), lpftLastWriteTime (FILETIME* optional, out)
r1, _, err := procClusterRegEnumKey.Call(
uintptr(hKey),
uintptr(dwIndex),
uintptr(lpszName),
uintptr(lpcchName),
uintptr(lpftLastWriteTime),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INTfunction ClusterRegEnumKey(
hKey: THandle; // HKEY
dwIndex: DWORD; // DWORD
lpszName: PWideChar; // LPWSTR out
lpcchName: Pointer; // DWORD* in/out
lpftLastWriteTime: Pointer // FILETIME* optional, out
): Integer; stdcall;
external 'CLUSAPI.dll' name 'ClusterRegEnumKey';result := DllCall("CLUSAPI\ClusterRegEnumKey"
, "Ptr", hKey ; HKEY
, "UInt", dwIndex ; DWORD
, "Ptr", lpszName ; LPWSTR out
, "Ptr", lpcchName ; DWORD* in/out
, "Ptr", lpftLastWriteTime ; FILETIME* optional, out
, "Int") ; return: INT●ClusterRegEnumKey(hKey, dwIndex, lpszName, lpcchName, lpftLastWriteTime) = DLL("CLUSAPI.dll", "int ClusterRegEnumKey(void*, dword, char*, void*, void*)")
# 呼び出し: ClusterRegEnumKey(hKey, dwIndex, lpszName, lpcchName, lpftLastWriteTime)
# hKey : HKEY -> "void*"
# dwIndex : DWORD -> "dword"
# lpszName : LPWSTR out -> "char*"
# lpcchName : DWORD* in/out -> "void*"
# lpftLastWriteTime : FILETIME* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。