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列挙する値の0始まりのインデックス。
lpszValueNameLPWSTRout値名を受け取るワイド文字列バッファ。
lpcchValueNameDWORD*inout入出力。値名バッファ文字数を渡し、必要文字数を受け取るポインタ。
lpdwTypeDWORD*outoptional値のデータ型を受け取るDWORDポインタ。NULL可。
lpDataBYTE*outoptional値データを受け取るバッファ。NULL可。
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)。
const std = @import("std");

extern "clusapi" fn ClusterRegEnumValue(
    hKey: ?*anyopaque, // HKEY
    dwIndex: u32, // DWORD
    lpszValueName: [*c]u16, // LPWSTR out
    lpcchValueName: [*c]u32, // DWORD* in/out
    lpdwType: [*c]u32, // DWORD* optional, out
    lpData: [*c]u8, // BYTE* optional, out
    lpcbData: [*c]u32 // DWORD* optional, in/out
) callconv(std.os.windows.WINAPI) u32;
proc ClusterRegEnumValue(
    hKey: pointer,  # HKEY
    dwIndex: uint32,  # DWORD
    lpszValueName: ptr uint16,  # LPWSTR out
    lpcchValueName: ptr uint32,  # DWORD* in/out
    lpdwType: ptr uint32,  # DWORD* optional, out
    lpData: ptr uint8,  # BYTE* optional, out
    lpcbData: ptr uint32  # DWORD* optional, in/out
): uint32 {.importc: "ClusterRegEnumValue", stdcall, dynlib: "CLUSAPI.dll".}
pragma(lib, "clusapi");
extern(Windows)
uint ClusterRegEnumValue(
    void* hKey,   // HKEY
    uint dwIndex,   // DWORD
    wchar* lpszValueName,   // LPWSTR out
    uint* lpcchValueName,   // DWORD* in/out
    uint* lpdwType,   // DWORD* optional, out
    ubyte* lpData,   // BYTE* optional, out
    uint* lpcbData   // DWORD* optional, in/out
);
ccall((:ClusterRegEnumValue, "CLUSAPI.dll"), stdcall, UInt32,
      (Ptr{Cvoid}, UInt32, Ptr{UInt16}, Ptr{UInt32}, Ptr{UInt32}, Ptr{UInt8}, Ptr{UInt32}),
      hKey, dwIndex, lpszValueName, lpcchValueName, lpdwType, lpData, lpcbData)
# hKey : HKEY -> Ptr{Cvoid}
# dwIndex : DWORD -> UInt32
# lpszValueName : LPWSTR out -> Ptr{UInt16}
# lpcchValueName : DWORD* in/out -> Ptr{UInt32}
# lpdwType : DWORD* optional, out -> Ptr{UInt32}
# lpData : BYTE* optional, out -> Ptr{UInt8}
# lpcbData : DWORD* optional, in/out -> Ptr{UInt32}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
uint32_t ClusterRegEnumValue(
    void* hKey,
    uint32_t dwIndex,
    uint16_t* lpszValueName,
    uint32_t* lpcchValueName,
    uint32_t* lpdwType,
    uint8_t* lpData,
    uint32_t* lpcbData);
]]
local clusapi = ffi.load("clusapi")
-- clusapi.ClusterRegEnumValue(hKey, dwIndex, lpszValueName, lpcchValueName, lpdwType, lpData, lpcbData)
-- hKey : HKEY
-- dwIndex : DWORD
-- lpszValueName : LPWSTR out
-- lpcchValueName : DWORD* in/out
-- lpdwType : DWORD* optional, out
-- lpData : BYTE* optional, out
-- lpcbData : DWORD* optional, in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('CLUSAPI.dll');
const ClusterRegEnumValue = lib.func('__stdcall', 'ClusterRegEnumValue', 'uint32_t', ['void *', 'uint32_t', 'uint16_t *', 'uint32_t *', 'uint32_t *', 'uint8_t *', 'uint32_t *']);
// ClusterRegEnumValue(hKey, dwIndex, lpszValueName, lpcchValueName, lpdwType, lpData, lpcbData)
// hKey : HKEY -> 'void *'
// dwIndex : DWORD -> 'uint32_t'
// lpszValueName : LPWSTR out -> 'uint16_t *'
// lpcchValueName : DWORD* in/out -> 'uint32_t *'
// lpdwType : DWORD* optional, out -> 'uint32_t *'
// lpData : BYTE* optional, out -> 'uint8_t *'
// lpcbData : DWORD* optional, in/out -> 'uint32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("CLUSAPI.dll", {
  ClusterRegEnumValue: { parameters: ["pointer", "u32", "buffer", "pointer", "pointer", "pointer", "pointer"], result: "u32" },
});
// lib.symbols.ClusterRegEnumValue(hKey, dwIndex, lpszValueName, lpcchValueName, lpdwType, lpData, lpcbData)
// hKey : HKEY -> "pointer"
// dwIndex : DWORD -> "u32"
// lpszValueName : LPWSTR out -> "buffer"
// lpcchValueName : DWORD* in/out -> "pointer"
// lpdwType : DWORD* optional, out -> "pointer"
// lpData : BYTE* optional, out -> "pointer"
// lpcbData : DWORD* optional, in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint32_t ClusterRegEnumValue(
    void* hKey,
    uint32_t dwIndex,
    uint16_t* lpszValueName,
    uint32_t* lpcchValueName,
    uint32_t* lpdwType,
    uint8_t* lpData,
    uint32_t* lpcbData);
