Thursday, December 28, 2006

A simple way 2 fix DMA problem of HDD in windows XP

Windows XP has a somewhat bad (IMHO) feature
that sets off the DMA of hard drives and CD/DVD drives when it gets CRC error in
reading the filesystem. This frequently happens when you are having subsequent power
cuts or if you have a bad sectors in your drive. And thus PC crawls when we want
to access data from that drive, as OS then retrieves data in PIO mode.



This problem has been bugging me for some time. So hacked my way into "regedit"
and finally made this script. This script deletes the registry entry that Windows
uses to calculate what addressing mode to use when accessing the drives. So upon
running the script, just rebooting PC will
force windows re-detect the drive resulting in restoration of UDMA mode 5 for the
hard drive.



Here is the code


#####################

REG DELETE HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E96A-E325-11CE-BFC1-08002BE10318}\0001
/v "MasterIdDataCheckSum" /f



REG DELETE HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E96A-E325-11CE-BFC1-08002BE10318}\0001
/v "SlaveIdDataCheckSum" /f



REG DELETE HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E96A-E325-11CE-BFC1-08002BE10318}\0002
/v "MasterIdDataCheckSum" /f



REG DELETE HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E96A-E325-11CE-BFC1-08002BE10318}\0002
/v "SlaveIdDataCheckSum" /f

#####################



Put this code fragment inside a text file and rename it to
"dma_restore.bat" or something like
it. Make sure you change the extension to ".bat".
Upon running the file, you may see some errors like "Error: the
system was unable to find the specific registry key or value". Do not worry
about it. Just
reboot
and your PC should be
fine in the next run.