Commit 9b7d1041 authored by Alexandre Julliard's avatar Alexandre Julliard

advapi32: Implemented RegDeleteKeyExA/W.

parent 8543c324
......@@ -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)
......
......@@ -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.@]
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment