Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Sep 4th, 2006, 5:13 AM   #1
Steiner
Newbie
 
Steiner's Avatar
 
Join Date: Jan 2006
Posts: 13
Rep Power: 0 Steiner is on a distinguished road
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.
Steiner is offline   Reply With Quote
Old Sep 4th, 2006, 8:26 AM   #2
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Where exactly did you get the file from, and what tutorial are you using?
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Sep 4th, 2006, 4:44 PM   #3
Steiner
Newbie
 
Steiner's Avatar
 
Join Date: Jan 2006
Posts: 13
Rep Power: 0 Steiner is on a distinguished road
ntddk.h I got from the Microsoft DDK package frm the MS website and the tutorial was out of a book for driver development
Steiner is offline   Reply With Quote
Old Sep 4th, 2006, 6:35 PM   #4
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Link? What book? We need specifics, man!
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Sep 4th, 2006, 8:28 PM   #5
The Dark
Expert Programmer
 
Join Date: Jun 2005
Posts: 879
Rep Power: 4 The Dark is on a distinguished road
Also the first few lines of errors would be handy.
The Dark is offline   Reply With Quote
Old Sep 8th, 2006, 1:43 AM   #6
Steiner
Newbie
 
Steiner's Avatar
 
Join Date: Jan 2006
Posts: 13
Rep Power: 0 Steiner is on a distinguished road
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.
Steiner is offline   Reply With Quote
Old Sep 8th, 2006, 3:13 AM   #7
grumpy
Programming Guru
 
grumpy's Avatar
 
Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,254
Rep Power: 5 grumpy will become famous soon enough
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.
grumpy is offline   Reply With Quote
Old Sep 9th, 2006, 3:48 PM   #8
Mad_guy
Hobbyist Programmer
 
Mad_guy's Avatar
 
Join Date: Oct 2004
Location: Sandstorm, Techno Club
Posts: 239
Rep Power: 5 Mad_guy is on a distinguished road
Send a message via AIM to Mad_guy Send a message via MSN to Mad_guy
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
__________________
os: mac os 10.5.4
revision control: git
editor: emacs

site
Mad_guy is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 8:42 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC