Chapter 22: Device Drivers and Services

Device drivers are modules that provide the interface between the operating system and the hardware. Device drivers take on an air of mystery because they're a mix of operating system–specific code and hardware customization. Most application developers are quite happy to let the real operating system junkies handle writing device drivers. This chapter shows you that while dealing with hardware can be a pain, the basic structure of a Windows CE driver is actually quite simple. An application developer might even have reasons to write a driver every now and then.Real operating system junkies also know about services. Under Windows XP, a service is a background application that typically runs in the background. Services can be automatically started when the operating system boots, or be manually started. They can also be stopped and restarted as needed. Windows CE .NET supports services, although not with the same architecture as Windows XP services. Instead, Windows CE services are quite similar to Windows CE drivers, as we will see. In this chapter, I'll first introduce drivers, because the basics of that discussion is important to both drivers and services, and then I'll dive into how to write a Windows CE service.