WdfDeviceSetStaticStopRemove function (wdfdevice.h)

[Applies to KMDF and UMDF]

The WdfDeviceSetStaticStopRemove method informs the framework whether a device can be stopped and removed.

Syntax

void WdfDeviceSetStaticStopRemove(
  [in] WDFDEVICE Device,
  [in] BOOLEAN   Stoppable
);

Parameters

[in] Device

A handle to a framework device object.

[in] Stoppable

A Boolean value that indicates whether the specified device can be stopped and removed. If TRUE, the device can be stopped and removed. If FALSE, the device cannot be stopped and removed.

Return value

None

Remarks

A bug check occurs if the driver supplies an invalid object handle.

By default, a device can be stopped and removed. Therefore, a driver typically calls WdfDeviceSetStaticStopRemove only if it must temporarily set the Stoppable parameter to FALSE. For example, a driver that controls a DVD writer might call WdfDeviceSetStaticStopRemove with Stoppable set to FALSE before it begins burning a DVD. After the driver has finished burning the DVD, it would call WdfDeviceSetStaticStopRemove again with Stoppable set to TRUE.

If your driver's device is supporting a special file (see WdfDeviceSetSpecialFileSupport), the framework will not allow the device to be stopped or removed. In this case, your driver does not have to call WdfDeviceSetStaticStopRemove .

The driver must match every call to WdfDeviceSetStaticStopRemove with Stoppable set to FALSE with a call to WdfDeviceSetStaticStopRemove with Stoppable set to TRUE.

Calling WdfDeviceSetStaticStopRemove with Stoppable set to FALSE does not prevent the framework from notifying the driver if the device is unexpectedly removed (surprise-removed).

For more information about how to prevent the operating system from stopping a device, see Handling Requests to Stop a Device.

Examples

The following code example informs the framework that the specified device cannot be stopped and removed.

WdfDeviceSetStaticStopRemove(
                             device,
                             FALSE
                             );

Requirements

Requirement Value
Target Platform Universal
Minimum KMDF version 1.0
Minimum UMDF version 2.0
Header wdfdevice.h (include Wdf.h)
Library Wdf01000.sys (KMDF); WUDFx02000.dll (UMDF)
IRQL <=DISPATCH_LEVEL
DDI compliance rules DriverCreate(kmdf), KmdfIrql(kmdf), KmdfIrql2(kmdf), KmdfIrqlExplicit(kmdf)