none
How to build a Driver Locally Kernel RRS feed

  • Question

  • Hi,

    I am having problems compiling SYS kernel level Drivers on my local machine. Can someone tell me how I can achieve this. Visual Studio 2012 Ultimate Does not allow me to do this how can I change it to allow me. If anyone says change IDE , I have to say I cannot becuase no other IDE can give me what I want except for VS. 

    Hopefully some one knows this problem.

    Thanks,

    Tuesday, April 9, 2013 9:14 AM

Answers

  • how did you create the new driver project? did you choose file | new project | empty driver ?or did you create a new project and then start changing the config?  you didn't need to create a new driver project, you already had one. what type of drive are you trying to create? perhaps a sample would be a better starting point

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    • Marked as answer by Sunder Hamu Thursday, April 11, 2013 12:51 PM
    Tuesday, April 9, 2013 5:30 PM
  • I have created a "Kernel Mode Driver, Empty". Yes , Thanks Doron , I am going to be downloading sample and studying them so I get a bit experienced in the field. Thanks
    • Marked as answer by Sunder Hamu Thursday, April 11, 2013 12:51 PM
    Tuesday, April 9, 2013 6:41 PM

All replies

  • Did you install the latest WDK?

    Visual Studio 2012 integrates perfectly with it.

    Tsang

    Tsang Chan

    • Edited by Tsang Chan Tuesday, April 9, 2013 9:56 AM
    Tuesday, April 9, 2013 9:55 AM
  • As Tsang asked did you install the WDK?  You should see a menu "Drivers" as one of the menus of VS2012 if you install the WDK properly.  If you haven't installed it go to http://msdn.microsoft.com/en-us/windows/hardware/hh852362.aspx for the kit.


    Don Burn Windows Filesystem and Driver Consulting Website: http://www.windrvr.com Blog: http://msmvps.com/blogs/WinDrvr

    Tuesday, April 9, 2013 11:22 AM
  • I did download it. And I do see a Drivers Menus in VS2012 when creating a "New Project". But When I want to Compile it gives me some stupid error: 

    Error 1 error MSB3030: Could not copy the file "c:\Users\Swag\Desktop\C programs & project\Ring0\VistaRelease\Ring0.sys" because it was not found. C:\Program Files (x86)\Windows Kits\8.0\build\WindowsDriver8.0.common.targets 1347 5 Ring0 Package

    So why can I not compile it. Thanks

    Tuesday, April 9, 2013 11:40 AM
  • You might want to try moving the project ot a directory path without the spaces and ampersand.  Microsoft did a lot of work to handle full path names, but it is possible they still have a problem with "C programs & project" as a directory name.  If it works with a simple path, then you have a temporary solution, and Microsoft will know there is a bug (a number of Microsoft WDK folks monitor and respond on this forum).


    Don Burn Windows Filesystem and Driver Consulting Website: http://www.windrvr.com Blog: http://msmvps.com/blogs/WinDrvr

    Tuesday, April 9, 2013 12:56 PM
  • Thanks ! I will report back after I try This.


    Tuesday, April 9, 2013 1:05 PM
  • Hi Donald,

    It still does not work. It give me a error : 

    Error 1 error : File not found: C:\MyDriver\Ring0\VistaDebug\Ring0.sys C:\MyDriver\Ring0\Ring0\SIGNTASK Ring0

    If it matters I am running as a Standard User. But I am just Building it. Thanks

    Tuesday, April 9, 2013 1:36 PM
  • Ok it looks like you are not creating a .sys file, are there any errors before the file not found?  This is likely a compile or link error causing a failure.


    Don Burn Windows Filesystem and Driver Consulting Website: http://www.windrvr.com Blog: http://msmvps.com/blogs/WinDrvr

    Tuesday, April 9, 2013 1:42 PM
  • Yes ! I am reading Books on it and Yes They are famous ones. 

    Tuesday, April 9, 2013 1:50 PM
  • I have added the Target extension to .sys.

    The Kernel Level Driver Code [Main.c] :

    #define _X86_
    #include <ntddk.h>
    
    NTSTATUS DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath)
    {
    	DbgPrint("Hello World");
    }

    The ERRORS:

    Only One:

    Error	1	error : File not found: C:\MyDriver\Ring0\VistaDebug\Ring0.sys	C:\MyDriver\Ring0\Ring0\SIGNTASK	Ring0

    Screenshot:


    So what is causing this Error? I mean this Driver is a very simple Driver much much simpler than big Drivers. 

    Kind Regards,


    Tuesday, April 9, 2013 1:54 PM
  • Post all the output from the output window for a run, there is something going on that is missing from your posts.


    Don Burn Windows Filesystem and Driver Consulting Website: http://www.windrvr.com Blog: http://msmvps.com/blogs/WinDrvr

    Tuesday, April 9, 2013 1:56 PM
  • Hi Donald I appreciate the Help,

    OutPut Windows:

    1>------ Build started: Project: Ring0, Configuration: Vista Debug Win32 ------
    1>  Stamping VistaDebug\Ring0.inf [Version] section with DriverVer=04/09/2013,15.0.8.742
    1>  Done Adding Additional Store
    1>  
    1>  Number of errors: 1
    1>  
    1>SIGNTASK : SignTool error : File not found: C:\MyDriver\Ring0\VistaDebug\Ring0.sys
    1>  
    Build has been canceled.
    Build Summary
    -------------
    00:01.307 - Failed  - Vista Debug Win32 - Ring0\Ring0.vcxproj
    
    Total build time: 00:01.336
    
    ========== Build: 0 succeeded or up-to-date, 1 failed, 1 skipped ==========
    

    Thanks,

    Tuesday, April 9, 2013 2:02 PM
  • You are attempting to build the driver in the package project. If you look at your solution, there are two projects in it. The driver project, this where your source goes and you build the .sys. And the package which builds the driver package, which is the driver, inf and other files you sign.

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Tuesday, April 9, 2013 2:29 PM
  • Well, Now I created a new project and deleted the Old one . But now I get a different Error : 

    Error	1	error : (WppCreateFile)Cannot open file trace.h, error 2	C:\MyDriver\Ring0\Ring0\wpp	Ring0
    

    Now what is that about?

    Screen Shot:

    Output Windows:

    1>------ Build started: Project: Ring0, Configuration: Vista Release Win32 ------
    1>  Stamping VistaRelease\Ring0.inf [Version] section with DriverVer=04/09/2013,15.38.10.750
    1>  cl wpp
    1>wpp : error : (WppCreateFile)Cannot open file trace.h, error 2
    Build has been canceled.
    Build Summary
    -------------
    00:01.093 - Failed  - Vista Release Win32 - Ring0\Ring0.vcxproj
    
    Total build time: 00:01.123
    
    ========== Build: 0 succeeded or up-to-date, 1 failed, 1 skipped ==========
    

    Thanks,

    Tuesday, April 9, 2013 2:40 PM
  • how did you create the new driver project? did you choose file | new project | empty driver ?or did you create a new project and then start changing the config?  you didn't need to create a new driver project, you already had one. what type of drive are you trying to create? perhaps a sample would be a better starting point

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    • Marked as answer by Sunder Hamu Thursday, April 11, 2013 12:51 PM
    Tuesday, April 9, 2013 5:30 PM
  • I have created a "Kernel Mode Driver, Empty". Yes , Thanks Doron , I am going to be downloading sample and studying them so I get a bit experienced in the field. Thanks
    • Marked as answer by Sunder Hamu Thursday, April 11, 2013 12:51 PM
    Tuesday, April 9, 2013 6:41 PM