Writng and Debuging Drivers in C++

Hi the expert,

I have never done development drivers in C++. Eventually, I will have to.
I wonder how hard it would be debuging Drivers in C++ using soft-ICE
Is it a nightmare ? Or it is as easy as debuging drivers wrtiiten in C.
For example how hard view or dump the content of a member variable of a
driver class ?

Thanks for any feedback

I do not use softice, so I can only speak about windbg and c++, which
work just fine together. Given that Compuware/Numega sells a kernel c++
class library in the same package as softice, I suspect that softice is
able to debug c++ without major issues.

===========================
Mark Roddy
Consultant, Microsoft DDK MVP
Hollis Technology Solutions
xxxxx@hollistech.com
www.hollistech.com
603-321-1032

-----Original Message-----
From: “Quang Vu”
To: “NT Developers Interest List”
Date: Mon, 9 Dec 2002 14:47:43 -0500
Subject: [ntdev] Writng and Debuging Drivers in C++

> Hi the expert,
>
> I have never done development drivers in C++. Eventually, I will have
> to.
> I wonder how hard it would be debuging Drivers in C++ using soft-ICE
> Is it a nightmare ? Or it is as easy as debuging drivers wrtiiten in C.
> For example how hard view or dump the content of a member variable of a
> driver class ?
>
>
> Thanks for any feedback
>
> —
> You are currently subscribed to ntdev as: xxxxx@hollistech.com
> To unsubscribe send a blank email to %%email.unsub%%

I have debugged several kernel-mode drivers written in C++ using SoftIce,
particularily on Win9x systems, and it works fine.


Bill McKenzie

“Quang Vu” wrote in message news:xxxxx@ntdev…
>
> Hi the expert,
>
> I have never done development drivers in C++. Eventually, I will have to.
> I wonder how hard it would be debuging Drivers in C++ using soft-ICE
> Is it a nightmare ? Or it is as easy as debuging drivers wrtiiten in C.
> For example how hard view or dump the content of a member variable of a
> driver class ?
>
>
> Thanks for any feedback
>
>

I have used VtoolsD, DriverWorks, and Softice. I found SoftIce useful when
the debuggers from Microsoft were in need of debugging themselves. It is
also useful if you have a single product that needs to run on 9x & NT, so
the debugger has a similar interface.

So many developers who use C++ don’t realize that the first implementations
were just a translator from the C++ to standard “C” code that was then
compiled by a old compiler. Most of the features suitable to use in drivers
are still in the same category. A class is just a structure but instead of
referencing it via an explicit pointer, the pointer is implicit and handled
by the compiler.

I do like DriverWorks. I have a few good reasons to use it that apply to my
experience. Accessing the registry and debug display support can be made
much easier and simpler to code. The debug stuff is only useful during
development, but we need all the help we can get. Of course, you could
write the registry access functions and just “cut and paste” to future
projects, but why bother?

It is expensive and Microsoft has not done much itself to reduce costs.
Windbg is “free”, but you still have to download it. Just printing the user
guide will chew up most of a ream of paper. MSDN is absurdly expensive and
appears designed to limit the ability to develop to those who have deep
pockets. MSDN Universal costs more than the two computers you need to write
drivers. Add in the IFS Kits and you need $10,000 just to start in the
first year. Remember when many shareware developers could write useful
utilities, TSRs, and drivers for MS-DOS with little or no expense except the
hardware. The costs seem to have shifted from hardware to software. I just
read that Microsoft has said that its costs for their operating systems is
only $0.15 or $0.16 per dollar charged. Nice margins!

If you are experienced with a good toolbox, then the only one you have to
pay is Microsoft. The Numega and other tools are optional. Even Microsoft
apparently uses PC-Lint, which might be the only other thing to buy.

----- Original Message -----
From: “Mark Roddy”
To: “NT Developers Interest List”
Sent: Monday, December 09, 2002 4:24 PM
Subject: [ntdev] Re: Writng and Debuging Drivers in C++

> I do not use softice, so I can only speak about windbg and c++, which
> work just fine together. Given that Compuware/Numega sells a kernel c++
> class library in the same package as softice, I suspect that softice is
> able to debug c++ without major issues.
>
>
>
> ===========================
> Mark Roddy
> Consultant, Microsoft DDK MVP
> Hollis Technology Solutions
> xxxxx@hollistech.com
> www.hollistech.com
> 603-321-1032
>
>
> -----Original Message-----
> From: “Quang Vu”
> To: “NT Developers Interest List”
> Date: Mon, 9 Dec 2002 14:47:43 -0500
> Subject: [ntdev] Writng and Debuging Drivers in C++
>
> > Hi the expert,
> >
> > I have never done development drivers in C++. Eventually, I will have
> > to.
> > I wonder how hard it would be debuging Drivers in C++ using soft-ICE
> > Is it a nightmare ? Or it is as easy as debuging drivers wrtiiten in C.
> > For example how hard view or dump the content of a member variable of a
> > driver class ?
> >
> >
> > Thanks for any feedback
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@hollistech.com
> > To unsubscribe send a blank email to %%email.unsub%%
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@yoshimuni.com
> To unsubscribe send a blank email to %%email.unsub%%

I used SoftICE for C++ debugging only in user mode but presume there is no
difference in kernel mode. There aren’t major problems and it is definitely
usable although not ideal. There are issues with templates and multiple
inheritance but nothing which would prevent debugging.

Best regards,

Michal Vodicka
STMicroelectronics Design and Application s.r.o.
[michal.vodicka@st.com, http:://www.st.com]


From: xxxxx@hollistech.com[SMTP:xxxxx@hollistech.com]
Reply To: xxxxx@lists.osr.com
Sent: Monday, December 09, 2002 10:24 PM
To: xxxxx@lists.osr.com
Subject: [ntdev] Re: Writng and Debuging Drivers in C++

I do not use softice, so I can only speak about windbg and c++, which
work just fine together. Given that Compuware/Numega sells a kernel c++
class library in the same package as softice, I suspect that softice is
able to debug c++ without major issues.

===========================
Mark Roddy
Consultant, Microsoft DDK MVP
Hollis Technology Solutions
xxxxx@hollistech.com
www.hollistech.com
603-321-1032

-----Original Message-----
From: “Quang Vu”
> To: “NT Developers Interest List”
> Date: Mon, 9 Dec 2002 14:47:43 -0500
> Subject: [ntdev] Writng and Debuging Drivers in C++
>
> > Hi the expert,
> >
> > I have never done development drivers in C++. Eventually, I will have
> > to.
> > I wonder how hard it would be debuging Drivers in C++ using soft-ICE
> > Is it a nightmare ? Or it is as easy as debuging drivers wrtiiten in C.
> > For example how hard view or dump the content of a member variable of a
> > driver class ?
> >
> >
> > Thanks for any feedback
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@hollistech.com
> > To unsubscribe send a blank email to %%email.unsub%%
>
>
>
> —
> You are currently subscribed to ntdev as: michal.vodicka@st.com
> To unsubscribe send a blank email to %%email.unsub%%
>

>

It is expensive and Microsoft has not done much itself to reduce costs.
Windbg is “free”, but you still have to download it. Just printing the
user
guide will chew up most of a ream of paper. MSDN is absurdly expensive
and
appears designed to limit the ability to develop to those who have deep
pockets. MSDN Universal costs more than the two computers you need to
write
drivers. Add in the IFS Kits and you need $10,000 just to start in the
first year. Remember when many shareware developers could write useful
utilities, TSRs, and drivers for MS-DOS with little or no expense except
the
hardware. The costs seem to have shifted from hardware to software. I
just
read that Microsoft has said that its costs for their operating systems is
only $0.15 or $0.16 per dollar charged. Nice margins!

You do not, by any means, need an MSDN subscription to develop device
drivers. If you have access to the internet then you’re completely set. The
DDK is practically free (just pay for the shipping), and the entire MSDN
library is available for free on Microsoft’s website. The DDK comes with a
compiler and everything you need to build a driver…in fact you don’t
really even need access to the internet (of course access to the extra
information is quite a help).

Now there are some useful things lacking from not having a MSDN
subscription, like checked OS builds, but I have actually never used them
despite having access to them (I’ve only used a couple checked system
drivers. ie. USB).

You are correct on the IFS kit, it does cost a fair amount. I wish I could
get my hands on it for free…oh well.

In summary, if you’re just starting out, don’t feel as though you need large
capital in order to start developing for windows.

Chris

P.S. This doesn’t just apply to device drivers. You can develop applications
for free using MS tools as well (you don’t need Visual Studio…although IMO
it is a great product and I use it).

I think MSDN is required for someone in the development group to have
available. You can get the DDKs for “free” if you have one. I have also
found that keeping the old DDKs, SDKs, and operating systems to be necessary
because most of the world isn’t switching as quickly as Microsoft would
like. There is the archive pack with some of the old stuff too. I have
found that some documentation disappears if you don’t have access to the
older versions. Also there is one hardware “requirement” that OSR advises
and that is a 8x SMP system. Some deadlocks and other SMP issues may not
show up quickly on a single CPU or a dual processor. I remember releasing
one driver that had the no-SMP flag set. We didn’t have a SMP system to
test and the risk to our partners was deemed too high. I have been at a
company where only one or two of the systems had DVDs. Every other system
had CD-ROMs only. I prefer the paychecks get paid instead of having all the
toys I want, but I still want the toys.

I think that using the checked builds of the HAL and Kernel is required to
drivers stable. I don’t think that you need the entire checked OS for
drivers, but you may want it for some applications.

----- Original Message -----
From: “Chris Dor?”
Newsgroups: ntdev
To: “NT Developers Interest List”
Sent: Monday, December 09, 2002 5:34 PM
Subject: [ntdev] Re: Writng and Debuging Drivers in C++

> >
> > It is expensive and Microsoft has not done much itself to reduce costs.
> > Windbg is “free”, but you still have to download it. Just printing the
> user
> > guide will chew up most of a ream of paper. MSDN is absurdly expensive
> and
> > appears designed to limit the ability to develop to those who have deep
> > pockets. MSDN Universal costs more than the two computers you need to
> write
> > drivers. Add in the IFS Kits and you need $10,000 just to start in the
> > first year. Remember when many shareware developers could write useful
> > utilities, TSRs, and drivers for MS-DOS with little or no expense except
> the
> > hardware. The costs seem to have shifted from hardware to software. I
> just
> > read that Microsoft has said that its costs for their operating systems
is
> > only $0.15 or $0.16 per dollar charged. Nice margins!
> >
>
> You do not, by any means, need an MSDN subscription to develop device
> drivers. If you have access to the internet then you’re completely set.
The
> DDK is practically free (just pay for the shipping), and the entire MSDN
> library is available for free on Microsoft’s website. The DDK comes with a
> compiler and everything you need to build a driver…in fact you don’t
> really even need access to the internet (of course access to the extra
> information is quite a help).
>
> Now there are some useful things lacking from not having a MSDN
> subscription, like checked OS builds, but I have actually never used them
> despite having access to them (I’ve only used a couple checked system
> drivers. ie. USB).
>
> You are correct on the IFS kit, it does cost a fair amount. I wish I could
> get my hands on it for free…oh well.
>
> In summary, if you’re just starting out, don’t feel as though you need
large
> capital in order to start developing for windows.
>
> Chris
>
> P.S. This doesn’t just apply to device drivers. You can develop
applications
> for free using MS tools as well (you don’t need Visual Studio…although
IMO
> it is a great product and I use it).
>
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@yoshimuni.com
> To unsubscribe send a blank email to %%email.unsub%%
>

I just went through the order form for the DDK and there is nothing about
needing a previous DDK. The DDK is “free” to anyone. If I’m wrong, then MS
better fix their site because there is nothing stating any conditions on the
“freeness” of the DDK.
I agree with the SMP machine, it is a great help in finding all those MP
bugs.

Chris

“David J. Craig” wrote in message
news:xxxxx@ntdev…

I think MSDN is required for someone in the development group to have
available. You can get the DDKs for “free” if you have one. I have also
found that keeping the old DDKs, SDKs, and operating systems to be necessary
because most of the world isn’t switching as quickly as Microsoft would
like. There is the archive pack with some of the old stuff too. I have
found that some documentation disappears if you don’t have access to the
older versions. Also there is one hardware “requirement” that OSR advises
and that is a 8x SMP system. Some deadlocks and other SMP issues may not
show up quickly on a single CPU or a dual processor. I remember releasing
one driver that had the no-SMP flag set. We didn’t have a SMP system to
test and the risk to our partners was deemed too high. I have been at a
company where only one or two of the systems had DVDs. Every other system
had CD-ROMs only. I prefer the paychecks get paid instead of having all the
toys I want, but I still want the toys.

I think that using the checked builds of the HAL and Kernel is required to
drivers stable. I don’t think that you need the entire checked OS for
drivers, but you may want it for some applications.

----- Original Message -----
From: “Chris Doré”
Newsgroups: ntdev
To: “NT Developers Interest List”
Sent: Monday, December 09, 2002 5:34 PM
Subject: [ntdev] Re: Writng and Debuging Drivers in C++

> >
> > It is expensive and Microsoft has not done much itself to reduce costs.
> > Windbg is “free”, but you still have to download it. Just printing the
> user
> > guide will chew up most of a ream of paper. MSDN is absurdly expensive
> and
> > appears designed to limit the ability to develop to those who have deep
> > pockets. MSDN Universal costs more than the two computers you need to
> write
> > drivers. Add in the IFS Kits and you need $10,000 just to start in the
> > first year. Remember when many shareware developers could write useful
> > utilities, TSRs, and drivers for MS-DOS with little or no expense except
> the
> > hardware. The costs seem to have shifted from hardware to software. I
> just
> > read that Microsoft has said that its costs for their operating systems
is
> > only $0.15 or $0.16 per dollar charged. Nice margins!
> >
>
> You do not, by any means, need an MSDN subscription to develop device
> drivers. If you have access to the internet then you’re completely set.
The
> DDK is practically free (just pay for the shipping), and the entire MSDN
> library is available for free on Microsoft’s website. The DDK comes with a
> compiler and everything you need to build a driver…in fact you don’t
> really even need access to the internet (of course access to the extra
> information is quite a help).
>
> Now there are some useful things lacking from not having a MSDN
> subscription, like checked OS builds, but I have actually never used them
> despite having access to them (I’ve only used a couple checked system
> drivers. ie. USB).
>
> You are correct on the IFS kit, it does cost a fair amount. I wish I could
> get my hands on it for free…oh well.
>
> In summary, if you’re just starting out, don’t feel as though you need
large
> capital in order to start developing for windows.
>
> Chris
>
> P.S. This doesn’t just apply to device drivers. You can develop
applications
> for free using MS tools as well (you don’t need Visual Studio…although
IMO
> it is a great product and I use it).
>
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@yoshimuni.com
> To unsubscribe send a blank email to %%email.unsub%%
>

>one driver that had the no-SMP flag set. We didn’t have a SMP system
to

test

Dual mobos are cheap, not much more expensive then usual mobos.

Max

Not that cheap if you get an “approved” motherboard with the Intel Xenon
processors. This was even more true about four years ago. No AMD SMP
systems at that time. I asked and other asked and the answer was get it
done and NO SMP. Later most of us got SMP systems for our desktops and we
tested and released a SMP version.

----- Original Message -----
From: “Maxim S. Shatskih”
To: “NT Developers Interest List”
Sent: Tuesday, December 10, 2002 8:50 AM
Subject: [ntdev] Re: Writng and Debuging Drivers in C++

> >one driver that had the no-SMP flag set. We didn’t have a SMP system
> to
> >test
>
> Dual mobos are cheap, not much more expensive then usual mobos.
>
> Max
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@yoshimuni.com
> To unsubscribe send a blank email to %%email.unsub%%
>

Why you need the “approved” one and Xeons for driver testing? Buy
something like Epox D3VA (around USD 120 in Moscow) and 2 usual
Pentium III chips. Works like a charm, and reproduces all race
conditions in the drivers you debug :slight_smile:

Remember then main task for you is to debug races, and races are the
same on AMD and on Intel. So, no need in AMD CPUs for dual.

Max

----- Original Message -----
From: “David J. Craig”
To: “NT Developers Interest List”
Sent: Wednesday, December 11, 2002 5:30 AM
Subject: [ntdev] Re: Writng and Debuging Drivers in C++

> Not that cheap if you get an “approved” motherboard with the Intel
Xenon
> processors. This was even more true about four years ago. No AMD
SMP
> systems at that time. I asked and other asked and the answer was
get it
> done and NO SMP. Later most of us got SMP systems for our desktops
and we
> tested and released a SMP version.
>
> ----- Original Message -----
> From: “Maxim S. Shatskih”
> To: “NT Developers Interest List”
> Sent: Tuesday, December 10, 2002 8:50 AM
> Subject: [ntdev] Re: Writng and Debuging Drivers in C++
>
>
> > >one driver that had the no-SMP flag set. We didn’t have a SMP
system
> > to
> > >test
> >
> > Dual mobos are cheap, not much more expensive then usual mobos.
> >
> > Max
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@yoshimuni.com
> > To unsubscribe send a blank email to %%email.unsub%%
> >
>
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to %%email.unsub%%
>