[Mono-dev] Re: UnixRegistryApi question

Robert Jordan robertj at gmx.net
Sat Mar 11 23:10:53 EST 2006


Cory,

> public static void ClearKey( RegistryKey key )
> {
>     foreach( string name in key.GetValueNames() )
>         key.DeleteValue( name );
>      foreach( string name in key.GetSubKeyNames() )
>         key.DeleteSubKeyTree( name );
> }
> 
> 
> Does this look to you all to be a bug in the UnixRegistryApi, or 
> something innocuous like an invalid name? The code that is calling 
> ClearKey verifies that the RegistryKey it is passing in isn't null. Any 
> pointers would be appreciated. Thanks!

There is a bug in UnixRegistryAp.DeleteValue ().
The current implementation is actually deleting the entry with
the specified value and not the entry with the specified name.
Because values are not always strings, you got this
InvalidCastException.

I'm attaching a patch.

Robert
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: UnixRegistryApi.diff
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20060312/bcd8e8aa/attachment.pl 


More information about the Mono-devel-list mailing list