I often need to write windows program (using MFC) that uses special APIs
defined in DDK header files. Therefore, the project includes some header
files from MSVC and some header files from DDK.

I add the DDK header file directory into MSVC's include path.
(VC6's top menu : Tools /Options/Directories/Include files)
However, I often get many compile errors in those DDK header files since
it seems that DDK's header files have some conflicts with MSVC's header
files.

Each time I need to try many include order and possibilities.

Does anyone know the method that can simplify this effort?
or What's the correct method to include DDK header files for windows program
in MSVC 6?

Best Regards

JJ Huang

Re: How to include header files of DDK correctly in MSVC 6? by Don

Don
Wed Jun 21 09:40:10 CDT 2006

Well first except for a few Zw and Rtl calls there is almost nothing from
the DDK that is useable in user space. Given that most people create their
own header for the things they need, taking pieces out of the DDK includes.

As I am sure you are aware you are diving into the unsupported world of
Windows, and a program that works today is not guarantteed to work
tommorrow.


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



"Jackal Huang" <huangjj@hotmail.com> wrote in message
news:eAIh79TlGHA.3816@TK2MSFTNGP02.phx.gbl...
>I often need to write windows program (using MFC) that uses special APIs
> defined in DDK header files. Therefore, the project includes some header
> files from MSVC and some header files from DDK.
>
> I add the DDK header file directory into MSVC's include path.
> (VC6's top menu : Tools /Options/Directories/Include files)
> However, I often get many compile errors in those DDK header files since
> it seems that DDK's header files have some conflicts with MSVC's header
> files.
>
> Each time I need to try many include order and possibilities.
>
> Does anyone know the method that can simplify this effort?
> or What's the correct method to include DDK header files for windows
> program
> in MSVC 6?
>
> Best Regards
>
> JJ Huang
>



Re: How to include header files of DDK correctly in MSVC 6? by Mark

Mark
Wed Jun 21 09:51:54 CDT 2006

Jackal Huang wrote:
> I often need to write windows program (using MFC) that uses special APIs
> defined in DDK header files. Therefore, the project includes some header
> files from MSVC and some header files from DDK.
>

Which special apis? User mode apis are defined in the platform sdk
header files.

You might need to include IOCTL definitions, guids, and related data
structures defined in various device specific header files not included
with the sdk. In that case, just include them, using some arrangement to
specify the correct ddk path.


Re: How to include header files of DDK correctly in MSVC 6? by Thomas

Thomas
Wed Jun 21 10:56:54 CDT 2006


"Mark Roddy" <markr@hollistech.com> wrote in message
news:uTa9EJUlGHA.2128@TK2MSFTNGP04.phx.gbl...
> Jackal Huang wrote:
>> I often need to write windows program (using MFC) that uses special APIs
>> defined in DDK header files. Therefore, the project includes some header
>> files from MSVC and some header files from DDK.
>>
>
> Which special apis? User mode apis are defined in the platform sdk header
> files.
>
> You might need to include IOCTL definitions, guids, and related data
> structures defined in various device specific header files not included
> with the sdk. In that case, just include them, using some arrangement to
> specify the correct ddk path.
>
In case Mark's reply isn't perfectly clear...

Yes, the DDK can be used to build user-mode applications. The inc tree
basically has two parts. For example, for Windows Server 2003:

3790.1801\inc\wnet - Contains "user-mode" includes
3790.1801\inc\ddk\wnet - Contains lernel-only includes

If you are using the DDK Build to build an application, then these are the
include trees you would use.

What Mark was saying is that most of the user-mode includes from the DDK are
also provided in the Platform SDK. In you install the latest Platform SDK,
then the includes that you probably need will automatically be integrated
into Visual Studio and you will have less greif in using them. There might
be some exceptions...

A strong suggestion is for you to abandon MCVC 6. It is two generations
behind the current VS .NET 2005. You will be more successful if you use more
current develoment tools.

Thomas F. Divine, Windows DDK MVP
http://www.pcausa.com




Re: How to include header files of DDK correctly in MSVC 6? by r_konjeti

r_konjeti
Wed Jun 21 17:25:59 CDT 2006

Are there any compiler options that will display (during compilation)
what header file locations are used when compiling a given file.

Thanks,
Raj

Thomas F. Divine [DDK MVP] wrote:
> "Mark Roddy" <markr@hollistech.com> wrote in message
> news:uTa9EJUlGHA.2128@TK2MSFTNGP04.phx.gbl...
> > Jackal Huang wrote:
> >> I often need to write windows program (using MFC) that uses special APIs
> >> defined in DDK header files. Therefore, the project includes some header
> >> files from MSVC and some header files from DDK.
> >>
> >
> > Which special apis? User mode apis are defined in the platform sdk header
> > files.
> >
> > You might need to include IOCTL definitions, guids, and related data
> > structures defined in various device specific header files not included
> > with the sdk. In that case, just include them, using some arrangement to
> > specify the correct ddk path.
> >
> In case Mark's reply isn't perfectly clear...
>
> Yes, the DDK can be used to build user-mode applications. The inc tree
> basically has two parts. For example, for Windows Server 2003:
>
> 3790.1801\inc\wnet - Contains "user-mode" includes
> 3790.1801\inc\ddk\wnet - Contains lernel-only includes
>
> If you are using the DDK Build to build an application, then these are the
> include trees you would use.
>
> What Mark was saying is that most of the user-mode includes from the DDK are
> also provided in the Platform SDK. In you install the latest Platform SDK,
> then the includes that you probably need will automatically be integrated
> into Visual Studio and you will have less greif in using them. There might
> be some exceptions...
>
> A strong suggestion is for you to abandon MCVC 6. It is two generations
> behind the current VS .NET 2005. You will be more successful if you use more
> current develoment tools.
>
> Thomas F. Divine, Windows DDK MVP
> http://www.pcausa.com


Re: How to include header files of DDK correctly in MSVC 6? by Jackal

Jackal
Thu Jun 22 10:34:36 CDT 2006

Thanks for all kindly replies.

I would write the utility to detect the arrival of usb storage device and
then
perform safe-remove operation. The program can be run on Win2000 or XP.
Therefore, I think MSVC 6 is enough.

To perform safe remove operation, I need to use CM_xxx function such as
CM_Request_Device_Eject defined in cfgmgr32.h.
These functions are not declared in VC or platform SDK header file.
To include cfgmgr32.h of DDK, I got many compile error in cfgmgr32.h.
I try many include directory orders in VC's include option.

CM_xxx functions are leagcy function and many CM functions can be
replaced by SetupDixxx function, but some seems not to be replaced by setup
api.

Therefore, I want to know whether some general include rule can solve this
problem ?

Best Regards

JJ Huang

"Thomas F. Divine [DDK MVP]" <tdivine@NOpcausaSPAM.com>
> "Mark Roddy" <markr@hollistech.com> wrote in message
> news:uTa9EJUlGHA.2128@TK2MSFTNGP04.phx.gbl...
>> Jackal Huang wrote:
>>> I often need to write windows program (using MFC) that uses special APIs
>>> defined in DDK header files. Therefore, the project includes some header
>>> files from MSVC and some header files from DDK.
>>>
>>
>> Which special apis? User mode apis are defined in the platform sdk header
>> files.
>>
>> You might need to include IOCTL definitions, guids, and related data
>> structures defined in various device specific header files not included
>> with the sdk. In that case, just include them, using some arrangement to
>> specify the correct ddk path.
>>
> In case Mark's reply isn't perfectly clear...
>
> Yes, the DDK can be used to build user-mode applications. The inc tree
> basically has two parts. For example, for Windows Server 2003:
>
> 3790.1801\inc\wnet - Contains "user-mode" includes
> 3790.1801\inc\ddk\wnet - Contains lernel-only includes
>
> If you are using the DDK Build to build an application, then these are the
> include trees you would use.
>
> What Mark was saying is that most of the user-mode includes from the DDK
> are also provided in the Platform SDK. In you install the latest Platform
> SDK, then the includes that you probably need will automatically be
> integrated into Visual Studio and you will have less greif in using them.
> There might be some exceptions...
>
> A strong suggestion is for you to abandon MCVC 6. It is two generations
> behind the current VS .NET 2005. You will be more successful if you use
> more current develoment tools.
>
> Thomas F. Divine, Windows DDK MVP
> http://www.pcausa.com
>
>
>



Re: How to include header files of DDK correctly in MSVC 6? by Norman

Norman
Thu Jun 22 19:53:54 CDT 2006

In my limited experience for the SetupDi and CM routines that I needed, MSDN
said which headers to #include, and the Platform SDK contained those
headers.

The Platform SDK for February 2003 can be used with VC++ 6.

If your program has to run on both Windows 2000 and Windows XP, then I think
you won't want to call any APIs that were added after February 2003. So
that will probably be enough.

If you need some #define lines for constants that aren't defined in the
Platform SDK, then copy those lines from the DDK into one of your own header
files. This might be risky in the future, i.e. your program will need
adjusting for future versions of Windows, but it will be fine for 2000 and
XP.


"Jackal Huang" <huangjj@hotmail.com> wrote in message
news:%23ZkefFhlGHA.4444@TK2MSFTNGP02.phx.gbl...
> Thanks for all kindly replies.
>
> I would write the utility to detect the arrival of usb storage device and
> then
> perform safe-remove operation. The program can be run on Win2000 or XP.
> Therefore, I think MSVC 6 is enough.
>
> To perform safe remove operation, I need to use CM_xxx function such as
> CM_Request_Device_Eject defined in cfgmgr32.h.
> These functions are not declared in VC or platform SDK header file.
> To include cfgmgr32.h of DDK, I got many compile error in cfgmgr32.h.
> I try many include directory orders in VC's include option.
>
> CM_xxx functions are leagcy function and many CM functions can be
> replaced by SetupDixxx function, but some seems not to be replaced by
> setup api.
>
> Therefore, I want to know whether some general include rule can solve this
> problem ?
>
> Best Regards
>
> JJ Huang
>
> "Thomas F. Divine [DDK MVP]" <tdivine@NOpcausaSPAM.com>
>> "Mark Roddy" <markr@hollistech.com> wrote in message
>> news:uTa9EJUlGHA.2128@TK2MSFTNGP04.phx.gbl...
>>> Jackal Huang wrote:
>>>> I often need to write windows program (using MFC) that uses special
>>>> APIs
>>>> defined in DDK header files. Therefore, the project includes some
>>>> header
>>>> files from MSVC and some header files from DDK.
>>>>
>>>
>>> Which special apis? User mode apis are defined in the platform sdk
>>> header files.
>>>
>>> You might need to include IOCTL definitions, guids, and related data
>>> structures defined in various device specific header files not included
>>> with the sdk. In that case, just include them, using some arrangement to
>>> specify the correct ddk path.
>>>
>> In case Mark's reply isn't perfectly clear...
>>
>> Yes, the DDK can be used to build user-mode applications. The inc tree
>> basically has two parts. For example, for Windows Server 2003:
>>
>> 3790.1801\inc\wnet - Contains "user-mode" includes
>> 3790.1801\inc\ddk\wnet - Contains lernel-only includes
>>
>> If you are using the DDK Build to build an application, then these are
>> the include trees you would use.
>>
>> What Mark was saying is that most of the user-mode includes from the DDK
>> are also provided in the Platform SDK. In you install the latest Platform
>> SDK, then the includes that you probably need will automatically be
>> integrated into Visual Studio and you will have less greif in using them.
>> There might be some exceptions...
>>
>> A strong suggestion is for you to abandon MCVC 6. It is two generations
>> behind the current VS .NET 2005. You will be more successful if you use
>> more current develoment tools.
>>
>> Thomas F. Divine, Windows DDK MVP
>> http://www.pcausa.com
>>
>>
>>
>
>


Re: How to include header files of DDK correctly in MSVC 6? by Tim

Tim
Fri Jun 23 22:58:10 CDT 2006

"Jackal Huang" <huangjj@hotmail.com> wrote:
>
>I would write the utility to detect the arrival of usb storage device and
>then
>perform safe-remove operation. The program can be run on Win2000 or XP.
>Therefore, I think MSVC 6 is enough.

That's not the point at all. MSVC 6 is 9 years old. It has bugs. It's
support of the C++ standard, templates, and standard library is well below
par. Microsoft has accumulated 9 more years of optimization tricks since
then.
--
- Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.