X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:reply-to:subject:to:references:from:message-id
	:date:mime-version:in-reply-to:content-type
	:content-transfer-encoding; q=dns; s=default; b=qPzADduNH9MD8ukI
	x74W6ewuGZD/xCEaiZ+Dj1c/2mMv+8YYKH4DCQqrtXy+SuWBeIFPpiEtZT4BGxDA
	7iya3QLxj6SI/LTASaWqYT1nebiYktO2SFFI7LL1ToOFrMknvlZKJdNwNQNXtCGI
	uODO3UGh/kGSx/053JBfJ9QpJMg=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:reply-to:subject:to:references:from:message-id
	:date:mime-version:in-reply-to:content-type
	:content-transfer-encoding; s=default; bh=viTXQy7UonF26IijtUFbdK
	IF5fw=; b=BPYqTYAN5zdejvm4zWea0Mdvtt9JYA2bJss4gYqyp2xMSJWFEznHnf
	8on5GXH4R7Dje5RWPzI+tHMOEETJ3yyfU5CoCGU/5YWMBeI1kA9HjaMjWmUR7CGw
	hIkNFXylWsoe5YQlgbllfEbb3/lrCR0MH0lCZ7hJdxsSkI0//ymtw=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=Penny, Gates, gates, licence
X-HELO: smtp-out-so.shaw.ca
X-Authority-Analysis: v=2.2 cv=NKylwwyg c=1 sm=1 tr=0 a=MVEHjbUiAHxQW0jfcDq5EA==:117 a=MVEHjbUiAHxQW0jfcDq5EA==:17 a=N659UExz7-8A:10 a=cYCMvJSPAAAA:8 a=c6Et_6znqUN4c9Ol1JQA:9 a=pILNOxqGKmIA:10 a=0cYAWHTMCJUZ_s7sn94O:22
Reply-To: Brian.Inglis@SystematicSw.ab.ca
Subject: Re: Ejecting a USB drive using Cygwin (sync)?
To: cygwin@cygwin.com
References: <ca5d930a-326c-51a2-c82b-db8efcb0a2bc@SystematicSw.ab.ca> <5a67c70d.89349d0a.83b53.40f2@mx.google.com>
From: Brian Inglis <Brian.Inglis@SystematicSw.ab.ca>
Message-ID: <4ce888e4-a825-be3b-afb5-77ba851a9760@SystematicSw.ab.ca>
Date: Wed, 24 Jan 2018 20:02:36 -0700
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2
MIME-Version: 1.0
In-Reply-To: <5a67c70d.89349d0a.83b53.40f2@mx.google.com>
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 8bit
X-CMAE-Envelope: MS4wfCQxxcl94CkfWpUXqTqncXkYnp6uRe1qvrMsdPZl6WvVEL8yd0XSpVdDz0Zu+G6Dc/yYi2NbBsXaE/pQ8P4AzoIbm706at3mbEXxA/+hLCO/NUIv1iid Vbi2CE2wqmImfyjpozEt0iQviNokYP0HVWzzWqJLct53f7ZkNxKFRQRLG0P0eZK4Kx2TRGUj2ZA/Xg==
X-IsSubscribed: yes

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
>> http://www.leapsecond.com/tools/eject.{c,exe}:
>>
>> // 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[10];
>>     sprintf(path, "\\\\.\\%s", drive);
>>     // Open (with write, but no lock) to flush pending writes.
>>     DEV_OPEN(path, GENERIC_READ | GENERIC_WRITE);
>>     FlushFileBuffers(hDev);
>>     CloseHandle(hDev);
>>     // Open (with read, and lock) to dismount and eject.
>>     DEV_OPEN(path, GENERIC_READ);
>>     DEV_IOCTL(FSCTL_LOCK_VOLUME);
>>     DEV_IOCTL(FSCTL_DISMOUNT_VOLUME);
>>     DEV_IOCTL(IOCTL_STORAGE_EJECT_MEDIA);
>>     DEV_IOCTL(FSCTL_UNLOCK_VOLUME);
>>     CloseHandle(hDev);
>>     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
private use.

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
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

