Commit 45d47c42 authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

Fix RegDeleteKey{A,W} to open the specified key with the DELETE access

right.
parent b12ad3ad
...@@ -875,11 +875,7 @@ DWORD WINAPI RegDeleteKeyW( HKEY hkey, LPCWSTR name ) ...@@ -875,11 +875,7 @@ DWORD WINAPI RegDeleteKeyW( HKEY hkey, LPCWSTR name )
if (!(hkey = get_special_root_hkey( hkey ))) return ERROR_INVALID_HANDLE; if (!(hkey = get_special_root_hkey( hkey ))) return ERROR_INVALID_HANDLE;
if (!*name) if (!(ret = RegOpenKeyExW( hkey, name, 0, DELETE, &tmp )))
{
ret = RtlNtStatusToDosError( NtDeleteKey( hkey ) );
}
else if (!(ret = RegOpenKeyExW( hkey, name, 0, KEY_ENUMERATE_SUB_KEYS, &tmp )))
{ {
ret = RtlNtStatusToDosError( NtDeleteKey( tmp ) ); ret = RtlNtStatusToDosError( NtDeleteKey( tmp ) );
RegCloseKey( tmp ); RegCloseKey( tmp );
...@@ -898,6 +894,11 @@ DWORD WINAPI RegDeleteKeyW( HKEY hkey, LPCWSTR name ) ...@@ -898,6 +894,11 @@ DWORD WINAPI RegDeleteKeyW( HKEY hkey, LPCWSTR name )
* hkey [I] Handle to parent key containing the key to delete * hkey [I] Handle to parent key containing the key to delete
* name [I] Name of the key user hkey 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 * RETURNS
* Success: ERROR_SUCCESS * Success: ERROR_SUCCESS
* Failure: Error code * Failure: Error code
...@@ -911,11 +912,7 @@ DWORD WINAPI RegDeleteKeyA( HKEY hkey, LPCSTR name ) ...@@ -911,11 +912,7 @@ DWORD WINAPI RegDeleteKeyA( HKEY hkey, LPCSTR name )
if (!(hkey = get_special_root_hkey( hkey ))) return ERROR_INVALID_HANDLE; if (!(hkey = get_special_root_hkey( hkey ))) return ERROR_INVALID_HANDLE;
if (!*name) if (!(ret = RegOpenKeyExA( hkey, name, 0, DELETE, &tmp )))
{
ret = RtlNtStatusToDosError( NtDeleteKey( hkey ) );
}
else if (!(ret = RegOpenKeyExA( hkey, name, 0, KEY_ENUMERATE_SUB_KEYS, &tmp )))
{ {
if (!is_version_nt()) /* win95 does recursive key deletes */ if (!is_version_nt()) /* win95 does recursive key deletes */
{ {
......
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