Volatile/Non-volatile registry keys...

Hello,

Is it programatically possible to know whether a given
registry key is volatile/non-volatile?

Any help on this is appriciated.

Thanks,
-Prasad

=====
Prasad S. Dabak
Director of Engineering, Windows NT/2000 Division
Cybermedia Software Private Limited
http://www.cybermedia.co.in
Co-author of the book “Undocumented Windows NT”
ISBN 0764545698


Do You Yahoo!?
Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/

Dear Prasad,

The idea I have to do it in user mode is to create a non-volatile subkey
using RegCreateKeyEx and
see if it returns ERROR_CHILD_MUST_BE_VOLATILE, then you’re dealing with a
volatile key. If it doesn’t then delete it afterwards.

Greetings,

Daniel Terhell
Resplendence Sp
xxxxx@resplendence.com
http://www.resplendence.com

It appears that the idea that I had works only on NT4 because on Windows
2000 it’s allowed to create a non-volatile subkey of a volatile key.

Another idea I have is the following:
-Export the parent key of the key to be examined to a registry hive file
using RegSaveKey.
-Import the hive file into another key using RegRestoreKey
-Check if the name of the registry key to be examined is present as a subkey
of the key into which you imported the hive file
If it is missing from the hive file, the key is volatile and if it’s there
then it’s not.
-Recursively delete the imported keys

It’s true that RegSaveKey does not export volatile registry keys (however it
would export the non-volatile contents of a volatile registry key). I have
tried it on both NT4 and Win2000.

Greetings,

Daniel Terhell
Resplendence Sp
xxxxx@resplendence.com
http://www.resplendence.com

-----Original Message-----
From: Daniel Terhell [mailto:xxxxx@resplendence.com]
Sent: Tuesday, August 29, 2000 12:37 PM
To: NT Developers Interest List
Subject: RE: Volatile/Non-volatile registry keys…

Dear Prasad,

The idea I have to do it in user mode is to create a non-volatile
subkey using RegCreateKeyEx and
see if it returns ERROR_CHILD_MUST_BE_VOLATILE, then you’re
dealing with a
volatile key. If it doesn’t then delete it afterwards.

Greetings,

Daniel Terhell
Resplendence Sp
xxxxx@resplendence.com
http://www.resplendence.com