Commit da00742a authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

Implemented recursive RegDeleteKey in Win95 emulation.

parent 49467be6
...@@ -605,12 +605,26 @@ DWORD WINAPI RegDeleteKeyW( HKEY hkey, LPCWSTR name ) ...@@ -605,12 +605,26 @@ DWORD WINAPI RegDeleteKeyW( HKEY hkey, LPCWSTR name )
DWORD ret; DWORD ret;
HKEY tmp; HKEY tmp;
if (!name || !*name) return NtDeleteKey( hkey ); if (!name || !*name)
if (!(ret = RegOpenKeyExW( hkey, name, 0, 0, &tmp )))
{ {
ret = RtlNtStatusToDosError( NtDeleteKey( hkey ) );
}
else if (!(ret = RegOpenKeyExW( hkey, name, 0, 0, &tmp )))
{
if (!is_version_nt()) /* win95 does recursive key deletes */
{
WCHAR name[MAX_PATH];
while(!RegEnumKeyW(tmp, 0, name, sizeof name))
{
if(RegDeleteKeyW(tmp, name)) /* recurse */
break;
}
}
ret = RtlNtStatusToDosError( NtDeleteKey( tmp ) ); ret = RtlNtStatusToDosError( NtDeleteKey( tmp ) );
RegCloseKey( tmp ); RegCloseKey( tmp );
} }
TRACE("%s ret=%08lx\n", debugstr_w(name), ret);
return ret; return ret;
} }
...@@ -623,12 +637,26 @@ DWORD WINAPI RegDeleteKeyA( HKEY hkey, LPCSTR name ) ...@@ -623,12 +637,26 @@ DWORD WINAPI RegDeleteKeyA( HKEY hkey, LPCSTR name )
DWORD ret; DWORD ret;
HKEY tmp; HKEY tmp;
if (!name || !*name) return NtDeleteKey( hkey ); if (!name || !*name)
if (!(ret = RegOpenKeyExA( hkey, name, 0, 0, &tmp )))
{ {
ret = RtlNtStatusToDosError( NtDeleteKey( hkey ) );
}
else if (!(ret = RegOpenKeyExA( hkey, name, 0, KEY_ALL_ACCESS, &tmp )))
{
if (!is_version_nt()) /* win95 does recursive key deletes */
{
CHAR name[MAX_PATH];
while(!RegEnumKeyA(tmp, 0, name, sizeof name))
{
if(RegDeleteKeyA(tmp, name)) /* recurse */
break;
}
}
ret = RtlNtStatusToDosError( NtDeleteKey( tmp ) ); ret = RtlNtStatusToDosError( NtDeleteKey( tmp ) );
RegCloseKey( tmp ); RegCloseKey( tmp );
} }
TRACE("%s ret=%08lx\n", debugstr_a(name), ret);
return ret; return ret;
} }
......
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