簡體   English   中英

Inno Setup 的安裝程序在上傳和下載周期后不需要管理員權限

[英]Inno Setup's installer doesn't require admin rights after uploading and downloading cycle

我有我的 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>

“副本”的清單是相同的

所以,我發現我的問題是由我下載后設置為安裝程序的低完整性級別引起的。 為什么? 因為我在LocalLow文件夾的Application.persistantDataPath中下載了它。 我將下載文件夾更改為非持久性的Application.dataPath ,並且在我的測試場景中是在桌面上,並且運行良好 - 下載的安裝程序副本的 MIC 不低

當然,我仍然需要注冊我的安裝程序,正如@MartinPrikryl 在評論中提到的,以避免智能屏幕出現問題,但這不是我的“它不需要許可,但仍然需要它”問題的解決方案

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM