Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Date: Wed, 16 Aug 2000 22:46:57 +0100 From: David Welch To: cygwin AT sourceware DOT cygnus DOT com Cc: marc AT corky DOT net Subject: What's the status of cygwin on NT device drivers Message-ID: <20000816224656.A1387@cwcom.net> Reply-To: welch AT cwcom DOT net References: <966423640 DOT 26738 DOT ezmlm AT sources DOT redhat DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <966423640.26738.ezmlm@sources.redhat.com>; from cygwin-digest-help@sources.redhat.com on Wed, Aug 16, 2000 at 11:00:40AM -0000 On Wed, Aug 16, 2000 at 11:00:40AM -0000, Marc Esipovich wrote: > > Hi, > > I would like very much to avoid using MSVC or similar packages > to make an NT device driver. paying cygnus is way better than paying MS :) > > I've skimmed through the lists, and found some old (1999) notes > about cygwin already supporting native PE's, but not __fastcall, what > has changed since then? > > So, who has some updated info for me on building them pesky drivers > w/ the help of that butt-ugly NT DDK? > > It needn't be a comlex driver, basically hooking some syscalls and > talking to a userland app. maybe even write a device which emulates /dev > so no changes will be needed in my Unixified userland code. ;) > > I'd also be glad to land a hand to those with things in progress > concerning this issue. > There are several problems. Firstly gcc probably can't compile the ntddk headers, you could try pulling an alternative set from the reactos source but I don't think these are compatible with nt except at the source level e.g. some constants maybe wrong. If you only need a small set of functions then you could probably build up your own set of headers from the ddk ones. The fastcall problem can be easily worked around by providing assembly language wrappers for functions which don't have stdcall equivalents. Drivers need to be built as relocatable dlls. A big problem is that the nt kernel requires a checksum in the PE header. The algorithm for calculating this checksum is proprietary, but the implementation in the kernel source isn't obfuscated (LdrVerifyMappedImageMatchesChecksum in a debugger). Here some more information http://www.instinct.org/fravia/wi_igno.htm. It such be relatively easy to reverse-engineer the alogrithm and write a program to set the checksum, or you can get the correct value by setting a breakpoint on the routine in the kernel that calculates it. I've not produced any significant drivers using mingw/cygwin but a 'hello world' one worked using the above techniques. -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com