2

I have Windows 7 64bit installed on a virtual box (the fact it is a virtual box shouldn't be relevant). I need to overwrite /Windows/System32/d3d9.dll but the system won't let me.

I've read the same "solution" on a lot of forums, except nobody mentions it doesn't work at all:

takeown -f filename
cacls filename /G username:F

which both succeed. But then, when I try to delete the file, I still get access denied. And I am doing all this in safe mode AND within CMD being run as administrator.

What is the working way to delete the file so I can replace it? (or directly overwrite it)

2 Answers 2

5

The only sure way to delete/replace the file that is used by a running system is to do it from outside of it. E.g. boot off Windows 7 Install CD in Recovery Mode, open command prompt and proceed with the commands you quoted in your question. The DLL won't be in use, and you'll be able to delete it.

3

Because you are running in a Virtual Box environment it is very relevant because you can power down the VM, mount the underlying virtual harddrive in Windows 7 disk management and then replace the file you need as you would any other file.

2
  • Do you mean mounting the virtual harddrive on the host? I forgot to mention my host is Ubuntu linux. Is there a way I can mount the virtual drive on ubuntu and delete files inside it? What is Windows 7 disk management?
    – matteo
    Jan 11, 2012 at 0:06
  • I don't know how to mount the virtual harddisk under Ubuntu. Windows 7 Disk Management is one of the system tools that lets you manage disks. A feature that was added in Windows Vista and above is to mount VHDs as a standard drive (new drive letter effectively). If I had known what your host OS was I would not have mentioned mounting the disk since I can not tell you how. Jaimg's answer is the better solution for you here.
    – Top__Hat
    Jan 11, 2012 at 14:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .