Saturday, February 19, 2011

suppress autoplay

I need to suppress autoplay for the mass storage devices. This needs to be achieved programatically through a service/deamon running in the background.

I know it can be done by an application which opens a window and handles the "queryCancelAutoPlay" message sent by windows.

Can this be done without GUI.I have the guid/pid/vid for the device whose autoplay needs to be disabled.

From stackoverflow
  • There is a registry entry that controls AutoRun:

    HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer
    

    This can be set to disable AutoRun on specific device types, from technet:

    NoDriveTypeAutoRun
    
    Value   Meaning
    0x1     Disables Autoplay on drives of unknown type.
    0x4     Disables Autoplay on removable drives.
    0x8     Disables Autoplay on fixed drives.
    0x10    Disables Autoplay on network drives.
    0x20    Disables Autoplay on CD-ROM drives.
    0x40    Disables Autoplay on RAM drives.
    0x80    Disables Autoplay on drives of unknown type.
    0xFF    Disables Autoplay on all types of drives.
    
    bobince : As the key implies, that only works for optical discs, not mass storage devices. And it has unwanted side-effects like breaking the updating of the disc name/icon in My Computer. The ‘disable autoplay’ group policy is a better way to disable AutoPlay globally.
    Robert Gamble : @bobince, I was thinking CD/DVD since that is where I usually see AutoPlay, I updated to include specific device types.
  • Sure. You can create a message-only window. That gives you a HWND without those annoying WM_PAINT messages etc. The other way is to use COM, IQueryCancelAutoplay

  • Thanks for the response

    But as I mentioned, this needs to be achieved programatically through a service/deamon running in the background.

    No registyry changes allowed.

    Can anyone help me on this? Thanks in advance

0 comments:

Post a Comment