none
WDK project compilation RRS feed

  • Question

  • Hello everyone i am newbie to DDK programming.
    Read lot of books, asked the same questions on several blogs, but can't resolve my difficulty. Might be i wasn't able to understand their solutions.
    Can anyone here can tell me simple setting or process to compile a very basic program in visual studio 2008.
    Let me make u understand what is my environment and also wht i did!

    I am using "Windows XP" and "Windows Vista home basic" with "Visual Studio 2008" on 2 different machines with the latest "WDK 6001.18002". Now here in VS 2008, i am trying to create the default MFC / Win32 project and just trying to add some header files as follows:

    #include "wdm.h"
    #include "ndis.h"
    #include "cfg.h"

    Now here i have
    1) Set path of DDK folder in    Project settings->C/C++->Additional Include Directories    as "C:\WinDDK\6001.18002\inc\ddk;C:\WinDDK\6001.18002\inc\mfc42;C:\WinDDK\6001.18002\inc\api;C:\WinDDK\6001.18002\inc\crt"
    2) Set in    Project settings->C/C++->preprocessor to "Yes" (changes from NO).
    3) Added path in Tools->options->Projects & Solutions  as "C:\WinDDK\6001.18002"
    4) Set the path in windows environment variables, under path as "C:\WinDDK\6001.18002\". And also added new variable name as "WLHBASE" with path as "C:\WinDDK\6001.18002\ddkbuild.cmd;C:\WinDDK\6001.18002\ddkbuild.bat".
    5) I installed as suggested on OSR site, their "Driver Wizard" util. And tried with their default projects.

    SO HERE BY TRYING ALL THESE OPTIONS I AM GOING OUT OF MY IDEAS AND SEARCHES TO MAKE OUT HOW TO COMPILE THESE THING, BY TRYING ALL THESE OPTION EVERYTIME IT GIVES ME TONS OF ERRORS, OUT OF SOME ARE AS BELOW:

    c:\winddk\6001.18002\inc\api\ntdef.h(827) : error C2011: '_FLOAT128' : 'struct' type redefinition

    c:\winddk\6001.18002\inc\api\winnt.h(565) : see declaration of '_FLOAT128'

    c:\winddk\6001.18002\inc\api\ntdef.h(878) : error C2011: '_LARGE_INTEGER' : 'union' type redefinition

    c:\winddk\6001.18002\inc\api\winnt.h(612) : see declaration of '_LARGE_INTEGER'

    c:\winddk\6001.18002\inc\api\ntdef.h(896) : error C2011: '_ULARGE_INTEGER' : 'union' type redefinition

    c:\winddk\6001.18002\inc\api\winnt.h(630) : see declaration of '_ULARGE_INTEGER'

    c:\winddk\6001.18002\inc\api\ntdef.h(918) : error C2011: '_LUID' : 'struct' type redefinition

    c:\winddk\6001.18002\inc\api\winnt.h(652) : see declaration of '_LUID'

    c:\winddk\6001.18002\inc\api\ntdef.h(1015) : error C2084: function 'ULONGLONG Int64ShllMod32(ULONGLONG,DWORD)' already has a body

    c:\winddk\6001.18002\inc\api\winnt.h(706) : see previous definition of 'Int64ShllMod32'

    c:\winddk\6001.18002\inc\api\ntdef.h(1031) : error C2084: function 'LONGLONG Int64ShraMod32(LONGLONG,DWORD)' already has a body

    c:\winddk\6001.18002\inc\api\winnt.h(713) : see previous definition of 'Int64ShraMod32'

    c:\winddk\6001.18002\inc\api\ntdef.h(1047) : error C2084: function 'ULONGLONG Int64ShrlMod32(ULONGLONG,DWORD)' already has a body

    c:\winddk\6001.18002\inc\api\winnt.h(720) : see previous definition of 'Int64ShrlMod32'

    c:\winddk\6001.18002\inc\api\ntdef.h(1261) : warning C4005: 'UNICODE_STRING_MAX_BYTES' : macro redefinition

    c:\winddk\6001.18002\inc\api\winnt.h(890) : see previous definition of 'UNICODE_STRING_MAX_BYTES'

    c:\winddk\6001.18002\inc\api\ntdef.h(1301) : error C2011: '_LIST_ENTRY' : 'struct' type redefinition

    c:\winddk\6001.18002\inc\api\winnt.h(899) : see declaration of '_LIST_ENTRY'

    c:\winddk\6001.18002\inc\api\ntdef.h(1311) : error C2011: '_SINGLE_LIST_ENTRY' : 'struct' type redefinition

    c:\winddk\6001.18002\inc\api\winnt.h(909) : see declaration of '_SINGLE_LIST_ENTRY'

    c:\winddk\6001.18002\inc\api\ntdef.h(1322) : error C2011: 'LIST_ENTRY32' : 'struct' type redefinition

    c:\winddk\6001.18002\inc\api\winnt.h(917) : see declaration of 'LIST_ENTRY32'

    c:\winddk\6001.18002\inc\api\ntdef.h(1328) : error C2011: 'LIST_ENTRY64' : 'struct' type redefinition

    c:\winddk\6001.18002\inc\api\winnt.h(923) : see declaration of 'LIST_ENTRY64'

    c:\winddk\6001.18002\inc\api\ntdef.h(1345) : error C2027: use of undefined type 'LIST_ENTRY64'

    c:\winddk\6001.18002\inc\api\winnt.h(923) : see declaration of 'LIST_ENTRY64'

    c:\winddk\6001.18002\inc\api\ntdef.h(1345) : error C2227: left of '->Flink' must point to class/struct/union/generic type



    So now here could someone help me out of this, that will be very greatfull.

    Thanks in advance

     

    • Edited by Mannu189 Thursday, June 4, 2009 7:04 AM
    Thursday, June 4, 2009 6:49 AM

Answers

  • Hmya, Visual Studio was not designed to be helpful in building drivers.  WDK uses nmake.exe, makefile projects, to build drivers.  Trying to hack VS configuration to make it build drivers, or trying to use project templates that were not designed to be used with WDK headers, is going to get you the kind of trouble you are now having.

    Spend another year or so studying Walter Oney's books to learn how to get this right.  You'll need to ask for help in a WDK related forum or newsgroup.

    Hans Passant.
    • Marked as answer by Wesley Yao Wednesday, June 10, 2009 3:42 AM
    Thursday, June 4, 2009 10:33 AM
    Moderator

All replies

  • Hmya, Visual Studio was not designed to be helpful in building drivers.  WDK uses nmake.exe, makefile projects, to build drivers.  Trying to hack VS configuration to make it build drivers, or trying to use project templates that were not designed to be used with WDK headers, is going to get you the kind of trouble you are now having.

    Spend another year or so studying Walter Oney's books to learn how to get this right.  You'll need to ask for help in a WDK related forum or newsgroup.

    Hans Passant.
    • Marked as answer by Wesley Yao Wednesday, June 10, 2009 3:42 AM
    Thursday, June 4, 2009 10:33 AM
    Moderator
  • help in a WDK related forum or newsgroup.

    Where is this forum located? Doesn't MSDN have a WDK related forum?

     

    Friday, October 22, 2010 4:23 PM