I have my Unity game downloading new version of installer from server to AppData/LocalLow/MyProject/Temp and trying to run it. Source executable file really requires UAC to run as admin, as it supposed.
PrivilegesRequired=admin
But when I upload installer to server and download it, an error occurs with a message "Unable to create temp folder. Access denied".
FC says it is complete copy, but one is requesting permission - another does not.
I upload file by converting to byte[] and sending it via POST, download - GET vice versa
It also happens when I try to run this executable by myself. It just doesn't want to ask me for rights.
Also, as solution, I tried to force my game to run new process with admin rights:
If I use Mono, I can run installer's process via :
new Process
{
StartInfo =
{
Verb = "runas",
FileName = Updater.GetPathToInstaller()
}
}.Start();
But I need to use IL2CPP, and Unity's IL2CPP doesn't include System.Diagnostics.Process yet, so I'm using this solution to run my installer.
And I don't know how to force it to run with admin.
Manifest of the installer:
я╗┐<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity name="JR.Inno.Setup" processorArchitecture="x86" version="1.0.0.0" type="win32"></assemblyIdentity>
<description>Inno Setup</description>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="x86" publicKeyToken="6595b64144ccf1df" language="*"></assemblyIdentity>
</dependentAssembly>
</dependency>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
</requestedPrivileges>
</security>
</trustInfo>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
</windowsSettings>
</application>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"></supportedOS>
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"></supportedOS>
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"></supportedOS>
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"></supportedOS>
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"></supportedOS>
</application>
</compatibility>
</assembly>
Manifest of "Copy" is identical
So, I figured out that my problem is caused by LOW Integrety Level set to installer after I download it. Why? Because I downloaded it in Application.persistantDataPath which is LocalLow folder. I changed download folder to Application.dataPath which isn't persistent, and in my testing scenario was on the Desktop, and it worked fine - downloaded copy of installer hasn't low MIC
Of course I still need to sign up my installer, as @MartinPrikryl mentioned in the comments, to avoid problems with smart screen, but it isn't the solution for my "It doesn't request the permission, but still needs it" problem
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With