delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/08/16/09:59:01

X-Recipient: archive-cygwin AT delorie DOT 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 AT cwilson DOT fastmail DOT 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 AT cygwin DOT com
Subject: Re: [ANNOUNCEMENT] Updated: run-1.1.11-1
References: <20090814152904 DOT GG32408 AT calimero DOT vinschen DOT de> <20090814154349 DOT GA10002 AT ednor DOT casa DOT cgf DOT cx> <20090814162049 DOT GH32408 AT calimero DOT vinschen DOT de> <4A859A59 DOT 1040308 AT cwilson DOT fastmail DOT fm> <4A85A9F3 DOT 9090108 AT cwilson DOT fastmail DOT fm> <20090814184157 DOT GI32408 AT calimero DOT vinschen DOT de> <20090814184849 DOT GJ32408 AT calimero DOT vinschen DOT de> <4A85D99B DOT 80101 AT cornell DOT edu> <20090815085738 DOT GB13648 AT calimero DOT vinschen DOT de> <4A86CA3F DOT 9010204 AT cwilson DOT fastmail DOT fm> <20090816092454 DOT GL32408 AT calimero DOT vinschen DOT de>
In-Reply-To: <20090816092454.GL32408@calimero.vinschen.de>
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

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

- Raw text -


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