ScriptingSteve Posted April 16, 2010 Share Posted April 16, 2010 I have a 32-bit-compiled autoit script that is returning false in error when run on 64-bit Windows 7 for this code: {{ $Dir=@WindowsDir & "\System32\Drivers\mrxsmb10.sys" If FileExists($Dir) Then Msgbox(64,"File found","File '" & $Dir & "' Version " & FileGetVersion($Dir)) Else Msgbox(16,"Error","File '" & $Dir & "' not found.") EndIf }} The file is physically in the above location (C:\Windows\System32\Drivers\Mrxsmb10.sys). When the script is compiled x86 (AutoIt 3360), it returns false (incorrect). If the same script is recompiled as x64(AutoIt 3360), it returns true (correct). The interesting thing here is that on a 64-bit Win7 machine, this file is NOT within C:\Windows\SysWOW64\..., it is sitting at the absolute path "C:\Windows\System32\Drivers\Mrxsmb10.sys". Thus the "If Fileexists($Dir)" from above is looking for this file at path "C:\Windows\System32\Drivers\Mrxsmb10.sys", (I validated this through debugging that variable substitution was correct). Visually verified as being present at the above path on 64-bit Windows 7.. yet 32-bit compiled script returns false (file does not exist, even when it does), but the same script, recompiled 64-bit, returns true (file exists), correct. Unless I'm missing something obvious, I suspected this as an AutoIt bug, but am told to discuss here first. Looking for any suggestions.. Link to comment Share on other sites More sharing options...
Developers Jos Posted April 16, 2010 Developers Share Posted April 16, 2010 (edited) When running in X64 mode the c:\windows\System32 directory is used and when in x86 mode any reference to c:\windows\system32 will use C:\Windows\SysWOW64. This is standard Vista/Win7 behaviour. Try running this script in SciTE with both a Y and a N on the first line and look at the files returned. (need the full SciTE4AutoIt3 version for that) #AutoIt3Wrapper_usex64=y $Dir = @WindowsDir & "\System32\Drivers\*.sys" FileFindFirstFile($Dir) $search = FileFindFirstFile($Dir) If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf While 1 $file = FileFindNextFile($search) If @error Then ExitLoop ConsoleWrite($file) ConsoleWrite(@CRLF) WEnd FileClose($search) Edited April 16, 2010 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
KaFu Posted April 16, 2010 Share Posted April 16, 2010 This one contains some more infos on the same topic. OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
JFX Posted April 16, 2010 Share Posted April 16, 2010 try sysnative if running under wow emulation If @OSArch = "X64" AND @AutoItX64 = 0 Then $Dir=@WindowsDir & "\Sysnative\Drivers\mrxsmb10.sys" Else $Dir=@WindowsDir & "\System32\Drivers\mrxsmb10.sys" EndIf Link to comment Share on other sites More sharing options...
ScriptingSteve Posted April 19, 2010 Author Share Posted April 19, 2010 try sysnative if running under wow emulation If @OSArch = "X64" AND @AutoItX64 = 0 Then $Dir=@WindowsDir & "\Sysnative\Drivers\mrxsmb10.sys" Else $Dir=@WindowsDir & "\System32\Drivers\mrxsmb10.sys" EndIf Yes, the "sysnative" technique did work correctly. Thanks to all for assistance. 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