A blog describing computer internals and electronics, from a student's viewpoint

"Paperbacks"

Sunday, March 14, 2010

Kernel-mode Applications under Windows XP

Recently, I have been making a dynamic-link library consisting of two main types of code: one that I actively learn through both trainings and algorithm books, and the other that are rewrites of old code I found in my data archives dating ~3 years back. For performance reasons, I decided to rewrite the code for operation as a device driver (which kernel-mode software are more commonly called by.) In the course of porting to kernel space, I came across this scenario: The well-beloved C runtime library of Windows, MSVCRT.DLL, has an almost non-existent equivalent for applications written to operate in kernel-mode. Of course, things like localization are not important for kernel-mode software, for their purpose is interfacing the operating system kernel to various hardware peripherals like CD-ROMs and USB host controllers. But C functions such as malloc(), free(), rand() and the str* series of functions, are very commonly used. The question is why Microsoft did not implement a kernel-mode equivalent of MSVCRT.DLL that contains even the most basic of C functions.

Because of this, I was forced to re-implement some C functions such as sin(), cos(), sqrt(), memcpy() and memset() . Being just a hobbyist, do not expect me to make a kernel-mode dynamic-link library without causing dreaded blue screens, in a short span of time; expect years. Some of the C functions now have a good-enough implementation, but many others are just "do nothing" stubs. I'll post a copy soon.

Upcoming hobby project for kernel-mode programming : an audio filter that is chained to a hardware driver to have dancing lights. :P

P.S. Do not ever expect me to make drivers for Vista and 7. The digital signatures required are way beyond my reach.

No comments:

Post a Comment