Question on source code layout

Greetings all,

I’m trying to reorganize my source files for a fairly complicated driver
and I’m having a hard time of it. Basically, I want to have several
directories for the sources and several directories for the include files
along the lines of:

Driver\

SourceDir1\
…various source files
IncDir1\
…various include files

SourceDir2\
…various source files
IncDir2\
…various include files

SourceDir3\
…various source files
IncDir1\
…various include files

All of these files are used to build one kernel mode driver. The MSDN
documentation lists several items that should facilitate this (sources
files, dir files, !include, SOURCES_INCLUDED…) but there’s not enough
documentation for me to make it work.

Does anyone know of an example driver that has a similar source code
layout or can you point me in the right direction?

Thanks in advance,
-bob

Here is a suggestion that you will not like: organize your separate
sources directories as libraries and have your driver link with those
libraries. Move your common include files up a level.

Driver\
CommonInc\
Lib1SourceDir\
Lib2SourceDir\
DriverDir\

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@dunstable.org
Sent: Monday, July 11, 2005 12:12 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Question on source code layout

Greetings all,

I’m trying to reorganize my source files for a fairly complicated driver

and I’m having a hard time of it. Basically, I want to have several
directories for the sources and several directories for the include
files
along the lines of:

Driver\

SourceDir1\
…various source files
IncDir1\
…various include files

SourceDir2\
…various source files
IncDir2\
…various include files

SourceDir3\
…various source files
IncDir1\
…various include files

All of these files are used to build one kernel mode driver. The MSDN
documentation lists several items that should facilitate this (sources
files, dir files, !include, SOURCES_INCLUDED…) but there’s not enough
documentation for me to make it work.

Does anyone know of an example driver that has a similar source code
layout or can you point me in the right direction?

Thanks in advance,
-bob


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@stratus.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Oh and I have no idea what SOURCES_INCLUDED is. Did you mean
SOURCES_USED?

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@dunstable.org
Sent: Monday, July 11, 2005 12:12 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Question on source code layout

Greetings all,

I’m trying to reorganize my source files for a fairly complicated driver

and I’m having a hard time of it. Basically, I want to have several
directories for the sources and several directories for the include
files
along the lines of:

Driver\

SourceDir1\
…various source files
IncDir1\
…various include files

SourceDir2\
…various source files
IncDir2\
…various include files

SourceDir3\
…various source files
IncDir1\
…various include files

All of these files are used to build one kernel mode driver. The MSDN
documentation lists several items that should facilitate this (sources
files, dir files, !include, SOURCES_INCLUDED…) but there’s not enough
documentation for me to make it work.

Does anyone know of an example driver that has a similar source code
layout or can you point me in the right direction?

Thanks in advance,
-bob


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@stratus.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

yes, of course…

Thanks for the idea with repect to libraries…
Seems like the build environment is pretty restrictive… hopefully
I’ll be able to find some other work-around as well.

Thanks,
-bob

Oh and I have no idea what SOURCES_INCLUDED is. Did you mean
SOURCES_USED?

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@dunstable.org
Sent: Monday, July 11, 2005 12:12 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Question on source code layout

Greetings all,

I’m trying to reorganize my source files for a fairly complicated driver

and I’m having a hard time of it. Basically, I want to have several
directories for the sources and several directories for the include
files
along the lines of:

Driver\

SourceDir1\
…various source files
IncDir1\
…various include files

SourceDir2\
…various source files
IncDir2\
…various include files

SourceDir3\
…various source files
IncDir1\
…various include files

All of these files are used to build one kernel mode driver. The MSDN
documentation lists several items that should facilitate this (sources
files, dir files, !include, SOURCES_INCLUDED…) but there’s not enough
documentation for me to make it work.

Does anyone know of an example driver that has a similar source code
layout or can you point me in the right direction?

Thanks in advance,
-bob


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@stratus.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

Yeah, other than following Mark’s advice, there isn’t a whole lot of
latitude in build.exe. The next-best thing is to organize your code
into static libraries and then have a final link step somewhere, if
you want deeply-nested hierarchies.

On the flip side, this organization method apparently works well
enough for Windows, which is a non-trivial amount of code :slight_smile: so
maybe it’ll work for you too.

Good luck.

-sd

On Jul 11, 2005, at 2:11 PM, xxxxx@dunstable.org wrote:

yes, of course…

Thanks for the idea with repect to libraries…
Seems like the build environment is pretty restrictive… hopefully
I’ll be able to find some other work-around as well.

Thanks,
-bob

> Oh and I have no idea what SOURCES_INCLUDED is. Did you mean
> SOURCES_USED?
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of
> xxxxx@dunstable.org
> Sent: Monday, July 11, 2005 12:12 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Question on source code layout
>
> Greetings all,
>
> I’m trying to reorganize my source files for a fairly complicated
> driver
>
> and I’m having a hard time of it. Basically, I want to have several
> directories for the sources and several directories for the include
> files
> along the lines of:
>
> Driver\
>
> SourceDir1\
> …various source files
> IncDir1\
> …various include files
>
> SourceDir2\
> …various source files
> IncDir2\
> …various include files
>
> SourceDir3\
> …various source files
> IncDir1\
> …various include files
>
> All of these files are used to build one kernel mode driver. The
> MSDN
> documentation lists several items that should facilitate this
> (sources
> files, dir files, !include, SOURCES_INCLUDED…) but there’s not
> enough
> documentation for me to make it work.
>
> Does anyone know of an example driver that has a similar source code
> layout or can you point me in the right direction?
>
> Thanks in advance,
> -bob
>
>
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@stratus.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: unknown lmsubst tag
> argument: ‘’
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>


Questions? First check the Kernel Driver FAQ at http://
www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as:
xxxxx@positivenetworks.net
To unsubscribe send a blank email to xxxxx@lists.osr.com

SOURCES_USED is a synchronization meta instruction in case you are doing
MP builds. You might need it if you do the library thing.

