On a windows mobile 6 or CE5 device, I need to install a CAB file 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 2 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.
Cheers
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 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;