VhfDelete function

The HID Source device driver calls this method to delete a VHF device.

Syntax

void VhfDelete(
  VHFHANDLE VhfHandle,
  BOOLEAN   Wait
);

Parameters

VhfHandle

A handle to a virtual HID device that your HID source driver received in the previous call to VhfCreate.

Wait

TRUE to return synchronously after deleting a device. In this case, Virtual HID Framework (VHF) does not return until the device is reported as missing to PnP Manager and EvtVhfCleanup callback function returns.

FALSE to return asynchronously. See Remarks for more information.

Return Value

This method does not return a value.

Remarks

The HID source driver must stop initiating new requests for the Virtual HID Framework (VHF) just before calling VhfDelete. VhfDelete can be called synchronously or asynchronously.

To call VhfDelete synchronously, call it at PASSIVE_LEVEL with the Wait parameter set to TRUE. In this case, it returns synchronously after completing the deletion. If the HID source driver has registered an EvtVhfCleanup callback function with VHF, it invokes that callback before VhfDelete returns. The function might be invoked on the same thread.

To call VhfDelete asynchronously, call it at maximum DISPATCH_LEVEL. If you call it at DISPATCH_LEVEL, then Wait parameter must be set to FALSE, the function returns immediately. VHF invokes the EvtVhfCleanup callback at a later time after the deletion has completed.

There are no restrictions on when a KMDF driver should call this function. It is recommended to call it from a function matching the VhfCreate call. For example, if VhfCreate is called from EvtDriverDeviceAdd, then call VhfDelete synchronously from EvtDeviceCleanupCallback.

Requirements

   
Target Platform Windows
Header vhf.h
Library VhfKm.lib
IRQL If Wait is TRUE, PASSIVE_LEVEL; if Wait is FALSE <= DISPATCH_LEVEL

See Also

Write a HID source driver by using Virtual HID Framework (VHF)