OK so just to be complete the other hideous ugly and depraved method is
to have ‘.h’ files that include your ‘up and over’ ‘.c’ files. If you
think that is less fugly than linking libraries…

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@dunstable.org
Sent: Monday, July 11, 2005 3:12 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Question on source code layout

yes, of course…

Thanks for the idea with repect to libraries…
Seems like the build environment is pretty restrictive… hopefully
I’ll be able to find some other work-around as well.

Thanks,
-bob

Oh and I have no idea what SOURCES_INCLUDED is. Did you mean
SOURCES_USED?

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@dunstable.org
Sent: Monday, July 11, 2005 12:12 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Question on source code layout

Greetings all,

I’m trying to reorganize my source files for a fairly complicated
driver

and I’m having a hard time of it. Basically, I want to have several
directories for the sources and several directories for the include
files
along the lines of:

Driver\

SourceDir1\
…various source files
IncDir1\
…various include files

SourceDir2\
…various source files
IncDir2\
…various include files

SourceDir3\
…various source files
IncDir1\
…various include files

All of these files are used to build one kernel mode driver. The MSDN
documentation lists several items that should facilitate this (sources
files, dir files, !include, SOURCES_INCLUDED…) but there’s not
enough
documentation for me to make it work.

Does anyone know of an example driver that has a similar source code
layout or can you point me in the right direction?

Thanks in advance,
-bob


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@stratus.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag
argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@stratus.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

#include “…/…/dir1/dir2/myfile.c”

This is one of the best ways.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From:
To: “Windows System Software Devs Interest List”
Sent: Monday, July 11, 2005 8:12 PM
Subject: [ntdev] Question on source code layout

> Greetings all,
>
> I’m trying to reorganize my source files for a fairly complicated driver
> and I’m having a hard time of it. Basically, I want to have several
> directories for the sources and several directories for the include files
> along the lines of:
>
> Driver<br>>
> SourceDir1<br>> …various source files
> IncDir1<br>> …various include files
>
> SourceDir2<br>> …various source files
> IncDir2<br>> …various include files
>
> SourceDir3<br>> …various source files
> IncDir1<br>> …various include files
>
> All of these files are used to build one kernel mode driver. The MSDN
> documentation lists several items that should facilitate this (sources
> files, dir files, !include, SOURCES_INCLUDED…) but there’s not enough
> documentation for me to make it work.
>
> Does anyone know of an example driver that has a similar source code
> layout or can you point me in the right direction?
>
> Thanks in advance,
> -bob
>
>
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com

Well actually I think it is hideous ugly and depraved, on the other hand it
works.

=====================
Mark Roddy DDK MVP
Windows 2003/XP/2000 Consulting
Hollis Technology Solutions 603-321-1032
www.hollistech.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim
S. Shatskih
Sent: Monday, July 11, 2005 5:07 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Question on source code layout

#include “…/…/dir1/dir2/myfile.c”

This is one of the best ways.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From:
> To: “Windows System Software Devs Interest List”
> Sent: Monday, July 11, 2005 8:12 PM
> Subject: [ntdev] Question on source code layout
>
>
> > Greetings all,
> >
> > I’m trying to reorganize my source files for a fairly
> complicated driver
> > and I’m having a hard time of it. Basically, I want to have several
> > directories for the sources and several directories for
> the include files
> > along the lines of:
> >
> > Driver<br>> >
> > SourceDir1<br>> > …various source files
> > IncDir1<br>> > …various include files
> >
> > SourceDir2<br>> > …various source files
> > IncDir2<br>> > …various include files
> >
> > SourceDir3<br>> > …various source files
> > IncDir1<br>> > …various include files
> >
> > All of these files are used to build one kernel mode
> driver. The MSDN
> > documentation lists several items that should facilitate
> this (sources
> > files, dir files, !include, SOURCES_INCLUDED…) but
> there’s not enough
> > documentation for me to make it work.
> >
> > Does anyone know of an example driver that has a similar source code
> > layout or can you point me in the right direction?
> >
> > Thanks in advance,
> > -bob
> >
> >
> >
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@hollistech.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

What if I simply populated the expected flat directory structure with
symlinks to the files?
-bob
----- Original Message -----
From: “Maxim S. Shatskih”
To: “Windows System Software Devs Interest List”
Sent: Monday, July 11, 2005 5:07 PM
Subject: Re: [ntdev] Question on source code layout

> #include “…/…/dir1/dir2/myfile.c”
>
> This is one of the best ways.
>
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
> ----- Original Message -----
> From:
> To: “Windows System Software Devs Interest List”
> Sent: Monday, July 11, 2005 8:12 PM
> Subject: [ntdev] Question on source code layout
>
>
>> Greetings all,
>>
>> I’m trying to reorganize my source files for a fairly complicated driver
>> and I’m having a hard time of it. Basically, I want to have several
>> directories for the sources and several directories for the include
>> files
>> along the lines of:
>>
>> Driver<br>>>
>> SourceDir1<br>>> …various source files
>> IncDir1<br>>> …various include files
>>
>> SourceDir2<br>>> …various source files
>> IncDir2<br>>> …various include files
>>
>> SourceDir3<br>>> …various source files
>> IncDir1<br>>> …various include files
>>
>> All of these files are used to build one kernel mode driver. The MSDN
>> documentation lists several items that should facilitate this (sources
>> files, dir files, !include, SOURCES_INCLUDED…) but there’s not enough
>> documentation for me to make it work.
>>
>> Does anyone know of an example driver that has a similar source code
>> layout or can you point me in the right direction?
>>
>> Thanks in advance,
>> -bob
>>
>>
>>
>>
>>
>> —
>> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>>
>> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
>> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@dunstable.org
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>

That doesn’t work well across source code repositories and if someone
picks up the src after you are gone, it will be very very unclear that
the file.c in one directory is actually file.c in another.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Bob Nelson
Sent: Monday, July 11, 2005 4:18 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Question on source code layout

