DriverEntry Return Values

A DriverEntry routine returns an NTSTATUS value, either STATUS_SUCCESS or an appropriate error status.

The DriverEntry routine should postpone any call to IoRegisterDriverReinitialization until just before it returns STATUS_SUCCESS. It must not make this call unless it will return STATUS_SUCCESS.

If a DriverEntry routine returns an NTSTATUS value that is not a success or informational value, such as STATUS_SUCCESS, the driver for that DriverEntry routine is not loaded.

A DriverEntry routine that will fail initialization must free any system objects, system resources, and registry resources it has already set up before it returns control. It should reset the driver's dispatch entry points in the driver object for IRP_MJ_FLUSH_BUFFERS and IRP_MJ_SHUTDOWN to NULL if the driver supports these requests.

If a driver will fail initialization, the DriverEntry routine also should log an error before returning control. See Logging Errors.

Note that a driver's Unload routine is not called if a driver's DriverEntry routine returns a failure status.

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft