Docfxit Posted October 31, 2014 Share Posted October 31, 2014 The script at: Runs fine in Win7 32bit. It runs but doesn't read the registry keys properly. What is required to get it to run in 64bit? Thanks, Docfxit Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted October 31, 2014 Share Posted October 31, 2014 There are no DllCall()'s to fail there. You are probably using it wrong, post a reproducer that shows your problem. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
Docfxit Posted October 31, 2014 Author Share Posted October 31, 2014 This is the script that I am useing. I don't get any errors. The output on a 32bit machine shows the values for the registry entries. The 64bit machine doesn't find some registry entries and doesn't show any of the values. expandcollapse popup;AutoIt_Debugger_Command:Disable_Debug #RequireAdmin #include <Array.au3> #include <File.au3> #include <FileConstants.au3> #include <_RegEnumKeyValEx.au3> ; The above #included script was written by DXRW4E ; and can be found here: http://www.autoitscript.com/forum/topic/144234-regenumkeyvalex-regenumkeyex-regenumvalex/?p=1207033 ;AutoIt_Debugger_Command:Enable_Debug Global $a, $Error, $Extended, $KeyName Local Const $ExtensionsFile = @ScriptDir & "\%OriginalRegistryKeys.txt" FileDelete($ExtensionsFile) Local $hExtensionsFile = FileOpen($ExtensionsFile, $FO_APPEND) FileCreate($hExtensionsFile, "") $KeyName = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" $a = _RegEnumValEx($KeyName, 128 + 256 + 32, "AutoAdminLogon") $Error = @Error $Extended = @Extended _WriteRecord($hExtensionsFile, $a, $Error, $Extended) $a = _RegEnumValEx($KeyName, 128 + 256 + 32, "ForceAutoLogon") $Error = @Error $Extended = @Extended _WriteRecord($hExtensionsFile, $a, $Error, $Extended) $a = _RegEnumValEx($KeyName, 128 + 256 + 32, "DefaultUserName") $Error = @Error $Extended = @Extended _WriteRecord($hExtensionsFile, $a, $Error, $Extended) $a = _RegEnumValEx($KeyName, 128 + 256 + 32, "AltDefaultUserName") $Error = @Error $Extended = @Extended _WriteRecord($hExtensionsFile, $a, $Error, $Extended) $a = _RegEnumValEx($KeyName, 128 + 256 + 32, "DefaultPassword") $Error = @Error $Extended = @Extended _WriteRecord($hExtensionsFile, $a, $Error, $Extended) $a = _RegEnumValEx($KeyName, 128 + 256 + 32, "DefaultDomainName") $Error = @Error $Extended = @Extended _WriteRecord($hExtensionsFile, $a, $Error, $Extended) $a = _RegEnumValEx($KeyName, 128 + 256 + 32, "AltDefaultDomainName") $Error = @Error $Extended = @Extended _WriteRecord($hExtensionsFile, $a, $Error, $Extended) FileClose($hExtensionsFile) ;_AutoLogon(1, "UserID", "Password", @ComputerName) RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce","Run(@ScriptDir & '\LoginAutoWindowsBack.au3')","REG_SZ",@ScriptFullPath) ; shutdown(2) Func _AutoLogon($iOnOff, $sUserName, $sPassword, $sDomain, $iForceAutoLogon = 0) If $iOnOff = 0 Then ;Auto Logon OFF. RegWrite($KeyName, "AutoAdminLogon", "REG_SZ", "0") Else ;Auto Logon ON. If $iOnOff is anything but 0, it is set to 1 (ON). RegWrite($KeyName, "AutoAdminLogon", "REG_SZ", "1") EndIf If $iForceAutoLogon = 1 Then ;Force Auto Logon ON. RegWrite($KeyName, "ForceAutoLogon", "REG_SZ", "1") Else ;Force Auto Logon OFF. If $iForceAutoLogon is anything but 1, it is set to 0 (OFF). RegWrite($KeyName, "ForceAutoLogon", "REG_SZ", "0") EndIf RegWrite($KeyName, "DefaultUserName", "REG_SZ", $sUserName) RegWrite($KeyName, "AltDefaultUserName", "REG_SZ", $sUserName) RegWrite($KeyName, "DefaultPassword", "REG_SZ", $sPassword) RegWrite($KeyName, "DefaultDomainName", "REG_SZ", $sDomain) RegWrite($KeyName, "AltDefaultDomainName", "REG_SZ", $sDomain) EndFunc ;==>_AutoLogon ; Create a file. Func FileCreate($hExtensionsFile, $sString) Local $bReturn = True ; Create a variable to store a boolean value. If FileExists($hExtensionsFile) = 0 Then $bReturn = FileWrite($hExtensionsFile, $sString) = 1 ; If FileWrite returned 1 this will be True otherwise False. Return $bReturn ; Return the boolean value of either True of False, depending on the return value of FileWrite. EndFunc ;==>FileCreate Func _WriteRecord($hExtensionsFile, $a, $Error, $Extended) If $Error = "4" Then ;ConsoleWrite("Return = " & $a & " - $Error = " & $Error & " - $Extended = " & $Extended & @LF) FileWrite($hExtensionsFile, 'Registry Key Not Found' & @CRLF) Else ;ConsoleWrite("Return = " & $a & " - $Error = " & $Error & " - $Extended = " & $Extended & @LF) _FileWriteFromArray($hExtensionsFile, $a) EndIf EndFunc The output on the 64 bit machine is: Registry Key Not Found Registry Key Not Found HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon|DefaultUserName|REG_SZ| Registry Key Not Found Registry Key Not Found HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon|DefaultDomainName|REG_SZ| Registry Key Not Found The first key is in the registry and the output shows it isn't found. The third key does have a value in the registry. The sixth one does have a value in the registry. The output on a 32bit machine is: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon|AutoAdminLogon|REG_SZ|1 Registry Key Not Found HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon|DefaultUserName|REG_SZ|UserName Registry Key Not Found Registry Key Not Found HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon|DefaultDomainName|REG_SZ|DOCFXIT Registry Key Not Found Thanks for looking at it. Docfxit Link to comment Share on other sites More sharing options...
JohnOne Posted October 31, 2014 Share Posted October 31, 2014 May be as simple as changing "HKEY_LOCAL_MACHINE" to "HKEY_LOCAL_MACHINE64". AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
MikahS Posted October 31, 2014 Share Posted October 31, 2014 When running on 64-bit Windows if you want to read a value specific to the 64-bit environment you have to suffix the HK... with 64 i.e. HKLM64. Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
Docfxit Posted October 31, 2014 Author Share Posted October 31, 2014 (edited) That worked great even though it doesn't show that in the registry. I had no idea that would be required. Amazing. You guys are really great. Thanks, Docfxit Edited October 31, 2014 by Docfxit MikahS 1 Link to comment Share on other sites More sharing options...
MikahS Posted October 31, 2014 Share Posted October 31, 2014 Yep, simply using @OSArch to find if it is X64 or X86 would help. Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
Solution JohnOne Posted October 31, 2014 Solution Share Posted October 31, 2014 "HKEY_LOCAL_MACHINE64" will work on both 64 and 32 bit. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Docfxit Posted October 31, 2014 Author Share Posted October 31, 2014 Yep, simply using @OSArch to find if it is X64 or X86 would help. That's super. I will add that macro right now. It sure makes life easy. Thanks a bunch. Thank you both. That makes it tough to decide which answer to mark as solved. Docfxit Link to comment Share on other sites More sharing options...
MikahS Posted October 31, 2014 Share Posted October 31, 2014 Just happy we could help. Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
Docfxit Posted October 31, 2014 Author Share Posted October 31, 2014 Just happy we could help. I think I'm happier than you are. MikahS 1 Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted October 31, 2014 Share Posted October 31, 2014 That worked great even though it doesn't show that in the registry. I had no idea that would be required. Amazing. You guys are really great. Thanks, Docfxit Thought it might be something like that. You want to read the 64-bit keys, and the Registry Redirector gave you the 32-bit keys. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now