onggie80 Posted February 18, 2004 Posted February 18, 2004 Hi, Does anyone know how i can detect when any unauthorized device is plugged into the USB port? In my case an unauthorized device would include a USB mouse or a thumb drive. I need to be able to detect if any of these 2 are plugged into my machine. Thanks :) Quote
*Gurus* Derek Stone Posted February 18, 2004 *Gurus* Posted February 18, 2004 You'd have to detect the initial install using the RMS API provided by the Win32 device subsystem. You can then query the device using [api]DeviceIOControl[/api] to determine its purpose. Quote Posting Guidelines
*Gurus* Derek Stone Posted February 18, 2004 *Gurus* Posted February 18, 2004 Just to expand you'd look for the WM_DEVICECHANGE message and filter for a "wParam" value that equates to DBT_DEVICEARRIVAL. LParam will be a pointer to a PDEV_BROADCAST_VOLUME if the device is of a media type (check for DBT_DEVTYP_VOLUME in the PDEV_BROADCAST_HDR structure). Quote Posting Guidelines
onggie80 Posted February 19, 2004 Author Posted February 19, 2004 Hi Derek, Thanks for the pointer I managed to solve my problem by using properties of Win32_USBControllerDevice Realised that it returns a standard device ID for the particular USB device that i am checking for. Thanks once again! :D Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.