Jump to content

How to use RegRead with unknown valuenames?

Go to solution Solved by big_daddy,

Recommended Posts

Hi, all!

I'm still an intermediate-level AutoIt v3 coder, and I've come across a problem I don't know how to solve, so I'm looking for some help.

I'm trying to use RegRead (and later RegWrite) to read an apparently unusual registry key whose valuenames can't be known in advance.  Besides an empty/null default value, everything else is an arbitrarily-long list of REG_SZ strings whose value "names" are  arbitrary strings!

In other words, the registry entry looks like this:

    (default)              REG_SZ    (value not set)
    ArbitraryValueName1    REG_SZ    "stuff1"
    ArbitraryValueName2    REG_SZ    "stuff2"
    ArbitraryValueNameN    REG_SZ    "stuffN"

Obviously, since the value names can't be known in advance, I can't possibly supply the second argument to RegRead(), which is supposed to be the value's name.  Somehow, I would need to read the key's value names in order to get the key's value names!  (There's a hole in that bucket...)

I was hoping that I could somehow read the registry key as a large string of zero-delimited substrings and then use StringSplit() to turn it into an array of strings that I could work with, but there's no way to call RegRead() to do that (since I can't specify the second argument).

So I'm completely stumped.  Does anyone have any suggestions?



ETA: For what it's worth, I tried calling RegRead() with the first argument set to "HKEY_USERSblahblahblah" and the second argument (valuename) as "FunkyKey" just out of desperation, but that didn't work...

Edited by Mbee
Link to comment
Share on other sites

You can use RegEnumVal to loop through the value names under the specified key.


Hey, thanks, big_daddy! :sweating:

I hadn't encountered RegEnumVal() until now, and it's a great solution.  Sorry I wasn't able to find it myself, so I greatly appreciate your patience and understanding for a newbie like myself.


Thanks again!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...