views:

80

answers:

1

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;
+1  A: 

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.

Cristian Adam
Hi, I should have mentioned I have already tried the above. CONFIG_S_REBOOTREQUIRED is not defined. Ill add some readable code to my question so u can see it
JonWillis
Cristian Adam
CONFIG_S_REBOOTREQUIRED does not work on CE5 or WM6, I added it to the codeInstall_EXIT enum returned it.However ExitWindowsEx does work, and I will use this instead (atleast on WM6, as its not supported on CE5)As to my uninstallation issue, I think I have tracked it down that the reboot was not the root cause. The root cause was the CAB installs to drivers/builtin, so on a "reboot" the BUSENUM (device.exe) retains on open handle to all these subkeys. An open subkey prevents the cab uninstalling the registry entry and it fails on this. Ill create the keys in setup.dll instead of cab wizard
JonWillis
It seems ExitWindowsEx is supported on Windows Mobile 5.0 platform and not on Windows CE 5.0. Crazy :)
Cristian Adam
I could only find the define under Windows CE6 cellcore - SIMTKIT to be exact - you can try it:`#define CONFIG_S_REBOOTREQUIRED 0x00042010` - Should have refreshed the page before posting this... :)
Shaihi
@Shaihi, I did try it (see comments on original questions), but it had no effect. I guess WCELoad.exe (the system app that installs the .CAB files) is just expecting a 1 or 0 response from Install_Exit(), and ignores the 0x00042010 (equiv to int, 270352).
JonWillis
be aware that wceload in WinMo and wceload in CE are not identical either - so you may well get different behaviors from them.
ctacke
@ctacke , I did not know that, but assumed it could be the case given the grief getting a program to work on both CE5/WM6. So I tried it on both and it had the same effect. Nothing happened. The ExitWindowsEx function is what i have used instead.
JonWillis