locked
There will pop-up a "UAC" dialog when my program run. RRS feed

  • Question

  • Hello everyone

    I have a program. It will connect internet .

    There always pop-up a "UAC" dialog when my program run.

    It tip "A unidefentified program wants access to you compater"

    now ,I want remove this dialog when my program run

    What can i do ?

    my program is build by VC6, and it must be work well in other Operate System.

    Please help me .

    thanks.

    Friday, October 13, 2006 7:17 AM

All replies

  • I'm not sure, but it sounds like your program might be being (mis)detected as an installer.  If that's what's going on you can fix the issue by embedding an application manifest into your application exes.  You might try looking at the 'manifest files for vista' thread.  Your desired requestedExecutionLevel (assuming you're not doing adminish things, intentionally or unintentionally) would be 'asInvoker'.
    Saturday, October 14, 2006 5:01 AM
  • Dear David Tyler Hunt:

    Thank for your reply.

    Yes ,I read the WindowsVistaUACDevReqs.doc article (Page 60 -68)

    but I can't find any way  to embedding a mainifest file into my application exes.

    There said can use mt.exe to insert the manifest,but is use in managed code, my program

    is build by VC6++ .

    How to embedding a manifest file into VC6++ program?

     

    other way :

    I use "Run by Administrtor" in context menu (whether same as embedding a manifest??) but is also have the problem.

    Thanks again.

    Ricmy

     

    Monday, October 16, 2006 7:32 AM
  • To imbed a manifest resource into your exe built using VC6, do as follows:

    1. Make sure that your project includes an rc (i.e. resource) file. If not, create one, and include it in the dsp.

    2. Create a text file containing the manifest. Let's say it is called manifest.txt. The contents will be something like this:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
      <assemblyIdentity version="1.0.0.0"
         processorArchitecture="X86"
         name="myexename.exe"
         type="win32"/>

      <!-- Identify the application security requirements. -->
      <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
        <security>
          <requestedPrivileges>
            <requestedExecutionLevel
              level="asInvoker"
              uiAccess="false"/>
            </requestedPrivileges>
           </security>
      </trustInfo>
    </assembly>

    Instead of "myexename.exe", you should use the actual name of the exe, but this is not essential. Instead of "1.0.0.0", you should use the actual version of the exe, but this is definitely not important. If you want your exe to always run as administrator - after popping up an elevation dialog as necessary - replace "asInvoker" with "requireAdministrator".

    3. Include the following line in your rc file:

    1    24      MOVEABLE PURE   "manifest.txt"

    That's all there is to it.

    • Proposed as answer by Fisnik Hasani Friday, October 30, 2009 8:55 AM
    Monday, October 16, 2006 2:02 PM
  • Dear  efratian:

     

    Thank your helps .

    I will try it .

     

    Ricmy

     

    Tuesday, October 17, 2006 12:46 AM
  • Hi,

    I have try this with VC6,, but no pop up message shown..

    Any possible way to get administrator privilege for oly one time request for user..

    next timer system restart and application restart.. no need to prompt to user for permission...?

    Thanks

    Saturday, December 9, 2006 8:32 AM
  •  

    One quick way you can do this is put the word "Setup" into the filename of the exe that you want elevated.  This method of manifest embedding didn't work for me either.
    Wednesday, January 16, 2008 1:45 PM
  •  

    An embedded manifest should always work - provided you did it right.

     

    Some common errors:

      typos in schema names

      used wrong requestedExecutionLevel

      embedded manifest at wrong ID

      embedded manifest under "RT_MANIFEST" instead of RT_MANIFEST (if you fail to include the right headers in a .rc file, it often interprets RT_MANIFEST as a string, not as a resource directory id).

      tried to use an external manifest when an embedded one was already in the EXE (on vista, embedded is preferred over the .manifest file)

      tried to use an external manifest, and external manifest caching causes the new external manifest not to get picked up (workaround: update the time stamp on the .exe - copy paste, rebuild, whatever).

     

    In any case, you don't want to do the thing with 'setup', which won't work in all environments - like if installer detection is turned off - and you can't pass the logo requirements without a requestedExecutionLevel on your exes.

    Wednesday, January 16, 2008 7:19 PM
  •  

    "and you can't pass the logo requirements without a requestedExecutionLevel on your exes."

     

    haha, I really don't think this is anything a company should be worried about.  Logo certification is extremely over rated, writing quality software that works on the other hand is, and a logo does not guarantee a quality product.

    Monday, January 28, 2008 7:49 PM
  • Hi,

     

    My legacy  application is in VC6.0.  And i embed my manifest file into the rc file and linked that with exe. I ran the application in vista.  It worked fine with no UAC prompt.  I used requireAdministrator.  Now in the same application when i am writing into the registry i want the UAC prompt.  I mean my exe should run with no UAC prompt but when i require to access certain direcotories or writing into the registry i want UAC prompt.

     

    How to do that

    Regards

     

    Wednesday, July 2, 2008 10:33 AM
  •  subramanyeswari wrote:

    Hi,

     

    My legacy  application is in VC6.0.  And i embed my manifest file into the rc file and linked that with exe. I ran the application in vista.  It worked fine with no UAC prompt.  I used requireAdministrator.  Now in the same application when i am writing into the registry i want the UAC prompt.  I mean my exe should run with no UAC prompt but when i require to access certain direcotories or writing into the registry i want UAC prompt.

     

    How to do that

    Regards

     

     

    Hi there,

     

    You have 1 of 2 ways, either make a separate application which you use to do this which requires administrator priviledges every time, or handle a command line value in your application, for example...

     

    [application entry point]

    1.  Check command line arguments

    2.  If argument is found to modify the registry, perform registry manipulation then quit

    3.  Otherwise continue as normal

     

    Then when you need to modify the registry you must invoke the application as an administrator with the necessary command line arguments.  You can do this by invoking the "runas" verb and using ShellExecute.

     

    Nick.

    Wednesday, July 2, 2008 4:47 PM
  • Hi,

     

     

    I tried including the manifest file and application shortcut still prompts UAC pop ups.

     

    Included the same manifest file, with my exe name and version, this option is not working.

     

    do we need to do something else than this.

     

    Thanks,

    nethra

    Thursday, July 3, 2008 7:28 AM
  •  Nethra wrote:

    Hi,

     

     

    I tried including the manifest file and application shortcut still prompts UAC pop ups.

     

    Included the same manifest file, with my exe name and version, this option is not working.

     

    do we need to do something else than this.

     

    Thanks,

    nethra

     

    Hi Nethra,

     

    Are you are trying to stop UAC prompts?

     

    The prompt won't appear automatically, so unless you have changed the manifest to include the invoker arguments it should not prompt.  What is the filename of your executable file?

     

    Nick.

     

    Thursday, July 3, 2008 12:56 PM
  •  

    Hi again Nethra,

     

    I think I understand what you are trying to do now.  Embedding a manifest with the invoker information in will not prevent the UAC prompt from appearing, the only way to do that is to disable the UAC system wide (not recommended).  The idea is to cause Vista to elevate the priviledges for the application (via the UAC prompt) so that it can be allowed to modify the system, not so the application can silently run, that would defeat the point of UAC.

     

    Alternatively you can try and design your application so that it does not need administration priviledges to run.

     

    Nick.

    Thursday, July 3, 2008 1:00 PM
  • I have similar problem.

    The program is on MFC (VS2005) with manifest that allows Elevated level of execution.

    I also want to get rid of the UAC prompt.




    If I understand correctly to do so I have to sign it (manifest only?) with trusted certificate.

    Is it correct ? Will it remove UAC prompt ?

    Assuming this is correct,let's say I want to buy certificate from VeriSign (do not want to mess with self issued), they have so many types - which one I have to use ?

    Monday, July 14, 2008 4:09 PM
  • Code Snippet

    The program is on MFC (VS2005) with manifest that allows Elevated level of execution.

     

     

    You mean you have a requestedExecutionLevel of 'requireAdministrator'?  That will pretty much guarantee an elevation prompt.  Signing will make your prompt look friendlier, but the correct way to avoid a prompt is to author your application in such a way as to reduce your need for administrative privileges.  You should probably peruse MSDN for more documents relating to UAC so you understand the feature a little bit better.
    Monday, July 14, 2008 8:02 PM
  • Thank you, after doing some research by myself on the topic I also came to this conclussion.

    The biggest problem for me is that there is no single place where I can find all the limitations listed.
    I mean there are probably a dozen of places I can look in but no single place where it all gathered. I am not even 100% sure my program needs elevated level - it does reads and writes into a registry , but writes into "software" section of HKEY_LOCAL_MACHINE and HKEY_CURRENT_USER , it does not writes into a "Program Files" but it runs other programs and it uses 3rd party SDKs (primary accessing the cameras with provider made API)  so I am not sure if I need it or not.
    Tuesday, July 15, 2008 5:22 AM
  • If those other applications require administrative privleges, they can specify them explicitly.  3rd party SDKs is another matter.   If you want to figure out what your current issues are, you might look at the LUA buglight tool: http://blogs.msdn.com/aaron_margosis/archive/2008/06/13/lua-buglight-2-0-preview.aspx

     

    Writing to a key under HKEY_LOCAL_MACHINE usually requires Admin privileges.  If you're using HKEY_LOCAL_MACHINE\Software\YourApp as a globally writeable registry location, though, you can modify the ACL on the key during your installation such that it doesn't require elevated privileges for a user to modify them.  If your installation software doesn't have built-in functionality for specifying ACLs of registry keys, you can write some custom code to apply one.  Take a look at ConvertStringSecurityDescriptorToSecurityDescriptor on MSDN, if you need to do that.

    • Proposed as answer by Fisnik Hasani Wednesday, October 21, 2009 6:28 PM
    Tuesday, July 15, 2008 7:31 PM
  •  David Tyler Hunt wrote:

    If you're using HKEY_LOCAL_MACHINE\Software\YourApp as a globally writeable registry location, though, you can modify the ACL on the key during your installation such that it doesn't require elevated privileges for a user to modify them. 



    That's exactly where we write.
    Can you please elaborate a bit on how to do it or point to some link to read about it ?
    Btw: we use InstallShield 2008  so I guess it might have such functionality built in , right ?
    Wednesday, July 16, 2008 12:50 PM
  • Hi - I think my information can help you:

    A User Account Control (UAC) message like this one seen below:



    UAC Message "An unidentified program wants access to your computer"

    The reason why you're getting a message bar like the above is because, your
    application isn't signed with a digital signature (or the digital signature is not valid).

    In order for you to get a UAC message bar like the one shown (See below the entire text),
    you need to pay Microsoft® for a digital signature, and they will validate your application
    and then sign it for you, so your application becomes a Windows Vista™ and a Windows® 7
    compatible app and also earn the "Works with Windows Vista
    " or "Works with Windows ® 7"
    logo, and so the system its self will accept your application as a valid program.



    UAC Message "A program needs your permission to continue"


    That's it, this is the information you need!

    I hope the above information was helpful...

    Have a nice day...

    Best regards,
    Fisnik  
    Coder24.com
    • Proposed as answer by Fisnik Hasani Wednesday, October 21, 2009 6:28 PM
    Sunday, October 11, 2009 4:26 PM
  • Hello ricmy:

    How is the situation on your side?
    Is this thread solved or NOT?

    Please tell me!

    Have a nice day...

    Best regards,
    Fisnik

    Coder24.com
    Wednesday, October 21, 2009 6:28 PM
  • Hello ricmy: How is the situation on your side? Is this thread solved or NOT? Please tell me! Have a nice day... Best regards, Fisnik
    Coder24.com
    Friday, October 23, 2009 4:26 PM
  • Hello ricmy:

    How is the situation on your side?
    Is this thread solved or NOT?

    Please tell me!

    Have a nice day...

    Best regards, Fisnik
    Coder24.com
    Saturday, October 24, 2009 6:49 AM
  • Hi ricmy:

    How is the situation on your side?
    Is this thread solved or NOT?

    Please tell me!

    Have a nice day...

    Best regards,
    Fisnik
    Coder24.com
    Friday, November 13, 2009 7:39 PM
  • Hi again:

    How is the situation on your side?
    Is this thread solved?

    Please tell me!

    Have a nice day...

    Best regards,
    Fisnik
    Coder24.com
    Sunday, December 27, 2009 10:21 AM
  • Hi again:

    Is this thread solved or NOT?
    Please tell me!

    Have a nice day...

    Best regards,
    Fisnik

    Coder24.com
    Saturday, January 2, 2010 2:29 PM
  • Hi - I think my information can help you:

    A User Account Control (UAC) message like this one seen below:



    UAC Message "An unidentified program wants access to your computer"

    The reason why you're getting a message bar like the above is because, your
    application isn't signed with a digital signature (or the digital signature is not valid).

    In order for you to get a UAC message bar like the one shown (See below the entire text),
    you need to pay Microsoft® for a digital signature, and they will validate your application
    and then sign it for you, so your application becomes a Windows Vista™ and a Windows® 7
    compatible app and also earn the "Works with Windows Vista
    " or "Works with Windows ® 7"
    logo, and so the system its self will accept your application as a valid program.



    UAC Message "A program needs your permission to continue"


    That's it, this is the information you need!

    I hope the above information was helpful...

    Have a nice day...

    Best regards,
    Fisnik  
    Coder24.com

    Now I understand more about it, Thanks for your analysis!
    Wednesday, January 12, 2011 12:09 PM