Building Driver Test Application Visual Studio

Dear List,

Is there any method to write the test application using Visual Studio build environment or we must use wdk build only for even test applications.

By seeing the test apps in the samples I found the flow something as below:
main - OpenDevice - GetDevicePath - SetupDiGetClassDevs - SetupDiEnumDeviceInterfaces - SetupDiGetDeviceInterfaceDetail - CreateFile - ReadFile - WriteFile

The point is file related CreateFIle, … functions can be used in visual studio but I cannot find those setup SetupDiGetClassDevs , … functions in vs as they belong to wdk. But we must open the device before performing any operation to it.

Alternative option is build a lib using ddk and use it in Visual Studio.

If any one successfully done any of the above, kindly clarify two things:

  1. Building driver test applications using visual studio
  2. Building library file using ddk.

Regards.

----- Original Message -----
From:
To: “Windows System Software Devs Interest List”
Sent: Wednesday, September 19, 2007 8:06 AM
Subject: [ntdev] Building Driver Test Application Visual Studio

> Dear List,
>
> Is there any method to write the test application using Visual Studio
> build environment or we must use wdk build only for even test
> applications.
>
> By seeing the test apps in the samples I found the flow something as
> below:
> main - OpenDevice - GetDevicePath - SetupDiGetClassDevs -
> SetupDiEnumDeviceInterfaces - SetupDiGetDeviceInterfaceDetail -
> CreateFile - ReadFile - WriteFile
>
> The point is file related CreateFIle, … functions can be used in visual
> studio but I cannot find those setup SetupDiGetClassDevs , … functions
> in vs as they belong to wdk. But we must open the device before
> performing any operation to it.
>
> Alternative option is build a lib using ddk and use it in Visual Studio.
>
> If any one successfully done any of the above, kindly clarify two things:
> 1. Building driver test applications using visual studio
> 2. Building library file using ddk.

Both the things can be done. Option 1. is obviously the easiest one. For the
Setup API functions, you need to include setupapi.h and add setupapi.lib in
your linker properties. Consider that these functions don’t specifically
belong to wdk vs. Visual Studio (or the Platform SDK). They are part of the
Win32 API, and can obviously be used from VS, DDK, WDK (or even a third
party build environment like Cygwin).

Hope it helps
GV


Gianluca Varenni, Windows DDK MVP

CACE Technologies
http://www.cacetech.com

>
> Regards.
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer

Yes, it helped a lot. Thanks for the simple and straight forward solution.
I included the required header files in the code and the correponding libs
in the linker path of the visual studio IDE and getting the output of the
test program as expected.

As mentioned although option 1 is the easiest one, what might be procedure
for the second one of creating .lib file in wdk. Do we need to change
sources file contents. sources file here refers to the file named
“sources”. I noticed TARGETTYPE option in the file which may be used for
creating the output file. Please correct me if I am wrong.

Regards.

On 9/19/07, Gianluca Varenni wrote:
>
>
> ----- Original Message -----
> From:
> To: “Windows System Software Devs Interest List”
> Sent: Wednesday, September 19, 2007 8:06 AM
> Subject: [ntdev] Building Driver Test Application Visual Studio
>
>
> > Dear List,
> >
> > Is there any method to write the test application using Visual Studio
> > build environment or we must use wdk build only for even test
> > applications.
> >
> > By seeing the test apps in the samples I found the flow something as
> > below:
> > main - OpenDevice - GetDevicePath - SetupDiGetClassDevs -
> > SetupDiEnumDeviceInterfaces - SetupDiGetDeviceInterfaceDetail -
> > CreateFile - ReadFile - WriteFile
> >
> > The point is file related CreateFIle, … functions can be used in
> visual
> > studio but I cannot find those setup SetupDiGetClassDevs , … functions
> > in vs as they belong to wdk. But we must open the device before
> > performing any operation to it.
> >
> > Alternative option is build a lib using ddk and use it in Visual Studio.
> >
> > If any one successfully done any of the above, kindly clarify two
> things:
> > 1. Building driver test applications using visual studio
> > 2. Building library file using ddk.
>
> Both the things can be done. Option 1. is obviously the easiest one. For
> the
> Setup API functions, you need to include setupapi.h and add setupapi.libin
> your linker properties. Consider that these functions don’t specifically
> belong to wdk vs. Visual Studio (or the Platform SDK). They are part of
> the
> Win32 API, and can obviously be used from VS, DDK, WDK (or even a third
> party build environment like Cygwin).
>
> Hope it helps
> GV
>
> –
> Gianluca Varenni, Windows DDK MVP
>
> CACE Technologies
> http://www.cacetech.com
>
>
>
> >
> > Regards.
> >
> > —
> > NTDEV is sponsored by OSR
> >
> > For our schedule of WDF, WDM, debugging and other seminars visit:
> > http://www.osr.com/seminars
> >
> > To unsubscribe, visit the List Server section of OSR Online at
> > http://www.osronline.com/page.cfm?name=ListServer
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

You’ve got it:

TARGETTYPE = LIBRARY

Good luck,

mm