Sign in to follow this  
Followers 0
ppat

au3 program dismounts the drive from which it is running

5 posts in this topic

My prog.au3 file is on a crypted container. I mount the container to drive F:\, using TrueCrypt or equivalent crytology software. I can run the program prog.au3 without problem. But for some reason I can't explain in detail here, the program has to force a dismount of the container on which it is located.

To my surprise, the program continues to sort of work, even when F:\ does not exist anymore. But some functions do not seem to work properly.

So could someone explain how launching an au3 file works? Does it load all the includes and the program into memory at the start of the launch? Are all includes really loaded to memory? I understand that forcing a dismount of the drive from which the au3 file is running is not very good practice, but once again, I have no choice. I would like to understand how things work.

My code for F:\prog.au3 looks like that:

; Note: the crypted drive must be mounted to F:\ to launch this program
#include "C:\script_on_C.au3"
#include "F:\other_script_on_mounted_drive.au3"

; Do some stuff

RunWait("""" & "C:\Program Files\TrueCrypt\TrueCrypt.exe" & """ " & "/quit /force /dismount F")

; Do other stuff such as calling functions from [b]C:\script_on_C.au3[/b] and [b]F:\other_script_on_mounted_drive.au3[/b]
; A bit dangerous as the F:\ drive does not exist any more
; Kind of half works (some things get executed, others not)

Share this post


Link to post
Share on other sites



OK, not much help sofar, I will give some code easier to reproduce. Here is what you need to do:

  • Install Truecrypt software on your PC

  • Create a crypted volume ("Create Volume" button). For example a 1MB volume.

  • Mount the volume to L:\

  • Create a L:\test.au3 file

  • Add the autoit code to it
RunWait(Chr(34) & "C:\Program Files\TrueCrypt\TrueCrypt.exe" & Chr(34) & " /dismount L /force /quit background")
MsgBox(0,"Note", "L has been dismounted")

RunWait("C:\WINNT\system32\notepad.exe")
MsgBox(0,"End of Test", "Check if the Notepad has been launched. Does not launch for user:ppat.")

Now the strange thing is that after dismounting the L drive, all RunWait instructions seem to be ignored (or to fail?). But the last MsgBox execution is done successfully.

So could someone explain why the program seems to be executed till its end, even after L has been dismounted, but RunWait instructions fail after the dismount?

Share this post


Link to post
Share on other sites

To my surprise, the program continues to sort of work, even when F:\ does not exist anymore. But some functions do not seem to work properly.

Same here. I think it is impressive AutoIt is still running even after something that Windows should not allow to be done in the first place (unmounting a drive that is in use).

I think we should leave it at that too. Don't try to add functionality and support for something is completely wrong to do.

Share this post


Link to post
Share on other sites

I think we should leave it at that too. Don't try to add functionality and support for something is completely wrong to do.

You are right. I completely revised my code so that it resides on drive C:\

Only a tiny bit of the code with the passwords sits on the encrypted drive, and I call it in a parallel call to autoit.exe.

By doing so, mounting / dismounting the encrypted drive, as well as the functions after the dismount command work as expected now.

Share this post


Link to post
Share on other sites

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