Jump to content
Sign in to follow this  
Rivers

RegRead() returning -1

Recommended Posts

Rivers

Hello,

I'm using RegRead() to check for the existence of a Key on a Windows 2008 Server. It is returning -1, but I can't figure out why.

Thank you,

Shawn

RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\TriZetto\Facets Application Server","")

MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '@error' & @lf & @lf & 'Return:' & @lf & @error) ;### Debug MSGBOX

If @error = 0 Then

WriteLog($LogHandle, " Installing: " & $PatchExe, $StatusBox)

EndIf

Share this post


Link to post
Share on other sites
Yoriz

Failure: Returns "" and sets the @error flag:

-1 if unable to open requested value

Maybe you dont have rights to open it.


GDIPlusDispose - A modified version of GDIPlus that auto disposes of its own objects before shutdown of the Dll using the same function Syntax as the original.EzMySql UDF - Use MySql Databases with autoit with syntax similar to SQLite UDF.

Share this post


Link to post
Share on other sites
JFX

If you compile your script as 32bit executable or run it with SciTE then it will not see the \Wow6432Node\ as this is only visible from x64 processes.

try: RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\TriZetto\Facets Application Server","")

Share this post


Link to post
Share on other sites
GEOSoft

Where are you getting the error? You do realize that If @Error = 0 is refering to the error returned from the MsgBox() call? To do what I think you intend you will have use a variable for the error.

RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\TriZetto\Facets Application Server","")
$iError = @Error
MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & $iError & @lf & @lf & 'Return:' & @lf & $iError) ;### Debug MSGBOX
If $iError = 0 Then 
    WriteLog($LogHandle, " Installing: " & $PatchExe, $StatusBox)
EndIf

Also check that you have the required permissions to access that registry key.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites
Rivers

The rights do not seem to be an issue. I can edit the registry as the same user running this script.

The intent of this application is to be able to determine the version of Windows (2008/64bit or 2003/32bit) and execute service packs based on entries in the registry. On the 2008/64bit systems, the entries are in Wow6432Node. Am I going to have to create 2 versions of this application?

Thanks,

Shawn

Share this post


Link to post
Share on other sites
Rivers

I have compiled the code on the 2008/64bit server with and without using the X64 option but it still fails.

Shawn

Share this post


Link to post
Share on other sites
GEOSoft

You can still do it all in one script but take a look at the Help File >> Macros >> System Info Macros.

TIP: Change the HKEY_LOCAL_MACHINE to HKLM64 for both 32 and 64 and please don't ask for the reason.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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.