Inno Setup的安装程序在上传和下载周期后不需要管理员权限



我让我的Unity游戏从服务器下载新版本的安装程序到AppData/LocalLow/MyProject/Temp并尝试运行它。源可执行文件确实需要UAC以管理员身份运行,正如它所设想的那样。

PrivilegesRequired=admin

但当我将安装程序上传到服务器并下载时,会出现错误,并显示消息"无法创建临时文件夹。访问被拒绝"。

FC表示这是一份完整的副本,但其中一份请求许可,另一份则没有。

我通过转换为byte[]上传文件并通过POST发送,下载-GET反之亦然

当我尝试自己运行这个可执行文件时,也会发生这种情况。它只是不想向我索取权利。


此外,作为解决方案,我试图强制我的游戏运行具有管理员权限的新进程:

如果我使用Mono,我可以通过运行安装程序的进程

new Process
{
StartInfo =
{
Verb = "runas", 
FileName = Updater.GetPathToInstaller()
}
}.Start();

但我需要使用IL2CPP,而Unity的IL2CPP还不包括System.Diagnostics.Process,所以我使用这个解决方案来运行我的安装程序。

我不知道如何强制它与管理员一起运行。


安装程序清单:

я╗┐<?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>

"副本"的清单是相同的

所以,我发现我的问题是由下载后设置为安装程序的LOW Integrity Level引起的。为什么?因为我在Application.persistantDataPath中下载了它,也就是LocalLow文件夹。我把下载文件夹改为Application.dataPath,这是不持久的,在我的测试场景中是在桌面上,它运行得很好——下载的安装程序副本的MIC 不低

当然,正如@MartinPrikryl在评论中提到的那样,我仍然需要注册我的安装程序,以避免智能屏幕出现问题,但这不是解决我的"它没有请求许可,但仍然需要它"问题的

最新更新