Author Topic: Requiring Administrator Privileges  (Read 183 times)

Matthias Merkel

  • Regular Member
  • *
  • Posts: 6
Requiring Administrator Privileges
« on: June 16, 2018, 10:42:09 PM »
Is there a way to require administrator privileges when running the application?

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 5756
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Requiring Administrator Privileges
« Reply #1 on: June 16, 2018, 10:51:50 PM »
Its usually the case that you log in as the administrator, if you are not the computer's administrator you should not be trying to circumvent the security.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin:

AW

  • Member
  • *****
  • Posts: 1475
  • Let's Make ASM Great Again!
Re: Requiring Administrator Privileges
« Reply #2 on: June 16, 2018, 11:06:54 PM »
Is there a way to require administrator privileges when running the application?
You can use a manifest, like this:
<?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>

There is another way, but this should be enough for now.