X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-3.2 required=5.0 	tests=AWL,BAYES_00,J_CHICKENPOX_22,RCVD_IN_DNSWL_LOW,SPF_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <4A881086.8000704@cwilson.fastmail.fm>
Date: Sun, 16 Aug 2009 09:58:30 -0400
From: Charles Wilson <cygwin@cwilson.fastmail.fm>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.22) Gecko/20090605 Thunderbird/2.0.0.22 Mnenhy/0.7.6.666
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: Re: [ANNOUNCEMENT] Updated: run-1.1.11-1
References: <20090814152904.GG32408@calimero.vinschen.de> <20090814154349.GA10002@ednor.casa.cgf.cx> <20090814162049.GH32408@calimero.vinschen.de> <4A859A59.1040308@cwilson.fastmail.fm> <4A85A9F3.9090108@cwilson.fastmail.fm> <20090814184157.GI32408@calimero.vinschen.de> <20090814184849.GJ32408@calimero.vinschen.de> <4A85D99B.80101@cornell.edu> <20090815085738.GB13648@calimero.vinschen.de> <4A86CA3F.9010204@cwilson.fastmail.fm> <20090816092454.GL32408@calimero.vinschen.de>
In-Reply-To: <20090816092454.GL32408@calimero.vinschen.de>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
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

Corinna Vinschen wrote:

>> Do you think this idea is worth pursuing?
> 
> Sounds like a good idea to me.  I'm just wondering, is there really
> no easy Win32 function to fetch this information, along the lines
> of the GetBinaryType function?

Well, there's SHGetFileInfo with the SHGFI_EXETYPE flag, but it doesn't
do exactly what we'd want. It returns

0
	Nonexecutable file or an error condition.

LOWORD = NE or PE and HIWORD = Windows version
	Microsoft Windows application.

LOWORD = MZ and HIWORD = 0
	Windows 95, Windows 98:
		Microsoft MS-DOS .exe, .com, or .bat file

	Microsoft Windows NT, Windows 2000, Windows XP:
		MS-DOS .exe or .com file

LOWORD = PE and HIWORD = 0
	Windows 95, Windows 98:
		Microsoft Win32 console application

	Windows NT, Windows 2000, Windows XP:
		Win32 console application or .bat file

I guess the only case that means "Windows GUI" is NE|PE,0 -- everything
else is "Windows CUI" or other, and we'd want to employ run's
console-hiding code for those other cases.

I'd need to use explicitly the *W version on cyg-1.7 -- but I'm not
ready to audit the entire program for long-path compliance yet (I'll do
that after forking the codebase for 1.7 as "run-1.2.x", and refactoring
a bit).

I'll think about it some more. Using stdio to access the innards of the
file isn't that hard, and lets me rely on cygwin to handle long path
name issues -- but means that the mingw version won't be LFN compliant.

--
Chuck

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