What if I simply populated the expected flat directory structure with
symlinks to the files?
-bob
----- Original Message -----
From: “Maxim S. Shatskih”
To: “Windows System Software Devs Interest List”
Sent: Monday, July 11, 2005 5:07 PM
Subject: Re: [ntdev] Question on source code layout

> #include “…/…/dir1/dir2/myfile.c”
>
> This is one of the best ways.
>
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
> ----- Original Message -----
> From:
> To: “Windows System Software Devs Interest List”
> Sent: Monday, July 11, 2005 8:12 PM
> Subject: [ntdev] Question on source code layout
>
>
>> Greetings all,
>>
>> I’m trying to reorganize my source files for a fairly complicated
driver
>> and I’m having a hard time of it. Basically, I want to have several
>> directories for the sources and several directories for the include
>> files
>> along the lines of:
>>
>> Driver<br>>>
>> SourceDir1<br>>> …various source files
>> IncDir1<br>>> …various include files
>>
>> SourceDir2<br>>> …various source files
>> IncDir2<br>>> …various include files
>>
>> SourceDir3<br>>> …various source files
>> IncDir1<br>>> …various include files
>>
>> All of these files are used to build one kernel mode driver. The
MSDN
>> documentation lists several items that should facilitate this
(sources
>> files, dir files, !include, SOURCES_INCLUDED…) but there’s not
enough
>> documentation for me to make it work.
>>
>> Does anyone know of an example driver that has a similar source code
>> layout or can you point me in the right direction?
>>
>> Thanks in advance,
>> -bob
>>
>>
>>
>>
>>
>> —
>> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>>
>> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
>> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@dunstable.org
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

This is the best way of sharing some logic among several binaries in the
project, some user and some kernel mode.

Things like CRC32, AES, AVL trees (I have one manually written and 100%
coverage and stress tested for pre-XP Windows) and such are easily shared this
way.

The including C file must contain 2 and only 2 lines:

#include “platform.h”
#include “…/…/common/crc32.c”

or such. There are 2 versions of platform.h header - one includes ntifs.h
and another includes windows.h.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Mark Roddy”
To: “Windows System Software Devs Interest List”
Sent: Tuesday, July 12, 2005 3:12 AM
Subject: RE: [ntdev] Question on source code layout

> Well actually I think it is hideous ugly and depraved, on the other hand it
> works.
>
> =====================
> Mark Roddy DDK MVP
> Windows 2003/XP/2000 Consulting
> Hollis Technology Solutions 603-321-1032
> www.hollistech.com
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Maxim
> > S. Shatskih
> > Sent: Monday, July 11, 2005 5:07 PM
> > To: Windows System Software Devs Interest List
> > Subject: Re: [ntdev] Question on source code layout
> >
> > #include “…/…/dir1/dir2/myfile.c”
> >
> > This is one of the best ways.
> >
> > Maxim Shatskih, Windows DDK MVP
> > StorageCraft Corporation
> > xxxxx@storagecraft.com
> > http://www.storagecraft.com
> >
> > ----- Original Message -----
> > From:
> > To: “Windows System Software Devs Interest List”
> > Sent: Monday, July 11, 2005 8:12 PM
> > Subject: [ntdev] Question on source code layout
> >
> >
> > > Greetings all,
> > >
> > > I’m trying to reorganize my source files for a fairly
> > complicated driver
> > > and I’m having a hard time of it. Basically, I want to have several
> > > directories for the sources and several directories for
> > the include files
> > > along the lines of:
> > >
> > > Driver<br>> > >
> > > SourceDir1<br>> > > …various source files
> > > IncDir1<br>> > > …various include files
> > >
> > > SourceDir2<br>> > > …various source files
> > > IncDir2<br>> > > …various include files
> > >
> > > SourceDir3<br>> > > …various source files
> > > IncDir1<br>> > > …various include files
> > >
> > > All of these files are used to build one kernel mode
> > driver. The MSDN
> > > documentation lists several items that should facilitate
> > this (sources
> > > files, dir files, !include, SOURCES_INCLUDED…) but
> > there’s not enough
> > > documentation for me to make it work.
> > >
> > > Does anyone know of an example driver that has a similar source code
> > > layout or can you point me in the right direction?
> > >
> > > Thanks in advance,
> > > -bob
> > >
> > >
> > >
> > >
> > >
> > > —
> > > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> > >
> > > You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: xxxxx@hollistech.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com

Try to ZIP such a source tree and unpack it on another machine, and you
will see why.
Also try putting symlinks to the source control.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Bob Nelson”
To: “Windows System Software Devs Interest List”
Sent: Tuesday, July 12, 2005 3:18 AM
Subject: Re: [ntdev] Question on source code layout

> What if I simply populated the expected flat directory structure with
> symlinks to the files?
> -bob
> ----- Original Message -----
> From: “Maxim S. Shatskih”
> To: “Windows System Software Devs Interest List”
> Sent: Monday, July 11, 2005 5:07 PM
> Subject: Re: [ntdev] Question on source code layout
>
>
> > #include “…/…/dir1/dir2/myfile.c”
> >
> > This is one of the best ways.
> >
> > Maxim Shatskih, Windows DDK MVP
> > StorageCraft Corporation
> > xxxxx@storagecraft.com
> > http://www.storagecraft.com
> >
> > ----- Original Message -----
> > From:
> > To: “Windows System Software Devs Interest List”
> > Sent: Monday, July 11, 2005 8:12 PM
> > Subject: [ntdev] Question on source code layout
> >
> >
> >> Greetings all,
> >>
> >> I’m trying to reorganize my source files for a fairly complicated driver
> >> and I’m having a hard time of it. Basically, I want to have several
> >> directories for the sources and several directories for the include
> >> files
> >> along the lines of:
> >>
> >> Driver<br>> >>
> >> SourceDir1<br>> >> …various source files
> >> IncDir1<br>> >> …various include files
> >>
> >> SourceDir2<br>> >> …various source files
> >> IncDir2<br>> >> …various include files
> >>
> >> SourceDir3<br>> >> …various source files
> >> IncDir1<br>> >> …various include files
> >>
> >> All of these files are used to build one kernel mode driver. The MSDN
> >> documentation lists several items that should facilitate this (sources
> >> files, dir files, !include, SOURCES_INCLUDED…) but there’s not enough
> >> documentation for me to make it work.
> >>
> >> Does anyone know of an example driver that has a similar source code
> >> layout or can you point me in the right direction?
> >>
> >> Thanks in advance,
> >> -bob
> >>
> >>
> >>
> >>
> >>
> >> —
> >> Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >>
> >> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> >> To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: xxxxx@dunstable.org
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com

