On 8/12/2022 21:32, 'Li Mr' wrote:
> Hello, I want to know how to make the entire installation folder have
> administrator rights after the program is installed
If you really need to do that, then you need to give your program a
"requireAdministrator" manifest resource when you compile it. It might
be a setting in your compiler project.
However, for >90% of applications, you shouldn't do that -- this should
be treated as a bug in your code instead.
Applications installed per-machine (such that admin rights are required
to install) should not be attempting to write anything to their own
folder, as this is both a security hole and causes problems with
clashing data when multiple users attempt to run the app.
It is possible to grant write permissions at install time, but this is
still the wrong solution for most cases (and should be limited to
specific subfolders that do not contain executable files, if you must).
Either switch to per-user deployment (which limits your dependencies) or
(better) fix your app so that it stores runtime data in the per-user
paths instead.
https://learn.microsoft.com/en-nz/archive/blogs/patricka/where-should-i-store-my-data-and-configuration-files-if-i-target-multiple-os-versions