delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/2000/01/26/00:05:12

Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-developers-subscribe AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin-developers/>
List-Post: <mailto:cygwin-developers AT sourceware DOT cygnus DOT com>
List-Help: <mailto:cygwin-developers-help AT sourceware DOT cygnus DOT com>, <http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-developers-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin-developers AT sourceware DOT cygnus DOT com
X-Authentication-Warning: hp2.xraylith.wisc.edu: khan owned process doing -bs
Date: Tue, 25 Jan 2000 23:10:01 -0600 (CST)
From: Mumit Khan <khan AT NanoTech DOT Wisc DOT EDU>
To: Chris Faylor <cgf AT cygnus DOT com>
cc: cygwin-developers AT sourceware DOT cygnus DOT com
Subject: Re: Trapping the Win32 API path functions
In-Reply-To: <20000124220247.A5855@cygnus.com>
Message-ID: <Pine.HPP.3.96.1000125225735.7124F-100000@hp2.xraylith.wisc.edu>
MIME-Version: 1.0

On Mon, 24 Jan 2000, Chris Faylor wrote:

> It has occurred to me that we could trap the Win32 functions
> which understand paths and slip Cygwin style paths in there.
> 
> At the most trivial, we could make a front-end for kernel32.dll
> although I'm sure it wouldn't be that easy.

Hmmm ... I'm trying to understand this. I can see hooking/replacing
selected kernel32 functions in Cygwin DLL and doing pre- and post-
processing before- and after- the real call.

Are you suggesting that you make a replacement for kernel32? Could
you elaborate a bit on your proposal please?

> That would allow much greater functionality for non-cygwin
> applications.  So, you could do something like:
> 
> notepad /etc/termcap
> 
> or
> 
> javac //d/foo/var.j
> 
> (Hmm.  I wonder why I thought of that example)
> 

I know you can hook specific API functions, but don't know any detail
there. I do know one way -- you can muck with IAT and force your routine
to be called instead, but you need to modify the executable for that
one to work. Also, keep in mind that kernel32 is one of those "Known DLLs"
and who knows what magic that adds. 

How about a trivial non-intrusive, albeit partial, solution? Provide a 
program, cygrun, that takes the arguments, modifies the arguments that 
may be cygwin paths into win32 paths, and executes the command line.
  
  $ cygrun javac //d/foo/var.j

will actually result in the equivalent of:

  $ javac `cygpath -w //d/foo/var.j`

If you want a slower way, have Cygwin exec check the list of imports and 
if Cygwin is not present, modify argv before exec'ing it. Of course, it
assumes you're running under bash.

Regards,
Mumit


- Raw text -


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