![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Jan 2006
Posts: 13
Rep Power: 0
![]() |
Driver Debug Problem
I'm working with the Microsoft DDKs and found this script in a driver tutorial and can not get it to work.
#include "ntddk.h"
NTSTATUS DriverEntry( IN PDRIVER_OBJECT theDriverObject,
IN PUNICODE_STRING theRegistryPath )
{
DbgPrint("test");
return STATUS_SUCCESS;
}It's supposed to print "test" to a 3rd party debugger but it won't compile, instead it gives 1137 lines of error messages before telling me "There must be something terribly wrong with your code. Please fix it." I think there's a problem with ntddk.h but I don't know what, I installed it straight from the Microsoft website and it was the one the tutorial described. Any thoughts would be appreciated, thanks. |
|
|
|
|
|
#2 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Where exactly did you get the file from, and what tutorial are you using?
|
|
|
|
|
|
#3 |
|
Newbie
Join Date: Jan 2006
Posts: 13
Rep Power: 0
![]() |
ntddk.h I got from the Microsoft DDK package frm the MS website and the tutorial was out of a book for driver development
|
|
|
|
|
|
#4 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Link? What book? We need specifics, man!
|
|
|
|
|
|
#5 |
|
Expert Programmer
Join Date: Jun 2005
Posts: 879
Rep Power: 4
![]() |
Also the first few lines of errors would be handy.
|
|
|
|
|
|
#6 |
|
Newbie
Join Date: Jan 2006
Posts: 13
Rep Power: 0
![]() |
the book I sadly don't have any more because it was borrowed but the first few errors are:
1 C:\Program Files\Dev-Cpp\include\ntddk.h:26, from dbgtest.c In file included from C:/Program Files/Dev-Cpp/include/ntddk.h:26, from dbgtest.c 1 C:\Program Files\Dev-Cpp\dbgtest.c from dbgtest.c 50:1 C:\Program Files\Dev-Cpp\include\ntstatus.h [Warning] "STATUS_SUCCESS" redefined 1 C:\Program Files\Dev-Cpp\include\ntddk.h:25, from dbgtest.c In file included from C:/Program Files/Dev-Cpp/include/ntddk.h:25, from dbgtest.c 1 C:\Program Files\Dev-Cpp\dbgtest.c from dbgtest.c 25:1 C:\Program Files\Dev-Cpp\include\ntdef.h [Warning] this is the location of the previous definition 1 C:\Program Files\Dev-Cpp\include\ntddk.h:26, from dbgtest.c In file included from C:/Program Files/Dev-Cpp/include/ntddk.h:26, from dbgtest.c dbgteat.c is the name of the file and now I'm wondering if it would be because I compiled it with Dev C++ but as a C project, even though I tried compileing it with another C compiler and it also gave error messages then crashed so I really don't know. |
|
|
|
|
|
#7 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,254
Rep Power: 5
![]() |
The Microsoft DDKs are (well) highly microsoft specific. Before windows XP, the DDKs required you to use Visual Studio to compile (although there was some uncertainty over which version of Visual Studio was required for a given version of the DDK). With windows XP, the DDK is a self contained development kit (i.e. it comes with the compilers required; the only extra things you need are a machine with operating system to run on and a text editor).
gnu compilers (dev-c++ is an IDE that uses the gnu compilers) have no relationship to Visual Studio, and are therefore not suitable "out of the box" for developing windows device drivers. |
|
|
|
|
|
#8 |
|
Hobbyist Programmer
|
The Microsoft Windows DDK is now completely free and comes even with the compiler (cl.exe) and libraries you need to build Drivers.
http://www.microsoft.com/whdc/devtools/ddk/default.mspx After you download the ISO and install it (by burning the ISO or otherwise,) you will have build environments which are essentially just shells with environment paths set. Access for example, the "Windows XP Checked build environment." (There are two types, the Checked and Free, checked includes debug information, while Free doesn't and is therefore for the production driver you will distribute) and CD to the directory with your driver source code. You should then be able to simply type "build" and it should build your driver. Note however you need a few other files, two, really. The two files are MAKEFILE and SOURCES (both in caps, neither with extensions.) Your MAKEFILE source should pretty much always be this: !INCLUDE $(NTMAKEENV)\makefile.def Your SOURCES file should be this (or something thereof): TARGETNAME=MYDRIVER TARGETPATH=OBJ TARGETTYPE=DRIVER SOURCES=mydriver.c TARGETNAME is the name of your driver, TARGETPATH is the directory it will be compiled to (normally this will simply be OBJ), TARGETTYPE describes what kind of application to build (in this case, a driver. You can also build executables with the DDK but it is undocumented.) SOURCES is simply the .c files that compose your driver, if you have more than one, do this: SOURCES = main.c \ func.c \ foobar.c |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| vector problem | Kilo | C++ | 1 | May 21st, 2006 10:46 PM |
| Break Point Problem on VC++ 6.0 | chanwing | C++ | 4 | Feb 8th, 2006 4:42 AM |
| cgi/perl script + IE problem | joyceshee | Perl | 2 | Jan 24th, 2006 12:10 PM |
| help with recursion problem | the_new_guy_in_town | Java | 3 | Apr 7th, 2005 4:04 AM |