Friday, June 01, 2007

Unloading an application Programmatically

In Pocket PC 2003 and earlier you could use unload.exe to unload applications that had been marked with flag NoUninstall as true.

This is not quite possible with later devices - Windows Mobile 5 and onwards. Instead Microsoft encourages the practice of using the Uninstall Configuration Service Provider (this link is for WM5 SDK but works on older devices). The cool thing about using the Uninstall CSP is that, you need not terminate the process if it is already loaded in memory before uninstalling it like you had to do when using unload.exe, instead you can just execute the CSP and it will handle shutting down the process for you. Of course it is recommended to ask the process to terminate rather than letting CSP do it but this shows just how powerful the uninstall CSP is.

Usage of the Uninstall CSP is dependent on the security roles that the OEM sets for individual devices. If unsure, ask your OEM if this CSP has been enabled. See here for a list of default roles for CSP's.

See here on how to provision your XML.

No comments: