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

1

3

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.

Gabrielgabriela answered 8/6, 2018 at 9:58 Comment(4)
As far as I know, the programs files directory was always protected. Are you sure that the win7 user isn't a admin with low UAC settings?Pyrrha
Ps; you might want to check %programdata%, %appdata% etc, : see #16276639Pyrrha
@Stefan, Sorry, i missed to check the UAC setting in Windows 7. It was set to low, so set it to default and the same issue persists as in Windows 10Gabrielgabriela
I am in doubt to post it as answer, although it seems a simple thing, it's also easy to overlook. I'll post it but also flag your question and let the community decide.Pyrrha
P
2

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.

Pyrrha answered 8/6, 2018 at 10:41 Comment(3)
But, this is not the case with my 32-bit application. When a 32-bit application is installed in C:\Program Files, i don't see this kind of problem. Is it something to do with the bitness ?Gabrielgabriela
Stefan, Does the above comment make sense ?Gabrielgabriela
Hmm, no. As far as I know program files is protected by default. But... security settings can be changed. Btw, the 32-bit folder typically is c:\program files (x86)Pyrrha

© 2022 - 2024 — McMap. All rights reserved.