Newly compiled application requires UAC/elevation?

半世苍凉 提交于 2019-12-22 23:13:18

问题


I have a system, I set it up as a normal with UAC, and in my delphi environment I compile my project named ka.exe, I create a installshield project for it.

setup and everything completes ok! but whenever I start my program, it requires elevation and I don't have any clue why.

just to be sure installshield is not playing mindgames on me, I compiled a new .exe, and copy it manually over to my networked computer.

the icon looks the same, and it also have this UAC shield on it.

my project has some functions inside that might be talking with a network shared name, and talking with a SQL database...

so why does my app need elevation to run ?


回答1:


First, if you are able to with Delphi, add an embedded manifest with asInvoker. If you can't, then make an external one and put it in the same folder as the exe. If the shield disappears, great.

If not, then things get murkier. Sometimes when you run an app, Windows comes along afterwards and says "that might not have worked; would you like to try again with recommended settings?". If you say ok, there is a group policy stored away that will elevate that app for the rest of time. It does appear that if you rename the exe the effect of the group policy stops. You could try that.




回答2:


Even if the filename has no "SETUP" or "INSTALL" string, Windows may think it needs elevation if the VersionInfo resources include such texts.

Check VersionInfo, try to clean any suspicious string, as I believe that Windows checks even more texts (like non-English texts).




回答3:


On Windows Vista and later, when UAC was enabled, administrators still doesn't have full rights as we saw in Windows XP and below. If your program trying to do one of administrative tasks (e.g. requests in system protected locations; write data to protected locations such as %ProgramFiles%, Windows directory, HKEY_LOCAL_MACHINE; and many more), your program needs to request elevation to bring the consent UI prompt to appear which need approval by administrators.

You'll get some detail info here



来源:https://stackoverflow.com/questions/3862786/newly-compiled-application-requires-uac-elevation

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