I want to create a program Foo.exe with error logging into foo.log. That program is installed (NSIS Installer) into C:\Program Files (x86)\Foo\. During installation NSIS added a shortcut (CreateShortCut "$SMSTARTUP\Foo.lnk" "$INSTDIR\Foo.exe") to start Foo.exe when windows starts.
C:\Program Files (x86)\Foo\foo.log. Workaround for that is to store editable files in another directory e.g. in $APPDATA.FooNew.exe. This file does not have any permissions (explicitly not the execute-flag).FooCopy.exeFooCopy.exe opens FooNew.exe and writes it content into Foo.exe. Now, Foo.exe is updated and has the execute-permission.FooCopy.exe will be removed.So I have not testet the updating but most likely it wont work. I assume that Foo.exe can not create files in C:\Program Files (x86)\Foo\ so the updating fails at point 1.
An idea is to save Foo.exe not in C:\Program Files (x86)\ but in $APPDATA. So the program has all needed rights. The question is starting that program: It is compiled for 32-bit. Is it possible to have a "launcher" C:\Program Files (x86)\Foo\launcher.exe which starts the real application in $APPDATA?
That's confused, isn't it? How could I change the auto-update procedure so that UAC will not kick me?
As an example I see firefox.exe. How does it updating, thus, writing directly into C:\Program Files (x86)\... when normally no one could write into that directory without prompting the user.
Chris
Firefox uses a NT service. Services normally run as SYSTEM so it can copy files anywhere and Mozilla configures their service so it can be started by a normal user.
It does not make sense to have a launcher in program files and the main app in appdata, you might as well do a per user install in that case (Like Chrome etc).
I assume your application is not a web-browser so keeping it up to date is probably not that critical. I would suggest that your updater just checks for updates and if there is a update you can spawn yourself again (or the main updater?) as Administrator using UAC and then do the update.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With