Who wrote an windows driver with FB ?

For other topics related to the FreeBASIC project or its community.
D.J.Peters
Posts: 7705
Joined: May 28, 2005 3:28

Who wrote an windows driver with FB ?

Postby D.J.Peters » Nov 01, 2010 3:55

First i'm sure i saw an win32 example years ago on this forum but can't find it anymore.

If you create an *.obj file with FB
i know i can use my own /ENTRY with LD (as driver starting point)
but is it posible to use NATIVE as /SUBSYSTEM with LD ? (not GUI or CONSOLE)

Thank you

Joshy
MichaelW
Posts: 3500
Joined: May 16, 2006 22:34
Location: USA

Postby MichaelW » Nov 01, 2010 5:07

The only one I recall is a driver example by voodooattack, and it's included in the FB distribution in FreeBASIC\examples\Windows\ddk\driver.
D.J.Peters
Posts: 7705
Joined: May 28, 2005 3:28

Postby D.J.Peters » Nov 01, 2010 5:33

thank you Michael

EXECUTION_STATE is defined more than once.

first in: \FREEBASIC\INC\win\winbase.bi(1155)

i added in \FREEBASIC\INC\win\ddk\winddk.bi(3399)

Code: Select all

...
#ifndef EXECUTION_STATE
type EXECUTION_STATE as ULONG
#endif
...


Joshy
D.J.Peters
Posts: 7705
Joined: May 28, 2005 3:28

Postby D.J.Peters » Nov 01, 2010 8:03

Any idea how to solve the linker warning does FB create more than one sections with the name 'INIT' ?

Joshy
D:\ddk\driver>fbc driver.bas -c
D:\ddk\driver>link driver.o /LIBPATH:D:\ddk\lib\w2k\i386 /DRIVER /align:0x80 /FULLBUILD /base:0x10000 /release
/osversion:5.1 /version:5.1 /OPT:ICF /OPT:REF /SECTION:INIT,d
/MERGE:_PAGE=PAGE /MERGE:.data=PAGE /MERGE:.ctors=PAGE
/MERGE:_INIT=INIT /MERGE:_TEXT=.text /subsystem:native,5.01 /entry:GsDriverEntry@8 bufferoverflowk.lib ntoskrnl.lib /OUT:driver.sys
LINK : warning LNK4078: multiple 'INIT' sections found with different attributes (E2000020)
voodooattack
Posts: 605
Joined: Feb 18, 2006 13:30
Location: Alexandria / Egypt
Contact:

Postby voodooattack » Nov 06, 2010 1:39

The multiple INIT sections come from the different MS libraries you have to link for the driver having different attributes from the one in your driver.

I remember I couldn't get gAS to set the attributes on the INIT section properly back at the time (not sure if the current version still lacks the support), and a dirty hex-edit per compile just to avoid a warning didn't seem so feasible nor practical. You can still suppress that warning by adding /IGNORE:4078 to the command-line, if I remember correctly.

Regardless, the linker takes care of this conflict by merging them using the proper attributes in the end. And yes, the resulting image has a NATIVE subsystem, otherwise the kernel wouldn't allow it to load.
D.J.Peters
Posts: 7705
Joined: May 28, 2005 3:28

Postby D.J.Peters » Nov 06, 2010 10:36

Hello voodooattack,
nice to see you here
(your last post was more than one year ago)

I have some questions about driver and or filter programing
do you have some knowlege in this topic ?

I got the old book "The Windows NT Device Driver Book" from Art Baker.
If you must write an WDM driver for real hardware it's a good starting point.

But for my needs a device driver or filter for virtual MIDI ports
all my questions are unanswered.

Do you know about miniport's or driver filter ?

Joshy
voodooattack
Posts: 605
Joined: Feb 18, 2006 13:30
Location: Alexandria / Egypt
Contact:

Postby voodooattack » Nov 06, 2010 16:16

I'm not even sure if it's possible at all to implement a miniport driver with FB to be honest, much less a MIDI miniport; you'd have to implement a sizeable inheritance tree just to get it working: IUnknown -> IMiniport -> IMiniportMidi, in addition to the IMiniportMidiStream interface.

I wouldn't advice you to do this in FB, just getting that bare-bones driver up and running was a feat by itself. Note that you'd still have to implement half -if not all- of the RTlib functions from scratch to get anything useful going in kernel mode.

As for my knowledge of how a MIDI port would function, I'm afraid I never got around to "using" a MIDI API in the first place. You can find a lot of info buried deep in MSDN and the WDK driver samples though; Another good place would be ReactOS sources.

Return to “Community Discussion”

Who is online

Users browsing this forum: No registered users and 1 guest