How To Create Device Objects in Dispatch Routines (126368)



The information in this article applies to:

  • Microsoft Windows NT 4.0 Driver Development Kit (DDK), when used with:
    • the operating system: Microsoft Windows NT
  • Microsoft Windows 2000 Driver Development Kit (DDK), when used with:
    • the operating system: Microsoft Windows 2000
  • Microsoft Windows XP Driver Development Kit (DDK), when used with:
    • the operating system: Microsoft Windows XP

This article was previously published under Q126368

SUMMARY

Most Windows NT kernel-mode device drivers create their device objects in either the DriverEntry routine or in a routine called by the DriverEntry routine. However, it is possible to create device objects in Dispatch routines.

After the device object has been created (IoCreateDevice) and the initialization is complete, the flag DO_DEVICE_INITIALIZING must be cleared before the device object can be used. If this flag is not cleared, CreateFile requests for this device object will fail (that is, applications will not be able to open the device).

Clear the flag as follows:
   deviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
				

Modification Type:MinorLast Reviewed:10/6/2004
Keywords:kbhowto KB126368