ホーム › Networking.Clustering › ClusterRegDeleteValueEx
ClusterRegDeleteValueEx
関数理由付きでクラスターレジストリキーから値を削除する。
シグネチャ
// CLUSAPI.dll
#include <windows.h>
DWORD ClusterRegDeleteValueEx(
HKEY hKey,
LPCWSTR lpszValueName,
LPCWSTR lpszReason // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hKey | HKEY | in |
| lpszValueName | LPCWSTR | in |
| lpszReason | LPCWSTR | inoptional |
戻り値の型: DWORD
各言語での呼び出し定義
// CLUSAPI.dll
#include <windows.h>
DWORD ClusterRegDeleteValueEx(
HKEY hKey,
LPCWSTR lpszValueName,
LPCWSTR lpszReason // optional
);[DllImport("CLUSAPI.dll", ExactSpelling = true)]
static extern uint ClusterRegDeleteValueEx(
IntPtr hKey, // HKEY
[MarshalAs(UnmanagedType.LPWStr)] string lpszValueName, // LPCWSTR
[MarshalAs(UnmanagedType.LPWStr)] string lpszReason // LPCWSTR optional
);<DllImport("CLUSAPI.dll", ExactSpelling:=True)>
Public Shared Function ClusterRegDeleteValueEx(
hKey As IntPtr, ' HKEY
<MarshalAs(UnmanagedType.LPWStr)> lpszValueName As String, ' LPCWSTR
<MarshalAs(UnmanagedType.LPWStr)> lpszReason As String ' LPCWSTR optional
) As UInteger
End Function' hKey : HKEY
' lpszValueName : LPCWSTR
' lpszReason : LPCWSTR optional
Declare PtrSafe Function ClusterRegDeleteValueEx Lib "clusapi" ( _
ByVal hKey As LongPtr, _
ByVal lpszValueName As LongPtr, _
ByVal lpszReason As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ClusterRegDeleteValueEx = ctypes.windll.clusapi.ClusterRegDeleteValueEx
ClusterRegDeleteValueEx.restype = wintypes.DWORD
ClusterRegDeleteValueEx.argtypes = [
wintypes.HANDLE, # hKey : HKEY
wintypes.LPCWSTR, # lpszValueName : LPCWSTR
wintypes.LPCWSTR, # lpszReason : LPCWSTR optional
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('CLUSAPI.dll')
ClusterRegDeleteValueEx = Fiddle::Function.new(
lib['ClusterRegDeleteValueEx'],
[
Fiddle::TYPE_VOIDP, # hKey : HKEY
Fiddle::TYPE_VOIDP, # lpszValueName : LPCWSTR
Fiddle::TYPE_VOIDP, # lpszReason : LPCWSTR optional
],
-Fiddle::TYPE_INT)#[link(name = "clusapi")]
extern "system" {
fn ClusterRegDeleteValueEx(
hKey: *mut core::ffi::c_void, // HKEY
lpszValueName: *const u16, // LPCWSTR
lpszReason: *const u16 // LPCWSTR optional
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("CLUSAPI.dll")]
public static extern uint ClusterRegDeleteValueEx(IntPtr hKey, [MarshalAs(UnmanagedType.LPWStr)] string lpszValueName, [MarshalAs(UnmanagedType.LPWStr)] string lpszReason);
"@
$api = Add-Type -MemberDefinition $sig -Name 'CLUSAPI_ClusterRegDeleteValueEx' -Namespace Win32 -PassThru
# $api::ClusterRegDeleteValueEx(hKey, lpszValueName, lpszReason)#uselib "CLUSAPI.dll"
#func global ClusterRegDeleteValueEx "ClusterRegDeleteValueEx" sptr, sptr, sptr
; ClusterRegDeleteValueEx hKey, lpszValueName, lpszReason ; 戻り値は stat
; hKey : HKEY -> "sptr"
; lpszValueName : LPCWSTR -> "sptr"
; lpszReason : LPCWSTR optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "CLUSAPI.dll"
#cfunc global ClusterRegDeleteValueEx "ClusterRegDeleteValueEx" sptr, wstr, wstr
; res = ClusterRegDeleteValueEx(hKey, lpszValueName, lpszReason)
; hKey : HKEY -> "sptr"
; lpszValueName : LPCWSTR -> "wstr"
; lpszReason : LPCWSTR optional -> "wstr"; DWORD ClusterRegDeleteValueEx(HKEY hKey, LPCWSTR lpszValueName, LPCWSTR lpszReason)
#uselib "CLUSAPI.dll"
#cfunc global ClusterRegDeleteValueEx "ClusterRegDeleteValueEx" intptr, wstr, wstr
; res = ClusterRegDeleteValueEx(hKey, lpszValueName, lpszReason)
; hKey : HKEY -> "intptr"
; lpszValueName : LPCWSTR -> "wstr"
; lpszReason : LPCWSTR optional -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
clusapi = windows.NewLazySystemDLL("CLUSAPI.dll")
procClusterRegDeleteValueEx = clusapi.NewProc("ClusterRegDeleteValueEx")
)
// hKey (HKEY), lpszValueName (LPCWSTR), lpszReason (LPCWSTR optional)
r1, _, err := procClusterRegDeleteValueEx.Call(
uintptr(hKey),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpszValueName))),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(lpszReason))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction ClusterRegDeleteValueEx(
hKey: THandle; // HKEY
lpszValueName: PWideChar; // LPCWSTR
lpszReason: PWideChar // LPCWSTR optional
): DWORD; stdcall;
external 'CLUSAPI.dll' name 'ClusterRegDeleteValueEx';result := DllCall("CLUSAPI\ClusterRegDeleteValueEx"
, "Ptr", hKey ; HKEY
, "WStr", lpszValueName ; LPCWSTR
, "WStr", lpszReason ; LPCWSTR optional
, "UInt") ; return: DWORD●ClusterRegDeleteValueEx(hKey, lpszValueName, lpszReason) = DLL("CLUSAPI.dll", "dword ClusterRegDeleteValueEx(void*, char*, char*)")
# 呼び出し: ClusterRegDeleteValueEx(hKey, lpszValueName, lpszReason)
# hKey : HKEY -> "void*"
# lpszValueName : LPCWSTR -> "char*"
# lpszReason : LPCWSTR optional -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。