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

ClusterRegDeleteValue

関数
クラスターレジストリキーから値を削除する。
DLLCLUSAPI.dll呼出規約winapi対応OSwindowsserver2008

シグネチャ

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

DWORD ClusterRegDeleteValue(
    HKEY hKey,
    LPCWSTR lpszValueName
);

パラメーター

名前方向
hKeyHKEYin
lpszValueNameLPCWSTRin

戻り値の型: DWORD

各言語での呼び出し定義

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

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

ClusterRegDeleteValue = ctypes.windll.clusapi.ClusterRegDeleteValue
ClusterRegDeleteValue.restype = wintypes.DWORD
ClusterRegDeleteValue.argtypes = [
    wintypes.HANDLE,  # hKey : HKEY
    wintypes.LPCWSTR,  # lpszValueName : LPCWSTR
]
require 'fiddle'
require 'fiddle/import'

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

var (
	clusapi = windows.NewLazySystemDLL("CLUSAPI.dll")
	procClusterRegDeleteValue = clusapi.NewProc("ClusterRegDeleteValue")
)

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