Jump to content
Sign in to follow this  
BodoWitcha

RegEnumVal en RegEnumKey unexpected results

Recommended Posts

BodoWitcha

When I try to use the Functions RegEnumKey and RegEnumVal I get unexpected results:

I have made this sample code:

ConsoleWrite('RegEnumVal' & @LF)
;
For $i = 1 To 3
    $var = RegEnumVal("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\", $i)
    If @error <> 0 Then
        ConsoleWrite("@error: " & @error & @LF)
        
        ExitLoop
    EndIf
    ConsoleWrite("SubVal #" & $i & " under HKLM\CurrentControlSet\Control\Session Manager\Environment: " & $var & @LF)
Next
;
ConsoleWrite('RegEnumKey' & @LF)
;
For $i = 1 To 3
    $var = RegEnumKey("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\", $i)
    If @error <> 0 Then
        ConsoleWrite("@error: " & @error & @LF)
        
        ExitLoop
    EndIf
    ConsoleWrite("SubKey #" & $i & " under HKLM\CurrentControlSet\Control\Session Manager\Environment: " & $var & @LF)
Next

and I get the following results:

Watch the version (3.2.12.0)

>Running:(3.2.12.0):C:\Program Files\AutoIt3\autoit3.exe "C:\Program Files\ComicHtmlMenuBuilderDevelopment\remove before shipping\tst.au3"  
RegEnumVal
SubVal #1 under HKLM\CurrentControlSet\Control\Session Manager\Environment: CLASSPATH
SubVal #2 under HKLM\CurrentControlSet\Control\Session Manager\Environment: ComSpec
SubVal #3 under HKLM\CurrentControlSet\Control\Session Manager\Environment: FP_NO_HOST_CHECK
RegEnumKey
@error: -1

Please help me out

As far I can see from RegEnumVal I get keys and from RegEnumKey I get an error

Share this post


Link to post
Share on other sites
Jos

I don't have any keys in that Registry tree, only fields and values.

what is it you expected to see ?


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
BodoWitcha

I don't have any keys in that Registry tree, only fields and values.

what is it you expected to see ?

I expected to see instead of CLASSPATH e.g. .;C:\Program Files\Java\jre1.6.0_03\lib\ext\QTJava.zip

Share this post


Link to post
Share on other sites
BodoWitcha

I found the bug. It is my brain. I shuffeld too much with key field and values.

Thanks for the quick reaction.

Share this post


Link to post
Share on other sites
Jos

Like this?

ConsoleWrite('RegEnumVal' & @LF)
;
For $i = 1 To 3
    $var = RegEnumVal("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\", $i)
    If @error <> 0 Then
        ConsoleWrite("@error: " & @error & @LF)
        ExitLoop
    EndIf
    $fieldval = RegRead("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment",$var)
    ConsoleWrite("SubVal #" & $i & " under HKLM\CurrentControlSet\Control\Session Manager\Environment: " & $var & " : " & $fieldval & @LF)
Next

:)


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
BodoWitcha

Like this?

ConsoleWrite('RegEnumVal' & @LF)
;
For $i = 1 To 3
    $var = RegEnumVal("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\", $i)
    If @error <> 0 Then
        ConsoleWrite("@error: " & @error & @LF)
        ExitLoop
    EndIf
    $fieldval = RegRead("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment",$var)
    ConsoleWrite("SubVal #" & $i & " under HKLM\CurrentControlSet\Control\Session Manager\Environment: " & $var & " : " & $fieldval & @LF)
Next

:(

Absolutely right. Thanks. :)

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.