安装 .CAB WM 后重新启动

发布于 2024-09-17 19:49:36 字数 1448 浏览 3 评论 0原文

在 Windows Mobile 6 或 CE 5 设备上,我需要安装 CAB 文件,然后重新启动。

我知道自定义操作。您需要使用本机 C++ 为 CAB 文件创建 setup.dll。

因此,我已经编写了以下代码,

codeINSTALL_EXIT Install_Exit(HWND hwndParent,
                              LPCTSTR pszInstallDir,
                              WORD cFailedDirs,
                              WORD cFailedFiles,
                              WORD cFailedRegKeys,
                              WORD cFailedRegVals,
                              WORD cFailedShortcuts)
{
    MessageBox(hwndParent,
               _T("A reboot is required to complete installation, Press OK to reboot."),
               _T("Reboot required"),
               MB_OK);
    SetSystemPowerState(NULL, POWER_STATE_RESET, 0);
    return codeINSTALL_EXIT_DONE;
}

SetSystemPowerState 将在设备上进行热启动。问题是,由于安装未完成(未达到返回代码 INSTALL_EXIT_DONE),因此当您稍后尝试删除该应用程序时,它会抱怨无法安装该应用程序。取消重新启动可以立即解决此问题。

我在其他 .CAB 安装中看到一条礼貌消息显示“需要重新启动才能完成安装...”,没有“确定/取消”按钮。然后设备会在显示该消息两秒后重新启动。此外,该软件可以毫无问题地卸载。

我希望实现与上述其他 CAB 文件中看到的相同功能,即超时系统弹出窗口,然后重新启动以及从设备上的删除程序选项卸载应用程序的能力。


我昨天发现的另一个可能的解决方案是返回 CONFIG_S_REBOOTREQUIRED 。但是,这尚未定义,因此无法编译。 codeINSTALL_EXIT 的定义返回如下。

Using typedef enum
{
    codeINSTALL_EXIT_DONE       = 0,    // @comm Exit the installation successfully
    codeINSTALL_EXIT_UNINSTALL          // @comm Uninstall the application before exiting the installation
}
codeINSTALL_EXIT;

On a Windows Mobile 6 or CE 5 device, I need to install a CAB file and then initiate a reboot.

I am aware of custom actions. You need to create a setup.dll for the CAB file in native C++.

So I have the following code already made

codeINSTALL_EXIT Install_Exit(HWND hwndParent,
                              LPCTSTR pszInstallDir,
                              WORD cFailedDirs,
                              WORD cFailedFiles,
                              WORD cFailedRegKeys,
                              WORD cFailedRegVals,
                              WORD cFailedShortcuts)
{
    MessageBox(hwndParent,
               _T("A reboot is required to complete installation, Press OK to reboot."),
               _T("Reboot required"),
               MB_OK);
    SetSystemPowerState(NULL, POWER_STATE_RESET, 0);
    return codeINSTALL_EXIT_DONE;
}

SetSystemPowerState will do a warm boot on the device. The problem is that since the installation does not finish (return code INSTALL_EXIT_DONE is not reached), it complains that is it unable to install the application when you attempt to remove it at a later time. Removal of the reboot is an instant cure to this problem.

I have seen on other .CAB installs a polite message appear saying "A restart is required to complete installation..." with no OK/Cancel button. Then the device reboots after two seconds of displaying the message. Furthermore this software can be uninstalled without a problem.

I am looking to achieve the same functionality seen in other CAB files like the above, a timeout system popup, followed by a reboot and the ability to uninstall the application from the remove programs option on the device.


Another possible solution I found yesterday was to return CONFIG_S_REBOOTREQUIRED instead. However, this is not defined and as such will not compile. The defined returns for codeINSTALL_EXIT are as below.

Using typedef enum
{
    codeINSTALL_EXIT_DONE       = 0,    // @comm Exit the installation successfully
    codeINSTALL_EXIT_UNINSTALL          // @comm Uninstall the application before exiting the installation
}
codeINSTALL_EXIT;

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

紫南 2024-09-24 19:49:36

这个线程我明白需要通知安装过程安装 CAB 软件包后需要重新启动。

因此,只需返回 CONFIG_S_REBOOTREQUIRED (不带 SetSystemPowerState)即可代替 codeINSTALL_EXIT_DONE

我通常使用 ExitWindowsEx 重新启动 Windows SetSystemPowerState.ExitWindowsEx(EWX_REBOOT | EWX_DEFER, 0);应该异步重新启动,以便有时间完成安装过程。

From this thread I understand that one needs to inform the installing process that a reboot is required after installing the CAB package.

So instead of codeINSTALL_EXIT_DONE just return CONFIG_S_REBOOTREQUIRED (without SetSystemPowerState).

I usually restart windows with ExitWindowsEx instead of SetSystemPowerState.ExitWindowsEx(EWX_REBOOT | EWX_DEFER, 0); should restart asynchronously, giving time to the setup process to finish.

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