There are all sorts of complicated things you could do but I personally
would keep the build environment as simple as possible. That said, the
symlink solution works fine for filesystems that support it. I’ve worked
with source code trees that use this approach in a clearcase environment and
it certainly allows a good deal of flexibility.

=====================
Mark Roddy DDK MVP
Windows 2003/XP/2000 Consulting
Hollis Technology Solutions 603-321-1032
www.hollistech.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Bob Nelson
Sent: Monday, July 11, 2005 7:18 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Question on source code layout

What if I simply populated the expected flat directory
structure with symlinks to the files?
-bob
----- Original Message -----
From: “Maxim S. Shatskih”
> To: “Windows System Software Devs Interest List”
> Sent: Monday, July 11, 2005 5:07 PM
> Subject: Re: [ntdev] Question on source code layout
>
>
> > #include “…/…/dir1/dir2/myfile.c”
> >
> > This is one of the best ways.
> >
> > Maxim Shatskih, Windows DDK MVP
> > StorageCraft Corporation
> > xxxxx@storagecraft.com
> > http://www.storagecraft.com
> >
> > ----- Original Message -----
> > From:
> > To: “Windows System Software Devs Interest List”
>
> > Sent: Monday, July 11, 2005 8:12 PM
> > Subject: [ntdev] Question on source code layout
> >
> >
> >> Greetings all,
> >>
> >> I’m trying to reorganize my source files for a fairly complicated
> >> driver and I’m having a hard time of it. Basically, I
> want to have
> >> several directories for the sources and several
> directories for the
> >> include files along the lines of:
> >>
> >> Driver<br>> >>
> >> SourceDir1<br>> >> …various source files
> >> IncDir1<br>> >> …various include files
> >>
> >> SourceDir2<br>> >> …various source files
> >> IncDir2<br>> >> …various include files
> >>
> >> SourceDir3<br>> >> …various source files
> >> IncDir1<br>> >> …various include files
> >>
> >> All of these files are used to build one kernel mode driver. The
> >> MSDN documentation lists several items that should facilitate this
> >> (sources files, dir files, !include, SOURCES_INCLUDED…)
> but there’s
> >> not enough documentation for me to make it work.
> >>
> >> Does anyone know of an example driver that has a similar
> source code
> >> layout or can you point me in the right direction?
> >>
> >> Thanks in advance,
> >> -bob
> >>
> >>
> >>
> >>
> >>
> >> —
> >> Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >>
> >> You are currently subscribed to ntdev as:
> xxxxx@storagecraft.com To
> >> unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: xxxxx@dunstable.org To
> > unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> >
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as:
> xxxxx@hollistech.com To unsubscribe send a blank email to
> xxxxx@lists.osr.com
>

CRC32, AES and AVL trees all seem like terrific candidates for being put
into separate libs and linked in.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S. Shatskih
Sent: Monday, July 11, 2005 4:30 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Question on source code layout

This is the best way of sharing some logic among several binaries in
the project, some user and some kernel mode.

Things like CRC32, AES, AVL trees (I have one manually written and
100% coverage and stress tested for pre-XP Windows) and such are easily
shared this way.

The including C file must contain 2 and only 2 lines:

#include “platform.h”
#include “…/…/common/crc32.c”

or such. There are 2 versions of platform.h header - one includes
ntifs.h and another includes windows.h.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Mark Roddy”
To: “Windows System Software Devs Interest List”
Sent: Tuesday, July 12, 2005 3:12 AM
Subject: RE: [ntdev] Question on source code layout

> Well actually I think it is hideous ugly and depraved, on the other
hand it
> works.
>
> =====================
> Mark Roddy DDK MVP
> Windows 2003/XP/2000 Consulting
> Hollis Technology Solutions 603-321-1032
> www.hollistech.com
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Maxim
> > S. Shatskih
> > Sent: Monday, July 11, 2005 5:07 PM
> > To: Windows System Software Devs Interest List
> > Subject: Re: [ntdev] Question on source code layout
> >
> > #include “…/…/dir1/dir2/myfile.c”
> >
> > This is one of the best ways.
> >
> > Maxim Shatskih, Windows DDK MVP
> > StorageCraft Corporation
> > xxxxx@storagecraft.com
> > http://www.storagecraft.com
> >
> > ----- Original Message -----
> > From:
> > To: “Windows System Software Devs Interest List”

> > Sent: Monday, July 11, 2005 8:12 PM
> > Subject: [ntdev] Question on source code layout
> >
> >
> > > Greetings all,
> > >
> > > I’m trying to reorganize my source files for a fairly
> > complicated driver
> > > and I’m having a hard time of it. Basically, I want to have
several
> > > directories for the sources and several directories for
> > the include files
> > > along the lines of:
> > >
> > > Driver<br>> > >
> > > SourceDir1<br>> > > …various source files
> > > IncDir1<br>> > > …various include files
> > >
> > > SourceDir2<br>> > > …various source files
> > > IncDir2<br>> > > …various include files
> > >
> > > SourceDir3<br>> > > …various source files
> > > IncDir1<br>> > > …various include files
> > >
> > > All of these files are used to build one kernel mode
> > driver. The MSDN
> > > documentation lists several items that should facilitate
> > this (sources
> > > files, dir files, !include, SOURCES_INCLUDED…) but
> > there’s not enough
> > > documentation for me to make it work.
> > >
> > > Does anyone know of an example driver that has a similar source
code
> > > layout or can you point me in the right direction?
> > >
> > > Thanks in advance,
> > > -bob
> > >
> > >
> > >
> > >
> > >
> > > —
> > > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> > >
> > > You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > > To unsubscribe send a blank email to
xxxxx@lists.osr.com
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: xxxxx@hollistech.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

