|
|
#1 |
|
Member
Join Date: Feb 2005
Posts: 51
|
Getting all sub-keys of a registry key
I know how to read the value of a registry key, but how do I iterate through all it's children?
I've seen code floating around that will return the current installed JRE, but it does not return the build version. The only way to do that (so far as I can see) is to iterate all versions listed in the registry, finding the entry with the highest build number and returning that. For example, instead of returning 1.5.0, I'm expecting the code to return 1.5.0_02 Gili |
|
|
|
|
|
#2 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,337
|
Use EnumRegKey.
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#3 |
|
Member
Join Date: Feb 2005
Posts: 51
|
Thank you. Now how does one strncmp()?
Specifically, I want to know whether the registry key returned has a name that starts with the string specified in $0. |
|
|
|
|
|
#4 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,337
|
Copy only the number of characters you need using StrCpy's parameters (see documentation for more information and examples) and then use StrCmp or the LogicLib.
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#5 |
|
Member
Join Date: Feb 2005
Posts: 51
|
I guess the same goes for dereferencing a specific character within a String? That is, I want to find the index of the first '_' within a String. Do I have to StrCpy one character at a time to find it?
|
|
|
|
|
|
#6 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,337
|
Yes, that's what you need to do. However, there are functions that already do that. StrStr is available in the documentation and others are available in the Wiki.
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#7 |
|
Member
Join Date: Feb 2005
Posts: 51
|
I didn't know we had a Wiki. Look what I found: http://nsis.sourceforge.net/wiki/Get...uild/update%29
No need to write my own, someone else did it Thanks a lot!Gili |
|
|
|
|
|
#8 |
|
Moderator
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
|
I'll make rIndexOf and indexOf functions.
-Stu Need an installer? http://www.afrowsoft.co.uk |
|
|
|
|
|
#9 |
|
Member
Join Date: Feb 2005
Posts: 51
|
Excellent idea. It seems most scripts use them and end up reinventing the wheel. It would also clear up the code
|
|
|
|
|
|
#10 |
|
Moderator
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
|
Need an installer? http://www.afrowsoft.co.uk |
|
|
|
|
|
#11 |
|
Major Dude
|
Ahnn... StrFunc already had a function called StrLoc where you can find the position of a string from the start or end of the main string, in one function. That means, you just reinvented the wheel.
I didn't like to post functions on Archive, but now, as the wiki is online, I can post the StrFunc functions there so they can be reselected for the future Useful Functions Header file. |
|
|
|
|
|
#12 |
|
Moderator
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
|
Ah well never mind
I was bored anyway lol-Stu Need an installer? http://www.afrowsoft.co.uk |
|
|
|
|
|
#13 |
|
Major Dude
|
That's ok, 2 are better than 1
. Here goes the wiki link for StrLoc: http://nsis.sourceforge.net/wiki/StrLoc.
|
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|