Jump to content
Sign in to follow this  
MrBedo

How to RegRead an unknown registry key ?

Recommended Posts

MrBedo

First of all, let me apologise if this has already been asked and answered before. I have had a search through old posts, but couldn't really find an answer.

What I am trying to do is read a REG_SZ entry, but the problem is I don't know what the registry key/folder will be called. This relates to an Outlook email profile and varies from user to user. Assuming the profile is called 'Bob', I have a reg key called 'Profiles', a sub key called 'Bob', and various sub keys under 'Bob' all with names like '1cf2a3879abf8a4fb42e19189ec8191d'......if that makes sense.

Now, the REG_SZ entry I want to read is in one of those oddly named keys. I'm trying to figure out a way to pull out that piece of data but can't work out how to do it.

The help file talks about RegEnumKey and RegEnumVal, but they seem to rely on you knowing exactly how deep the key you want to query is.

Any help would be greatly appreciated, and apologies again is this has already been asked and answered !

Share this post


Link to post
Share on other sites
PsaltyDS

The help file talks about RegEnumKey and RegEnumVal, but they seem to rely on you knowing exactly how deep the key you want to query is.

So, if you were browsing to this mystery key manually in RegEdit, how would you find it and know you had the right one?

Answer that question and we can see about turning your logic into AutoIt code...

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
MrBedo

Sorry, should have told you that !

Right, the REG_SZ key that I need is unique to that one place in the registry. To find it manually I would use the 'Find' function in Regedit itself. I don't know how to do this with Autoit, or even if it would be the most efficient way of locating the REG_SZ key I need.

The reg structure is like this,

[HKEY_USERS\S-1-5-21-1409082233-1060284298-1163701267-1003\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Rich\84d88889a2a6bc42b3f2c69991882f2c]

That last long number/letter key is an example. Theres actually about 11 similarly named folders under the 'Rich' profile. Only one of which contains the REG_SZ key that I need to read.

I'd know it was the right key if I was manually browsing for it because it is absolutely unique to that one particular '84d88889a2a6bc42b3f2c69991882f2c' folder it's hiding in. So to find it manually I'd click through each '84d88889a2a6bc42b3f2c69991882f2c' folder until I saw the REG_SZ key I needed.

Hope that makes it a bit clearer, I don't actually have any code example to show you, because the piece ive written only RegReads a key in the 'Profile' directory, and that is in the same place on every PC, so far then my code consists of one line. I can't go any further until I find a way of identying this one REG_SZ key. If it helps, the REG_SZ key I need will always end '.pst'. But..........there are other references to .pst in other areas of the registry, these however are irrelevant to what I'm trying to do. This is why I need to be able to tell Autoit to go to a specific folder rather than somehow get it to search the registry, cos it might not identify the correct key.

Thanks for taking the time out to trawl through this !! :">

Edited by MrBedo

Share this post


Link to post
Share on other sites
MrBedo

Thanks for the pointer. I'm gonna dissect it and see what I can do with it (best way to learn, right?). In case you hadn't gathered, I'm not an advanced Autoit user, so I might be tripping over my own feet for a bit while I work out what all that code does !!

Thanks again for the help :)

Share this post


Link to post
Share on other sites
MrBedo

I've been playing with this for a while today and have a question if that's ok..........

The second version of the script you posted doesn't work for me, it errors with the following message:

post-3686-1179326762_thumb.jpg

Any idea why it might be doing that ?

If I use the first script you posted then it works fine. The only issue I have with it is that it doesn't seem to search subfolders. This isn't a major issue and I'll see if I can work it out myself, but like I said before, I'm not exactly a pro at this stuff yet !!

cheers

Share this post


Link to post
Share on other sites
PsaltyDS

I've been playing with this for a while today and have a question if that's ok..........

The second version of the script you posted doesn't work for me, it errors with the following message:

post-3686-1179326762_thumb.jpg

Any idea why it might be doing that ?

If I use the first script you posted then it works fine. The only issue I have with it is that it doesn't seem to search subfolders. This isn't a major issue and I'll see if I can work it out myself, but like I said before, I'm not exactly a pro at this stuff yet !!

cheers

You are probably trying to increment $v before declaring it. The statement $v += 1 is correct, but $v has to already have been declared before this statement.

:)

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
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
Sign in to follow this  

×