Jump to content
Sign in to follow this  
caramen

RegEnumVal Error -1 :(

Recommended Posts

Hi guys :)

 

Local $cKey ="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
    Local $sSubKey = "", $sEnumKey = $cKey & @CRLF & @CRLF , $sEnumKeyFTV
    For $i = 1 To 10
        MsgBox(0, "debug $i:", $i)
        MsgBox(0, "debug $cKey:", $cKey)
        $sSubKey = RegEnumVal( $cKey , $i)
            If @error Then
               MsgBox(0,"Debug error",""&@error)
               ExitLoop
            EndIf
            MsgBox(0, "debug $sSubKey:", $sSubKey)
        $sEnumKey &= "#" & $i & @TAB & $sSubKey & @CRLF
        $sEnumKeyFTV = $cKey & "\" & $sSubKey & @TAB  & @CRLF
     Next
    $ScanDemarrage = 1

My Goal is to get all key's values in "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"

 

I keep getting error -1 :(

This sample is prepared for you so you can test and try to help me to solve this.

Btw i dont know how to solve this :

-1 = unable to retrieve requested value name (value instance out of range)

Tryed with #requireAdmin

 

And maybe that help : The exact same sample of code is working with "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"

Edited by caramen

My video tutorials : HERE ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

Maybe something like:

#include <Array.au3>
Global $aRegRun[0][3]
_RegRunValues("HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run")
_RegRunValues("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run")
_RegRunValues("HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Run")
_ArrayDisplay($aRegRun)

Func _RegRunValues($cKey)
    Local $i = 1, $sSubKey
    While 1
        $sSubKey = RegEnumVal($cKey, $i)
            If @error Then ExitLoop
        _ArrayAdd($aRegRun, $cKey & "|" & $sSubKey & "|" & RegRead($cKey, $sSubKey))
        $i += 1
    WEnd
EndFunc

 

Share this post


Link to post
Share on other sites

Thanks got it.

Edited by caramen

My video tutorials : HERE ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

I suspect that you don't have any values under the 32 bit key "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Run", which you are referencing in your code.  Can you check the key to see if it has any values?

To access the 64 bit key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" you need to use HKLM64 (only if compiled as 32 bit) as my example above and remember that HKLM references the 32 bit keys.  If you compile your script as 64 bit then you'll can use: HKEY_LOCAL_MACHINE\Software and HKEY_LOCAL_MACHINE\Software\WOW6432Node

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...