Event Mechanism and Flow

This section applies only to operating systems starting with Microsoft Windows Vista.

When a scan operation completes, the driver notifies an application through an event handle that the EventData member of the KSEVENT_TUNER_INITIATE_SCAN_S structure specifies. However, to determine the actual lock status of the scan operation, the driver's KSPROPERTY_TUNER_SCAN_STATUS property must be called.

Like all kernel-streaming event requests, the application can cancel a KSEVENT_TUNER_INITIATE_SCAN event request before the event completes. When the application requires the cancellation of the current scan operation, the tuner filter (KsTvTune.ax) sets the StartFrequency and EndFrequency members of KSEVENT_TUNER_INITIATE_SCAN_S to zero in a call to the driver's KSEVENT_TUNER_INITIATE_SCAN. The driver might perform an entire cleanup. However, because KsTvTune.ax might request another entire scan operation, the driver might not perform an entire cleanup. The call to cancel a scan operation is a synchronous operation.

When the application requires the termination of scanning, KsTvTune.ax calls KSEVENT_TUNER_INITIATE_SCAN with StartFrequency and EndFrequency set to zero to unregister the event. The driver then must perform the entire cleanup of its worker threads and other internal data structures.