Detecting Devices with Plug and Play

< BACK  NEXT >
[oR]

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;      : } 

Table 9.1. Function Prototype for an AddDevice Routine
NTSTATUS AddDevice IRQL ==9 PASSIVE_LEVEL
Parameter Description
IN PDRIVER_OBJECT pDriverObject Pointer to driver object
IN PDEVICE_OBJECT pdo Pointer to physical device object
Return value Success or failure code

The prime responsibility of the AddDevice function is to create a device object using IoCreateDevice in the same manner described in chapter 6.

< BACK  NEXT >


The Windows 2000 Device Driver Book(c) A Guide for Programmers
The Windows 2000 Device Driver Book: A Guide for Programmers (2nd Edition)
ISBN: 0130204315
EAN: 2147483647
Year: 2000
Pages: 156

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net