What if the AVL tree uses ExAllocatePoolWithTag in kernel mode and malloc
in user mode?

What about the different build options for user and kernel mode builds? If
VC++ is used for user mode builds - then it uses __cdecl as a default, while
DDK uses __stdcall.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Peter Wieland”
To: “Windows System Software Devs Interest List”
Sent: Tuesday, July 12, 2005 3:53 AM
Subject: RE: [ntdev] Question on source code layout

CRC32, AES and AVL trees all seem like terrific candidates for being put
into separate libs and linked in.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S. Shatskih
Sent: Monday, July 11, 2005 4:30 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Question on source code layout

This is the best way of sharing some logic among several binaries in
the project, some user and some kernel mode.

Things like CRC32, AES, AVL trees (I have one manually written and
100% coverage and stress tested for pre-XP Windows) and such are easily
shared this way.

The including C file must contain 2 and only 2 lines:

#include “platform.h”
#include “…/…/common/crc32.c”

or such. There are 2 versions of platform.h header - one includes
ntifs.h and another includes windows.h.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Mark Roddy”
To: “Windows System Software Devs Interest List”
Sent: Tuesday, July 12, 2005 3:12 AM
Subject: RE: [ntdev] Question on source code layout

> Well actually I think it is hideous ugly and depraved, on the other
hand it
> works.
>
> =====================
> Mark Roddy DDK MVP
> Windows 2003/XP/2000 Consulting
> Hollis Technology Solutions 603-321-1032
> www.hollistech.com
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Maxim
> > S. Shatskih
> > Sent: Monday, July 11, 2005 5:07 PM
> > To: Windows System Software Devs Interest List
> > Subject: Re: [ntdev] Question on source code layout
> >
> > #include “…/…/dir1/dir2/myfile.c”
> >
> > This is one of the best ways.
> >
> > Maxim Shatskih, Windows DDK MVP
> > StorageCraft Corporation
> > xxxxx@storagecraft.com
> > http://www.storagecraft.com
> >
> > ----- Original Message -----
> > From:
> > To: “Windows System Software Devs Interest List”

> > Sent: Monday, July 11, 2005 8:12 PM
> > Subject: [ntdev] Question on source code layout
> >
> >
> > > Greetings all,
> > >
> > > I’m trying to reorganize my source files for a fairly
> > complicated driver
> > > and I’m having a hard time of it. Basically, I want to have
several
> > > directories for the sources and several directories for
> > the include files
> > > along the lines of:
> > >
> > > Driver<br>> > >
> > > SourceDir1<br>> > > …various source files
> > > IncDir1<br>> > > …various include files
> > >
> > > SourceDir2<br>> > > …various source files
> > > IncDir2<br>> > > …various include files
> > >
> > > SourceDir3<br>> > > …various source files
> > > IncDir1<br>> > > …various include files
> > >
> > > All of these files are used to build one kernel mode
> > driver. The MSDN
> > > documentation lists several items that should facilitate
> > this (sources
> > > files, dir files, !include, SOURCES_INCLUDED…) but
> > there’s not enough
> > > documentation for me to make it work.
> > >
> > > Does anyone know of an example driver that has a similar source
code
> > > layout or can you point me in the right direction?
> > >
> > > Thanks in advance,
> > > -bob
> > >
> > >
> > >
> > >
> > >
> > > —
> > > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> > >
> > > You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > > To unsubscribe send a blank email to
xxxxx@lists.osr.com
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: xxxxx@hollistech.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

The issue of targeting static libraries to different environments is easily
handled with BUILD by using target/environment specific subdirectories, one
for each environment (target). I routinely use this method to build
drivers, driver libraries, and user libraries for multiple platforms. The
tree(s) look like this:

[LibA]
DIRS
SOURCES.INC
LibA.c
LibA.h
[NT4]
SOURCES
precomp.h
[NT5]
SOURCES
precomp.h
[WIN]
SOURCES
precomp.h

The basic idea is that the common source for the library is in the top-level
folder. The SOURCE.INC file controls the common build rules, SOURCES list,
etc. The sub-folders (target specific) contain the special nonsense
required to build for a specific target. By having each c/cpp file #include
“precomp.h” and specifying “.” in the INCLUDES macro, the target specific
rules, headers, etc. can be easily factored into each compiland.
Maintenance is a snap with simple separation. I generally setup a
PROJECT.MK as well to cover common configuration across multiple libraries
and binary targets.

BUILD.EXE is fine with ‘one level up’ sharing of source and trying to do
anything other than this is just going to make the next person that has to
understand, fix, or contribute to the code very frustrated.

The library technique is simple and effective. The multi-target technique
is likewise simple and effective. Combined, they work well for just about
any way the source is rationally organized.

Good Luck,
Dave Cattley
Consulting Engineer
Systems Software Development

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S. Shatskih
Sent: Monday, July 11, 2005 9:00 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Question on source code layout

What if the AVL tree uses ExAllocatePoolWithTag in kernel mode and
malloc
in user mode?

What about the different build options for user and kernel mode builds?
If
VC++ is used for user mode builds - then it uses __cdecl as a default, while
DDK uses __stdcall.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Peter Wieland”
To: “Windows System Software Devs Interest List”
Sent: Tuesday, July 12, 2005 3:53 AM
Subject: RE: [ntdev] Question on source code layout

CRC32, AES and AVL trees all seem like terrific candidates for being put
into separate libs and linked in.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S. Shatskih
Sent: Monday, July 11, 2005 4:30 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Question on source code layout

