2008年8月2日 星期六

USB 儲存裝置(隨身碟, 外接式硬碟)自動執行 Autorun

USB Storage - FAQ for Driver and Hardware Developers
Q: What must I do to trigger Autorun on my USB storage device?
The Autorun capabilities are restricted to CD-ROM drives and fixed disk drives. If you need to make a USB storage device perform Autorun, the device must not be marked as a removable media device and the device must contain an Autorun.inf file and a startup application.

The removable media device setting is a flag contained within the SCSI Inquiry Data response to the SCSI Inquiry command. Bit 7 of byte 1 (indexed from 0) is the Removable Media Bit (RMB). A RMB set to zero indicates that the device is not a removable media device. A RMB of one indicates that the device is a removable media device. Drivers obtain this information by using the StorageDeviceProperty request.
不同的Windows 版本似乎對 "卸除式(DRIVE_REMOVABLE)" 裝置有不同的處理, 如僅就WinXP 來說, WinXP 不支援卸除式裝置的自動執行, 其中包含了絕大多數的USB 讀卡機和隨身碟, 這是和韌體設計有關, 解決的方法是安裝第三方軟件, 例如APO USB Autorun 或者購買包含附加功能的USB 隨身碟, 例如U3 的U3 Smart Drive

另外要注意的是, 一旦USB 儲存裝置能夠自動執行(例如USB 外接式硬碟), 那麼拔除前最好能 "安全地移除硬體", 因為固定式和卸除式磁碟機的差異之一就是寫入快取, Windows XP 預設為固定式磁碟機啟用寫入快取, 如果未經正常卸除, 則可能會造成資料遺失

Tips for USB pen drives
Troubleshooting for USB pen drives under Windows XP

卸除式與 USB 儲存裝置
Enabling and Disabling AutoRun
Using and Configuring AutoPlay
Preparing Hardware and Software for Use with AutoPlay
NoDriveTypeAutoRun
NoDriveAutoRun
CDROM Autorun
CDROM AutoRunAlwaysDisable

沒有留言: