David
Fri Feb 06 19:22:05 CST 2004
I see you still don't have a clue. A couple of people on this list have
seen some of my code and it that works and is clean. It was written in
C++ using DriverWorks. I don't mind a 'smart C programmer' eating up
stack space. They will know the limitations of the environment and how
to overcome any problems. It is the newbie who has taken a few college
courses in programming basic and now thinks they can write drivers using
a sample and not even reading the DDK documentation. SoftIce had its
time and used to love it when I had to do the same drivers in 9x and NT,
especially since Windbg was extremely unstable. SoftIce's ability to
use a 3COM Ethernet card was also useful, especially since Windbg could
only do serial. I have found that with the transfer of ownership of the
various pieces of Compuware Numega's Driver Studio, it is priced far too
high. Another problem is Microsoft's soon to be framework. It may
solve many of the problems I used DriverWorks for in the past.
If you can't write drivers using C and the Microsoft APIs, you have no
business writing them with a framework. Early versions of DriverWorks
caused interesting problems if a pending status was returned to certain
commands since the code was only checking for the error bit to be set.
I had to report that bug and the fix to Numega. I actually started
using VtoolsD when it was Steve's code around 1995, I think. At one
time, Numega had a combo that could handle a driver that worked on both
9x and NT. This was before WDM and 2000. I have heard good things
about VMware, but never used it. I found that actually having two
machines to be easier and much safer for my primary system. Testing
code on your primary system is very dangerous, especially when the code
is a driver. Restoring a test system using Partition Magic from one HD
to another is fast and simple when the test image is only a few
megabytes.
Recently I had to write code for MS-DOS. One was an application that
used the BIOS and the other was a driver written in assembly. I am glad
I still had SoftIce for DOS, but I also have Periscope which is good
too, but not source code based. Restoring that partition was less than
a couple of seconds using Ghost.
I have been doing this so long, it is easy. I also enjoy being a
curmudgeon. P.S. I sometimes try to be helpful, but not much lately.
The overload of newbie questions has pushed me to be more of a lurker
than a participant, but I do like to stir the pot once in a while. Even
Walter slowed down participating for a while due to slowness in this
business. Consulting can be a bear as I know of many who are having
problems.
"G." <na@na.na> wrote in message
news:OTP21wQ7DHA.1428@TK2MSFTNGP12.phx.gbl...
> Helpfull as ever, i see.
> Should you be writing drivers?
>
> C++ is juat a tool, you use it for good or evel. C++ dosn't eat stack
space
> on it's own, and a smart C programmer could eat the stack space as
well.
>
> DriversStudio from Compuware offers a complete C++ framework, VS.NET
> integration, you can compile from inside the IDE, etc...2 verry good
kernel
> debugers, SoftICE for local debuging and VisualSoftICE for remote
debuging,
> that in combination with VMware it's a must have for driver
development,
> IMHO
>
> "David J. Craig" <SeniorDriversWriter@shogunyoshimuni.com.net> wrote
in
> message news:umHs4ZP7DHA.2300@TK2MSFTNGP10.phx.gbl...
> > Oh, we need C++ in the kernel. RTTI sounds good. Maybe we can use
half
> > of the 64-bit CPU's address space for the kernel if they add all
this
> > stuff. Also we need at least 32MB stacks in the kernel too - not a
> > measly 12KB.
> >
> > "Don Burn" <burn@stopspam.acm.org> wrote in message
> > news:1027ve610tnuuc9@corp.supernews.com...
> > > Actually, this does not work, since the compiler will call delete
> > without
> > > for some things. So you always new with the tag and the tag says
you
> > must
> > > free with the tag, then the compiler frees without the tag for a
blue
> > > screen! I believe Microsoft is looking in to the question of
object
> > > orientation in the kernel, but I'm not sure you will ever see C++
> > blessed,
> > > it is too easy for the novice to think C++, so I will use RTTI and
> > STL, and
> > > other things that should never live in the kernel.
> > >
> > >
> > > --
> > > Don Burn (MVP, Windows DDK)
> > > Windows 2k/XP/2k3 Filesystem and Driver Consulting
> > > Remove StopSpam from the email to reply
> > >
> > >
> > > "Vitaly" <anonymous@discussions.microsoft.com> wrote in message
> > > news:04301907-E391-4CDE-B951-3844231DD8F1@microsoft.com...
> > > > Re: delete() with parameters, as any C++ method it allows
> > overloading;
> > > consider:
> > > >
> > > > void * __cdecl operator new(size_t Size, POOL_TYPE Type, ULONG
Tag)
> > > > {
> > > > return ExAllocatePoolWithTag(Type, Size, Tag);
> > > > }
> > > >
> > > > void __cdecl operator delete(void* p, ULONG Tag)
> > > > {
> > > > if (p) ExFreePoolWithTag(p, Tag);
> > > > }
> > > >
> > > > IMHO: with enough effort and care C++ can be tuned up to be an
> > efficient
> > > tool for kernel development. The C++ side effects (ones you
mentioned
> > and
> > > many others) could be taken care of by a kernel C++
subset/library,
> > endorsed
> > > and thoroughly tested by an entity setting standards in Windows
driver
> > > development... Until this happens, C++ in the kernel will remain a
> > realm of
> > > few enthusiasts. IHMO,
> > > >
> > > > - Vitaly
> > > >
> > > >
> > > > ----- Don Burn wrote: -----
> > > >
> > > > Actually you can use C++ in the kernel, and there have been
> > many wars
> > > on
> > > > newsgroups on whether you should. For a simple environment
for
> > C++
> > > handling
> > > > see the "C++ kernel runtime environment" from
> > >
http://www.hollistech.com/.
> > > >
> > > > WARNING MY HUMBLE OPINION STARTING
> > > >
> > > > The problem with C++ in the kernel is not if you should,
but
> > how to
> > > > constrain the world if you do. C++ is a powerful language
that
> > can
> > > generate
> > > > a lot of code behind your back (I used to run a code
generator
> > group
> > > for a
> > > > major compiler firm, so been there and done that). This
> > represents a
> > > > problem for the driver developer since it is easy for the
> > compiler to
> > > do
> > > > things you didn't intend, so of the biggies are:
> > > >
> > > > 1. Surprise copy constructors, where allocations an
> > copies
> > > occur
> > > > without it being obvious
> > > > 2. Large stack usage, remember the kernel has a
very
> > limited
> > > stack
> > > > 3. Code generation at unexpected times, this is a
> > variant of
> > > the
> > > > copy constructor, but can really nail you when you use
pageable
> > code
> > > > sections in the kernel.
> > > > 4. Interesting potential interactions between C++
> > exception
> > > handling
> > > > and structured exception handling.
> > > >
> > > > One other major complaint I have is that I now use
> > > ExFreePoolWithTag
> > > > whenever possible to add the check that I am freeing what I
> > think,
> > > since C++
> > > > doesn't allow parameters on destructors I cannot do this.
> > > >
> > > > I try never to use C++ in the kernel, except as a
better
> > C.
> > > Other
> > > > folks including parts of Microsoft do use it (though in
> > Microsofts
> > > case I
> > > > understand they check the generated code quite thoroughly).
> > > >
> > > > MY HUMBLE OPINION OFF
> > > >
> > > > It is your choice, there are some interesting
decisions
> > to
> > > make.
> > > >
> > > >
> > > > --
> > > > Don Burn (MVP, Windows DDK)
> > > > Windows 2k/XP/2k3 Filesystem and Driver Consulting
> > > > Remove StopSpam from the email to reply
> > > >
> > > > "Peter" <pskvarka@softinengines.com> wrote in message
> > > > news:%232wPf%23H7DHA.2576@TK2MSFTNGP11.phx.gbl...
> > > > > Question about C++ and NDIS
> > > > >> Hi,
> > > > >> I have some experiences with developing
> > > > > TDI,Protocol and Intermediate drivers.
> > > > >> In all my drivers I have used C language.
> > > > > For me it is known some guidelines relating to writing
> > > > > kernel-mode drivers which I red in DDK doc.
> > > > > For example: Use ANSI C, dont use any standard C runtime
> > library
> > > > > function that maintains state,....etc.
> > > > >> My question is:
> > > > > What is wrong with C++ in kernel-mode ?
> > > > > I red some older articles in MSDN where are examples,
> > > > > where are defined new operator, delete operator with help
of
> > > > > kernel-mode memory allocation etc.
> > > > >> I heart something about:
> > > > > "Kernel can not process code compiled with C++ compiler
> > normal way"
> > > > > but If it is true I dont understand why.
> > > > >>> What is wrong with C++ in Kernel mode ?
> > > > > Especially what is wrong with C++ in NDIS drivers ?
> > > > >>> Thanks !
> > > > > Peter
> > > > >>>
> > >
> > >
> >
> >
>
>