delorie.com/archives/browse.cgi | search |
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=LWRTHL3rpRXHIRkLkPDBT3mg+Vhuu0tLC6KBPWd/XlaZgMIpVv8si | |
q11OXqfzOLZpUCafQ126nNAJtOP4o/19QaXq+MjSsMVpLBKZP+X7x34OymQ4bpT4 | |
F9pGt/UicaEPootzPYNz0+UO+sV5fhJVkOy6Q5uTo20f08DoKNiKYw= | |
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=ELnv/VZAoBtl2p8V44IZrnypwXQ=; b=SnGj09+ObI045XoJbceL5i//Wtv9 | |
2ouGUZsxN3BS+mY9wsBjiAZjV5CcNJa+h21pU1z2B7z2/XpWu9xLNSZ77dKgdpHG | |
LZ7jcbI4ewyLatiuBMbsuh+bjTezYESjqFWIxmvVAdPkH4b9USJXPhWVLdjovrmK | |
PvNyaNGWLbCgE9w= | |
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=-5.9 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 |
X-HELO: | calimero.vinschen.de |
Date: | Wed, 12 Mar 2014 09:45:47 +0100 |
From: | Corinna Vinschen <corinna-cygwin AT cygwin DOT com> |
To: | cygwin AT cygwin DOT com |
Subject: | Re: Compiled executables requiring admin rights - different results between MinGW host type |
Message-ID: | <20140312084547.GB8066@calimero.vinschen.de> |
Reply-To: | cygwin AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
References: | <4B9115A4BEEA4186A5E73D27941286AB AT TKsamsung> |
MIME-Version: | 1.0 |
In-Reply-To: | <4B9115A4BEEA4186A5E73D27941286AB@TKsamsung> |
User-Agent: | Mutt/1.5.21 (2010-09-15) |
--x+6KMIRAuhnl3hBn Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mar 11 11:50, Tony Kelman wrote: > Hi, I'm looking at a very simple 32-line c file, source is available > here > https://github.com/JuliaLang/julia/blob/master/contrib/stringpatch.c >=20 > I'm seeing unpredictable results w.r.t. the compiled executable > requiring admin rights to run, depending which host compiler is > used. >=20 > Under 32 bit Cygwin: > gcc -o stringpatch-cyg stringpatch.c # requires admin rights > i686-pc-mingw32-gcc -o stringpatch-pc-32 stringpatch.c # requires > admin rights > i686-w64-mingw32-gcc -o stringpatch-w64-32 stringpatch.c # > requires admin rights > x86_64-w64-mingw32-gcc -o stringpatch-w64-64 stringpatch.c # does > not require admin rights >=20 > Under 64 bit Cygwin: > gcc -o stringpatch-cyg stringpatch.c # does not require admin rights > i686-pc-mingw32-gcc -o stringpatch-pc-32 stringpatch.c # requires > admin rights > i686-w64-mingw32-gcc -o stringpatch-w64-32 stringpatch.c # > requires admin rights > x86_64-w64-mingw32-gcc -o stringpatch-w64-64 stringpatch.c # does > not require admin rights >=20 > What is the explanation for this discrepancy? Is this expected > behavior? You won't believe it, but yes! Welcome to the wonderful world of UAC installer detection!!!1!11 See http://msdn.microsoft.com/en-us/library/bb530410.aspx and scroll down to the section called "Installer Detection". I'll wait while you read... [..."whistling while you work"...] Finished? Fine. So, the only fault of your application is it's name. It's called "something-with-patch-in-it". As everybody knows, an application which is called "something-with-patch-in-it" is an installer and needs elevation. But only if it's a 32 bit application. > Is there an easy way to prevent any of the compiled > executables from requiring admin rights? You have four ways around this: - Rename your executable so it doesn't have the chutzpah to call itself "something-with-patch-in-it" or "something-with-instal-in-it" or "something-with-setup-in-it" or "something-with-update-in-it". - Take one of the manifest files you find in Cygwin's /usr/bin dir, and copy it alongside your binary, for instance: $ cp /usr/bin/patch.exe.manifest ./stringpatch.exe.manifest - Wait until the next binutils version is released (should be in the next couple of days), and link your executable with the new linker. This will give you a default manifest integrated in your executable by default, which doesn't only claim compatibility with all existing WIndows versions, but also sets the RequestedExecutionLevel to "asInvoker", which avoids the elevation for this executable entirely. - Switch off UAC installer detection on your machine. You can do this in the Local Security Policy MMC Snapin. HTH, COrinna --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --x+6KMIRAuhnl3hBn Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJTIB67AAoJEPU2Bp2uRE+gaqUQAKQDuOdMw2QzMXtbbFYWMcj4 UpDPGg7IjW6Ue9p1r8Dv8WL12foD4LI+ZYp5nFKgvs2POy8bVsrzw2kUGDg95JPG QGiPC8s1WYNS9ZAep1+YlJPXK2WgWD1MHKb7TXBpiVzdxtTWqYYLmV7ZeneyxITb hlcPnXFFxLtXlG+4Jmjn/iHBFduUsdGUkYqGhXtU7vxNwqMO5PiAnDXte62Eu29b ZdIGSSX2sSYUO30Su4F0EC1AmkRnJFSlwJfGeo50utIpjjqCVItexA3UMiC8Y1hl bLk8J2bBqG8gurmiGmsMm1gPY/TTS5HcuiOUGhk0xzpNKSfrYBOKVyV7Iz7wItQf W9b/OsmsTMqF+9wYTadWNXtOYLJwz5OIClX/8lZc9S53yukHgrA6e6/efC2Q7RK0 1MgMmPq8LuOHBZ64WfrXuAFPF05XF81UW/RgIWeooXctkozQlvxrxSFHaz3ZRJvX zGvM6QOqTnbQ21vRsY6iAjo3IG4/BE6n8gKSQ/GesHBC6MEE4TWoE3T2Qb2RE7AN gkMLCg4QPx/goOoZfYtWo1/KfEjqCKVPFFk7j0CQXKfcAiajct1kk9QaVx9t74JW pOdu1gX49JJ7DDm0cCxi8jRRyTvBopHWZtlokj+t/ZSOQZuoaPrGnjcFZ3yHxxvh aHeU4S6DY+x1d/C/X3oj =rdH8 -----END PGP SIGNATURE----- --x+6KMIRAuhnl3hBn--
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |