VhfDelete function (vhf.h)

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


void VhfDelete(
  [in] VHFHANDLE VhfHandle,
  [in] BOOLEAN   Wait


[in] VhfHandle

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

[in] 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 is reserved and should not be passed. See Remarks for more information.

Return value



The HID source driver must stop initiating new requests for the Virtual HID Framework (VHF) just before calling VhfDelete.

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.

VhfDelete cannot be called asynchronously (Wait parameter set to FALSE) or at any IRQL higher than PASSIVE_LEVEL. Doing so may result in undefined behavior.

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. VhfDelete may be called on a VHFHANDLE without having previously called VhfStart.


Requirement Value
Target Platform Windows
Header vhf.h
Library VhfKm.lib

See also

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