Old 28th August 2017, 07:53   #1
Luke123
Junior Member
 
Join Date: Aug 2017
Posts: 3
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 is offline   Reply With Quote
Old 28th August 2017, 11:41   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,610
RequestExecutionLevel? Windows version?

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 28th August 2017, 12:52   #3
Luke123
Junior Member
 
Join Date: Aug 2017
Posts: 3
RequestExecutionLevel isn't being used for this installer.

I tested it with Windows Server 2012 R2 and Windows 7.
Luke123 is offline   Reply With Quote
Old 28th August 2017, 17:44   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,610
You should use RequestExecutionLevel to make sure there are no compatibility shims applied to your process.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 29th August 2017, 10:07   #5
Luke123
Junior Member
 
Join Date: Aug 2017
Posts: 3
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.
Luke123 is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump