I'm taking over a legacy project at my job. Currently there is an issue running the app on Windows 7 that requires the user to run the app as administrator for full functionality/database connectivity. I have no experience with writing apps that need elevation. Where/What should i be looking for that would cause this? I don't want the application to need elevation.

thanks

What kind of problems do you have when you don't run it as Admin? Does it use/write to local files?

it does appear to write to a local file...i think. the elevation window does not give me a lot of details. the application appears to have it's own updater, as in another exe file other than the program itself, and that is what is causing the need for elevation.

Ah, then you probably have it installed in the Program Files (or the x86 version) directory. Those directories are purposely set so that only admin can write to them (this is a malware protection measure).

Try right clicking on the updater exe and set it to run as administrator. It should pop up the UC window when it runs, but it will run.

If you want to, you can set the directory that the exe is in to allow the user to read/write it. Right click on the directory and select properties. Select the security tab, add the user then set the advanced permissions. You might have to do this for every directory above where the exe resides, also.

it does appear to write to a local file...i think. the elevation window does not give me a lot of details. the application appears to have it's own updater, as in another exe file other than the program itself, and that is what is causing the need for elevation.

I believe there are only 2 ways a UAC dialog is invoked:
1. The *.exe has an embedded application manifest file requesting elevated privileges
2. The process is started with the verb set to "runas"

If you open the *.exe in notepad scroll to the very end of the file you should be able to XML data similar to:

<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    <security>
      <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
        <!-- UAC Manifest Options
            If you want to change the Windows User Account Control level replace the 
            requestedExecutionLevel node with one of the following.

        <requestedExecutionLevel  level="asInvoker" uiAccess="false" />
        <requestedExecutionLevel  level="requireAdministrator" uiAccess="false" />
        <requestedExecutionLevel  level="highestAvailable" uiAccess="false" />

            If you want to utilize File and Registry Virtualization for backward 
            compatibility then delete the requestedExecutionLevel node.
        -->
        <requestedExecutionLevel level="asInvoker" uiAccess="false" />
      </requestedPrivileges>
    </security>
  </trustInfo>
</asmv1:assembly>

Likewise if the application has a shield on the icon (Vista+) then it has an embedded manifest. If you can run the application as a normal user but sometimes it requests elevation then you're looking at "runas".

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.