Alexandre Julliard : advapi32: Implemented RegDeleteKeyExA/W.
Alexandre Julliard
julliard at winehq.org
Thu Feb 18 12:49:24 CST 2010
Module: wine
Branch: master
Commit: 9b7d1041fc198d62145ddedcda174c7fc515eb86
URL: http://source.winehq.org/git/wine.git/?a=commit;h=9b7d1041fc198d62145ddedcda174c7fc515eb86
Author: Alexandre Julliard <julliard at winehq.org>
Date: Thu Feb 18 13:12:31 2010 +0100
advapi32: Implemented RegDeleteKeyExA/W.
---
dlls/advapi32/advapi32.spec | 2 +
dlls/advapi32/registry.c | 66 ++++++++++++++++++++++++++++---------------
include/winreg.h | 3 ++
3 files changed, 48 insertions(+), 23 deletions(-)
diff --git a/dlls/advapi32/advapi32.spec b/dlls/advapi32/advapi32.spec
index 806cecf..892e84a 100644
--- a/dlls/advapi32/advapi32.spec
+++ b/dlls/advapi32/advapi32.spec
@@ -472,6 +472,8 @@
@ stdcall RegCreateKeyExW(long wstr long ptr long long ptr ptr ptr)
@ stdcall RegCreateKeyW(long wstr ptr)
@ stdcall RegDeleteKeyA(long str)
+@ stdcall RegDeleteKeyExA(long str long long)
+@ stdcall RegDeleteKeyExW(long wstr long long)
@ stdcall RegDeleteKeyW(long wstr)
@ stdcall RegDeleteTreeA(long str)
@ stdcall RegDeleteTreeW(long wstr)
diff --git a/dlls/advapi32/registry.c b/dlls/advapi32/registry.c
index b9cb8c5..faae2b1 100644
--- a/dlls/advapi32/registry.c
+++ b/dlls/advapi32/registry.c
@@ -931,11 +931,9 @@ LSTATUS WINAPI RegCloseKey( HKEY hkey )
/******************************************************************************
- * RegDeleteKeyW [ADVAPI32.@]
- *
- * See RegDeleteKeyA.
+ * RegDeleteKeyExW [ADVAPI32.@]
*/
-LSTATUS WINAPI RegDeleteKeyW( HKEY hkey, LPCWSTR name )
+LSTATUS WINAPI RegDeleteKeyExW( HKEY hkey, LPCWSTR name, REGSAM access, DWORD reserved )
{
DWORD ret;
HKEY tmp;
@@ -944,7 +942,8 @@ LSTATUS WINAPI RegDeleteKeyW( HKEY hkey, LPCWSTR name )
if (!(hkey = get_special_root_hkey( hkey ))) return ERROR_INVALID_HANDLE;
- if (!(ret = RegOpenKeyExW( hkey, name, 0, DELETE, &tmp )))
+ access &= KEY_WOW64_64KEY | KEY_WOW64_32KEY;
+ if (!(ret = RegOpenKeyExW( hkey, name, 0, access | DELETE, &tmp )))
{
ret = RtlNtStatusToDosError( NtDeleteKey( tmp ) );
RegCloseKey( tmp );
@@ -955,24 +954,20 @@ LSTATUS WINAPI RegDeleteKeyW( HKEY hkey, LPCWSTR name )
/******************************************************************************
- * RegDeleteKeyA [ADVAPI32.@]
- *
- * Delete a registry key.
- *
- * PARAMS
- * hkey [I] Handle to parent key containing the key to delete
- * name [I] Name of the key user hkey to delete
- *
- * NOTES
- *
- * MSDN is wrong when it says that hkey must be opened with the DELETE access
- * right. In reality, it opens a new handle with DELETE access.
+ * RegDeleteKeyW [ADVAPI32.@]
*
- * RETURNS
- * Success: ERROR_SUCCESS
- * Failure: Error code
+ * See RegDeleteKeyA.
*/
-LSTATUS WINAPI RegDeleteKeyA( HKEY hkey, LPCSTR name )
+LSTATUS WINAPI RegDeleteKeyW( HKEY hkey, LPCWSTR name )
+{
+ return RegDeleteKeyExW( hkey, name, 0, 0 );
+}
+
+
+/******************************************************************************
+ * RegDeleteKeyExA [ADVAPI32.@]
+ */
+LSTATUS WINAPI RegDeleteKeyExA( HKEY hkey, LPCSTR name, REGSAM access, DWORD reserved )
{
DWORD ret;
HKEY tmp;
@@ -981,7 +976,8 @@ LSTATUS WINAPI RegDeleteKeyA( HKEY hkey, LPCSTR name )
if (!(hkey = get_special_root_hkey( hkey ))) return ERROR_INVALID_HANDLE;
- if (!(ret = RegOpenKeyExA( hkey, name, 0, DELETE, &tmp )))
+ access &= KEY_WOW64_64KEY | KEY_WOW64_32KEY;
+ if (!(ret = RegOpenKeyExA( hkey, name, 0, access | DELETE, &tmp )))
{
if (!is_version_nt()) /* win95 does recursive key deletes */
{
@@ -989,7 +985,7 @@ LSTATUS WINAPI RegDeleteKeyA( HKEY hkey, LPCSTR name )
while(!RegEnumKeyA(tmp, 0, name, sizeof(name)))
{
- if(RegDeleteKeyA(tmp, name)) /* recurse */
+ if(RegDeleteKeyExA(tmp, name, access, reserved)) /* recurse */
break;
}
}
@@ -1001,6 +997,30 @@ LSTATUS WINAPI RegDeleteKeyA( HKEY hkey, LPCSTR name )
}
+/******************************************************************************
+ * RegDeleteKeyA [ADVAPI32.@]
+ *
+ * Delete a registry key.
+ *
+ * PARAMS
+ * hkey [I] Handle to parent key containing the key to delete
+ * name [I] Name of the key user hkey to delete
+ *
+ * NOTES
+ *
+ * MSDN is wrong when it says that hkey must be opened with the DELETE access
+ * right. In reality, it opens a new handle with DELETE access.
+ *
+ * RETURNS
+ * Success: ERROR_SUCCESS
+ * Failure: Error code
+ */
+LSTATUS WINAPI RegDeleteKeyA( HKEY hkey, LPCSTR name )
+{
+ return RegDeleteKeyExA( hkey, name, 0, 0 );
+}
+
+
/******************************************************************************
* RegSetValueExW [ADVAPI32.@]
diff --git a/include/winreg.h b/include/winreg.h
index e532459..145a026 100644
--- a/include/winreg.h
+++ b/include/winreg.h
@@ -104,6 +104,9 @@ WINADVAPI LSTATUS WINAPI RegCreateKeyExW(HKEY,LPCWSTR,DWORD,LPWSTR,DWORD,REGSA
WINADVAPI LSTATUS WINAPI RegDeleteKeyA(HKEY,LPCSTR);
WINADVAPI LSTATUS WINAPI RegDeleteKeyW(HKEY,LPCWSTR);
#define RegDeleteKey WINELIB_NAME_AW(RegDeleteKey)
+WINADVAPI LSTATUS WINAPI RegDeleteKeyExA(HKEY,LPCSTR,REGSAM,DWORD);
+WINADVAPI LSTATUS WINAPI RegDeleteKeyExW(HKEY,LPCWSTR,REGSAM,DWORD);
+#define RegDeleteKeyEx WINELIB_NAME_AW(RegDeleteKeyEx)
WINADVAPI LSTATUS WINAPI RegDeleteKeyValueA(HKEY,LPCSTR,LPCSTR);
WINADVAPI LSTATUS WINAPI RegDeleteKeyValueW(HKEY,LPCWSTR,LPCWSTR);
#define RegDeleteKeyValue WINELIB_NAME_AW(RegDeleteKeyValue)
More information about the wine-cvs
mailing list