CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 17

Thread: UAC on WIndows7

  1. #1
    Join Date
    Jul 2006
    Posts
    203

    UAC on WIndows7

    To run exe which require administrator right, i use ShellExecute to run as admin in Initinstance method. It works fine and my exe run as admin.
    But UAC windows give a message "An unidentified program want to access..........."
    It's not secure.
    http://www.codeproject.com/KB/vista-...12&fr=26#xx0xx
    To make my program secure i follow above link, create and add bin file to my project and write below contents in it.
    But it does not work. Please suggest i want a window like in given link

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <assemblyIdentity processorArchitecture="x86" version="5.1.0.0" type="win32" name="myexe.exe"/>
    <description>myexe</description>
    <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    <security>
    <requestedPrivileges>
    <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
    </requestedPrivileges>
    </security>
    </trustInfo>
    </assembly>

  2. #2
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: UAC on WIndows7

    You need to sign your executable using a code signing certificate.
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

  3. #3
    Join Date
    Jul 2006
    Posts
    203

    Re: UAC on WIndows7

    can you give some example/link

  4. #4
    Join Date
    Dec 2008
    Posts
    144

  5. #5
    Join Date
    Jul 2006
    Posts
    203

    Re: UAC on WIndows7

    thanks for your reply.
    Signtool exe is part of Windows SDK 7.1
    Suppose i have an exe from Visual Studio6.0 (vc6) and i use signtool for this exe, when a run my vc6 exe at any system then will it ask for .net library at that system? Generally vc6 exe does not ask it because it's not part of .net framework.
    About the signature for exe, i think i need to buy a digital signature. right

  6. #6
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: UAC on WIndows7

    Yes, you need to buy a digital code signing signature.

    Using signtool does not alter your exe file in any way, except for adding the signature itself. Thus, if your exe does not need .NET, then, after signing, it still will not need .NET.
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

  7. #7
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: UAC on WIndows7

    Quote Originally Posted by MFCQuery View Post
    Generally vc6 exe does not ask it because it's not part of .net framework.
    And just to add to what Marc replied. Just because you use a later version of Visual C++ (like VC9 or VC10) beyond VC6, doesn't mean your C++ exe requires .net.

  8. #8
    Join Date
    Jul 2006
    Posts
    203

    Re: UAC on WIndows7

    I download 30 day trial of certificate and sign my exe using signtool
    sigbtool sign /a myexe.exe

    After signing when i run my exe on windows7, it still says unknown application.
    In my exe, i run it as admin in OnInitInstance using ShellExecuteEx

    Am i missing something? DO i need to add something else

  9. #9
    Join Date
    Apr 1999
    Posts
    27,449

    Re: UAC on WIndows7

    Quote Originally Posted by MFCQuery View Post
    I download 30 day trial of certificate and sign my exe using signtool
    sigbtool sign /a myexe.exe

    After signing ...
    So how did you confirm that signtool actually signed anything?

    Regards,

    Paul McKenzie

  10. #10
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: UAC on WIndows7

    Take a look here, it might help.
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

  11. #11
    Join Date
    Jul 2006
    Posts
    203

    Re: UAC on WIndows7

    I download the codesign tool, create a new certificate and run below command to sign exe
    signcode.exe -t <timestamp URL> -spc mycert.spc -v mykey.pvk "<file to be signed

    but when i run my exe on windowsy, it still display same message "unidentified program"
    I use ShellExecuteEx in InitInstance to run exe as admin

  12. #12
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: UAC on WIndows7

    Did you read the link in post #10?

  13. #13
    Join Date
    Jul 2006
    Posts
    203

    Re: UAC on WIndows7

    Hi Arjay,

    After going through link suggested by MarkG, i download the signature tool, create a test certificate to verify, and sign my exe.
    When i launch exe on windows7 it still giving same message "unidentified program"
    In my exe i use ShellExecuteEx to run as admin.
    I'll try to upload a sample

  14. #14
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: UAC on WIndows7

    Post a screenshot of the message Windows 7 shows when launching the .exe.
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

  15. #15
    Join Date
    Jul 2006
    Posts
    203

    Re: UAC on WIndows7

    Print screen can not be taken when UAC window displays.
    I am attaching exe and source code.
    Attached Files Attached Files

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured