Menu

Using TinyXML in a Windows kernel-mode driver

Developer
2009-07-03
2013-05-20
  • Charles Hanes

    Charles Hanes - 2009-07-03

    Has anyone tried using a modified version of TinyXML in a Windows kernel-mode driver?

    I know that the file operations will have to be modified, and the float and double attribute routines removed (using floating point is possible in kernel mode but not easy, so it is avoided if not needed).

    If not, is there another XML project that would be better suited for this purpose?

    I need to read in and parse a simple XML file, and be able to traverse the object tree and read attribute values.  All operations will be performed at "passive" priority level, so paging of code and data is possible.

    Any advice or suggestions are appreciated.

     
    • Mark Johnson

      Mark Johnson - 2009-08-28

      I know it sounds amusing, but the biggest single obstacle to using tinyXML in kernel mode is that it is written in C++ instead of C.  There is no C++ runtime library in kernel mode, among other obstacles.  Everything in the windows kernel is aimed at support of the C language, not C++.  The other problems are not so big.  Many people write kernel code using C++, but all of the tools and support for kernel mode development are for C, so it is an uphill battle.  The truly seasoned windows kernel developers understand that the chances of creating projects that and stable are best realized when you can capitalize on the resources provided.  There are reasons why Microsoft has gone this route, but that is a lengthy discussion.

       
    • Charles Hanes

      Charles Hanes - 2009-08-28

      Thanks for your response.

      I have TinyXml working now in Windows kernel mode, with changes as I originally outlined, plus, as you suggest, some minor runtime library additions.  I had to add isalpha() , isdigit(), and isalnum() for example, which otherwise would compile but did not link correctly.  I also had to change various print routine calls to kernel-mode equivalents so that they would compile.

      The biggest problem I encountered is that, as I mentioned, it is essential to only run at passive priority level, which means that you cannot hold a spinlock while loading the document.  Any attempt to do this will result in the IRQL_NOT_LESS_THAN_OR_EQUAL bluescreen.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.