This is the mail archive of the
mailing list for the Cygwin project.
Re: Ejecting a USB drive using Cygwin (sync)?
On 2018-01-23 16:36, Steven Penny wrote:
> On Tue, 23 Jan 2018 14:13:24, Brian Inglis wrote:
>> I found the following utility works well without elevation - Windows code from
>> // eject -- Allow safe removal of USB thumb drive.
>> // - Command line tool to flush/dismount/eject USB drive.
>> // - Simpler than mouse clicking through taskbar "Safely Remove Hardware" icon.
>> // - Usable in batch file scripts.
>> // 02-Nov-2012 Tom Van Baak (tvb) www.LeapSecond.com/tools
>> // Per MSDN, follow procedure for safe removal of USB drive.
>> int drive_eject (char *drive)
>> HANDLE hDev;
>> // Convert vintage DOS drive letter to weird Windows object pathname.
>> char path;
>> sprintf(path, "\\\\.\\%s", drive);
>> // Open (with write, but no lock) to flush pending writes.
>> DEV_OPEN(path, GENERIC_READ | GENERIC_WRITE);
>> // Open (with read, and lock) to dismount and eject.
>> DEV_OPEN(path, GENERIC_READ);
>> return 0;
> No, this is not the code from that site. The code is similar, but I see you have
> at least removed some empty lines. If you are going to do so, you need to
> clearly present said changes to the community - something like "adapted from
> http://..." or "modified from http://...", etc.
> Software copyright - even open source license is serious, and you should give it
> due respect.
I was providing information, that's why I said /from/, gave the link to the
original, and included the copyright, which does not include a link to the MSDN
article it mentions: checking any licences are left as an exercise for any
reader who wants to make use of the program or code other than for their own
What do you mean by "/even/ open source licence"?!
You sound like the early Bill Gates ;^>
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple