DrvRemoveDriver

LRESULT
   DrvRemoveDriver(
       PREG_ACCESS
RegAccess
       );

The DrvRemoveDriver function unloads the kernel-mode driver and marks the kernel-mode driver service for deletion.

Parameters

RegAccess

Pointer to a globally-defined structure of type REG_ACCESS.

Return Value

Returns one of the following values.

Value Definition
DRVCNF_OK Kernel-mode driver service has been marked for deletion. Driver was not loaded prior to call.
DRVCNF_RESTART Kernel-mode driver service has been marked for deletion. Driver was loaded prior to call.
DRVCNF_CANCEL Attempt to mark kernel-mode driver service for deletion failed.

See the Comments section below.

Comments

The structure pointed to by RegAccess must be a single, globally-defined REG_ACCESS structure that the driver uses with all calls to drvlib.lib functions requiring a RegAccess parameter.

The DrvRemoveDriver function first checks to see if the kernel-mode driver is loaded and, if it is, calls DrvUnloadKernelDriver. Then it calls DrvDeleteServicesNode.

Typically, a user-mode driver calls DrvRemoveDriver from its DriverProc function, when processing a DRV_REMOVE command. The return values provided by DrvRemoveDriver match those specified for DRV_REMOVE.

The driver must call DrvCreateServicesNode before calling DrvRemoveDriver. After DrvRemoveDriver returns, the driver should call DrvCloseServiceManager.

For additional information, see Installing and Configuring your Driver, Using drvlib.lib.