Why does my application requires admin priviliges when placed in C:\Program Files on windows 10 but not on windows 7?

随声附和 提交于 2019-12-20 03:16:42

问题


My Java RCP application (App.exe) was recently converted from 32-bit to 64-bit. Since it is a 64-bit application i have used NSIS to create an installer which will dump all the required files along with App.exe in C:\Program Files. When the App.exe is run, i am getting a security exception(Access denied) when the application tries to open files (in C:\Program Files) in edit mode to dump the results/logs. When i run App.exe as administrator it works fine. It also works fine in windows 7 64-bit machine even when run in non-admin mode.

Any idea, as what to do to run App.exe in non-admin mode ?

Note : This is not the problem of NSIS as samething was working fine as a 32-bit application.


回答1:


Basically, the programs files directory is always protected.

You should check the WIN 7 users privileges and the user's UAC settings.

Meanwhile....


You might want to reconsider where to store your data.

There is a SO post about that here

To put it straight, ProgramData contains application data that is not user specific.This data which will be available to all users on the computer. Any global data should be put in here.

AppData folder contains configuration settings, downloaded information/files for a particular user. So, for example any user specific preferences and profile configurations can be stored in the AppData folder. The AppData folder is further divided into three subfolders
Roaming - This folder contains data that can move with your user profile from a computer to another.
Local - This folder contains data that will not move with your user profile.
LocalLow - You can put in lowlevel access information such as information related to web browser running in a protected mode in this folder.



来源:https://stackoverflow.com/questions/50758075/why-does-my-application-requires-admin-priviliges-when-placed-in-c-program-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!