Detect when a USB Token with digital signature is insert or remove
Can i detect when a USB Token with digital signature is insert or remove in a USB plug?
Re: Detect when a USB Token with digital signature is insert or remove
What does it show up as?
If it's just a storage drive you can check the file list on, that's easiest.
But if it's some special hardware device that doesn't show up as a drive letter you'd need to use RegisterDeviceNotification/WM_DEVICECHANGE to detect DBT_DEVICEARRIVAL notifications for the devinterface class GUID giving you the specific device type like smart cards, security devices, sensors, etc.
Re: Detect when a USB Token with digital signature is insert or remove
Quote:
Originally Posted by
fafalone
But if it's some special hardware device that doesn't show up as a drive letter you'd need to use RegisterDeviceNotification/WM_DEVICECHANGE to detect DBT_DEVICEARRIVAL notifications for the devinterface class GUID giving you the specific device type like smart cards, security devices, sensors, etc.
Thank you
it's a SmartCard and i want to detect only if it's insert or when insert/remove
Re: Detect when a USB Token with digital signature is insert or remove
If, when connected, it's in the Device Manager under the "Smart cards" category, then you'd use RegisterDeviceNotification with DBT_DEVTYP_DEVICEINTERFACE and DEVICE_NOTIFY_ALL_INTERFACE_CLASSES, then WM_DEVICECHANGE to detect DBT_DEVICEARRIVAL/DBT_DEVICEREMOVECOMPLETE and be looking for a device with the class guid {990A2BD7-E738-46C7-B26F-1CF8FB9F1391}
Re: Detect when a USB Token with digital signature is insert or remove
Quote:
Originally Posted by
fafalone
If, when connected, it's in the Device Manager under the "Smart cards" category, then you'd use RegisterDeviceNotification with DBT_DEVTYP_DEVICEINTERFACE and DEVICE_NOTIFY_ALL_INTERFACE_CLASSES, then WM_DEVICECHANGE to detect DBT_DEVICEARRIVAL/DBT_DEVICEREMOVECOMPLETE and be looking for a device with the class guid {990A2BD7-E738-46C7-B26F-1CF8FB9F1391}
Thank you
1 Attachment(s)
Re: Detect when a USB Token with digital signature is insert or remove
Quote:
Originally Posted by
fafalone
...device with the class guid {990A2BD7-E738-46C7-B26F-1CF8FB9F1391}
my guid seems to be {50dd5230-ba8a-11d1-bf5d-0000f805f530}
Attachment 194001