mikephn Posted October 19, 2010 Posted October 19, 2010 I'm trying to automate an installation and I need to copy a new .sys to system32/drivers. FileCopy and FileMove seem to make no changes, the file doesn't appear there after copying. Oddly enough, FileExists will tell me the file is there, when it's clearly not. The program that requires this .sys to be present also doesn't start. I have all files visible, including system, and I'm requesting admin rights at the beginning of the script. I run Win7 64-bit. So far I can only do it with a .bat being run by AutoIt, which is a bit pointless. Can anybody offer a solution and/or explanation? Many thanks Mike
gerwim Posted October 19, 2010 Posted October 19, 2010 Might be a stupid question, but what if you F5 in the folder? Sometimes Windows screws up and doesn't auto-refresh the folder.
whim Posted October 19, 2010 Posted October 19, 2010 @mikephnIf your script runs/is compiled as 32-bits code, Win 7 will redirect ALL your 'operations' on system32 to sysWOW64 ...So you might want to take a look there. Extremely logical, isn't it ? (64-bit code in system32, 32-bits in sysWOW64) HTH,wim
gerwim Posted October 19, 2010 Posted October 19, 2010 (edited) @mikephn If your script runs/is compiled as 32-bits code, Win 7 will redirect ALL your 'operations' on system32 to sysWOW64 ... So you might want to take a look there. Extremely logical, isn't it ? (64-bit code in system32, 32-bits in sysWOW64) HTH, wim This could be it too. To fix this, make your destination: $dest = @WindowsDir & "\System32\Drivers\" Edited October 19, 2010 by gerwim
whim Posted October 19, 2010 Posted October 19, 2010 This could be it too. To fix this, make your destination: True, but if you want to install 64 bit drivers, you might as well compile your scriptas 64 bit - so it won't accidentally f*** up a 32 bit system.whim
mikephn Posted October 19, 2010 Author Posted October 19, 2010 The program that needs this .sys needs to have it in System32, and depending on the OS (64/32) I have two versions of the file to copy. I'm checking @OSArch to determine which one to copy, but the script needs to run on both 32 and 64 bit systems. My path actually is based on the Windows directory, because I also noticed that the system directory AutoIt gives is for sysWOW64. So my command is: FileCopy(@WindowsDir & "\System32\drivers\64b.sys", @WorkingDir & "\Win64\64b.sys", 9) FileExists(@WindowsDir & "\System32\drivers\64b.sys") returns 1, but the file is not there. It also doesn't appear in sysWOW64.
whim Posted October 19, 2010 Posted October 19, 2010 @mikephn You will also need full Administrator rights to write to /drivers, when running from SciTe add: #RequireAdmin to the top of your script. In a compiled script, use #AutoIt3Wrapper_res_requestedExecutionLevel=requireAdministrator hope that helps, whim
trancexx Posted October 19, 2010 Posted October 19, 2010 This is only (un)proper redirection, nothing more. Use functions for disabling/enabling redirection an all should work fine. String \System32 is interpreted differently depending on... what it depends. ♡♡♡ . eMyvnE
mikephn Posted October 19, 2010 Author Posted October 19, 2010 This is only (un)proper redirection, nothing more. Use functions for disabling/enabling redirection an all should work fine.String \System32 is interpreted differently depending on... what it depends.The line is:DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 1)Worked like a charm. Thanks a lot everyone!
llewxam Posted July 19, 2011 Posted July 19, 2011 The line is:DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 1)Worked like a charm. Thanks a lot everyone!Sorry to necro-post a little, but this helped me SOOO much that I had to acknowledge it!! I was trying everything reasonable, then some and some dumb stuff too like trying to set attributes and taking ownership before finding that FileGetSize was returning 0! The above DllCall made everything fall in to place!BTW, Win7 x64THANKS!!!!!Ian My projects: IP Scanner - Multi-threaded ping tool to scan your available networks for used and available IP addresses, shows ping times, resolves IPs in to host names, and allows individual IPs to be pinged. INFSniff - Great technicians tool - a tool which scans DriverPacks archives for INF files and parses out the HWIDs to a database file, and rapidly scans the local machine's HWIDs, searches the database for matches, and installs them. PPK3 (Persistent Process Killer V3) - Another for the techs - suppress running processes that you need to keep away, helpful when fighting spyware/viruses. Sync Tool - Folder sync tool with lots of real time information and several checking methods. USMT Front End - Front End for Microsoft's User State Migration Tool, including all files needed for USMT 3.01 and 4.01, 32 bit and 64 bit versions. Audit Tool - Computer audit tool to gather vital hardware, Windows, and Office information for IT managers and field techs. Capabilities include creating a customized site agent. CSV Viewer - Displays CSV files with automatic column sizing and font selection. Lines can also be copied to the clipboard for data extraction. MyDirStat - Lists number and size of files on a drive or specified path, allows for deletion within the app. 2048 Game - My version of 2048, fun tile game. Juice Lab - Ecigarette liquid making calculator. Data Protector - Secure notes to save sensitive information. VHD Footer - Add a footer to a forensic hard drive image to allow it to be mounted or used as a virtual machine hard drive. Find in File - Searches files containing a specified phrase.
ViciousXUSMC Posted February 9, 2015 Posted February 9, 2015 (edited) I'll Necro it again Just fixed my issue. So strange as I was doing a filecopy and not using any macros I was using a defined file path. In this case my code: #RequireAdmin ;Disabled Auto Push to 32bit Location DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 1) FileInstall("C:\My Places\Scripting\AutoIT\My Scripts\Disable Flash Update\mms.cfg", @TempDir & "\mms.cfg", 1) If FileExists("C:\Windows\SysWOW64\Macromed\Flash\") Then FileCopy(@TempDir & "\mms.cfg", "C:\Windows\SysWOW64\Macromed\Flash\mms.cfg", 1) Else EndIf If FileExists("C:\Windows\System32\Macromed\Flash\") Then FileCopy(@TempDir & "\mms.cfg", "C:\Windows\System32\Macromed\Flash\mms.cfg", 1) Else EndIf Just a little script to push the mms.cfg file to disabled auto updated on Adobe Flash. My question now is this, are there any ill effects in running that dllcall, like do I need to re-enable it after I have finished my script? Edited February 9, 2015 by ViciousXUSMC
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