Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello Everyone,

I'm stuck working on a project using VC6. Please don't hate, If I had the option to work with something more modern I would be.

My application requires Administration rights to work properly. On my computer, I've embedded this manifest into my release .exe via the mt.exe Microsoft SDK from an external notepad file in the same directory as my .exe:
XML
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel
          level="RequireAdministrator"
          uiAccess="false"/>
        </requestedPrivileges>
       </security>
  </trustInfo>
</assembly>


via the command line:
mt.exe -nologo –manifest "MyApp.exe.manifest" -outputresource:"MyApp.exe;#1"


On my computer(running windows 7 32bit), this works flawlessly and forces the system admin prompt, allowing my program to function after I hit yes.

However if I attempt to transfer my newly embedded release .exe, along with the manifest file to my different computer (running windows 7 64bit) the admin prompt no longer occurs, even if I attempt to re-embed the Manifest on the new computer causing my program to not properly function.

Is there any way for me to be able to transfer this application to a different computer while maintaining the ability to prompt admin status?

Thanks for hearing me out! Also, everything I'm currently working with is still very new to me so I apologize in advance if I'm missing something obvious or doing something very basic wrong.
Posted
Comments
Sergey Alexandrovich Kryukov 24-Oct-12 17:06pm    
It could be possible that UAC is disabled on the second machine -- please check up.
--SA

From the first glance, it seems to me you were doing right thing. It could be possible that UAC is disabled on the second machine.

Please see:
http://en.wikipedia.org/wiki/User_Account_Control[^].

This is how it could be disabled, so you can see how to check it up:
http://www.howtogeek.com/howto/windows-vista/4-ways-to-make-uac-less-annoying-on-windows-vista/[^].

This is an interesting article, even though it's obsolete:
http://4sysops.com/archives/vista-user-account-control-uac-traps-part-2-elevated-applications/[^].

—SA
 
Share this answer
 
Comments
Parwarrior7 25-Oct-12 8:50am    
Thanks for the tip, I'll look into it as soon as I'm able to see if UAC is in fact disabled or not.
Sergey Alexandrovich Kryukov 25-Oct-12 13:19pm    
Please find out. I you think my guess was reasonable or the information was useful, please accept the answer formally (green button) -- thanks.
--SA
Parwarrior7 25-Oct-12 14:09pm    
Absolutely, I just won't be able to check until tomorrow afternoon.
Sergey Alexandrovich Kryukov 25-Oct-12 14:58pm    
Timing does not matter at all... :-)
Thank you,
--SA
Parwarrior7 26-Oct-12 11:53am    
UAC settings were definitely part of the problem. Now at least the UAC prompt does become triggered properly on the secondary computer. However the administrator-dependent section of the my code still doesn't appear to be properly executing on the secondary machine even after the prompt... This however is probably a different issue altogether involving my code and not any issues with the manifest.... Thanks for the help! I'm halfway there haha!
This manifest file works for me in both 32 and 64 bit environment:
XML
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestversion="1.0">
  <ms_asmv2:trustinfo xmlns:ms_asmv2="urn:schemas-microsoft-com:asm.v2">
    <ms_asmv2:security>
      <ms_asmv2:requestedprivileges>
        <ms_asmv2:requestedexecutionlevel level="requireAdministrator" uiaccess="false">
        </ms_asmv2:requestedexecutionlevel>
      </ms_asmv2:requestedprivileges>
    </ms_asmv2:security>
  </ms_asmv2:trustinfo>
</assembly>
 
Share this answer
 
Comments
Parwarrior7 25-Oct-12 8:49am    
Thanks for the quick response, I'll give it another shot as soon as I'm able and see if it works out.
Parwarrior7 26-Oct-12 11:54am    
Manifest works great, ty.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900