EjectUSB

If you are currently developing portable freeware or planning to do so, use this forum to discuss technical implementation, seek out like-minded developers for partnership, or solicit interested users for beta testing.
Message
Author
User avatar
m^(2)
Posts: 890
Joined: Sat Mar 31, 2007 2:38 am
Location: Kce,PL
Contact:

#91 Post by m^(2) »

What if Program A hung?
Will EjectUSB hang too?
Or maybe after waiting 5 seconds, it will kill everything w/out giving a chance to clean after themselves?
Anyway, I feel that such time should depend on number of programs to close. Pausing ejection would be a solution too.

User avatar
Queue
Posts: 197
Joined: Mon Oct 08, 2007 2:41 am
Contact:

#92 Post by Queue »

If Program A hangs, that just fulfills the wait period and it will get forcibly terminated. And after 5 seconds, yes it would forcibly terminate everything still running, but that's the entire point of TimeToWait. If you want to make sure EjectUSB isn't killing anything early you can set TimeToWait to 1000, to make sure everything has a chance to close gracefully. If everything does close just fine, it won't wait 1000 seconds, it will continue as soon as it detects everything's closed. However, if a program does hang, it will wait 1000 seconds before trying to terminate it. There isn't a perfect solution here; TimeToWait is a guess at when to kill off a program that has taken too long to close.

I'd like to emphasize all programs are told to close BEFORE any waiting occurs, so one program hanging won't prevent others from getting a chance to shut down properly.

