Skip to content
⌘ NSIS Forum Archive

overwriting DLLs in C:\Windows (32- and 64-bit)

5 posts

Luke123#

overwriting DLLs in C:\Windows (32- and 64-bit)

Hello guys, hopefully you can help me with my problem.

I have a programm that, when being updated with my installer, needs to replace two DLL-files (32- and 64-bit) in "C:\Windows" with their new version.

Now those DLLs should only be replaced when the user who starts the setup has the rights to write there. Also if the user can't replace one of those files then none of them should be replaced.

I managed to do this by trying to open the existing files with "FileOpen (a)" and if there are any errors then not replace and without errors then do replace.

I then tested this by first giving myself no rights to write to the 32-bit DLL and after that the same for the 64-bit version.

The first one is located in "C:\Windows\SysWOW64" (32-bit). When trying to open it without having the rights then there is an error and both files are being skipped automatically. That's how it's supposed to work.

The second one under "C:\Windows\System32" (64-bit) apparently can be opened while not having the rights because there is no error being output.

Why is that so? Is there any significant difference between 32- and 64-bit DLLs regarding the user's rights?

Thanks for your answers!
Luke123#
RequestExecutionLevel isn't being used for this installer.

I tested it with Windows Server 2012 R2 and Windows 7.
Anders#
You should use RequestExecutionLevel to make sure there are no compatibility shims applied to your process.
Luke123#
Thanks for your answer!

I will look into using RequestExecutionLevel. I took over the scripts from a colleague and just started working with those.

I actually managed to solve my problem. There was a "DisableX64FSRedirection" missing so Windows didn't find the correct directory for the 64-bit DLL.