Using Pelle's c for generating kernel mode device drivers (e.g. .sys)

Started by shlomok, April 03, 2012, 08:43:52 PM

Previous topic - Next topic

shlomok

Hi,
I just moved from using RadASM and MASM32 to Pelle's c IDE. The single reason for doing so is the integrated debugger that is shipped with Pelle's c and is a pleasure to work with.

Now, I am using the Kernel Mode Driver Development Kit for MASM32 programmers (http://www.freewebs.com/four-f/) and with RadASM its very easy to set the target as a .sys file (and not an exe).

How do I do that in Pelle's c IDE?

Please see the attached screen-shots.

Thanks,

SK.


qWord

FPU in a trice: SmplMath
It's that simple!

shlomok

Quote from: qWord on April 03, 2012, 09:21:16 PM
subsystem = native  :U

Thanks but it is still generating an EXE and not  SYS, see:

> poasm.exe -AIA32 -Zi -Gd  -Fo"C:\Users\bim\Documents\Pelles C Projects\test345\output\test.obj" "C:\Users\bim\Documents\Pelles C Projects\test345\test.asm"
Building test345.tag.
> polink.exe -debug -debugtype:coff -subsystem:native -machine:x86 kernel32.lib advapi32.lib delayimp.lib -out:"C:\Users\bim\Documents\Pelles C Projects\test345\test345.exe" "C:\Users\bim\Documents\Pelles C Projects\test345\output\test.obj"


qWord

it is the same option as for link.exe:  /DRIVER
You have take a look in the documentation before asking? :wink

qWord
FPU in a trice: SmplMath
It's that simple!

clive

Quote from: shlomok on April 03, 2012, 09:44:59 PM
Thanks but it is still generating an EXE and not  SYS, see:

> poasm.exe -AIA32 -Zi -Gd  -Fo"C:\Users\bim\Documents\Pelles C Projects\test345\output\test.obj" "C:\Users\bim\Documents\Pelles C Projects\test345\test.asm"
Building test345.tag.
> polink.exe -debug -debugtype:coff -subsystem:native -machine:x86 kernel32.lib advapi32.lib delayimp.lib -out:"C:\Users\bim\Documents\Pelles C Projects\test345\test345.exe" "C:\Users\bim\Documents\Pelles C Projects\test345\output\test.obj"

The -out option is wrong, and you're not going to be able to use kernel32, advapi32 or delayimp because they won't be available to you in kernel mode.
It could be a random act of randomness. Those happen a lot as well.

shlomok

Quote from: clive on April 04, 2012, 02:30:10 AM
The -out option is wrong, and you're not going to be able to use kernel32, advapi32 or delayimp because they won't be available to you in kernel mode.

I used the IDE to create a new "win 32 console application" so you are right, the out option is wrong and was generated automatically by the IDE.
This is what i am trying to change since there is no template for creating drivers under this IDE.

clive

I always used MSVC, MASM and NMAKE, and then debugged with SoftICE loaded real early in the boot process. Some how I don't think the IDE debugger is going to be much use to you.
It could be a random act of randomness. Those happen a lot as well.

shlomok

Quote from: clive on April 04, 2012, 06:14:28 AM
I always used MSVC, MASM and NMAKE, and then debugged with SoftICE loaded real early in the boot process. Some how I don't think the IDE debugger is going to be much use to you.

Hi,
When writing Assembly code under MSVC, the syntax highlighting and code completion is very limited even with the latest plugin.

I am using Dbgview.exe which intercepts messages generated by a device driver, at this stage SoftIce is not that useful to me though it is an indispensible tool.

You are right that the IDE debugger is useless for debugging drivers, but the driver will be shipped with a GUI to send messages to the driver for configuration purposes and the GUI can be debugged with Pelles IDE.

So what is the bottom line, is there a way that I can create my own template under Pelles so that the -out\ option is set to SYS and not EXE?


Thanks,