ZwUnloadDriver routine
The ZwUnloadDriver routine unloads a driver from the system. Use this routine with extreme caution. (See the following Remarks section.)
Syntax
NTSTATUS ZwUnloadDriver( _In_ PUNICODE_STRING DriverServiceName );
Parameters
- DriverServiceName [in]
-
Pointer to a counted Unicode string that specifies a path to the driver's registry key, \Registry\Machine\System\CurrentControlSet\Services\DriverName, where DriverName is the name of the driver.
Return value
ZwUnloadDriver returns STATUS_SUCCESS or an error NTSTATUS value such as STATUS_INVALID_DEVICE_REQUEST.
Remarks
ZwUnloadDriver dynamically unloads a device or file system driver from the currently running system.
Note that a file system filter driver cannot safely be unloaded from a running system. Thus a filter should only use ZwUnloadDriver for debugging purposes. It should not call this routine in a retail version of the filter.
If DriverName is the name of a PnP device driver, ZwUnloadDriver returns STATUS_INVALID_DEVICE_REQUEST and does not unload the driver.
A minifilter should use FltUnloadFilter instead of ZwUnloadDriver to unload a supporting minifilter.
Note If the call to the ZwUnloadDriver function occurs in user mode, you should use the name "NtUnloadDriver" instead of "ZwUnloadDriver".
Requirements
|
Version | Available in Windows XP and later versions of Windows. |
|---|---|
|
Header |
|
|
Library |
|
|
IRQL | PASSIVE_LEVEL |
|
DDI compliance rules | PowerIrpDDis, HwStorPortProhibitedDDIs |
See also
Send comments about this topic to Microsoft
Build date: 5/2/2013