HOWTO: Create Device Objects in Dispatch Routines

Last reviewed: February 17, 1998
Article ID: Q126368
The information in this article applies to:
  • Microsoft Win32 Device Development Kit (DDK) for Windows NT, versions 3.5, 3.51

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;
Keywords          : NTDDKKMode
Version           : WINNT:3.5,3.51;
Platform          : winnt
Issue type        : kbhowto


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 17, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.