Sign in to follow this  
Followers 0
wisem2540

Regread does not seem to be working under x64

3 posts in this topic

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

#Requireadmin


DirCreate("C:\AutoitTemp")
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")
   EndIf


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")
EndIf

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

ideas?

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.


√-1 2^3 ∑ π, and it was delicious!

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  
Followers 0