Media Change Notifications of CDRom

Hi,

I am currently writing a minifilter to filter CD-Rom device. I am trying to get
notification of a media change so I can detect when a CD has been loaded/ejected.
Can anyone tell me how exactly to do to get the notification.

Thanks

Not sure what exactly you need but you can get this sort of information through device events (e.g. GUID_IO_MEDIA_ARRIVAL/GUID_IO_MEDIA_REMOVAL). You can register for these in kernel mode using IoRegisterPlugPlayNotification for EventCategoryTargetDeviceChange.

thanks @“Scott_Noone_(OSR)” I need monitor this because when user use a raw CD I can’t get notify in instanceSetup when it replugin. So if I want block it I don’t know it is a new CD or it is the old one.