本文介绍了重新启动安装.CAB WM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



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



所以我已经做了以下代码


$ b $
WORD cFailedDiles,
WORD cFailedFiles,
WORD cFailedRegKeys
WORD cFailedDiles
WORD cFailedDiles,
WORD cFailedDiles,
WORD cFailedFiles,
WORD cFailedRegKeys,
WORD cFailedRegVals,
WORD cFailedShortcuts)
{
MessageBox(hwndParent,
_T(完成安装需要重新启动,按OK重新启动),
_T(需要重启),
MB_OK);
SetSystemPowerState(NULL,POWER_STATE_RESET,0);
return codeINSTALL_EXIT_DONE;
}

SetSystemPowerState将在设备上进行热启动。问题是,由于安装没有完成(没有达到返回代码 INSTALL_EXIT_DONE ),它抱怨说,当您尝试将其删除时无法安装该应用程序晚点。删除重新启动是立即解决这个问题。



我已经看到其他的.CAB安装一个礼貌的消息出现说重启是需要完成安装...,没有确定/取消按钮。然后设备在显示消息两秒钟后重新启动。此外,该软件可以卸载没有问题。



我正在寻求实现与上述其他CAB文件相同的功能,超时系统弹出窗口,其次是重新启动,并可以从设备上的删除程序选项卸载应用程序。






我昨天发现的另一个可能的解决方案是返回CONFIG_S_REBOOTREQUIRED代替。但是,这没有定义,因此不会编译。 codeINSTALL_EXIT的定义的返回值如下所示。

 使用typedef枚举
{
codeINSTALL_EXIT_DONE = 0,/ / @comm成功退出安装
codeINSTALL_EXIT_UNINSTALL // @comm退出安装前卸载应用程序
}
codeINSTALL_EXIT;


解决方案

从而不是 SetSystemPowerState ExitWindowsEx(EWX_REBOOT | EWX_DEFER,0); 应该以异步方式重新启动,让设置过程有时间完成。


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;
解决方案

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.

这篇关于重新启动安装.CAB WM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 17:40