Modifier le look & feel de Windows Mobile et/ou implémenter le mode Kiosque - Modify Windows Mobile look & feel and/or implement kiosk mode

J'ai déjà parlé des méthodes et solutions tierces permettant de mettre un device Windows Mobile en mode kiosque. Vous pouvez essayer de le faire par vous même.

Il y a deux approches différentes consistant pour l'une à s'intégrer à Windows Mobile, et pour l'autre à prendre le controle du système. Vous pouvez donc soit opter pour le développement de plug-ins, la personnalisation des icones, des sonneries, etc,... soit opter pour développer une application en mode kiosque. Voici quelques éléments qui pourront vous y aider :

Pour commencer, qu'est-ce qu'un shell?

  • Le shell est la partie de l'OS qui sert de point d'entrée pour accéder aux autres applications et fonctionnalités disponibles.
  • Le shell de Windows Mobile consiste en diverses parties : le today/home screen, les menus, le gestionnaire de programmes, les panneaux de configuration...

La première approche consiste à s'intégrer dans le Sheel standard en ajoutant des plug-ins :

  • Vous pouvez développer un plug-in "today" (il s'agit de DLL chargées dynamiquement et gérant les messages suivant : WM_PAINT, WM_TODAYCUSTOM_CLEARCACHE, WM_TODAYCUSTOM_QUERYREFRESHCACHE, et fournissant différentes fonctionnalités).
  • Tout peut se faire en s'appuyant sur le .Net Compact Framework 2.0
  • Sur Windows Mobile Standard Edition, on parle de "Home Plug-in" tandis que dans WM Professionnal Edition, on parle de "Today Plug-in"
  • On peut utiliser CSP pour déployer et configurer les plug-in.
  • Pour tirer parti des fonctions de WM tels que les Contacts, le calendrier, la messagerie, on peut s'appuyer sur POOM et MAPI
  • Pour exploiter les fonctions de téléphonie, il faut utiliser Microsoft.WindowsMobile.Telephony.Phone

La seconde approche (certainement celle qui vous a conduit sur ce post ;-)) consiste à customiser son application et le système en mode kiosque:

  • Attention !
    • ceci n'est par essence pas portable puisque dépendant du Hardware (pour ce qui es de la résolution de l'écran par exemple...)
    • Le Mode Kiosque n'est pas supporté !
    • En cas de Hard reset...
  • Pour recouvrir le "today screen" :
    • mettre WindowState=Normal, ControlBox=False, MinimizeBox=False, TopMost=true. Dans le code, utiliser FindWindowW pour localiser la barre des tâches (HHTaskBar), et SetWindowsPos pour positioner sa propre application au premier plan.
  • Faire en sorte que l'application démarre au lancement du système
  • Prendre le contrôle des boutons hardware en utilisant UnregisterFunc1, et en s'enregistrant pour obtenir les notifications des hotkeys à l'aide de RegisterHotKey.
  • Bloquer le  Run Dialog :
    • en modifiant la clé de registre NoRunDlg
    • en bloquant les applications à l'aide de DisallowRun
    • en bloquant les applications exécutées à l'insertion d'une carte mémoire
  • Arrêter l'AutoRun à l'aide des security policies (peut être effectué à l'aide de CSP)
  • BLoquer RAPI en utilisant la security policy 4097 (peut être effectué à l'aide de CSP)
  • penser à LAP (Local Authentication Plug-in), vous permettant d'implémenter votre propre mode d'authentification en exploitant les capacité de l'OS.
  • Gérer la mnière dont les applicationsn sont "trustées", installées et exécutées pour les blacklister ou les whitelister : en signant les applications (l'OS pourra les exécuter), en signant les fichiers d'installation CAB (l'OS pourra les installer), en prenant en compte le fait que le système peut demander l'intervention de l'utiliateur, en supprimant les certificats indésirables et en ajoutant les certificats voulus.

Enfin, pour compléter tout cela, voici quelques pointeurs vers les post du blog de Fabien Decret qui peuvent vous être utile:

 

I have already been talking about putting Windows Mobile into Kiosk mode in order to have an application having the full control of a Windows Mobile device. Third party products can help you to do so, but you can also implement that by yourself.

There are 2 different approaches. Wether you want to integrate into the standard shell by modifying today screen look and feel, modifying ring tones, icons, ... Or you can try and develop a Kiosk mode application.

So, what is a shell?

  • Shell is part of the OS and lets the user access other applications or functions.
  • Windows Mobile shell = Today screen, menus, Program, settings, etc...

First way do things would be to integrate in the standard Shell by adding plug-ins:

  • You can develop a "today screen" plug-in (Dynamically loaded DLL processing the following messages WM_PAINT, WM_TODAYCUSTOM_CLEARCCHE, WM_TODAYCUSTOM_QUERYREFRESHCACHE, and providing different functionnalities).
  • Everything can be done using .Net Compact Framework 2.0
  • On Standard, do a Home Plug-in
  • On Professionnal, do a Today Plug-in
  • Use CSP to provision and configure the plug-in
  • To integrate in Contacts, Calendar, Email, etc... you can use POOM (there is a managedand MAPI
  • To integrate in phone calls, use Microsoft.WindowsMobile.Telephony.Phone

The other way (surely the one you came accross this post for :-) ) is to tailor your application to be run in Kiosk mode:

  • Warning!
    • this is not portable by essence because very hardware dependent...
    • Kiosk mode is not supported!
    • Hard reset: Lights out and hello, backdoor!
  • What you can do to cover Today Screen :
    • Set WindowState=Normal, ControlBox=False, MinimizeBox=False, TopMost=true. In the code, use FindWindowW to find the taskbar (HHTaskBar), and SetWindowsPos to set your own application on top of the taskbar.
  • Have your application launch on startup
  • Get rid of the Hardware key using UnregisterFunc1, and then register to get notified of hotkeys in your application using RegisterHotKey.
  • Block Run Dialog by:
    • modifying the NoRunDlg registry entry
    • blocking applications with DisallowRun
    • blocking applications running on removable media
  • Stop the AutoRun from the security policy (can be provisionned using CSP)
  • Block RAPI using security policy 4097 (can be provisionned using CSP)
  • Think about Local Authentication Plug-in (LAP): allows you to implement a custom application independent authentication using OS.
  • Manage the way applications are trusted and installed/executed in order to Blacklist or whitelist applications at will: code sign applications (OS will run application), sign CAB (OS will install CAB), be aware that system can prompt for user intervention, revoke unwanted certificates and install certificates that are relevant.

To complete that, here are some pointers from Fabien Decret's blog that can help you: