Yesterday, an Yi Language developer asked me for help and said that the 32-bit program software he compiled in Yi Language was released to a 64-bit operating system Win 7 user for use because the user was sure that he did not have administrator permissions, and the program was required to enter the administrator password when starting the program, so he was in trouble. The target enterprise has strict user management and it is unrealistic to require the allocation of administrator rights to ordinary users. It can only be technically solved by developers from the perspective of software development.
When I heard this problem, my first feeling was caused by Microsoft User Account Control (UAC), which is estimated to be solved by adding a specific manifest resource to the exe. So I gave him a piece of code and asked him to add it to the software using software such as ResHacker to try to solve the problem:
<?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="asInvoker" uiAccess="false" /> </requestedPrivileges> </security> </trustInfo> </assembly>
After the test, he found that the problem was solved very successfully. The modified software is released to users for testing, and the administrator password is no longer prompted to enter the administrator password when starting, and the functions are all normal.
The following is a comparison of the manifest resources added by default when compiled by Yi Language:
<?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="......" type="win32" /> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> <security> <requestedPrivileges> <requestedExecutionLevel level="requireAdministrator" uiAccess="false"/> </requestedPrivileges> </security> </trustInfo> </assembly>
You will find a subtle difference between the two: the difference between asInvoker and requireAdministrator. The latter will require that the software must have administrator privileges when starting, otherwise it will be refused work. So can you use asInvoker by default in the one-size-fits-all requirement? I'm afraid it's not possible, because behaviors such as modifying the Windows registry must still have administrator rights (otherwise the modification is invalid). Perhaps some intelligent judgment can be made under certain conditions?
Attached ResHacker (Resource Hacker) 3.6 download address:
https:///softs/