Aug 2, 2010

Start writing simple WDM driver

View the sample code downloaded from code project.
Starting the sample program with Visual C++ 2010 express.
Some problems encountered:

  1. Cannot directly compile the solution, have to compile each cpp file step by step, C1083 Error
  2. Cannot link to the symbol from kernal, system32. Have to set Debug->Option and Setting->Symbols->Checked the option.
  3. Device not found, still figuring out.
Problems encountered while editing HelloWDM: http://www.luocong.com/articles/show_article.asp?Article_ID=11

  1. VC2010 cannot find the path of DDK header files
  2. 1. Run VS2005
    2. Select Tools->Options->Project and Solutions->VC++ Directories For;VC2010 it is in Project->Properties
    3. On the right side choose Include file (from show directories from)
    4. Add WDKInstallationPath\BuildNumber\ inc to the list; For win7, we have to specifically identify the DDK path: C:\WinDDK\7600.16385.1\inc\ddk
    5. On the right side choose Library file (from show directories from)
    6. Add WDKInstallationPath\BuildNumber\ lib to the list
    7. Press OK

However, error msg appeared:

1>  stdafx.cpp
1>c:\program files\microsoft visual studio 10.0\vc\include\crtdefs.h(520): error C2065: '_In_opt_z_' : undeclared identifier
1>c:\program files\microsoft visual studio 10.0\vc\include\crtdefs.h(520): error C2143: syntax error : missing ')' before 'const'
1>c:\program files\microsoft visual studio 10.0\vc\include\crtdefs.h(520): warning C4229: anachronism used : modifiers on data are ignored
1>c:\program files\microsoft visual studio 10.0\vc\include\crtdefs.h(520): error C2182: '_invalid_parameter' : illegal use of type 'void'
1>c:\program files\microsoft visual studio 10.0\vc\include\crtdefs.h(520): error C2491: '_invalid_parameter' : definition of dllimport data not allowed
1>c:\program files\microsoft visual studio 10.0\vc\include\crtdefs.h(520): error C2059: syntax error : ')'


Solution from http://stackoverflow.com/questions/1356653/multiple-compiling-errors-with-basic-c-application-on-vs2010-beta-1

The problem is here: C:\WinDDK\6001.18001\inc\api\sal.h

sal.h defines annotations, which are being used in the CRT headers... The DDK includes its own sal.h, which is obsolete and dones not contain all the annotations.

There are 2 possible solutions: - change the include paths so that the "C:\Program Files\Microsoft Visual Studio 10.0\VC\include" comes before "C:\WinDDK\6001.18001\inc\api"

  • just delete "C:\WinDDK\6001.18001\inc\api\sal.h" :)

No comments:

Post a Comment