free web page counters

Windows Mobile Pocket PC Smartphone Programming

==>Click here for the SiteMap<==. Original contents with decent amount of source codes.

Sunday, March 12, 2006

Programmatically find out all the programs that can be unInstalled in Windows Mobile devices

====>SiteMap of this Blog<===

Programmatically find out all the programs that can be unInstalled in Windows Mobile devices

In my previous post, I talked about how to programmatically unInstall/remove/delete one program in Windows Mobile devices. Notice that is only for one program. In this post, I am going to talk about how to find out all the programs that can be un-installed in a Windows Mobile device. With such a list, we can programmatically un-install all those programs. To enterprise customers, such functionality is a very welcome one, who deem the ability to remote-destroying lost or stolen devices a MUST-Have feature.

Like what I did in the previous post on programmatically unInstall/remove/delete one program in Windows Mobile devices, I have to treat Pocket PC 2003 differently from other newer platforms to locate a list of un-installable programs

Pocket PC 2003 platform

Information about what programs are installed in a Pocket PC 2003 device can be found under registry key "\HKLM\SOFTWARE\Apps\". Each program is listed as a sub-key, with program name as the sub-key name. For each program, the value "CabFile" stores what is the original CAB file (the installation package), and value "InstallDir" is where (in which directory) the program is installed to.

Notice not all the programs listed there can be unInstalled, but only the sub-key with value "Instl" = dword:1. So to find a list of programs that can be uninstalled in a Pocket PC 2003 device, you can simply iterate through all sub-keys under registry hive "\HKLM\SOFTWARE\Apps\" with value "Instl" = dword:1. The APIs to use are RegOpenKeyEx, RegQueryInfoKey, RegQueryValueEx, and mainly RegEnumKeyEx.

Other newer platforms (Smartphone 2003, Pocket PC 5.0, Smartphone 5.0)

As I put in my previous post, Microsoft wants to move anything regarding mobile device management and configuration to its CSP (Configuration Service Provider) architecture. UnInstallation is one CSP. UnInstall Configuration Service Provider not only uninstalls applications from the device, but also returns information like what programs can be unInstalled. Below is the exact XML to feed into DMProcessConfigXML to get the list of un-installable programs in a Smartphone 2003 device, Pocket PC 5.0 device, or Smartphone 5.0 device:

<wap-provisioningdoc>
<characteristic-query type="UnInstall">
</characteristic-query> </wap-provisioningdoc>




Category: [Setup / Install / unInstall / Upgrade]

====>SiteMap of this Blog<===