The MASM Forum

Miscellaneous => The Orphanage => Topic started by: Matthias Merkel on June 16, 2018, 10:42:09 PM

Title: Requiring Administrator Privileges
Post by: Matthias Merkel on June 16, 2018, 10:42:09 PM
Is there a way to require administrator privileges when running the application?
Title: Re: Requiring Administrator Privileges
Post by: hutch-- 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.
Title: Re: Requiring Administrator Privileges
Post by: aw27 on June 16, 2018, 11:06:54 PM
Quote from: Matthias Merkel on June 16, 2018, 10:42:09 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.