自动程序更新和 Windows 7

发布于 2024-08-23 13:49:54 字数 480 浏览 9 评论 0原文

我们有一套程序可以在启动时检查新版本,然后根据需要下载新版本来运行。这显然是 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

笑,眼淚并存 2024-08-30 13:49:54

应用程序安装有两个选项:

  1. 应用程序可供所有用户使用:安装或更新需要对 Windows Vista 及更高版本进行提升
  2. 应用程序可供一名用户使用:安装或更新%LOCALAPPDATA% 中用户个人资料中的应用程序,无需提升

广告 2:Google Chrome 就是这样做的。它在此处安装 .exe:

%LOCALAPPDATA%\Google\Chrome\Application\chrome.exe

--jeroen

There are two options for application installation:

  1. Application is available for all users: installation or update requires elevation for Windows Vista and up
  2. The application is available for one user: install or update the application in the user profile in %LOCALAPPDATA%, no elevation is required

Ad 2: Google Chrome does this. It installs the .exe here:

%LOCALAPPDATA%\Google\Chrome\Application\chrome.exe

--jeroen

风月客 2024-08-30 13:49:54

通常,如果应用程序需要升级权限,您将看到应用程序执行的操作如下所示。

  1. 应用程序确定是否需要升级
  2. 应用程序启动需要“管理员”权限的“更新程序”服务
  3. 应用程序使用此更新的更新自行更新
  4. 应用程序重新启动

这是一种非常常见的情况,特别是因为要更新您自己的 DLL,您需要转到辅助应用程序无论如何都要处理。

Typically what you will see an application do if it needs to escalate permissions is something like this.

  1. Application determines if upgrade is needed
  2. Application launches an "updater" service that requires "Administrator" permissions
  3. Application updates itself with this updated
  4. Application re-starts

This is a pretty common scenario, especially since to update your own DLL you need to go to a secondary process anyway.

子栖 2024-08-30 13:49:54

以下是一些帮助您解决更新难题的提示:

  1. 如果您的文件名为“update.exe”或“install.exe”,那么它将自动强制出现 UAC 提升提示。这是使现有软件绕过 Windows Vista/7 权限的简单方法。
  2. 从应用程序内部管理更新检查和更新过程并不是一个好主意。问题是您的应用程序可能会锁定文件并需要自行更新。外部应用程序应该管理您的更新。
  3. 最简单的更新解决方案是进行 HTTP 调用来检查当前产品版本号,然后在必要时下载安装程序二进制文件。这不会给您提供任何更新灵活性,但它是一个快速且简单的解决方案。

我们公司销售专门帮助 Windows 7 UAC 自动更新的软件(您可以通过单击此处访问 AutoUpdate+:链接文本)。使用第三方解决方案(任何解决方案)的最佳理由是,您可以更灵活地进行更新,并且可以避免支持不同 Windows 版本的棘手挑战。

Here are some tips for you to get around updating challenges:

  1. If your file is names 'update.exe' or 'install.exe' then it will automatically force a UAC elevation prompt. This is an easy way to make existing software bypass Windows Vista/7 permissions.
  2. It is not a good idea to have the update checking and update process managed from within your application. The problem is that your app is likely to lock files and need updating itself. An external app should manage your updates.
  3. The simplest update solution is to make an HTTP call that checks for the current product version number, and then download the installer binary if necessary. This won't give you any flexibility in updates, but it is a quick and easy solution.

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.

零度° 2024-08-30 13:49:54

或者您可以拥有它,以便用户运行启动器应用程序。

  1. 应用程序使用 LOCALAPPPATH\ 文件夹来存储主应用程序的缓存。
  2. 启动器检查互联网是否有比缓存文件更新的文件版本。
  3. 启动器启动 LOCALAPPPATH 中的缓存应用程序

Or you can have it so that the user runs a launcher app.

  1. The application uses the LOCALAPPPATH\ folder to store a cache of the main application.
  2. Launcher checks to see if the internet has newer version of file(s) than the cached file.
  3. Launcher launches the cached application in LOCALAPPPATH
夕嗳→ 2024-08-30 13:49:54

您的应用程序可以检查远程服务器上是否有新版本。如果是,则它可以将更新文件下载到用户特定的文件夹之一,例如用户的临时文件夹。您可以使用 SHGetSpecialFolder API 函数。

下载完成后,您可以弹出一个对话框,告诉用户您已准备好更新。如果用户同意更新,则您可以使用提升的权限(以管理员身份)运行更新程序进程,更新程序进程可以将安装路径中的现有文件替换为用户临时文件夹中已下载的文件。要以管理员身份运行更新程序,您可以使用 ShellExecute< /a>:

ShellExecute(0,'runas','notepad.exe',nil,nil,SW_SHOWNORMAL);

更新完成后,您的更新程序进程可以重新启动您的应用程序。

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:

ShellExecute(0,'runas','notepad.exe',nil,nil,SW_SHOWNORMAL);

When updating is done, your updater process can restart your app.

只为守护你 2024-08-30 13:49:54

您需要有一个单独的可执行文件来进行更新工作。更新程序需要有一个清单,将其标记为需要提升。

请参阅: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

源来凯始玺欢你 2024-08-30 13:49:54

如果您的应用程序使用 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.

落叶缤纷 2024-08-30 13:49:54
  1. 如果您的安装程序不是在管理员下运行 - 您不需要任何额外的权限来安装更新。

    如果

  2. 如果您的安装程序在管理员下运行 - 那么它可以在任务计划程序中创建任务。比如说,每周在该帐户(管理员)下并以最高权限运行此任务一次。任务将是您的更新程序。简单。

  1. If your installer wasn't run under admin - you don't need any additional rights to install update.

  2. 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文