Windows CE and Pocket PC

Programming and More

Hacking



I will place small Snippets, Informations and code samples about Windows CE and Pocket PC programming here


Suche:  


Please go to Tools to find about essential Tools for PocketPC and Windows CE

See Servant Salamander - File Manager for the best Norton Commander Clone for Windows. The new versions also support WinCe/PPC devices connected with ActiveSync

See me Link list for more resources.

Books I have and require.

Some small tips and hints.

I have setup a yahoo group with sources and tools http://groups.yahoo.com/group/ITC_Software/

New 31 Jun 2005GrabIt, dump your rom


Changes

NEW: 11. may 2009, my Blog is ONLINE (http://www.hjgode.de/wp/). I will put everything new in the BLOG
and transfer the contents from these static pages from time to time.
15. apr 2009: added version 1.3 of KeyWedge
12. Feb 2009: added new version of KeyWedge
ITC Community now open! Please visit the developer community
21. June 2008: added KeyWedge application
1. April 2008: updated the scandemo files and page
18. mar 2008: added NoWakeUpAtMidnight and SNTPClient to iLock tools page
9. jan 2008: added newsletter archive in dev/newsletter
17. Oct 2007: updated iHook3
10. Oct. 2007: updated ScanDemo
28. August 2007: added MortScript and TSync (timesync tool) on tools page
6. July 2007: added page about Pocket/Mobile Internet Explorer
22. June 2007: added BT scanning with WinXP
19. June 2007: added ActiveX LinePrinter sample page
1. June 2007: added WM5 AutoRun page
19. April 2007: added MortScript info on tools page
24. Jan 2007: added keytoggle tool and description (Updated Keytoggle.cab 30. jan 2007)
15. Nov 2006: added new active sync autoconnect script to catalog devices with there MAC address
14. July 2006: added irebootme
13. July 2006: added final link to CF2SP1
11. July 2006: added sample ActiveSync OnConnect script
30. June 2006: added ScanDemo 5 page and files
13. June 2006: added itsutils from XDA tools
added description on AutoStartOnConnect "PC ActiveSync can be used to automate tasks on device connection"
added "Disable the ActiveSync Partnership setup dialog"
23. may: added info about ITC programming and WinCE 4.2 support in VS2005
2. may 2006: added Servant Salamander, ifranView to tools
added contact info
7. apr 2006: added iLock4.0.0.4
16. feb 2006: Added links to TotalCommanderCE and CabInstaller on Tools page
19. jan 2006: Added How to create an installer cab
24. jan 2006: Added new iHook3 (v2.0) and new iLock3 to iLock page
27. jan 2006: Added ie sample page


Starting Development

New 31 Jun 2005What you need to develop for a WinCE or PPC device, please see the table below:

GREEN
· Apps written using the tool will run on the platform.
· Tool is able to connect to the platform for deployment, debugging, etc.
YELLOW
· Apps written using the tool will run on the platform.
· Tool is NOT able to connect to the platform for deployment, debugging, etc.
WHITE
· Apps written using the tool will NOT run on the platform.
· The letter “R” denotes combinations where a runtime library needs to be installed on
the device.

ITC programming support

700 Mono

700 Color

CK3x

CK6x

CN30

CN2x

CK1

PPC 2000

X

PPC 2002

X

X

PPC 2003

X

X

PPC 2005

TBD

X

X

CE 3.0

X

CE 4.2

X

X

CE 5.0

TBD

X

Linux

X

 

PPC 2000

PPC 2002

PPC 2003

PPC 2005

CE 3.0

CE 4.2

CE 5.0

Linux

Embedded Tools 3.0

X

X

X

Embedded Tools 4.0

X

X

X

Visual Studio 2005

X

X

X

X

X

X

X

 

New 31 Jun 2005Visual Studio 2005

(23. may 2006)
VS2005 does not support programming for WinCE 4.2 devices. But MS changed there mind due to many requests and now there is a beta service pack for CF2, that adds support for WinCE 4.2 programming. See http://blogs.msdn.com/netcfteam/archive/2006/04/21/580901.aspx for details. The CF2SP1 beta was located here: http://www.microsoft.com/downloads/details.aspx?FamilyID=6548dd53-a418-42d9-a481-19ba3ceca1a6&displaylang=en

New 31 Jun 2005The final CF2SP1 redistributable is located here (or search for Compact Framework 2).


Before you start

It is very essential, that you understand, how a WinCE (PocketPC) System starts and works (here is a brief description). So you should be familiar with the OS and how to change settings and behaviours. One good source are the books about WinCE. Some of them are listed here.

The Registry and powerfull tools for free

Another very good source for information about how a WinCE system works and what are all the registry entries are for is the Windows CE 4.2 Platform Builder. You can download an evaluation software, which includes very valuable sources, utilities and help files. Although the evaluation will expire, the utilities, sources and help files (WinCE 4.2 has about 60MB help files, see pdf sample here) are still accessible and are ready to serve you. You don't need to be a platform builder to get value from these. Another good source for missing informations are the source codes of Windows CE: i.e. get the Windows CE 3.0 source code.

[Added 13.4.2005]: Free Windows CE 4.2 Documentation including Registry description.

[Last change 29.4.2005]:


Lock down or kiosk mode applications

Should the user only be able to use your Application only? If so, then this is been called kiosk mode or lockdown application. The user can not leave your application and cannot change settings that your application needs to run. If you don't lock the user, it may possible, that the user changes essential system settings or deletes files, plays games instead of working with your application.

If you don't like to lock the user, your application should check the environment needed to run properly. In example, formatting for date, time and numbers depends on the International Settings of the device. If you need german settings to correctly display data, you must ensure, that the device has the german settings as long as your application will run. If you locked the user inside your application, you can rely, that the international settings have not been changed.

How is locking been done

There are differnet steps and levels. You can simply search the hhtaskbar window and disable it. You can additionally hide the taskbar to not confuse the user. Then you can enlarge your applications window with the room freed by the taskbar hiding.

You can also disable the SIP (software input panel), to ensure the customer does not use it. If you do not have components with the WS_TABSTOP flag and your application does not have a menu, you can also hide the menu bar. You have to use SH functions to do so and be aware, that these functions differ between a Pocket PC and a Windows CE device.

Here is a sample MFC source disabletaskbar.zip , here a C# one LockDown.cs, here a nice MFC class fullscreenST.zip and here a pure API one showing how to use these technics.

Also take a look at my iLock system! and this little description


Automatic setup of application

If your application is finished, you have to decide, how it will be installed. You can install it manually, if there are only a few devices, where the application will be installed. But if you offer your application to useres in the world or if there are many devices to setup, then you should provide a automatic installation. Automatic installation files on Windows CE and Pocket PC devices are CAB files. You can build a cab using the cabwizard. Cabwizard is part of embedded Visual Tools 3.0 (eVT3), embedded Visual C++ 4.0 (eVC4), Visual Studio .Net 2003 and possibly other development tools. Cabwizard needs an INF file, which is like a script, to compile a CAB file. As the INF file is partly complicated, you should think about using WinCE Cab Manager by OCP software. (Be warned, that the Cab Manager does not work perfectly. It crashes on 0 byte files, it will not import reg files with binary data correctly.) A description of the INF file is here. The INF file will hold the information about which files to copy where, where to create links, the target of the links, how to change the registry. Here is another description by ITC describing the INF file format and how to create cab files: Making a CAB file.htm

You should put all registry changes needed into the cab file(s). In example: international settings, owner information, time zone information, activesync informations, WLAN settings and so on. See also: How to create an installer cabNew 31 Jun 2005

Finding required registry changes[02.052005]

As there is no single source for all the possible registry settings and keys, it is sometimes hard to find the values affected by a option chnegd in the UI. A nearly perfect tool to find registry changes is SSNAP. You should use SSNAP to make a snapshot immediately before you change a setting in the UI and then again directly after you closed the UI component. With this you get two snapshots of the registry, which you can compare with diff tools like the free WinMerge. The differences in the snapshots show you, which registry value has been affected by your change and so you know, how you can change the setting directly with a registry change.

SETUPDLL.DLL

If you need special functions, you write a setupdll.dll, which will be installed as first file during the install and will be invoked by the OS four times: at the beginning with installinit, at end with installexit and during uninstall with uninstallinit and uninstallexit. How can this be done by the OS installing different CABs? The setupdll.dll is extraced first from the cab and will be copied to \Windows\AppMgr renamed to the reflect the cab file information. Now it is available to the OS also all CAB files use the same setupdll.dll name. There is a link to more information and here is another example of an setupdll.dll.

After you get the cab file, you copy it either via ActiveSync (there are automation tools available too), TCP/IP or simply using a PC card reader to have a memory card with the cab that you put into the device.

Autoinstall with AutoRun.exe

If you put in a memory card or boot a device, the OS will look for a AutoRun.exe in a processor specific directory. For Intels PCA, ARM, XScale this directory is 2577 (more in Douglas Boling book, see book links). If the OS finds such a programm, it will be copied to the windows dir and then be executed. It is up to you, how you use this. ITC(1) uses a special AutoRun.exe together with other tools to work thru batch like files called AutoRun.dat, AutoExec.dat and AutoUser.dat. For more information on these look here.

CAB installer

The OS uses wceload.exe to install CAB files. If you tap a cab inside the file explorer, wceload is called and installs the CAB. As default, the cab is deleted after the installation. wceload supports some options, which you can use in a batch like file to customize your installation needs. Here is wceload.doc.

Silent install of Compact Framework updates or service packs

Windows CE 4.x and PocketPC 2003 come with a preinstalled .NET Compact Framework. So some of the files are in ROM. When you try to install a Compact Framework service pack or update, either manually or automatically, you will be asked if you like to overwrite some System files. To avoid this, you must replace the ROM files by dummy files before you start the install of the service pack or update. These dummy files do not have the system, hidden or the IN_ROM flag and can easily overwritten by the cab installation. BTW this is a nice trick: you cannot delete ROM files but you have a file with the same name on top of this ROM file. So, if you don't like a user to play solitare.exe, which is a IN_ROM file, simply replace solitare.exe with an application of your choice by copying it on top of solitare.exe.

In the case of the compact framework service pack 3, the cab install asks for permissions to overwrite mscoree.dll, mscoree1_0.dll, cgacutil.exe and netcfagl1_0.dll. I have written a small cab with a setupdll, that will just create some dummy files with these names (Download PrePareNETCF.zip, incl. source). If you install the cab before the service pack, you will not be asked to replace files.

If you search the internet (exactly the news groups) there is a tip that you can launch wceload with /NOUI to install the compact framework without additional queries.

will be continued...


More thoughts

Show a top window splash screen during startup of the OS (warm or coldboot) as starting up an application can take time. This best is done by writing a simple application, that is loaded by the init registry settings before the explorer shell and will be closed by your application after load is complete.

Ensure Power Management will not be a problem for your application, if you use any online connection to transfer data. You can disable the power button and disable all power management options. So your application is controlling the power.


(1) ITC is

[Counter]

last update: 11. may 2009