This is the best way of sharing some logic among several binaries in
the project, some user and some kernel mode.

Things like CRC32, AES, AVL trees (I have one manually written and
100% coverage and stress tested for pre-XP Windows) and such are easily
shared this way.

The including C file must contain 2 and only 2 lines:

#include “platform.h”
#include “…/…/common/crc32.c”

or such. There are 2 versions of platform.h header - one includes
ntifs.h and another includes windows.h.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Mark Roddy”
To: “Windows System Software Devs Interest List”
Sent: Tuesday, July 12, 2005 3:12 AM
Subject: RE: [ntdev] Question on source code layout

> Well actually I think it is hideous ugly and depraved, on the other
hand it
> works.
>
> =====================
> Mark Roddy DDK MVP
> Windows 2003/XP/2000 Consulting
> Hollis Technology Solutions 603-321-1032
> www.hollistech.com
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Maxim
> > S. Shatskih
> > Sent: Monday, July 11, 2005 5:07 PM
> > To: Windows System Software Devs Interest List
> > Subject: Re: [ntdev] Question on source code layout
> >
> > #include “…/…/dir1/dir2/myfile.c”
> >
> > This is one of the best ways.
> >
> > Maxim Shatskih, Windows DDK MVP
> > StorageCraft Corporation
> > xxxxx@storagecraft.com
> > http://www.storagecraft.com
> >
> > ----- Original Message -----
> > From:
> > To: “Windows System Software Devs Interest List”

> > Sent: Monday, July 11, 2005 8:12 PM
> > Subject: [ntdev] Question on source code layout
> >
> >
> > > Greetings all,
> > >
> > > I’m trying to reorganize my source files for a fairly
> > complicated driver
> > > and I’m having a hard time of it. Basically, I want to have
several
> > > directories for the sources and several directories for
> > the include files
> > > along the lines of:
> > >
> > > Driver<br>> > >
> > > SourceDir1<br>> > > …various source files
> > > IncDir1<br>> > > …various include files
> > >
> > > SourceDir2<br>> > > …various source files
> > > IncDir2<br>> > > …various include files
> > >
> > > SourceDir3<br>> > > …various source files
> > > IncDir1<br>> > > …various include files
> > >
> > > All of these files are used to build one kernel mode
> > driver. The MSDN
> > > documentation lists several items that should facilitate
> > this (sources
> > > files, dir files, !include, SOURCES_INCLUDED…) but
> > there’s not enough
> > > documentation for me to make it work.
> > >
> > > Does anyone know of an example driver that has a similar source
code
> > > layout or can you point me in the right direction?
> > >
> > > Thanks in advance,
> > > -bob
> > >
> > >
> > >
> > >
> > >
> > > —
> > > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> > >
> > > You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > > To unsubscribe send a blank email to
xxxxx@lists.osr.com
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: xxxxx@hollistech.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@msn.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

… and of course, my handy AVL tree library (everyone has one, right?) uses
trivial __inline function wrappers in a platform specific header file to
hide details like how memory allocation is performed in any particular
environment… (no, not really! my AVL tree library does not do memory
allocation the nodes are expected to bring their own, but you get the idea.
The mutex, event, spinlock, memory allocation, and many other common
services are handled this way, however.)

To suggest one of many possible answers to Maxim’s rhetorical question.

Good Luck,
Dave Cattley
Consulting Engineer
Systems Software Development

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S. Shatskih
Sent: Monday, July 11, 2005 9:00 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Question on source code layout

What if the AVL tree uses ExAllocatePoolWithTag in kernel mode and
malloc
in user mode?

What about the different build options for user and kernel mode builds?
If
VC++ is used for user mode builds - then it uses __cdecl as a default, while
DDK uses __stdcall.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Peter Wieland”
To: “Windows System Software Devs Interest List”
Sent: Tuesday, July 12, 2005 3:53 AM
Subject: RE: [ntdev] Question on source code layout

CRC32, AES and AVL trees all seem like terrific candidates for being put
into separate libs and linked in.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S. Shatskih
Sent: Monday, July 11, 2005 4:30 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Question on source code layout

This is the best way of sharing some logic among several binaries in
the project, some user and some kernel mode.

Things like CRC32, AES, AVL trees (I have one manually written and
100% coverage and stress tested for pre-XP Windows) and such are easily
shared this way.

The including C file must contain 2 and only 2 lines:

#include “platform.h”
#include “…/…/common/crc32.c”

or such. There are 2 versions of platform.h header - one includes
ntifs.h and another includes windows.h.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Mark Roddy”
To: “Windows System Software Devs Interest List”
Sent: Tuesday, July 12, 2005 3:12 AM
Subject: RE: [ntdev] Question on source code layout

> Well actually I think it is hideous ugly and depraved, on the other
hand it
> works.
>
> =====================
> Mark Roddy DDK MVP
> Windows 2003/XP/2000 Consulting
> Hollis Technology Solutions 603-321-1032
> www.hollistech.com
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Maxim
> > S. Shatskih
> > Sent: Monday, July 11, 2005 5:07 PM
> > To: Windows System Software Devs Interest List
> > Subject: Re: [ntdev] Question on source code layout
> >
> > #include “…/…/dir1/dir2/myfile.c”
> >
> > This is one of the best ways.
> >
> > Maxim Shatskih, Windows DDK MVP
> > StorageCraft Corporation
> > xxxxx@storagecraft.com
> > http://www.storagecraft.com
> >
> > ----- Original Message -----
> > From:
> > To: “Windows System Software Devs Interest List”

