You are here

Ejecting instead of removing

10 posts / 0 new
Last post
taconsta
Offline
Last seen: 13 years 7 months ago
Joined: 2009-04-21 10:42
Ejecting instead of removing

By using the ^_ symbol on the PAP platform, one gets the "Safe remove hardware" window with all USB hardware pieces, a Properties button and an "End" button (I have the German interface, so translation is approximative). Anyway, it's the same window you'd get by DOUBLE-clicking on the "Safe remove hardware" icon in the system tray. This is leading to confusion, especially since the default of the window is having the "Show components" unchecked and you might have 2 or 3 "USB Mass storage device"s. Then you have to click your way through menus, which is really annoying and error-prone.

It would be much nicer to silently eject the drive (i.e. simulate a SINGLE click on the "Safe remove hardware" icon and the choice of the hard drive from which PAP was launched).

I wrote a small batch file to:
- kill the PAP Launcher using tskill command under XP (seems to work on both Pro and Home) [obvious platform limitation here, not compatibile with Win98 and, I think, NT4/Win 2k]
- eject the drive using RemoveDrive from http://www.uwe-sieber.de/drivetools_e.html#RemoveDrive

It's a two-liner:

REM Stops the App Launcher and unmounts the USB drive
REM Might have to use taskkill on XP Pro (switch & Co)
tskill PortableAppsPlat*
REM Eject the drive
RemoveDrive.exe \ -b

I then compiled the batch file to generate an EXE (so that PAP can use it) using Bat2Exe converter by Fatih Kodak.

Could I dare to suggest to the dev team to take pretty much the same approach (or, I am sure, there are way better ones for real programmers, as opposed to scripters wannabes like me) and set the eject button in the PAP start menu to do the same thing? Even more, I guess the program might check which apps/files are still open on the drive, present them to you, so that you can close them gracefuly (or not) and then eject the drive.

Many thanks!

[removed double post - moderator PP]

Zach Thibeau
Zach Thibeau's picture
Offline
Last seen: 1 month 2 weeks ago
Developer
Joined: 2006-05-26 12:08
actually this request would

actually this request would cause problems if implimented since it would kill all tasks running from the drive which would in turn corrupt profiles on the drive, which in turn would cause unnecessary problems

your friendly neighbourhood moderator Zach Thibeau

taconsta
Offline
Last seen: 13 years 7 months ago
Joined: 2009-04-21 10:42
How that?


actually this request would cause problems if implimented since it would kill all tasks running from the drive which would in turn corrupt profiles on the drive

How that?
1) if there are open files/handles, in my "implementation" nothing happens, since the drive is not set free for removal and RemoveDrive fails
2) I thought I was saying that a nice implementation would be to present you with a list of open applications and files, so that you can close them nicely. I never suggested *killing* tasks running. The ONLY task which gets killed is the Launcher, which HAS to be killed in order to free the drive. And the Launcher does not open anything else, AFAIK.

Pyromaniac
Pyromaniac's picture
Offline
Last seen: 7 years 8 months ago
Developer
Joined: 2008-09-30 19:18
I'm not sure but couldn't it

I'm not sure but couldn't it be possible though to eject the drive similar to how U3 ejected it. On the U3 menu, there is a little "eject" button and you click it and the light on the flash drive turns off and you remove it. I don't know if you can do that though because I think that the only reason you can do that is because its a "CD" drive that allows the ejection without the funky window popping up like when you click "eject" on the PA suite menu.

John T. Haller
John T. Haller's picture
Offline
Last seen: 7 hours 35 min ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Closed Source

As has been discussed before, we're working on a better way of closing the apps that won't crash them as nearly all other eject tools do. The issue is in telling Windows to eject the drive specifically as all the tools out there to do it are closed source, which means we can't use em.

Sometimes, the impossible can become possible, if you're awesome!

taconsta
Offline
Last seen: 13 years 7 months ago
Joined: 2009-04-21 10:42
Maybe not all of them

I thought that Uwe Sieber set up a nice explanation of what his program is doing.
http://www.codeproject.com/KB/system/RemoveDriveByLetter.aspx

I'm not good at all kinds of licenses, but it seems to me that you could actually modify the code he presented here without getting into any trouble. Am I missing something crucial here (regarding the license model or regarding the technical bit you were refering to)?

John T. Haller
John T. Haller's picture
Offline
Last seen: 7 hours 35 min ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Code Project Open License (CPOL) Is Not Open Source

The Code Project Open License (CPOL) is not considered an open source license due to numerous odd and ambiguous restrictions (like not being permitted to use it for 'immoral' purposes... based on whose morality, eh?). It's not OSI approved so it can't be hosted on any open source hosting sites (like SourceForge.net or Google Code) and the license is incompatible with all other open source licenses. Basically, the code project stuff can't legally be used for much of anything except other stuff released under the same ambiguous license.

If we can get Uwe to release it under a real open source license, we may be in business.

Sometimes, the impossible can become possible, if you're awesome!

NathanJ79
NathanJ79's picture
Offline
Last seen: 2 years 10 months ago
Joined: 2007-07-31 15:07
Immoral?

I had to go and see that for myself. Basically he's saying that if you have *ahem* adult material on your flash drive, you can't use his eject script, I guess.

As for the guesswork, I'd say look at the country the author (of the license) is from and attribute the morality to the leading religion in that country, contradictory and inapplicable to software as religion may be. But, assuming Christianity, if I use Firefox Portable to blog about liking my neighbor's new car, depending on how specific you want to get, I could be in violation of that license. I suppose it doesn't matter that nobody would know, PA.c has to be by the book and that clause has to go.

Then again, we have launchers for DVD Shrink (DVD backup) and ZSNES (Super Nintendo emulation), and all legally and morally ambiguous software pretty much has to assume you're using it in good faith (or at least say so on the site).

Best way to eject is to get Windows to optimize the drive for quick removal. XP is fine with this, but my Vista installation at home doesn't like it.

Bruce Pascoe
Offline
Last seen: 10 years 11 months ago
Joined: 2006-01-15 16:14
Optimize for removal

Still isn't safe, because you can't be sure there's not still a launcher running in the background cleaning up, or that Windows hasn't cached a write in the background--which is what I suspect is happening when Vista complains (since it doesn't complain all the time).

I always use Safely Remove, even with Optimize for Safe Removal on, just to be safe. I'd rather be safe than lose data.

jseymour
Offline
Last seen: 13 years 6 months ago
Joined: 2009-04-22 15:51
Well I for one would really

Well I for one would really like to try your compiled executable. I understand the risks and already use Removedrive Smile

If you could zip it up and send it to wibblyw at gmail dot com, I'd very much appreciate it.

John

Log in or register to post comments