I am new to writing drivers. I have just begun on the work of writing
a NDIS protocol driver. As a starting point I am using the sample
protocol driver NDISUIO provided with WINDDK 2600.1106. I have
modified NDISUIO and put some DbgPrint() statements to understand its
behaviour. I build the driver using the build environment provided
with WINDDK on a windows XP sp1 box. I install the driver using
snetcfg utility and load it using net start <driver> command. All this
is successful. I have written a user level program (DriverTest.exe)
that opens the driver using "CreateFile" call and then communicates
with the driver through "DeviceIoControl" calls. All calls are running
perfectly without any problem. The problem is when I try to debug I
cannot see the messages that I am passing through DbgPrint()
statements in my driver. Here is how I am trying to Debug the driver
locally (target and host machine are the same):

1. type kd -kl at the command prompt (symbols are loaded properly, no
error messages)
2. open windbg.exe from Start > Programs > Debugging Tools for Windows
3. open my user level program DriverTest.exe from File > Open
Executable in WindDbg GUI
4. I don't get any error messages, I can press F5 (Go) and get the
program to complete and do intended task but cannot see any messages
in the debugger neither in WinDbg nor in kd

Is there a fundamental mistake in my debugging approach? Where are the
debugging messages sent by DbgPrint() supposed to appear, in kd or
WinDbg? Any help would be appreciated.

Thanks in advance,
James

Re: Debugging NDIS protocol driver by stewo68

stewo68
Wed Sep 22 09:17:33 CDT 2004

jamfmartin@gmail.com (James) wrote in message news:<47174fbc.0409211645.5df73c78@posting.google.com>...
[..]
> Is there a fundamental mistake in my debugging approach? Where are the
> debugging messages sent by DbgPrint() supposed to appear, in kd or
> WinDbg? Any help would be appreciated.

Although I have read once that WinDbg is now able to debug the local
machine, I have never tested or seen that actually running.

One usually needs *separate* host and target machines. That is ture
for both KD and WinDbg (WinDbg just has a GUI whereas KD is the
"old-fashion" command-line version - still some people prefer KD
because it's "more fun").

Anyway, go ahead and run the DebugView tool on your *host*. DebugView
can display DbgPrint() messages on the local machine. Download here:

http://www.sysinternals.com/ntw2k/utilities.shtml

Note, however, that DebugView is not a debugger.

Stephan

Re: Debugging NDIS protocol driver by used2win

used2win
Thu Sep 23 06:07:22 CDT 2004

James,

As far as I know, you cannot run and debug a driver
with windbg on a standalone PC.
If you just need to display debug messages then you
can use DebugView from sysinternals otherwise get
Numega SoftIce ( not only you can see debug messages
but also you can debug your driver - Just generate
and load your driver NMS file ).

Regards,
Kamel Messaoudi
¤ TheGreenBow VPN client R&D team leader
¤ VPN IPsec, firewalling and NDIS drivers expert

jamfmartin@gmail.com (James) wrote in message news:<47174fbc.0409211645.5df73c78@posting.google.com>...
> I am new to writing drivers. I have just begun on the work of writing
> a NDIS protocol driver. As a starting point I am using the sample
> protocol driver NDISUIO provided with WINDDK 2600.1106. I have
> modified NDISUIO and put some DbgPrint() statements to understand its
> behaviour. I build the driver using the build environment provided
> with WINDDK on a windows XP sp1 box. I install the driver using
> snetcfg utility and load it using net start <driver> command. All this
> is successful. I have written a user level program (DriverTest.exe)
> that opens the driver using "CreateFile" call and then communicates
> with the driver through "DeviceIoControl" calls. All calls are running
> perfectly without any problem. The problem is when I try to debug I
> cannot see the messages that I am passing through DbgPrint()
> statements in my driver. Here is how I am trying to Debug the driver
> locally (target and host machine are the same):
>
> 1. type kd -kl at the command prompt (symbols are loaded properly, no
> error messages)
> 2. open windbg.exe from Start > Programs > Debugging Tools for Windows
> 3. open my user level program DriverTest.exe from File > Open
> Executable in WindDbg GUI
> 4. I don't get any error messages, I can press F5 (Go) and get the
> program to complete and do intended task but cannot see any messages
> in the debugger neither in WinDbg nor in kd
>
> Is there a fundamental mistake in my debugging approach? Where are the
> debugging messages sent by DbgPrint() supposed to appear, in kd or
> WinDbg? Any help would be appreciated.
>
> Thanks in advance,
> James

_________________________________________________________

Personal Home Page : http://www.geocities.com/used2win
ICQ number : 7943103

Re: Debugging NDIS protocol driver by jamfmartin

jamfmartin
Fri Sep 24 14:22:55 CDT 2004

Thanks Stephan and Kamel. DebugView() has solved my problem for now,
would have to switch to two machine debug set up soon.

Thanks again,
James

used2win@yahoo.com (Kamel Messaoudi) wrote in message news:<dc3817a.0409230307.702f5d54@posting.google.com>...
> James,
>
> As far as I know, you cannot run and debug a driver
> with windbg on a standalone PC.
> If you just need to display debug messages then you
> can use DebugView from sysinternals otherwise get
> Numega SoftIce ( not only you can see debug messages
> but also you can debug your driver - Just generate
> and load your driver NMS file ).
>
> Regards,
> Kamel Messaoudi
> ¤ TheGreenBow VPN client R&D team leader
> ¤ VPN IPsec, firewalling and NDIS drivers expert
>
> jamfmartin@gmail.com (James) wrote in message news:<47174fbc.0409211645.5df73c78@posting.google.com>...
> > I am new to writing drivers. I have just begun on the work of writing
> > a NDIS protocol driver. As a starting point I am using the sample
> > protocol driver NDISUIO provided with WINDDK 2600.1106. I have
> > modified NDISUIO and put some DbgPrint() statements to understand its
> > behaviour. I build the driver using the build environment provided
> > with WINDDK on a windows XP sp1 box. I install the driver using
> > snetcfg utility and load it using net start <driver> command. All this
> > is successful. I have written a user level program (DriverTest.exe)
> > that opens the driver using "CreateFile" call and then communicates
> > with the driver through "DeviceIoControl" calls. All calls are running
> > perfectly without any problem. The problem is when I try to debug I
> > cannot see the messages that I am passing through DbgPrint()
> > statements in my driver. Here is how I am trying to Debug the driver
> > locally (target and host machine are the same):
> >
> > 1. type kd -kl at the command prompt (symbols are loaded properly, no
> > error messages)
> > 2. open windbg.exe from Start > Programs > Debugging Tools for Windows
> > 3. open my user level program DriverTest.exe from File > Open
> > Executable in WindDbg GUI
> > 4. I don't get any error messages, I can press F5 (Go) and get the
> > program to complete and do intended task but cannot see any messages
> > in the debugger neither in WinDbg nor in kd
> >
> > Is there a fundamental mistake in my debugging approach? Where are the
> > debugging messages sent by DbgPrint() supposed to appear, in kd or
> > WinDbg? Any help would be appreciated.
> >
> > Thanks in advance,
> > James
>
> _________________________________________________________
>
> Personal Home Page : http://www.geocities.com/used2win
> ICQ number : 7943103