Hi,
For a program I'm writing I need to detect the insertion/removal of
media from removable media devices, and for that I'm using the
WM_DEVICE_CHANGE Windows message. The problem is that while it works
fine with CD/DVD devices and USB flash drives, it doesn't notify me when
memory cards are inserted/removed from a card reader. The card reader
behaves like a CD-ROM drive in that the letter is allocated when the
reader is connected, then as cards are inserted their contents become
available.
I've tried different ways using the RegisterDeviceNotification API
without success. I could use polling of course but it doesn't seem to me
very efficient.
I'm sure this should be possible because the Windows Explorer does
somehow detect the changes.
Does anybody know of a sure way (user/kernel mode) to receive those
notifications?

Thanks for any hint.

Eduardo

Re: Memory card reader insertion/removal notification by Maxim

Maxim
Wed Jul 06 15:15:15 CDT 2005

Polling once per second or 0.5 seconds is fine.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com

"Eduardo Francos" <efrancos@wanadoo.fr> wrote in message
news:42cba92f$0$883$8fcfb975@news.wanadoo.fr...
> Hi,
> For a program I'm writing I need to detect the insertion/removal of
> media from removable media devices, and for that I'm using the
> WM_DEVICE_CHANGE Windows message. The problem is that while it works
> fine with CD/DVD devices and USB flash drives, it doesn't notify me when
> memory cards are inserted/removed from a card reader. The card reader
> behaves like a CD-ROM drive in that the letter is allocated when the
> reader is connected, then as cards are inserted their contents become
> available.
> I've tried different ways using the RegisterDeviceNotification API
> without success. I could use polling of course but it doesn't seem to me
> very efficient.
> I'm sure this should be possible because the Windows Explorer does
> somehow detect the changes.
> Does anybody know of a sure way (user/kernel mode) to receive those
> notifications?
>
> Thanks for any hint.
>
> Eduardo



Re: Memory card reader insertion/removal notification by Eduardo

Eduardo
Thu Jul 07 04:05:19 CDT 2005

Maxim S. Shatskih wrote:
> Polling once per second or 0.5 seconds is fine.
>

Right, it works. I could even go up to three to five seconds without
loosing functionality but I'd really prefer a notification system

Re: Memory card reader insertion/removal notification by Maxim

Maxim
Thu Jul 07 13:02:59 CDT 2005

Let's look. Card insert is a media insert, not device insert (unlike USB
flash drive).
CdRom.sys driver has some ways of signalling the OS about the media insert.
Maybe the card reader's driver does this too - some WM_DEVICECHANGE code is
IIRC about the media insert.
But, if the card reader's driver has no such thing (it should call the
routine named something like IoNotifyVolumeEvent) - then polling is the only
way.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com

"Eduardo Francos" <efrancos@wanadoo.fr> wrote in message
news:42cceeea$0$3140$8fcfb975@news.wanadoo.fr...
> Maxim S. Shatskih wrote:
> > Polling once per second or 0.5 seconds is fine.
> >
>
> Right, it works. I could even go up to three to five seconds without
> loosing functionality but I'd really prefer a notification system



Re: Memory card reader insertion/removal notification by Eduardo

Eduardo
Fri Jul 08 02:58:56 CDT 2005

Maxim S. Shatskih wrote:
> Let's look. Card insert is a media insert, not device insert (unlike USB
> flash drive).
> CdRom.sys driver has some ways of signalling the OS about the media insert.
> Maybe the card reader's driver does this too - some WM_DEVICECHANGE code is
> IIRC about the media insert.
> But, if the card reader's driver has no such thing (it should call the
> routine named something like IoNotifyVolumeEvent) - then polling is the only
> way.
>

I understand. I guess that either Windows Explorer or Windows has a
hidden service that does some kind of polling then.
Looks like it will have to be a polling solution :-(

Thanks

Eduardo