0

I need to rename a certain dll on my Windows 7 machine (a comctl32.dll, to be precise) in order to replace it with another version of this file.

I tried:

  1. [under: Right-click, properties, security, permissions, advanced, owner] changed owner to current user and [under: right-click, security] gave all possible permissions to current user. Tried [Right-click, rename] - can't rename it, access denied.
  2. Started an admin cmd (elevated rights), and used the force:

    takeown /f comctl32.dll
    icacls "comctl32.dll" /grant (current user):F
    rename comctl32.dll comctl32.old 
    

    Got permission denied.

  3. That made me angry so I started a shell as Systems user (following the steps oulined in [1]) and tried to rename the file using rename comctl32.dll comctl32.old in this shell. Resulted again in permission denied.

I thought the systems-shell gives me basically god-mode, so this is pretty upsetting! Anyone got any further suggestions on how to rename this file or what denies me access? I'm totally at loss!

[1] http://blogs.technet.com/b/askds/archive/2008/10/22/getting-a-cmd-prompt-as-system-in-windows-vista-and-windows-server-2008.aspx

//EDIT:
By now I also tried the Unlocker tool. It couldn't rename the file, but promised to try and do so after reboot. I rebooted the system but my old friend hasn't changed names still.

//EDIT 2:
Based on the downvotes and comments I would like to add a line of warning for my fellow users with the same question. Only do this if you know what and why you are doing it. Otherwise you might crash your system.
I in fact do know what I do: I need to replace a file that already IS corrupted. What I do not know is HOW to do it. So no need to mention the dangers here or downvote the question just because it might be dangerous to system integrity. In fact just using a system is in the end a danger to its integrity - why punishing a legitimate question for the same property?

7
  • 6
    NEVER DO THIS; THIS WILL BREAK YOUR WINDOWS! This sounds like a XY problem:meta.stackexchange.com/questions/66377/what-is-the-xy-problem Oct 13, 2015 at 4:27
  • Indeed this is an XY problem. However I don't need help with my actual problem, which would be to complicated to post here anyway. I need help with the realization of my solution. I know quite precisely what I do, which you might have gathered from the solutions I tried so far. So while I thank you for warning me I have to say that I regard it as highly impolite to downvote a question based on the unwarranted assumption of incompetence of the OP. Why not just assume OP knows what he does and help him? :)
    – Zakum
    Oct 13, 2015 at 15:25
  • 2
    if you need the replace a corrupted file, run sfc /scannow and run checksur: technet.microsoft.com/en-us/library/ee619779%28WS.10%29.aspx Oct 13, 2015 at 16:10
  • 1
    @Zakum: I would listen to the others' suggestions and explain your reasoning better. If you just want to fix a corrupted system file, there are automatic methods for doing it that don't involve circumventing most of Windows' security measures.
    – qasdfdsaq
    Oct 13, 2015 at 16:45
  • 1
    Install the update KB2966583 in Win7 and run DISM /Online /Cleanup-Image /Scanhealth Oct 14, 2015 at 4:29

2 Answers 2

2

You can't get access to it (regardless of your permissions) because Windows itself is using it to function.

Boot from another OS (like say, a Linux LiveCD or a Windows install disk) and rename it from there.

Warning: This a really bad idea, and will possibly keep your Windows from booting. Ensure you make a full backup first.

2
  • There are multiple versions of comctl.dll on my system that are all located in different subdirectories of System. These are used by different programs. The particular one I need to replace got corrupted, so what I try to do is safe. Especially since at the moment of replacing it is not used - neither by the system nor by any running program. Otherwise the warning would not have been one of permission being denied but one of the file being currently in use. I will try your suggestion of course, although I don't see how that could actually help with a permission problems.
    – Zakum
    Oct 13, 2015 at 15:37
  • 1
    @Zakum: "Access denied" is exactly the warning you would get when trying to modify system files that are locked because they are in use.
    – qasdfdsaq
    Oct 13, 2015 at 16:44
2

If the file is being use by the kernel then you cant rename it without unloading it from memory first. such as by using Windows recovery console to rename it.

If it is not being used by a process, then you may be able to rename it however windows file protection might either make a copy with the original name, or rename it back again.

The quickest way to patially disable windows file protection you must delete the following file:

C:/windows/system32/restore/filelist.xml

I advise you - unless its on a test installation of the OS to backup the file you wish to rename first, but you can also just expand it from the binary file on the windows CD:

expand -r filename.dl_ C:/windows/system32

This will create the filename.dll in system32, obvioustly youll have to replace filename with the dll's filename.

Alternitivley you can use debug.exe to disable windows file protection but that is way more risky and takes about half an hour

You must log in to answer this question.

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