- deleting a registry ke
- Posted by Brian on October 12th, 2007
I save some device specific information in the registry that is created with
ACCESS_ALL. Sometimes it is necessary go back to default configuration, so I
would like to delete the information. I am opening an handle to the key and
calling ZwDeleteKey, but I get an error with the status that I can't delete
it (0xC0000121). The information has a tree structure (the key itself
contains sub keys) and it also contains values. Is this the reason the
delete fails? I can delete the node easily enough using regedit, why can't I
delete it in my driver entry?
- Posted by Doron Holan [MSFT] on October 12th, 2007
you can only delete a key if there are no subkeys. so, if you want to do
this in a driver you have to enumerate all of the subkeys recursively and
delete every one of them. this is what regedit does. BUT, this should not
be done in the driver, recursion is not good b/c there is very limited stack
space and the interfaces are a bit more difficult to deal with compared to
user mode (for instance there is a RegDeleteTree in Vista which does it all
for you instead of recursing). the reset to a default config should really
be done by a UM helper application/service.
d
--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.
"Brian" <Brian@discussions.microsoft.com> wrote in message
news:34A3931F-4AE8-4E3F-8EC9-6D652CDA22A7@microsoft.com...
- Registry Deleting. (Microsoft Windows) by window rookie
- Deleting Registry Information (Computers & Technology) by Ron
- Deleting Items in the Registry (Computers & Technology) by MJW
- Deleting Items in the Registry (Computers & Technology) by MJW
- Re: deleting a key from registry (Development Resources) by Tim Robinson

