If when you try to delete a registry key win Windows 7, Windows Vista or Windows Server 2008, you are unable to delete it and you get an error message: Error while deleting key, then this article may interest you.
This can be caused if you attempt to delete a registry key that contains embedded null characters. These characters are not visible when viewing the registry entry.
To delete a registry key that contains an embedded null character, you must first replace the null character with another character.
You can accomplish this by using the RegDelNull tool from Sysinternals.
This command-line utility searches for and allows you to delete Registry keys that contain embedded-null characters and that are otherwise undeleteable using standard Registry-editing tools. Note: deleting Registry keys may cause the applications they are associated with to fail.