- lists and hash maps
- Posted by zde on September 30th, 2003
Hello,
I am doing first steps with kernel mode programming and want to ask if there
is some library like STL for using in kernel mode? I need to use lists and
hash maps in my trial driver and I belive that it's already implemented by
someone.
Thanks
- Posted by Ray Trent on October 1st, 2003
Oh no, the C++ wars ride again...
Seriously, though, I wouldn't recommend it. Even if you could get it
to work (which is tricky due to the fact that STL throws exceptions a
lot), lists and hashes are straightforward to write, and the extra
complexity introduced into the driver by including STL isn't really
worth the saved work. You'll probably just end up debugging a hard bug
later rather than implementing a simple class now.
zde wrote:
--
.../ray\..
- Posted by Don Burn on October 1st, 2003
Well the kernel gives you a whole set of list primatives, single and double
linked lists, both thread safe and not. If you have the IFS kit, it even
has queue you can wait on. It would be pretty stupid to go try to roll your
own instead of using the provided mechaisms.
Simple hash maps are pretty simple to do, so why are you not implementing
what you need yourself. Again with the IFS kit, the kernel provides a
number of complex high level data structure primatives.
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
"zde" <conio@seznam.cz> wrote in message
news:uScTmEyhDHA.2420@TK2MSFTNGP10.phx.gbl...
- Posted by Alexei Jelvis on October 1st, 2003
First of all if you really need STL you can use C++ to build your driver. It
is not recommended but it works.
Single and double linked lists are well documented in DDK.
Kernel exports set of functions that provide functionality similar to STL
map, but those functions documented only in IFS kit and not documented in
DDK. If you don't have IFS kit you can check GNU ntifs.h available in
internet and look for "generic table".
Alexei.
"zde" <conio@seznam.cz> wrote in message
news:uScTmEyhDHA.2420@TK2MSFTNGP10.phx.gbl...
- Posted by lallous on October 1st, 2003
Hello,
This has been discussed many times, google group search:
http://groups.google.com/groups?q=stl+kernel+windows
--
Elias
http://lgwm.org/
"zde" <conio@seznam.cz> wrote in message
news:uScTmEyhDHA.2420@TK2MSFTNGP10.phx.gbl...
- Posted by Stephan Wolf on October 1st, 2003
The kernel world is a simple one. No "high level" functionality
available, sorry. (Ok, there is, to some extent...)
Simple lists can be implemented using InsertTailList() etc.
No hash functions available that I am aware of.
Stephan
---
On Tue, 30 Sep 2003 09:05:04 +0200, "zde" <conio@seznam.cz> wrote:
- Posted by Peter Viscarola on October 1st, 2003
"zde" <conio@seznam.cz> wrote in message
news:uScTmEyhDHA.2420@TK2MSFTNGP10.phx.gbl...
It will take you FAR longer to figure out how to moveCOjbect or CMap into
the kernel than to just write the freakin' think yourself. A hash table
isn't very difficult to write (there's a ton of guidance on how to do this
on th web), and writing your own gives you the opportunity to decide on the
characteristics you want for the table.
If you need more complex table handling (such as auto-balancing binary
trees) there ARE functions in the IFS kit to handle this, as folks
described.
But for something dumb like CMap or CArray, you can probably write this (as
good or better than the STL implementation) in about an hour.
Peter
OSR
- Posted by Carl Appellof on October 1st, 2003
No hash functions, but there ARE balanced binary tree (or "splay tree")
functions like
RtlInsertGenericTable()
RtlLookupGenericTable().
Unfortunately, documentation and prototypes are only available to the lucky
few who have a spare $1000 to buy the IFS kit.
As someone else suggested, you could look at the "public domain" copy of
ntifs.h, which should have prototypes for these functions.
Carl
"Stephan Wolf" <stewo68@hotmail.com> wrote in message
news:tf2lnvsq6cjad7oovq2nk62hsdt8a7lqd8@4ax.com...
- Posted by Ray Trent on October 1st, 2003
Whoa, recursion... my head's spinning.. the parent article itself
appears near the top of the search results triggered by the link (and
now, presumably, this article will too... blurk).
lallous wrote:
--
.../ray\..
- Posted by Phil Barila on October 3rd, 2003
"Peter Viscarola" <PeterGV@osr.com> wrote in message
news:Otaa1HCiDHA.2400@TK2MSFTNGP11.phx.gbl...
Who said anything about CList or CMap? That would be std::list & std::map.
I agree with you, if you are going to use something as ugly and non-portable
as a CMap or CList, you might as well write your own.
Phil
--
Philip D. Barila Windows DDK MVP
Seagate Technology, LLC
(720) 684-1842
As if I need to say it: Not speaking for Seagate.
E-mail address is pointed at a domain squatter. Use reply-to instead.
- Posted by zde on October 3rd, 2003
Thanks you all for your help!
I tryed to move std::list and std::map into the kernel - it seems to work
(if exception handling and synchronization disabled), but it's without
warranty, i think:-) Finally it was challenge for me to get it working..and
now I will implement lists and hash maps on my own...for the peace of my
mind:-)
zde
Zdenek Polnicky NetLimiter Team www.netlimiter.com
"zde" <conio@seznam.cz> wrote in message
news:uScTmEyhDHA.2420@TK2MSFTNGP10.phx.gbl...
- Posted by Duh Pohmelja on October 7th, 2003
zde wrote:
That package allows quite simple disabling of any exceptions you can
have in STL. They do not support NT kernel mode multithreading issues
for now, but if you don't use IOStreams and protect all shared STL
objects with spinlock or mutex - it is the best C++ (in meaning of
execution speed and develop time) solution ever.
STL's algorithms for work with hash maps, lists, allocators & iterators
are greatly optimal ones. I believe, just like Phil Barila said, if you
try to implement your own solution it would be just as dumb and ugly as
CMap/CList.
Just my 2 cents, Duh.