Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

:)

  • *Gurus*
Posted
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).
Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...