Originally EjectUSB did wait on each program individually. With a TimeToWait of only 5 seconds, if EjectUSB was trying to close a mere 10 hanged programs, that would've taken 50+ seconds, which is unacceptable. EjectUSB was designed to eject the drive as quickly as possible, not to manage programs that the user hasn't saved data in yet. This means closing everything to stop read/write activity to the drive and initiating safe removal calls. It's meant to be human accomodating (you set how long you're willing to wait) not computer accomodating (the computer tells you how long you're going to wait). This is a major point of EjectUSB's design philosophy.

If you frequently use programs that take a while to close, increase the TimeToWait value. 30 is probably enough time for nearly anything and 30 seconds isn't TOO excrutiating of a wait if somethnig does hang.

Queue

User avatar
m^(2)
Posts: 890
Joined: Sat Mar 31, 2007 2:38 am
Location: Kce,PL
Contact:

#93 Post by m^(2) »

Queue wrote:If Program A hangs, that just fulfills the wait period and it will get forcibly terminated. And after 5 seconds, yes it would forcibly terminate everything still running, but that's the entire point of TimeToWait. If you want to make sure EjectUSB isn't killing anything early you can set TimeToWait to 1000, to make sure everything has a chance to close gracefully. If everything does close just fine, it won't wait 1000 seconds, it will continue as soon as it detects everything's closed. However, if a program does hang, it will wait 1000 seconds before trying to terminate it. There isn't a perfect solution here; TimeToWait is a guess at when to kill off a program that has taken too long to close.

I'd like to emphasize all programs are told to close BEFORE any waiting occurs, so one program hanging won't prevent others from getting a chance to shut down properly.
Ok, as it sends messages to all programs first, there's no problem.
If it could detect save dialogs and wait for them, it would be perfect.

wraithdu
Posts: 15
Joined: Mon Jul 21, 2008 11:57 am

#94 Post by wraithdu »

I just wanted to add that another possibility to WM_CLOSE is to send the WM_DESTROY message. Some apps (like Sandboxie) will respond to the DESTROY message instead of the CLOSE message. Perhaps you'd want to implement that in an INI file somewhere so a user could experiment and see if it works better for a particular app.

garbanzo
Posts: 248
Joined: Thu May 15, 2008 3:00 am

#95 Post by garbanzo »

EjectUSB is today's 'featured Windows download' on Lifehacker 8)

User avatar
guinness
Posts: 4118
Joined: Mon Aug 27, 2007 2:00 am
Contact:

#96 Post by guinness »

seems everyone is liking the application:

http://www.freewaregenius.com/2008/07/2 ... e-removal/

Wow you have created a program that everyone is finally catching onto, if only they had read your post back in April!!!

Hows 1.4 looking?
Last edited by guinness on Tue Jun 28, 2011 4:28 pm, edited 1 time in total.

User avatar
Queue
Posts: 197
Joined: Mon Oct 08, 2007 2:41 am
Contact:

#97 Post by Queue »

Oh holy crud, 1.3's up to 15k downloads already. 1.0, 1.1 and 1.2 together got 10k downloads and I was REALLY proud of that.

1.4's still just a list of things to work on, right now I'm working on the documentation for (and testing) hybrid batch scripts. I'm hoping to have that ready sometime mid next week; I've been very busy, and EjectUSB just gets worked on in my free time.

1.4 will likely contain new keywords for the scripting, I'm gonna look into WM_DESTROY, will improve graceful program closing and compatibility with programs with hidden windows (<- this is actually done already), an improved dead icons in the system tray cleanup routine, ejection pausing for save dialogs... I think covers what I have planned so far.

In particular I need to figure out how to detect more specific information about drive types, particularly if something is a flash card reader.

Oh, and http://www.ejectusb.com now points to the PAR blog entry for EjectUSB. I'll get a proper website made for it eventually...

Queue
Last edited by Queue on Sat Jul 26, 2008 7:24 am, edited 1 time in total.

User avatar
m^(2)
Posts: 890
Joined: Sat Mar 31, 2007 2:38 am
Location: Kce,PL
Contact:

#98 Post by m^(2) »

What do you mean by "hybrid batch scripts"?

User avatar
Queue
Posts: 197
Joined: Mon Oct 08, 2007 2:41 am
Contact:

#99 Post by Queue »

It's the inane name I'm using for specialized batch file support for EjectUSB. The first line of the batch file contains special keywords that EjectUSB reads, and based on these, the normal contents of the batch file are executed by EjectUSB at a specific time (namely, before or after programs are closed) or not at all if you use the keywords to do all the work and don't need to run the batch script itself.

http://www.pocketappreview.com/main/med ... C_beta.zip

Here are 4 example scripts to work with TrueCrypt. None of them will work without at least renaming them from EjectUSB_TC#.bat to EjectUSB.bat (or whatever you rename EjectUSB.exe to). TC0 requires you to edit the first line and specifically set the TrueCrypt volume letter. TC1, 2 and 3 all automatically detect the TrueCrypt volume for you. TC3 is the same as TC1 except it also performs cleanup on the drive TC is located on (instead of just on the TrueCrypt volume itself); useful if you don't keep EVERYTHING in your TC volume.

None of them do any TrueCrypt specific registry cleanup yet. The keywords to do that are ''delregval'' and ''delregkey'' but I haven't yet researched exactly which values/keys would need to be removed. I keep putting that off but I'll get around to it eventually.

Queue

User avatar
m^(2)
Posts: 890
Joined: Sat Mar 31, 2007 2:38 am
Location: Kce,PL
Contact:

#100 Post by m^(2) »

Lol, the thing had problems to get WM_CLOSE was a tool that executes a batch when EjectUSB is run.
It's works on system shutdown too, so the work was not useless though. ;)

User avatar
xephyr69
Posts: 42
Joined: Fri Jul 11, 2008 11:36 pm
Location: Nebraska, ISA
Contact:

#101 Post by xephyr69 »

If you need assistance in updating, maintaining or moderating, I can help. I am free most hours of the day, finding myself browsing the web for hours on end with nothing else to do. I can help if you need it. Please let me know.

Regards,
Xephyr69

donald
Posts: 561
Joined: Wed Dec 19, 2007 4:14 am
Location: knoxville TN USA

false positive??

#102 Post by donald »

I am using avast and it detects a trojan in the new download.

Is this a common issue or is this just me?

User avatar
spacemonkey
Posts: 42
Joined: Wed Jun 06, 2007 11:09 pm

#103 Post by spacemonkey »

I've been using this for a while and only just started getting Avast giving me the same report. Looks like a false positive with a new Avast update!! :S

User avatar
Queue
Posts: 197
Joined: Mon Oct 08, 2007 2:41 am
Contact:

#104 Post by Queue »

Obviously I've been gone for eons (3 or 4 months at least). Now that my life's a little less hectic, I'm going to be trying to spend more time around here at TPFC, portable app'ing in general (the stuff on my flash drive has been a godsend the past few months), and getting more development done on EjectUSB. I had a little time recently to work on the latter and should have EjectUSB 1.4 done and available before Christmas.

I know about the Avast issues and can assure you it's a false positive; my test builds of EjectUSB 1.4 haven't been triggering Avast, though they do trigger Ikarus. Scrambling the UPX header avoids the Ikarus false positives, but I'm not particularly happy with having to do that. =/

Queue

User avatar
m^(2)
Posts: 890
Joined: Sat Mar 31, 2007 2:38 am
Location: Kce,PL
Contact:

#105 Post by m^(2) »

Queue wrote:Obviously I've been gone for eons (3 or 4 months at least). Now that my life's a little less hectic, I'm going to be trying to spend more time around here at TPFC, portable app'ing in general (the stuff on my flash drive has been a godsend the past few months), and getting more development done on EjectUSB. I had a little time recently to work on the latter and should have EjectUSB 1.4 done and available before Christmas.

I know about the Avast issues and can assure you it's a false positive; my test builds of EjectUSB 1.4 haven't been triggering Avast, though they do trigger Ikarus. Scrambling the UPX header avoids the Ikarus false positives, but I'm not particularly happy with having to do that. =/

Queue
Drop Avast an email.

Post Reply