views:

125

answers:

3

hi!

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 ?

A: 

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

Vantomex
The question wasn't "why does my app need elevation and fail without it?", it was "why does my app ask for elevation?" While it would be cool if apps requested elevation simply because they need it, that's not what happens. The reasons why apps request elevation are not obvious to most developers - some of them are listed in other answers to this question.
Kate Gregory
My answer even can be also applied to the latter one. Questioner should provide enough background and expectation description, so that there is no multiple interpretation to his/her question.
Vantomex
+2  A: 

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.

Kate Gregory
@Plastkort which one worked? the manifest or the rename?
Kate Gregory
+1  A: 

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).

Manuel Gonzalez