> > Sent: Monday, July 11, 2005 8:12 PM
> > Subject: [ntdev] Question on source code layout
> >
> >
> > > Greetings all,
> > >
> > > I’m trying to reorganize my source files for a fairly
> > complicated driver
> > > and I’m having a hard time of it. Basically, I want to have
several
> > > directories for the sources and several directories for
> > the include files
> > > along the lines of:
> > >
> > > Driver<br>> > >
> > > SourceDir1<br>> > > …various source files
> > > IncDir1<br>> > > …various include files
> > >
> > > SourceDir2<br>> > > …various source files
> > > IncDir2<br>> > > …various include files
> > >
> > > SourceDir3<br>> > > …various source files
> > > IncDir1<br>> > > …various include files
> > >
> > > All of these files are used to build one kernel mode
> > driver. The MSDN
> > > documentation lists several items that should facilitate
> > this (sources
> > > files, dir files, !include, SOURCES_INCLUDED…) but
> > there’s not enough
> > > documentation for me to make it work.
> > >
> > > Does anyone know of an example driver that has a similar source
code
> > > layout or can you point me in the right direction?
> > >
> > > Thanks in advance,
> > > -bob
> > >
> > >
> > >
> > >
> > >
> > > —
> > > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> > >
> > > You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > > To unsubscribe send a blank email to
xxxxx@lists.osr.com
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: xxxxx@hollistech.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@msn.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

The AVL tree can call out to an AllocateMemory function provided by the
driver/exe that’s linking it in. Or generate separate user-mdoe and
kernel-mode library under different subdirectories.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S. Shatskih
Sent: Monday, July 11, 2005 6:00 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Question on source code layout

What if the AVL tree uses ExAllocatePoolWithTag in kernel mode and
malloc in user mode?

What about the different build options for user and kernel mode
builds? If
VC++ is used for user mode builds - then it uses __cdecl as a default,
VC++ while
DDK uses __stdcall.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Peter Wieland”
To: “Windows System Software Devs Interest List”
Sent: Tuesday, July 12, 2005 3:53 AM
Subject: RE: [ntdev] Question on source code layout

CRC32, AES and AVL trees all seem like terrific candidates for being put
into separate libs and linked in.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S. Shatskih
Sent: Monday, July 11, 2005 4:30 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Question on source code layout

This is the best way of sharing some logic among several binaries in
the project, some user and some kernel mode.

Things like CRC32, AES, AVL trees (I have one manually written and
100% coverage and stress tested for pre-XP Windows) and such are easily
shared this way.

The including C file must contain 2 and only 2 lines:

#include “platform.h”
#include “…/…/common/crc32.c”

or such. There are 2 versions of platform.h header - one includes
ntifs.h and another includes windows.h.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Mark Roddy”
To: “Windows System Software Devs Interest List”
Sent: Tuesday, July 12, 2005 3:12 AM
Subject: RE: [ntdev] Question on source code layout

> Well actually I think it is hideous ugly and depraved, on the other
hand it
> works.
>
> =====================
> Mark Roddy DDK MVP
> Windows 2003/XP/2000 Consulting
> Hollis Technology Solutions 603-321-1032
> www.hollistech.com
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Maxim
> > S. Shatskih
> > Sent: Monday, July 11, 2005 5:07 PM
> > To: Windows System Software Devs Interest List
> > Subject: Re: [ntdev] Question on source code layout
> >
> > #include “…/…/dir1/dir2/myfile.c”
> >
> > This is one of the best ways.
> >
> > Maxim Shatskih, Windows DDK MVP
> > StorageCraft Corporation
> > xxxxx@storagecraft.com
> > http://www.storagecraft.com
> >
> > ----- Original Message -----
> > From:
> > To: “Windows System Software Devs Interest List”

> > Sent: Monday, July 11, 2005 8:12 PM
> > Subject: [ntdev] Question on source code layout
> >
> >
> > > Greetings all,
> > >
> > > I’m trying to reorganize my source files for a fairly
> > complicated driver
> > > and I’m having a hard time of it. Basically, I want to have
several
> > > directories for the sources and several directories for
> > the include files
> > > along the lines of:
> > >
> > > Driver<br>> > >
> > > SourceDir1<br>> > > …various source files
> > > IncDir1<br>> > > …various include files
> > >
> > > SourceDir2<br>> > > …various source files
> > > IncDir2<br>> > > …various include files
> > >
> > > SourceDir3<br>> > > …various source files
> > > IncDir1<br>> > > …various include files
> > >
> > > All of these files are used to build one kernel mode
> > driver. The MSDN
> > > documentation lists several items that should facilitate
> > this (sources
> > > files, dir files, !include, SOURCES_INCLUDED…) but
> > there’s not enough
> > > documentation for me to make it work.
> > >
> > > Does anyone know of an example driver that has a similar source
code
> > > layout or can you point me in the right direction?
> > >
> > > Thanks in advance,
> > > -bob
> > >
> > >
> > >
> > >
> > >
> > > —
> > > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> > >
> > > You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > > To unsubscribe send a blank email to
xxxxx@lists.osr.com
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: xxxxx@hollistech.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument:
‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

You can use “new” and override it kernel mode. Malloc is soooo
20th century! :slight_smile:

Alberto.

----- Original Message -----
From: “Maxim S. Shatskih”
To: “Windows System Software Devs Interest List”

Sent: Monday, July 11, 2005 9:00 PM
Subject: Re: [ntdev] Question on source code layout

> What if the AVL tree uses ExAllocatePoolWithTag in kernel
> mode and malloc
> in user mode?
>
> What about the different build options for user and kernel
> mode builds? If
> VC++ is used for user mode builds - then it uses cdecl as a
> default, while
> DDK uses
stdcall.
>
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
> ----- Original Message -----
> From: “Peter Wieland”
> To: “Windows System Software Devs Interest List”
>
> Sent: Tuesday, July 12, 2005 3:53 AM
> Subject: RE: [ntdev] Question on source code layout
>
>
> CRC32, AES and AVL trees all seem like terrific candidates for
> being put
> into separate libs and linked in.
>
> -p
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Maxim
> S. Shatskih
> Sent: Monday, July 11, 2005 4:30 PM
> To: Windows System Software Devs Interest List
> Subject: Re: [ntdev] Question on source code layout
>
> This is the best way of sharing some logic among several
> binaries in
> the project, some user and some kernel mode.
>
> Things like CRC32, AES, AVL trees (I have one manually
> written and
> 100% coverage and stress tested for pre-XP Windows) and such
> are easily
> shared this way.
>
> The including C file must contain 2 and only 2 lines:
>
> #include “platform.h”
> #include “…/…/common/crc32.c”
>
> or such. There are 2 versions of platform.h header - one
> includes
> ntifs.h and another includes windows.h.
>
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
> ----- Original Message -----
> From: “Mark Roddy”
> To: “Windows System Software Devs Interest List”
>
> Sent: Tuesday, July 12, 2005 3:12 AM
> Subject: RE: [ntdev] Question on source code layout
>
>
>> Well actually I think it is hideous ugly and depraved, on the
>> other
> hand it
>> works.
>>
>> =====================
>> Mark Roddy DDK MVP
>> Windows 2003/XP/2000 Consulting
>> Hollis Technology Solutions 603-321-1032
>> www.hollistech.com
>>
>> > -----Original Message-----
>> > From: xxxxx@lists.osr.com
>> > [mailto:xxxxx@lists.osr.com] On Behalf Of
>> > Maxim
>> > S. Shatskih
>> > Sent: Monday, July 11, 2005 5:07 PM
>> > To: Windows System Software Devs Interest List
>> > Subject: Re: [ntdev] Question on source code layout
>> >
>> > #include “…/…/dir1/dir2/myfile.c”
>> >
>> > This is one of the best ways.
>> >
>> > Maxim Shatskih, Windows DDK MVP
>> > StorageCraft Corporation
>> > xxxxx@storagecraft.com
>> > http://www.storagecraft.com
>> >
>> > ----- Original Message -----
>> > From:
>> > To: “Windows System Software Devs Interest List”
>
>> > Sent: Monday, July 11, 2005 8:12 PM
>> > Subject: [ntdev] Question on source code layout
>> >
>> >
>> > > Greetings all,
>> > >
>> > > I’m trying to reorganize my source files for a fairly
>> > complicated driver
>> > > and I’m having a hard time of it. Basically, I want to
>> > > have
> several
>> > > directories for the sources and several directories for
>> > the include files
>> > > along the lines of:
>> > >
>> > > Driver<br>>> > >
>> > > SourceDir1<br>>> > > …various source files
>> > > IncDir1<br>>> > > …various include files
>> > >
>> > > SourceDir2<br>>> > > …various source files
>> > > IncDir2<br>>> > > …various include files
>> > >
>> > > SourceDir3<br>>> > > …various source files
>> > > IncDir1<br>>> > > …various include files
>> > >
>> > > All of these files are used to build one kernel mode
>> > driver. The MSDN
>> > > documentation lists several items that should facilitate
>> > this (sources
>> > > files, dir files, !include, SOURCES_INCLUDED…) but
>> > there’s not enough
>> > > documentation for me to make it work.
>> > >
>> > > Does anyone know of an example driver that has a similar
>> > > source
> code
>> > > layout or can you point me in the right direction?
>> > >
>> > > Thanks in advance,
>> > > -bob
>> > >
>> > >
>> > >
>> > >
>> > >
>> > > —
>> > > Questions? First check the Kernel Driver FAQ at
>> > http://www.osronline.com/article.cfm?id=256
>> > >
>> > > You are currently subscribed to ntdev as:
>> > > xxxxx@storagecraft.com
>> > > To unsubscribe send a blank email to
> xxxxx@lists.osr.com
>> >
>> >
>> > —
>> > Questions? First check the Kernel Driver FAQ at
>> > http://www.osronline.com/article.cfm?id=256
>> >
>> > You are currently subscribed to ntdev as:
>> > xxxxx@hollistech.com
>> > To unsubscribe send a blank email to
>> > xxxxx@lists.osr.com
>> >
>>
>>
>>
>> —
>> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>>
>> You are currently subscribed to ntdev as:
>> xxxxx@storagecraft.com
>> To unsubscribe send a blank email to
>> xxxxx@lists.osr.com
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as:
> xxxxx@windows.microsoft.com
> To unsubscribe send a blank email to
> xxxxx@lists.osr.com
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: unknown lmsubst tag
> argument: ‘’
> To unsubscribe send a blank email to
> xxxxx@lists.osr.com
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@ieee.org
> To unsubscribe send a blank email to
> xxxxx@lists.osr.com

Have a fourth directory, call it BuildDir. Have three “sources”
files for the three SourceDirs. Have the BuildDir “sources” to
integrate the results of the three builds into a fourth.
Finally, use a “dirs” file in your Driver directory.

Or you can use four service .dsp or .vcproj projects and call
build.exe from a post-build step. Put them all together inside a
.sln file and invoke it from a Checked or Free Build CMD shell.
If you use msvc.net you can easily plug in any holes with
handwritten macros.

Hope this helps,

Alberto.

----- Original Message -----
From:
To: “Windows System Software Devs Interest List”

Sent: Monday, July 11, 2005 12:12 PM
Subject: [ntdev] Question on source code layout

> Greetings all,
>
> I’m trying to reorganize my source files for a fairly
> complicated driver
> and I’m having a hard time of it. Basically, I want to have
> several
> directories for the sources and several directories for the
> include files
> along the lines of:
>
> Driver<br>>
> SourceDir1<br>> …various source files
> IncDir1<br>> …various include files
>
> SourceDir2<br>> …various source files
> IncDir2<br>> …various include files
>
> SourceDir3<br>> …various source files
> IncDir1<br>> …various include files
>
> All of these files are used to build one kernel mode driver.
> The MSDN
> documentation lists several items that should facilitate this
> (sources
> files, dir files, !include, SOURCES_INCLUDED…) but there’s
> not enough
> documentation for me to make it work.
>
> Does anyone know of an example driver that has a similar
> source code
> layout or can you point me in the right direction?
>
> Thanks in advance,
> -bob
>
>
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@ieee.org
> To unsubscribe send a blank email to
> xxxxx@lists.osr.com