Writing device drivers in Delphi.
- From: "Martin Harvey" <martin@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 24 Nov 2005 22:30:03 -0000
Hey guys,
I've been thinking .... really thinking.
If I get really bored, I'm well inclined to embark on the worlds largest
hack to let you write device drivers in Delphi.
As I see it, there's only one really difficult problem: Producing an
executable of the right format, with appropriate entry point and fixup
information.
Routes that I can see:
1. Use the Delphi compiler to give you a DLL with some appropriate stubs in
(link it against a "stub module" which exports the same functions as the
kernel). Then write your own utility to rip the DLL apart, pull the various
sections out, and put them into a sys file, and munge the fixup information
appropriately.
2. Use the Delphi compiler to give you either a DLL or an EXE, but more
appropriately, the .OBJ files for all the modules. Then either, feed these
into the microsoft linker / an open source linker, or something originally
open source, but now substantially hacked, in order to give you an
appropriate .sys file.
After that, all you need to do is to port a few header files (start out with
wdm.h and add more flavouring to taste) and bob's your uncle.
Downsides:
1. Welcome to kernel debuggers. There will be much scrutinizing of assembler
and head-scratching.
2. Oh dear, no suitable symbolic debug information for the executables - at
least not that WinDbg will understand. *definitely* welcome to assembler.
2. Need to make sure that the Delphi compiler doesn't output anything really
horrible in kernel mode. The worst I can think of is the exception handling
code, which simply won't work. Might have to do some clever hackery to
convert to the equivalent kernel exception handling.
3. We might concievably want to patch the things, so that the Default memory
allocation mapped automatically onto ExAllocatePoolWithTag and ExFreePool -
and with some considerable care, you might be able to use objects.
Thoughts?
MH.
.
- Follow-Ups:
- Re: Writing device drivers in Delphi.
- From: Mat Ballard
- Re: Writing device drivers in Delphi.
- From: Martin James
- Re: Writing device drivers in Delphi.
- Prev by Date: Re: Elector electronics
- Next by Date: Re: Writing device drivers in Delphi.
- Previous by thread: question on the 2006 trial
- Next by thread: Re: Writing device drivers in Delphi.
- Index(es):
Relevant Pages
|