The WDM model is an extension of the NT driver model. DriverEntry still serves as the driver's initial entry point, but its responsibilities are reduced. In particular, the role of DriverEntry is limited to the announcement of other driver functions. Specifically, DriverEntry does not create device objects for hardware it is capable of controlling. A new driver function, AddDevice, is announced within (interestingly) the Driver Extension. The prototype for the AddDevice function is shown in Table 9.1 and is announced with code typical of the following: NTSTATUS DriverEntry( IN PDRIVER_OBJECT pDriverObject, IN PUNICODE_STRING pRegistryPath ) { : // Export other driver entry points... // for example... pDriverObject->DriverUnload = DriverUnload; pDriverObject->DriverExtension->AddDevice = AddDevice; : }
The prime responsibility of the AddDevice function is to create a device object using IoCreateDevice in the same manner described in chapter 6.
|