Coding is easy compared to building!

Hello,

I have a lot of user-mode development experience (Win32, COM) and a pretty
good theoretical understanding of the NT kernel, but I have no kernel-mode
development experience. I’m trying to change that by writing a little driver
that I can use to peek at the KTHREAD block (but I digress).

I’m having a hell of a time figuring out how to build my driver. The BUILD
utility seems underdocumented and its error messages are unhelpful to the
uninitiated. Can anyone point me in the direction of a “this is how you
build a driver for NT, using smallest words possible” tutorial or FAQ?

Thanks!

Owen T. Cunningham, MCSE4
Fidelity Institutional CCIT Production Services
xxxxx@fmr.com
“You should not examine legislation in the light of the benefits it
will convey if properly administered, but in the light of the wrongs
it would do and the harm it would cause if improperly administered.”
— Lyndon B. Johnson


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

> I’m having a hell of a time figuring out how to build my driver. The BUILD

utility seems underdocumented

Yes, but it can be easily comprehended by reading MAKEFILE.DEF, which is primary source of knowledge on SOURCES file.
In fact, BUILD combines SOURCES and MAKEFILE.DEF and runs NMAKE.

uninitiated. Can anyone point me in the direction of a “this is how you
build a driver for NT, using smallest words possible” tutorial or FAQ?

For simplest cases, borrow the SOURCES from some DDK sample and patch it for your project.
If you use NT4 DDK and want to use the WinDbg debugger, write

USE_PDB=1

to SOURCES, otherwise, WinDbg will have problems with your debug info.

If you have NT4 DDK, you will need to set up the environment for BUILD. Your will need SETENV.BAT from the NT4 SDK for this - or
full SDK installed.
For a former case:

  • place SETENV.BAT from the SDK (yes, DDK has SETENV.BAT too, it is completely other) to some dir
  • start CMD.EXE
  • execute
    set MSTOOLS=

- then go to DDK BIN directory
- execute
setenv checked
or
setenv free
- then CD to your driver's directory, you're ready to run BUILD.

You will not have this problems with w2k DDK - they do not require any SDK, just install the kit and select "Checked Build
Environment" from the start menu.

If you want to have a multi-directory source tree:

- for all subdirs except one, write SOURCES which will build a library - .LIB file, TARGETTYPE=LIBRARY.
- for some one "main" subdir, write SOURCES file which will build a driver and will link with all those LIBs - using CRTLIBS
statement worked fine for me, other LIB-related switches had problems with dependency rebuild. Pathnames for LIBs are also a pain.
- place a DIRS file in the topmost directory, note that the order in the DIRS file there IS important, the "main" subdirectory must
be last.
- run BUILD from where you have DIRS.

This worked fine for both full and incremental builds, and both NT4 and w2k DDKs.

Max

---
You are currently subscribed to ntdev as: $subst('Recip.EmailAddr')
To unsubscribe send a blank email to leave-ntdev-$subst('Recip.MemberIDChar')@lists.osr.com
  1. www.cmkrnl.com
  2. Make search on MSDN on “bugslayer”. In one of the issues
    John Robbins wrote about it.

— “Cunningham, Owen” wrote:
> Hello,
>
> I have a lot of user-mode development experience (Win32, COM) and a pretty
> good theoretical understanding of the NT kernel, but I have no kernel-mode
> development experience. I’m trying to change that by writing a little driver
> that I can use to peek at the KTHREAD block (but I digress).
>
> I’m having a hell of a time figuring out how to build my driver. The BUILD
> utility seems underdocumented and its error messages are unhelpful to the
> uninitiated. Can anyone point me in the direction of a “this is how you
> build a driver for NT, using smallest words possible” tutorial or FAQ?
>
> Thanks!
>
> Owen T. Cunningham, MCSE4
> Fidelity Institutional CCIT Production Services
> xxxxx@fmr.com
> “You should not examine legislation in the light of the benefits it
> will convey if properly administered, but in the light of the wrongs
> it would do and the harm it would cause if improperly administered.”
> — Lyndon B. Johnson
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@yahoo.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

__________________________________________________
Do You Yahoo!?
Find a job, post your resume.
http://careers.yahoo.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Make sure you read the DDK docs on the build utility - which were added for
the Windows XP rtm DDK release. You can read them online at OSR or the MSDN
library site, if you don’t have the WinXP DDK release yet. Most of the info
applies across releases.

“Cunningham, Owen” wrote in message
news:xxxxx@ntdev…
>
> Hello,
>
> I have a lot of user-mode development experience (Win32, COM) and a pretty
> good theoretical understanding of the NT kernel, but I have no kernel-mode
> development experience. I’m trying to change that by writing a little
driver
> that I can use to peek at the KTHREAD block (but I digress).
>
> I’m having a hell of a time figuring out how to build my driver. The BUILD
> utility seems underdocumented and its error messages are unhelpful to the
> uninitiated. Can anyone point me in the direction of a “this is how you
> build a driver for NT, using smallest words possible” tutorial or FAQ?
>
> Thanks!
>
> Owen T. Cunningham, MCSE4
> Fidelity Institutional CCIT Production Services
> xxxxx@fmr.com
> “You should not examine legislation in the light of the benefits it
> will convey if properly administered, but in the light of the wrongs
> it would do and the harm it would cause if improperly administered.”
> — Lyndon B. Johnson
>
>
> —
> You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
> To unsubscribe send a blank email to
leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>
>


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com