delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2014/04/07/23:18:39

X-Recipient: archive-cygwin AT delorie DOT 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:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; q=dns; s=
default; b=nFRvUFwsZO2dBWBVL6LbEilLSetUodWsSbma+w/v240auzVO1DbZn
Xjfp8pLuVbyEK4PC2Ri+24EEWf2V6IXscqVT9YyNqn8MVA2pMuN52NKVXO+QcnHW
HtEX/gmlBjjtLSesEW+GF+dmCRzf1Jk7hIuCfvT1KQSXw0KDRz2994=
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:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; s=default;
bh=vOPQz2jGvAZBiZXIcRontWxY2I4=; b=bB2xgEY+LcX9hwf+nGW1CLzUcokH
5z70aJWiyOAWj3oMikfQ9tismu/725urXbeKJ/ckQfuCOddO7rbEWaT7/0yJSV8m
QQYNmRHRzTxaC69rIs+XXhkKDtQF4qZN2+pzxkT0JJu6yKwDkWJzmMHE91E4ByR0
uuLEw665alqsRmI=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-6.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2
X-HELO: mho-02-ewr.mailhop.org
X-Mail-Handler: Dyn Standard SMTP by Dyn
X-Report-Abuse-To: abuse AT dyndns DOT com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information)
X-MHO-User: U2FsdGVkX1/Our0+GUpWMSmTL0nM9PTm
Date: Mon, 7 Apr 2014 23:18:17 -0400
From: Christopher Faylor <cgf-use-the-mailinglist-please AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Cygwin kill utility //Was: cgwin_internal(): difference b/w CW_CYGWIN_PID_TO_WINPID and CW_GETPINFO_FULL for taking only dwProcessId ?
Message-ID: <20140408031817.GA1796@ednor.casa.cgf.cx>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <5F8AAC04F9616747BC4CC0E803D5907D0C8AED9C AT MLBXv04 DOT nih DOT gov>
MIME-Version: 1.0
In-Reply-To: <5F8AAC04F9616747BC4CC0E803D5907D0C8AED9C@MLBXv04.nih.gov>
User-Agent: Mutt/1.5.20 (2009-06-14)

On Tue, Apr 08, 2014 at 03:01:18AM +0000, Lavrentiev, Anton (NIH/NLM/NCBI) [C] wrote:
>Hello,
>
>It looks like in order to effectively kill the process by Windows means (i.e. what Cygwin "kill -f" is supposed to do),
>the process handle must be obtained with the SYNCHRONIZE right (in addition to PROCESS_TERMINATE), otherwise
>WaitForSingleObject() fails with code 5, permission denied (at least for a regular user, i.e. not an administrator).
>
>That's about this portion of kill.cc located at winsup\utils:
>
>  HANDLE h = OpenProcess (PROCESS_TERMINATE, FALSE, (DWORD) dwpid);
>  if (!h)
>    {
>      if (!wait || GetLastError () != ERROR_INVALID_PARAMETER)
>	fprintf (stderr, "%s: couldn't open pid %u\n",
>		 prog_name, (unsigned) dwpid);
>      return;
>    }
>  if (!wait || WaitForSingleObject (h, 200) != WAIT_OBJECT_0)
>    if (sig && !TerminateProcess (h, sig << 8)
>	&& WaitForSingleObject (h, 200) != WAIT_OBJECT_0)
>      fprintf (stderr, "%s: couldn't kill pid %u, %lu\n",
>	       prog_name, (unsigned) dwpid, GetLastError ());
>
>MSDN is in agreement with the observed behavior (access denied),
>
>http://msdn.microsoft.com/en-us/library/windows/desktop/ms684320%28v=vs.85%29.aspx
>
><quote>
>The handle returned by the OpenProcess function can be used in any function that requires a handle to a process, such as the wait functions, provided the appropriate access rights were requested.
></quote>
>
>http://msdn.microsoft.com/en-us/library/windows/desktop/ms684880%28v=vs.85%29.aspx

If only there was some way to programatically supply a change in source
code from party A which could be applied to the source code by party B,
along with a description which logs the change.  Nah.  Maybe we'll have
something when the Singularity finally occurs.

cgf

--
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019