Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 10th August 2006, 17:30   #1
beano_okc
Junior Member
 
Join Date: Aug 2006
Posts: 2
EnumRegKey - infinite loop on some Win98 machine, but not others?

I need to enumerate Outlook profiles on Windows 98 machines as part of my NSIS script. I have 42 machines as an initial group I'm working with, and of the 42, I had 6 that went into an infinite loop when trying to enumerate "HKCU\Software\Microsoft\Windows Messaging Subsystem\Profiles". I can't see anything different on these machines, they all have anywhere from 1 to 7-8 Outlook profiles configured. I'm doing some testing on one of the machines and can't determine why this loops endlessly:

Machine has only one Outlook profile, "GTriplett", so beneath Profiles in the registry, that is the only key present, and should therefore be the only key EnumRegKey sees before it returns an empty string or errors out. I've added some debugging stuff (well, attempt at debugging) to the loop so I can see the condition of variables and whatnot via DetailPrint, but I'm stumped.

The NSIS loop is (debugging stuff is still in it):

--------------------------------
; First build a stack of Outlook profiles
StrCpy $1 0
StrCpy $2 0
DetailPrint "Building a list of Outlook profiles..."
loop_getprofs:
ClearErrors
DetailPrint "Var 1 is $1, now reading registry"
EnumRegKey $1 HKCU "Software\Microsoft\Windows Messaging Subsystem\Profiles" $2
IfErrors getprof_error
StrCmp $1 "" done_getprofs
Push $1
DetailPrint " $2. $1"
IntOp $2 $2 + 1
StrCpy $1 0
StrCmp $2 30 EndIt
Goto loop_getprofs

getprof_error:
DetailPrint "Ran into an error reading HKCU\Sofware\MS\WMS\Profiles at index $2"
done_getprofs:
-----------------------------------


The Details window of NSIS shows this:

----------------------------------------
Building a list of Outlook profiles...
Var 1 is 0, now reading registry
0. GTriplett
Var 1 is 0, now reading registry
1. GTriplett
Var 1 is 0, now reading registry
2. GTriplett
Var 1 is 0, now reading registry
3. GTriplett
--- snip ---
Var 1 is 0, now reading registry
28. GTriplett
Var 1 is 0, now reading registry
29. GTriplett
Completed
------------------------------------

So you can see that $2 is incrementing, and therefore EnumRegKey is being told to read an incrementing index, yet it always returns "GTriplett", and will loop infinitely on it. The majority of my machines went just fine, is this a bug in EnumRegKey, or registry corruption, or... any other ideas?

Thanks very much,
Mark
beano_okc is offline   Reply With Quote
Old 10th August 2006, 22:07   #2
beano_okc
Junior Member
 
Join Date: Aug 2006
Posts: 2
update

As an update, it appears that on the Windows 98 machines where I saw an issue, that I can enumerate *any* registry key and get an infinite loop. I am very definitely incrementing the key index with IntOp, and echoing the registry key name, and can see that the script goes through the values as you would expect, listing each one individually. When it exhausts the keys, though, it just keeps listing the last key it hit, over and over, and the key index just keeps climbing from the IntOp (the line in my script snippet above, "DetailPrint $2. $1" is showing me the key index and the result of that particular enumeration).

Has anyone else run into something like this? Is there some update to Windows that these machines have missed, and they have a broken API "RegEnumKey" function?
beano_okc is offline   Reply With Quote
Old 19th August 2006, 13:24   #3
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Run the attached executable on a machine which shows this behavior and let me know what is the result you get from it. It will call RegEnumKey with an index above the number of available subkeys and show the result.
Attached Files
File Type: zip enum.zip (11.4 KB, 158 views)

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump