Tech Support > Microsoft Windows > Drivers > DDK Integration with VS
DDK Integration with VS
Posted by Rich S. on February 14th, 2005


Hello,

I just installed the Server 2003 DDK. Am I incorrect in assuming that it is
supposed to integrate with Visual Studio? It can't be that I must write my
code with notepad and then compile and link at the command line, can it?

Please forgive my ignorance, but how does one integrate the DDK with Visual
Studio? Or can you point me to an article that tells how?

Thank you very much,
Rich

Posted by Steve on February 15th, 2005


Yes you can integrate the DDK with a VS project. All
that is required is that you configure VS and your VS
project. This involves settings that make the ddk
headers\libs get included\linked instead of the standard
headers\libs.

To setup include location -
Tools/Options/Directories/Include files - set to location
of your ddk include directories.

To setup library location -
Tools/Options/Directories/Library files - set to location
of your ddk lib directories.

Ensure that your ddk directories are highest in the list.

For your vc project ...
Project Settings/C/C++
Code Generation/Calling convention - __stdcall
Preprocessor/Preprocessor definitions - replace existing
defines with _X86_,_WIN32_WINNT=0x500

Project Settings/Link
Input/Object/library modules - int64.lib ntoskrnl.lib
hal.lib
Output/Base address - 0x10000
Output/Entry-point symbol - DriverEntry (i.e. the name of
your drivers driver entry function)

You can also setup program database which will be
required for crash dump analysis ...
Project Settings/Link/Customize/Use program database.

I think this is all that is required.
Steve.

Posted by Rich S. on February 15th, 2005


Thank you, Steve, for your very helpful reply. Beginner's information is
rather hard to come by for writing drivers.



"Steve" wrote:

Posted by Tim Roberts on February 15th, 2005


"Rich S." <RichS@discussions.microsoft.com> wrote:
=>
Most driver writers (in my experience) build their drivers from the
command-line, with the "build" tool, and use standalone editors like vim or
MultiEdit or Codeworks.

The editor in some versions of Visual Studio is pretty good, but you are
adding yet another layer of confiusion if you try to use Visual Studio to
build drivers before you are confident of the inner workings of the build
process.
--
- Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc

Posted by Mark Roddy on February 15th, 2005


Rich S. wrote:
However Steve's advice is, in my opinion and that of many others, the
wrong way to go.

The DDK comes with its own compiler toolset, which toolset you just
avoided using by following the given advice. There is a reason why the
ddk comes with its own tools - these are the tools tested and approved
for building drivers. Perhaps you should consider using them.

There is a way to build drivers in visual studio using the DDK supplied
tools. Use External Makefile projects for your driver projects. Point
the external makefile project at a shell script that will invoke the ddk
build tools to build your driver. Documentation (for VS6 but it easily
translates to VS.NET) and the infamous ddkbuild.bat are located on my
web site at http://www.hollistech.com



--

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

Posted by Don Burn on February 15th, 2005


You can do this, but of course that means you:

1. Don't care that you are using the wrong compiler. The DDH comes with
its own compiler, and that is the one you should be using.

2. Don't care that your options do not match the "blessed norm" for
options. I have a customer who spent 6 months chasing a subtle bug, because
of a hack like this (cost them millions, but I'm sure your company doesn't
care).

3. Can't use the tools such as PreFast (with tools comming) that integrate
into the DDK build environment. But who cares if you find bugs right?

Using anything other than the DDK build environment is asking for problems
for you and your custoners.


--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply



"Steve" <swoodberry@foursticks.com> wrote in message
news:167901c51300$a80f4d30$a501280a@phx.gbl...


Posted by Maxim S. Shatskih on February 15th, 2005


I do this.

Or, sorry, no "vim", it is pathetic. MSVC is a fine text editor. MultiEdit is
too.

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



Posted by Rich S. on February 15th, 2005


Don,

I care! I care! I just didn't know, that's all! Geez.

As I said, I am looking for beginner information because I am just beginning.


Rich.


"Don Burn" wrote:

Posted by Don Burn on February 15th, 2005


Rich,

Then use Mark Roddy's excellent DdkBuild, this gives you the best of
both worlds.


--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply



"Rich S." <RichS@discussions.microsoft.com> wrote in message
news:ED83600D-F553-4365-9574-C9A39490F44A@microsoft.com...


Posted by James Antognini [MSFT] on February 15th, 2005


The following isn't the official word, just some advice.

If you encountered a build problem and the build involved an intermediary
layer like Mark Roddy's very useful DDKBUILD, you probably would have some
trouble in getting help from DDK Support (eg, in a MSDN support incident).
THAT SAID, it should be very easy for you to convert your build process from
the DDKBUILD form to the completely supported form, which is a command
window. Then there would be no issue about supportability (all other things
being equal).

--
James Antognini
Windows Driver Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.

"Don Burn" <burn@stopspam.acm.org> wrote in message
news:n5tQd.7113$tN2.2531@fe03.lga...


Posted by Don Burn on February 15th, 2005


Well since DDKBUILD just invokes build, I for one toggle all the time
(especially until Mark put in support for PreFast). I've never seen a
problem. I do on principle build the driver before release from the
command line.


--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply


"James Antognini [MSFT]" <jantogni@online.mindspring.com> wrote in message
news:%23BVu2Y7EFHA.2676@TK2MSFTNGP12.phx.gbl...


Posted by Mark Roddy on February 16th, 2005


James Antognini [MSFT] wrote:
pop a ddk shell and build from the command line. Send that to msoft.

--

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

Posted by Tim Roberts on February 18th, 2005


"Maxim S. Shatskih" <maxim@storagecraft.com> wrote:
It is not "pathetic" if you need to work in both Windows and Linux on a
regular basis. Vim works just the same, everywhere.
--
- Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc

Posted by Maxim S. Shatskih on February 23rd, 2005


That's why I have used MSVC to edit the PHP scripts intended for FreeBSD. I
have not found the matching editor there.

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



Posted by _Doug on May 9th, 2008


Which compiler should be used
to simply build a Visual-C++ program
that needs to call the USB interface functions in the DDK?

Our program isn't a driver; it part of a GUI
lets other programs connect by socket,
and relays their read/writes over USB
to our USB device.

-- Doug


"Rich S." wrote:

Posted by Maxim S. Shatskih on May 9th, 2008


I think any MS's compiler will be OK, and probably non-MS too.

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



Similar Posts