ホーム › 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 | 操作理由を示すワイド文字列。監査ログ用でNULL可。 |
戻り値の型: 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)。const std = @import("std");
extern "clusapi" fn ClusterRegDeleteValueEx(
hKey: ?*anyopaque, // HKEY
lpszValueName: [*c]const u16, // LPCWSTR
lpszReason: [*c]const u16 // LPCWSTR optional
) callconv(std.os.windows.WINAPI) u32;proc ClusterRegDeleteValueEx(
hKey: pointer, # HKEY
lpszValueName: WideCString, # LPCWSTR
lpszReason: WideCString # LPCWSTR optional
): uint32 {.importc: "ClusterRegDeleteValueEx", stdcall, dynlib: "CLUSAPI.dll".}pragma(lib, "clusapi");
extern(Windows)
uint ClusterRegDeleteValueEx(
void* hKey, // HKEY
const(wchar)* lpszValueName, // LPCWSTR
const(wchar)* lpszReason // LPCWSTR optional
);ccall((:ClusterRegDeleteValueEx, "CLUSAPI.dll"), stdcall, UInt32,
(Ptr{Cvoid}, Cwstring, Cwstring),
hKey, lpszValueName, lpszReason)
# hKey : HKEY -> Ptr{Cvoid}
# lpszValueName : LPCWSTR -> Cwstring
# lpszReason : LPCWSTR optional -> Cwstring
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
uint32_t ClusterRegDeleteValueEx(
void* hKey,
const uint16_t* lpszValueName,
const uint16_t* lpszReason);
]]
local clusapi = ffi.load("clusapi")
-- clusapi.ClusterRegDeleteValueEx(hKey, lpszValueName, lpszReason)
-- hKey : HKEY
-- lpszValueName : LPCWSTR
-- lpszReason : LPCWSTR optional
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('CLUSAPI.dll');
const ClusterRegDeleteValueEx = lib.func('__stdcall', 'ClusterRegDeleteValueEx', 'uint32_t', ['void *', 'str16', 'str16']);
// ClusterRegDeleteValueEx(hKey, lpszValueName, lpszReason)
// hKey : HKEY -> 'void *'
// lpszValueName : LPCWSTR -> 'str16'
// lpszReason : LPCWSTR optional -> 'str16'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("CLUSAPI.dll", {
ClusterRegDeleteValueEx: { parameters: ["pointer", "buffer", "buffer"], result: "u32" },
});
// lib.symbols.ClusterRegDeleteValueEx(hKey, lpszValueName, lpszReason)
// hKey : HKEY -> "pointer"
// lpszValueName : LPCWSTR -> "buffer"
// lpszReason : LPCWSTR optional -> "buffer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
uint32_t ClusterRegDeleteValueEx(
void* hKey,
const uint16_t* lpszValueName,
const uint16_t* lpszReason);
C, "CLUSAPI.dll");
// $ffi->ClusterRegDeleteValueEx(hKey, lpszValueName, lpszReason);
// hKey : HKEY
// lpszValueName : LPCWSTR
// lpszReason : LPCWSTR optional
// 構造体/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 ClusterRegDeleteValueEx(
Pointer hKey, // HKEY
WString lpszValueName, // LPCWSTR
WString lpszReason // LPCWSTR optional
);
}@[Link("clusapi")]
lib LibCLUSAPI
fun ClusterRegDeleteValueEx = ClusterRegDeleteValueEx(
hKey : Void*, # HKEY
lpszValueName : UInt16*, # LPCWSTR
lpszReason : UInt16* # LPCWSTR optional
) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef ClusterRegDeleteValueExNative = Uint32 Function(Pointer<Void>, Pointer<Utf16>, Pointer<Utf16>);
typedef ClusterRegDeleteValueExDart = int Function(Pointer<Void>, Pointer<Utf16>, Pointer<Utf16>);
final ClusterRegDeleteValueEx = DynamicLibrary.open('CLUSAPI.dll')
.lookupFunction<ClusterRegDeleteValueExNative, ClusterRegDeleteValueExDart>('ClusterRegDeleteValueEx');
// hKey : HKEY -> Pointer<Void>
// lpszValueName : LPCWSTR -> Pointer<Utf16>
// lpszReason : LPCWSTR optional -> Pointer<Utf16>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function ClusterRegDeleteValueEx(
hKey: THandle; // HKEY
lpszValueName: PWideChar; // LPCWSTR
lpszReason: PWideChar // LPCWSTR optional
): DWORD; stdcall;
external 'CLUSAPI.dll' name 'ClusterRegDeleteValueEx';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "ClusterRegDeleteValueEx"
c_ClusterRegDeleteValueEx :: Ptr () -> CWString -> CWString -> IO Word32
-- hKey : HKEY -> Ptr ()
-- lpszValueName : LPCWSTR -> CWString
-- lpszReason : LPCWSTR optional -> CWString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let clusterregdeletevalueex =
foreign "ClusterRegDeleteValueEx"
((ptr void) @-> (ptr uint16_t) @-> (ptr uint16_t) @-> returning uint32_t)
(* hKey : HKEY -> (ptr void) *)
(* lpszValueName : LPCWSTR -> (ptr uint16_t) *)
(* lpszReason : LPCWSTR optional -> (ptr uint16_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library clusapi (t "CLUSAPI.dll"))
(cffi:use-foreign-library clusapi)
(cffi:defcfun ("ClusterRegDeleteValueEx" cluster-reg-delete-value-ex :convention :stdcall) :uint32
(h-key :pointer) ; HKEY
(lpsz-value-name (:string :encoding :utf-16le)) ; LPCWSTR
(lpsz-reason (:string :encoding :utf-16le))) ; LPCWSTR optional
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $ClusterRegDeleteValueEx = Win32::API::More->new('CLUSAPI',
'DWORD ClusterRegDeleteValueEx(HANDLE hKey, LPCWSTR lpszValueName, LPCWSTR lpszReason)');
# my $ret = $ClusterRegDeleteValueEx->Call($hKey, $lpszValueName, $lpszReason);
# hKey : HKEY -> HANDLE
# lpszValueName : LPCWSTR -> LPCWSTR
# lpszReason : LPCWSTR optional -> LPCWSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
類似 API
- f ClusterRegDeleteValue — クラスターレジストリキーから値を削除する。