自动程序更新和 Windows 7
我们有一套程序可以在启动时检查新版本,然后根据需要下载新版本来运行。这显然是 Windows 7 中的一个问题,当它被锁定为“标准用户”时,因为他们无法写入 c:\program files 目录及以下目录。有人见过解决问题的应用程序的示例吗?
我们的应用程序是用 Delphi 编写的,但任何语言的示例都会很有用。
预先感谢
更新:
我们已经有一个系统来确定是否存在新版本,唯一的问题是下载和安装(如果需要),因为这需要提升。我想不出一种不需要提升提示或我们的用户降低安全设置的方法。
更新 2:
我已询问后续问题,而不是在这里添加一个新问题
We have a suite of programs that check for new versions at startup, and then download new versions to run if required. This is obviously a problem in Windows 7, when it is locked down as a 'standard user', as they can't write to the c:\program files directory and below. Anyone seen a example of an application that gets around with issue ?
Our applications are written in Delphi, but an example in any language would be useful.
Thanks in advance
Update:
We already have a system for determing whether a new version exists, the only problem is the download and install (if required), as this requires elevation. I can't think of a way that doesn't require an elevation prompt, or our users to reduce their security settings.
Update 2 :
I've asked a subsequent question, rather than adding a new one here
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
应用程序安装有两个选项:
广告 2:Google Chrome 就是这样做的。它在此处安装 .exe:
%LOCALAPPDATA%\Google\Chrome\Application\chrome.exe
--jeroen
There are two options for application installation:
Ad 2: Google Chrome does this. It installs the .exe here:
%LOCALAPPDATA%\Google\Chrome\Application\chrome.exe
--jeroen
通常,如果应用程序需要升级权限,您将看到应用程序执行的操作如下所示。
这是一种非常常见的情况,特别是因为要更新您自己的 DLL,您需要转到辅助应用程序无论如何都要处理。
Typically what you will see an application do if it needs to escalate permissions is something like this.
This is a pretty common scenario, especially since to update your own DLL you need to go to a secondary process anyway.
以下是一些帮助您解决更新难题的提示:
我们公司销售专门帮助 Windows 7 UAC 自动更新的软件(您可以通过单击此处访问 AutoUpdate+:链接文本)。使用第三方解决方案(任何解决方案)的最佳理由是,您可以更灵活地进行更新,并且可以避免支持不同 Windows 版本的棘手挑战。
Here are some tips for you to get around updating challenges:
Our company sells software that specifically helps with automatic updates on Windows 7 UAC (you can visit AutoUpdate+ by clicking here: link text). The best reasons for using a third party solution - any solution - are that you will have more flexibility with your updates and also avoid the finicky challenges of supporting different Windows releases.
或者您可以拥有它,以便用户运行启动器应用程序。
Or you can have it so that the user runs a launcher app.
您的应用程序可以检查远程服务器上是否有新版本。如果是,则它可以将更新文件下载到用户特定的文件夹之一,例如用户的临时文件夹。您可以使用 SHGetSpecialFolder API 函数。
下载完成后,您可以弹出一个对话框,告诉用户您已准备好更新。如果用户同意更新,则您可以使用提升的权限(以管理员身份)运行更新程序进程,更新程序进程可以将安装路径中的现有文件替换为用户临时文件夹中已下载的文件。要以管理员身份运行更新程序,您可以使用 ShellExecute< /a>:
更新完成后,您的更新程序进程可以重新启动您的应用程序。
Your app can check if a new version is available on the remote server. If it does, then it can download update files in one of user-specific folders, like user's temp folder. You can get address of such special folders using SHGetSpecialFolder API function.
Once the download is done, you can pop up a dialog box telling user that you are ready for update. If user agrees with update, then you can run the updater process with elevated privileges (as administrator), and updater process can replace existing files in your installation path with the ones already downloaded in user Temp folder. To run your updater as administrator, you can use ShellExecute:
When updating is done, your updater process can restart your app.
您需要有一个单独的可执行文件来进行更新工作。更新程序需要有一个清单,将其标记为需要提升。
请参阅:http://msdn.microsoft.com/en-us/library/ bb756929.aspx
You need to have a separate executable to the updating work. The updater needs to have a manifest that marks it as requiring elevation.
See: http://msdn.microsoft.com/en-us/library/bb756929.aspx
如果您的应用程序使用 MSI (Windows Installer) 作为其安装程序,则
If your application uses MSI (Windows Installer) for its installer, then User Account Control Patching, if properly configured, can let you install updates without elevation.
如果您的安装程序不是在管理员下运行 - 您不需要任何额外的权限来安装更新。
如果
如果您的安装程序在管理员下运行 - 那么它可以在任务计划程序中创建任务。比如说,每周在该帐户(管理员)下并以最高权限运行此任务一次。任务将是您的更新程序。简单。
If your installer wasn't run under admin - you don't need any additional rights to install update.
If your installer was run under admin - then it can create a task in Task Sheduler. Say, run this task once a week, under this account (admin) and with highest privs. Task will be your updater. Simple.