Windows XP Locking Video Files Software & Sites 19 JUN 2008

AVI IconWindows XP has a nasty habit of locking corrupt or incomplete video files, and you’ll often find yourself screaming in frustration as your latest attempts to delete the offending file keeps resulting in an annoying Windows error message proclaiming:

“Cannot delete FILE_X: It is being used by another person or program. Close any programs that might be using the file and try again.”

It turns out that the problem is caused by Window’s pesky Windows XP Shell Media Extension (shmedia.dll) which is the .dll that Windows uses in order to give you all those nice video file statistics in the Explorer status bar, as well as the video preview thumbnail that appears under the file’s details tab to the left of the Explorer window.

The problem is that when shmedia.dll encounters a corrupt or incomplete video file (or even one simply using an unknown codec), it crashes, effectively locking the file. And because the .dll is executed under Explorer, the file will basically remain locked until you logout and log back into Windows!

Now you can try killing the Explorer process from Task Manager and then deleting the file via the command line, but often this rather simple solution fails to do the trick. Of course, if you don’t like using the command line to delete files anyway, you can take a different approach by temporarily unregistering the offending shmedia.dll (run regsvr32 /u shmedia.dll), restarting Explorer and deleting the file, and then re-registering shmedia.dll (run regsvr32 shmedia.dll). This method is a little cleaner than directly hacking away at the registry, and if you find that you don’t actually need the data provided by shmedia.dll anyway, you may as well just leave it unregistered.

Note: There is also a bad bug in older versions of VirtualDub’s frameclient that causes shmedia.dll to fall over for all video files, not just broken ones. The problem only occurs if you have manually installed the AVIFile frameclient using auxsetup.exe and also enabled proxy mode via the proxyon.reg file. Uninstalling the frameclient or turning off proxy mode is usually sufficient enough to fix this particular problem. (Apparently this issue has since been patched from VirtualDub version 1.6.0 onwards)

(And as an extra little tip, you can also run regsvr32 /u shimgvw.dll to disable image previews, should they also be plaguing your system unnecessarily.)

For those of you who do however like mucking about in the Windows registry, there is yet another, more final fix to the shmedia.dll problem, a solution which basically stops Windows from loading the handler up in the first place. So after making a registry backup just for safety’s sake, you can remove the following key to give you the desired effect: HKLM, “SOFTWAREClassesCLSID{87D62D94-71B3-4b9a-9489-5FE6850DC73E}InProcServer32”

Hopefully you now have enough tools in your arsenal to deal with this rather pesky problem that’s been bugging me for ages already!

About Craig Lotter

South African software architect and developer at Touchwork. Husband to a cupcake baker and father to two little girls. I don't have time for myself any more.

  • Thanks!!! “Hopefully you now have enough tools in your arsenal to deal with this rather pesky problem that’s been bugging me for ages already!”