Thread: How Do I Determine if Registy Key is Volatile?

  1. #1
    Registered User
    Join Date
    Nov 2005
    Posts
    88

    How Do I Determine if Registy Key is Volatile?

    I am trying to determine whether or not a particular registry key is volatile (or non-volatile). Does anyone know of a means of detecting this?

    Thank you.

    Joe

  2. #2
    Registered User
    Join Date
    Mar 2005
    Location
    Mountaintop, Pa
    Posts
    1,058
    AFAIK, there is no way to determine if a key is volatile since this key resides in memory only. The volatile key is created everytime the system is started. Thus, there is no file associated with the key and it cannot be loaded or saved. This eliminates the use of RegQueryKeyEx which would return the type of key in the options parm. If by some really remote chance, ReqQueryKeyEx was successful on a volatile key, the options parm would be set to REG_OPTION_VOLATILE. Unfortunately, RegQueryKeyEx will not work on a volatile key.

  3. #3
    Registered User
    Join Date
    Nov 2005
    Posts
    88
    Thank you for the suggestion, however I am unfamilar with any API called RegQueryKeyEx. I checked msdn, and there is no documentation on it. Is it an undocumented API call? If it does exist, and does fail, perhaps the error value returned is the way to determine whether or not a key is volatile.

    For the time being I have brainstormed a technique for determining whether or not a key is volatile. To achieve this, I create a non-volatile subkey of the key I want to test. If it is non-volatile, the creation is a success. If it fails with the error ERROR_CHILD_MUST_BE_VOLATILE, I know the key is volatile. This method does in fact work, but I was hoping to find a more graceful way. I do not like being forced to create a subkey just to test if a key is volatile. I am still eager to find a more straightforward way of handling it, but if I am unable to find one, at least I have something that works for the time being.

    Thanks again. Hopefully someone can think of an even better way to determine.

    Joe

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 10-29-2006, 05:04 AM
  2. Virtual keys
    By Arkanos in forum Windows Programming
    Replies: 4
    Last Post: 12-12-2005, 10:00 AM
  3. Directional Keys - Useing in Console
    By RoD in forum C++ Programming
    Replies: 38
    Last Post: 10-06-2002, 04:42 PM
  4. FAQ: Directional Keys - Useing in Console
    By RoD in forum FAQ Board
    Replies: 38
    Last Post: 10-06-2002, 04:42 PM