在Windows Mobile 6或CE 5设备上,我需要安装CAB文件,然后重新启动。
On a Windows Mobile 6 or CE 5 device, I need to install a CAB file and then initiate a reboot.
我知道自定义操作。您需要在本机C ++中为CAB文件创建一个setup.dll。
I am aware of custom actions. You need to create a setup.dll for the CAB file in native C++.
所以我有以下代码
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 未达到),它抱怨说,它是无法安装应用程序,当您尝试删除它以后的时间。删除重新启动是即时解决这个问题。
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.
我在其他.CAB安装看到一个礼貌的消息出现重新启动是需要完成安装...,没有确定/取消按钮。然后,设备在显示消息两秒后重新启动。此外,这个软件可以卸载没有问题。
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.
我正在寻找实现相同的功能看到在其他CAB文件像上面,超时系统弹出,其次是重新启动和从设备上的删除程序选项卸载应用程序。
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.
我昨天找到的另一个可能的解决方案是以返回CONFIG_S_REBOOTREQUIRED。但是,这没有定义,因此不会编译。 codeINSTALL_EXIT的定义返回如下。
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.
因此,代替 codeINSTALL_EXIT_DONE 只需返回 CONFIG_S_REBOOTREQUIRED (不含SetSystemPowerState)。
So instead of codeINSTALL_EXIT_DONE just return CONFIG_S_REBOOTREQUIRED (without SetSystemPowerState).
我通常使用 ExitWindowsEx ,而不是 SetSystemPowerState 。 ExitWindowsEx(EWX_REBOOT | EWX_DEFER,0); 应该异步重新启动,让安装过程完成。
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时重新启动
发布评论