C, "CLUSAPI.dll");
// $ffi->ClusterRegEnumValue(hKey, dwIndex, lpszValueName, lpcchValueName, lpdwType, lpData, lpcbData);
// hKey : HKEY
// dwIndex : DWORD
// lpszValueName : LPWSTR out
// lpcchValueName : DWORD* in/out
// lpdwType : DWORD* optional, out
// lpData : BYTE* optional, out
// lpcbData : DWORD* optional, in/out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Clusapi extends StdCallLibrary {
    Clusapi INSTANCE = Native.load("clusapi", Clusapi.class);
    int ClusterRegEnumValue(
        Pointer hKey,   // HKEY
        int dwIndex,   // DWORD
        char[] lpszValueName,   // LPWSTR out
        IntByReference lpcchValueName,   // DWORD* in/out
        IntByReference lpdwType,   // DWORD* optional, out
        byte[] lpData,   // BYTE* optional, out
        IntByReference lpcbData   // DWORD* optional, in/out
    );
}
@[Link("clusapi")]
lib LibCLUSAPI
  fun ClusterRegEnumValue = ClusterRegEnumValue(
    hKey : Void*,   # HKEY
    dwIndex : UInt32,   # DWORD
    lpszValueName : UInt16*,   # LPWSTR out
    lpcchValueName : UInt32*,   # DWORD* in/out
    lpdwType : UInt32*,   # DWORD* optional, out
    lpData : UInt8*,   # BYTE* optional, out
    lpcbData : UInt32*   # DWORD* optional, in/out
  ) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef ClusterRegEnumValueNative = Uint32 Function(Pointer<Void>, Uint32, Pointer<Utf16>, Pointer<Uint32>, Pointer<Uint32>, Pointer<Uint8>, Pointer<Uint32>);
typedef ClusterRegEnumValueDart = int Function(Pointer<Void>, int, Pointer<Utf16>, Pointer<Uint32>, Pointer<Uint32>, Pointer<Uint8>, Pointer<Uint32>);
final ClusterRegEnumValue = DynamicLibrary.open('CLUSAPI.dll')
    .lookupFunction<ClusterRegEnumValueNative, ClusterRegEnumValueDart>('ClusterRegEnumValue');
// hKey : HKEY -> Pointer<Void>
// dwIndex : DWORD -> Uint32
// lpszValueName : LPWSTR out -> Pointer<Utf16>
// lpcchValueName : DWORD* in/out -> Pointer<Uint32>
// lpdwType : DWORD* optional, out -> Pointer<Uint32>
// lpData : BYTE* optional, out -> Pointer<Uint8>
// lpcbData : DWORD* optional, in/out -> Pointer<Uint32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
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';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "ClusterRegEnumValue"
  c_ClusterRegEnumValue :: Ptr () -> Word32 -> CWString -> Ptr Word32 -> Ptr Word32 -> Ptr Word8 -> Ptr Word32 -> IO Word32
-- hKey : HKEY -> Ptr ()
-- dwIndex : DWORD -> Word32
-- lpszValueName : LPWSTR out -> CWString
-- lpcchValueName : DWORD* in/out -> Ptr Word32
-- lpdwType : DWORD* optional, out -> Ptr Word32
-- lpData : BYTE* optional, out -> Ptr Word8
-- lpcbData : DWORD* optional, in/out -> Ptr Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let clusterregenumvalue =
  foreign "ClusterRegEnumValue"
    ((ptr void) @-> uint32_t @-> (ptr uint16_t) @-> (ptr uint32_t) @-> (ptr uint32_t) @-> (ptr uint8_t) @-> (ptr uint32_t) @-> returning uint32_t)
(* hKey : HKEY -> (ptr void) *)
(* dwIndex : DWORD -> uint32_t *)
(* lpszValueName : LPWSTR out -> (ptr uint16_t) *)
(* lpcchValueName : DWORD* in/out -> (ptr uint32_t) *)
(* lpdwType : DWORD* optional, out -> (ptr uint32_t) *)
(* lpData : BYTE* optional, out -> (ptr uint8_t) *)
(* lpcbData : DWORD* optional, in/out -> (ptr uint32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library clusapi (t "CLUSAPI.dll"))
(cffi:use-foreign-library clusapi)

(cffi:defcfun ("ClusterRegEnumValue" cluster-reg-enum-value :convention :stdcall) :uint32
  (h-key :pointer)   ; HKEY
  (dw-index :uint32)   ; DWORD
  (lpsz-value-name :pointer)   ; LPWSTR out
  (lpcch-value-name :pointer)   ; DWORD* in/out
  (lpdw-type :pointer)   ; DWORD* optional, out
  (lp-data :pointer)   ; BYTE* optional, out
  (lpcb-data :pointer))   ; DWORD* optional, in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $ClusterRegEnumValue = Win32::API::More->new('CLUSAPI',
    'DWORD ClusterRegEnumValue(HANDLE hKey, DWORD dwIndex, LPWSTR lpszValueName, LPVOID lpcchValueName, LPVOID lpdwType, LPVOID lpData, LPVOID lpcbData)');
# my $ret = $ClusterRegEnumValue->Call($hKey, $dwIndex, $lpszValueName, $lpcchValueName, $lpdwType, $lpData, $lpcbData);
# hKey : HKEY -> HANDLE
# dwIndex : DWORD -> DWORD
# lpszValueName : LPWSTR out -> LPWSTR
# lpcchValueName : DWORD* in/out -> LPVOID
# lpdwType : DWORD* optional, out -> LPVOID
# lpData : BYTE* optional, out -> LPVOID
# lpcbData : DWORD* optional, in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。