free web page counters

Windows Mobile Pocket PC Smartphone Programming

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

Thursday, March 09, 2006

Programmatically unInstall/remove/delete one program in Windows Mobile devices

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

Programmatically unInstall/remove/delete one program in Windows Mobile devices

Sometimes you need to provide functionality to programmatically unInstall/remove/delete a program from a user's device. Let us think about a use case: Your program is managing some private or sensitive data. Unfortunately the user lose the device, or some one stolen the device. Either case, the capability to remotely destroy the program and data is highly desired. If you are targeting enterprise customer, this remote-destroy functionality is almost certain listed as one of MUST-Have features.

How to send a signal to or notify a lost device is the other story that I might talk later in another blog post, here I solely focus on how to programmatically unInstall a program in Windows Mobile devices.

Pocket PC 2003 platform

In Pocket PC 2003 devices, you can simply execute "\Windows\unload.exe" and pass program name as the parameter. I guess you should know your own program's name :)

  • The program name is the concatenation of "Provider" and "AppName" specified in your .INF file (the file for cabwiz to build)
  • The program name is listed in the list of "Settings" => "System" => "Remove Programs"

You can call either CreateProcess or ShellExecuteEx to spawn unload.exe. If you want to be a little more prefessional, call WaitForSingleObject on the handle to the new process returned by both calls. Remember to close those handles!

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

The simple method of running unload.exe does not work in newer Windows Mobile platforms: Smartphone 2003, Pocket PC 5.0, Smartphone 5.0. Microsoft wants to move anything regarding mobile device management and configuration to its CSP (Configuration Service Provider) architecture. UnInstalling program is one CSP. UnInstall Configuration Service Provider uninstalls applications from the device. A provisioning document that contains XML to uninstall an application should contain only that XML and no other provisioning information.

MSDN documentation states that using UnInstall CSP is "the
cleanest way to uninstall an application under the transactioning model for
Windows Mobile Version 5.0 software for Smartphones
". Actually it is also the case for Smartphone 2003 device.

Below is a code snippet for such purpose:


   // build an XML for UnInstallation
   // using stack , sloppy code
   TCHAR szProvXML[512];
   LPTSTR szPvXMLOut = NULL;
   memset(szProvXML, 0, 512*sizeof(TCHAR));
   wcscat(szProvXML, TEXT("<wap-provisioningdoc><characteristic type=\"UnInstall\"><characteristic type=\""));
   wcscat(szProvXML, TEXT("TestingApp"));
   wcscat(szProvXML, TEXT("\">"));
   wcscat(szProvXML, TEXT("<parm name=\"uninstall\" value=\"1\"/>"));
   wcscat(szProvXML, TEXT("</characteristic></characteristic></wap-provisioningdoc>"));
   HRESULT hr = DMProcessConfigXML(szProvXML, CFGFLAG_PROCESS, &szPvXMLOut);



Category: [Setup / Install / unInstall / Upgrade]

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




[ [permalink] ]

5 Comments:

At October 05, 2008 7:50 AM, Anonymous Anonymous said...

We specialize in laptop battery,laptop AC adapters. All our products are brand new, with the excellent service from our laptop battery of customer service team.
the most convenient and cheap replacement battery online shop in uk. We specialize in laptop batteries,laptop AC adapters. All our akku are brand new, with the excellent service from our customer service team.
the most convenient and cheap replacement battery online shop in uk. We specialize in laptop batteries,laptop AC adapters. All of batteries are brand new, with the excellent service from our customer service team, you can feel free to purchase on laptop battery!
Here is cheap laptop ac adapter online shop in uk. We specialize in laptop AC adapters. All our au battery are brand new, with the excellent service from our customer service team.

 
At February 11, 2009 12:13 AM, Blogger uiyui said...

Youth is warcraft leveling not a time of life;warcraft leveling it is a wow lvl state of mind; wow power level it is not power leveling amatter of World of warcraft Power Leveling rosy cheeks, red wrath of the lich king power leveling lips and supple knees;WOTLK Power Leveling it is a matter of thewill,wlk Power Leveling a quality of buy aoc gold the imagination,aoc gold a vigor of the emotions; it is thefreshness of the deep springs wow gold of life. Youth means a tempera-mental maplestory mesos predominance of courage over timidity, of the appetite formaple story mesos adventure over the love of ease. wow gold This often existsin a man of 60 more than a boy of 20. Nobody grows old merely by anumber of years.

 
At April 29, 2009 4:44 PM, Anonymous program acne said...

Hi

 
At July 01, 2009 9:13 PM, Anonymous angry said...

You brainless idiots.

 
At October 25, 2009 11:54 PM, Blogger Adi said...

Thank you for sharing.
Oes Tsetnoc | Mengembalikan Jati Diri Bangsa | Kenali dan Kunjungi Objek Wisata di Pandeglang | Oes tsetnoc | Online Marketing | Electronics Gadgets | etips solution | Travel Guide

 

Post a Comment

Links to this post:

Create a Link

<< Home