how can i build a driver using visual studio? [closed]

☆樱花仙子☆ 提交于 2019-11-30 13:50:02

问题


does anyone have an article how to do this ?


回答1:


Since you gave no exact version of Visual Studio, let me give you the options I am aware of.

Visual Studio 2012, 2013 and 2015

Respective contemporary DDK/WDK versions: WDKs 8, 8.1 and 10 (as of this writing).

With the WDK for Windows 8, the WDK team at Microsoft finally offers full integration with Visual Studio again directly from Microsoft.

However, while Visual Studio 2017 exists in minor version 15.4 already by the time of this update, the WDK still requires Visual Studio 2015.

Visual Studio 2002 through 2010

Respective contemporary DDK/WDK versions: DDKs for Windows XP/2003 Server, WDKs for Windows Vista and Windows 7 with their respective service pack levels and the respective server versions.

Those versions were not officially supported by Microsoft to build drivers. The only worse choice to compile a driver would be a complete third-party toolchain (other than Intel's C compiler which was sanctioned by MS, IIRC).

It was considered very bad form to use the Visual Studio compilers during that period, and Microsoft explicitly recommended against it. However, C++ in kernel mode was also once frowned upon and now MS provides C++ frameworks for kernel mode. The times they are changin' ... ;)

Anyway, workarounds exist in the form of ddkbuild.bat and ddkbuild.cmd which use the DDK toolchain, but effectively allow you to integrate the resulting invocation from your "make" project inside Visual Studio. DDKWizard is a project creation wizard for both of those scripts. DDKWizard does not support Visual Studio 2010! The links to the two scripts provide a good documentation and DDKWizard also comes with a decent documentation.

To my knowledge ddkbuild.cmd is originally based on ddkbuild.bat and the HollisTech version can also trace its heritage back to that version from OSR.

VisualDDK combined with VirtualKD emerged later than the aforementioned, but is to be considered a far superior, more sophisticated solution. But your mileage may vary. In either case the integration into Visual Studio is far more complete in the latter solution.

Visual Studio 6

Respective contemporary DDK/WDK versions: DDKs for Windows NT 4 and Windows 2000.

Prior to the Windows XP DDK (now DDK is called WDK) the compiler was not included in the DDK, so you had to have the compiler toolchain installed. This would be the case for NT 4.0 and Windows 2000.




回答2:


Download and install VisualDDK and you'll be able to create driver projects and debug drivers directly from Visual Studio.




回答3:


The ddkbuild from OSR-Online is a nice alternative ddkbuild download link.




回答4:


To build my driver i used VisualDDK in visual studio 2008. In the beginning i start debugging using my computer and virtualBox machine but when i launch the debugging process in visual studio, my virtual machine did not show me the external ip address(normally should show me 192.168.1.102 and 10.0.1.15 in DDKLauncherMonitor but it show me only 10.0.1.15 ).

I stopped using virtual machine and i decide to use real computer. In the second computer i launched DDKLauncherMonitor. And i start debugging from my first computer. I received Udp package in my second machine and also the driver.sys. But when i tried to load the driver from visual studio(First computer) nothing work. Plus this, in the second machine tell me "Windows required digitally signed driver".

There is same one meet this kind of problem and he/she can help.




回答5:


create a makefile project and use the following as the build command:

pushd .  
call C:\WinDDK\7600.16385.1\bin\setenv.bat C:\WinDDK\7600.16385.1\ chk x86 WXP no_oacr   
popd  
build -cgwiz  

(obviously tweak the arguments to setenv to suit)




回答6:


If you want to use DDK build and WDK use ddkbuild.bat, it is pretty good (I think most of it works still) that should have you going. Alternatively check out ddkbuild.cmd from OSR.




回答7:


In VS create a makefile project. Add your sources, headers, makefile and sourcefile. Open project properties->Configuration properties->NMake->Build Command Line and write:

call $(WINDDK)\bin\setenv.bat $(WINDDK) fre wnet
cd /d $(ProjectDir)
build.exe -I

Now you can build from VS. The advantage of the makefile project: it provides you with as many configurations as you need (w2k, wxp, wnet, wlh and etc) and you can build from the DDK command line.

P.S. fre wnet - is a sample configuration, use what is required for your project. It is good to have both fre and chk configurations. WINDDK - environment variable with a path to the DDK root.



来源:https://stackoverflow.com/questions/1037343/how-can-i-build-a-driver-using-visual-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!