Jump to content
Sign in to follow this  

Regread does not seem to be working under x64

Recommended Posts

Strange issue.  We have been using 32bit workstations until recently.  I have a very simple script to run Autologon from sysinternals, then read the value of a regkey, and disable the logoff button if needed


FileInstall("C:\Autologon.exe", "C:\AutoitTemp\Autologon.exe")

RunWait("C:\AutoitTemp\autologon.exe -accepteula")

$IsAutoLogonEnabled = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "AutoAdminLogon")

   MsgBox(0, "Info", $isautologonenabled)

If $IsAutoLogonEnabled = 1 Then
   RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Explorer", "StartMenuLogoff", "REG_DWORD", 1)
   RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Explorer", "NoLogoff", "REG_DWORD", 1)
   MsgBox(0, "Info", "Logoff Disabled")

If $IsAutoLogonEnabled = 0 Then
   RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Explorer", "StartMenuLogoff", "REG_DWORD", 0)
   RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Explorer", "NoLogoff", "REG_DWORD", 0)
   MsgBox(0, "Info", "LogOff Button Enabled")

DirRemove("C:\AutoitTemp", 1)

the problem is, on x64 windows 7, the value seems to come back as NULL.  Works fine on 32bit.  If I compile the script as x64 it DOES work, but then will not run on 32bit.....


Share this post

Link to post
Share on other sites

So I may have posted too soon.  If I change the regread to HKLM64, it works.  So am i going to have to change all my scripts to if @osversion = X64..... else.....


Or is there an easier way to make it more compatible?

Share this post

Link to post
Share on other sites

Hi, wisem2540, please see the Remarks section of RegRead in the help file, specifically the second statement. It is pretty black and white.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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...