Monday, October 26, 2009

Get an USB Flash key booting DOS

While using Windows Embedded CE or Windows Embedded Standard, you need to boot your device under DOS, in order to format, create partition on the storage, or to use loadcepc to launch your runtime image. Nowadays, floppy disk readers are vintage hardware that you probably don't have anymore, and more over Floppy disk are covered of dust and you are afraid to use them. In this case you have to boot your device using a USB Flash disk, thanks to the fact that most of the actual BIOS do support them.

- HP USB Disk Storage Format Tool (
- Winimage (
- DOS floppy disk image (get from Windows Embedded CE 6 CEPC BSP)

Extract the DOS image
For the first step we have to extract from the cepcboot.144 floppy disk image, the files for DOS. Using Winimage, open the image file, select all the files and go the Image->Extract. Enter c:\Temp\FloppyContent as a folder for the extracted files, and select "Extract with pathname" option.

Format the USB Flash disk
Plug the USB disk and wait for USB device availability notification.
Using the HP USB Disk tool, select the USB device in the list box, use FAT as File System, Select Create a DOS startup disk, choose "using DOS system files located at", and choose the folder used in winimage for the extraction.

Hit Start and voila your device is ready to boot dos. Then you can add the tools you need to prepare the device to boot...

I have identified some USB devices that, are not compatible, cannot be used for booting x86 devices, but did not find the link between them.
This tutorial should also work with Compact Flash devices and SDCard (miniSD, microSD) devices.

Thanks to Eric for his help.

Network Projector demonstration

Joe Broxson, from Adeneo Embedded, is demonstrating the network projector feature of Windows Embedded CE on OMAP3530 based Gumstix Overo device.
Check out the video at
- Nicolas

Tuesday, October 13, 2009

Trick my Windows Mobile device [Part 1]

Change the startup splash screen :

Get bored by the Windows Mobile splash screen display at you Windows Mobile device startup ... here is the solution to customize it. Just pick up you favorite picture, adjuste it to your Windows Mobile device screen resolution, and save it to a png file (mywelcomehead.png).

Then copy it to the Windows folder on your device and then adjust the following keys in the registry :
[HKLM\Software\Microsoft\Splash Screen]
And that's it, restart your device and the nice picture shows up :-)

More for HTC users :
For HTC, you can also change the startup animation, by provisioning on your device and in the registry an animated gif file, just set the following registry key.
Sample below for an animated gif named myanimation.gif and located in \Windows\
WARNING : As usual, use this information at your own risk.

- Nicolas

Post Mortem Debug of Windows Mobile with Visual Studio 2005

We saw on the previous post on Post Mortem debugging, the way to open KDMP files with WinDbg. But those system dump files can also be loaded using Visual Studio 2005 (and higher).

First step : Configure your device
Just follow the instructions in the previous post for the configuration of you Windows Mobile device (registry configuration to specify the location of the kdmp files).

Second step : Locate and copy the kdmp files
Locate the kdmp files on your device and copy it to your Development machine.

Third step : Open the kdmp file and run debugger
From VS2005, go to File -> open project/solution, and select the kdmp file.

Then go to Debug -> Start menu or hit F5 key, this will launch the debugger locally. The exception is then catch, and the assembly source code is shown.

At this time, the debugger is not able to make the link between the binary and the source code, as the symbols are not set. For this show the modules by going in Debug -> Windows -> Modules menu (screen must looks like the screen shot above). Select the module on which the exception occurs in our case it MemException.exe, right click on it and select the "Load Symbols" popup menu.
Provide the path to the pdb files and TAADAAA the source code is displayed.

Have a good debugging then...

- Nicolas

Post Mortem Debug under Windows Mobile with WinDbg

Under Windows Mobile, DrWatson is watching you (... in fact your applications) and identify while they crashe. This is only visible when exceptions occurs, showing memory error reports. At this time a memory dump of the stack and process context is done and stored in a KDMP file located by default in \Windows\System\DumpFiles. This type of files can be then loaded inside the WinDbg application used for desktop application debugging.

Required Tools :
Before starting any debugging you need to get the following tools :
- WinDbg from Microsoft available here (Install Debugging Tools for Windows 32-bit Version).
- Remote Registry Editor provided with Visual Studio 2005.

Sample Application :
An easy way to get memory exceptions, is by accessing unreferenced pointer, we do illustrate the next step of this article with the very simple application code below.

// MemException application

#include "stdafx.h"
#include <windows.h>
#include <commctrl.h>

void PrintHello ()
OutputDebugString(L"Hello World");

void GenerateNullPointerException ()
BYTE *pByte = NULL;
*pByte = 0xFF;

int _tmain(int argc, _TCHAR* argv[])
PrintHello ();

return 0;

First Step : Locate the kdump files
By default the kdump files are located in \Windows\System\DumpFiles folders and are deleted after the error reporting dialog box is closed. So to get those files, you have to copy them while the dialog box is displayed, but unfortunately those files are in readonly mode.
Using the registry you can change the file location folder for the kdump files.
"DumpDirectory"="\Temp\DumFiles" (string entry)
"DumpEnabled"=dword:1 (dword entry)

Second step : Copy the kdump files
While dump files are move to \Temp\Dumpfiles, as shown in the example above, files are not accessed as read only and can then by copy to your desktop hard drive, through active sync.
Note : Don't close the warning message box, before doing the copy as DrWatson is removing the files right after.

Third Step : Open the kdump files
The kdump files are generated by Dr Watson, and can be interpreted by WinDbg, usually used for Windows Desktop debugging.
Launch the WinDbg application and get to File -> Open Crash Dump menu.
Select the kdmp file retrieve from your device.

Then in the command line area of Windbg, launch the command :
!analyze -v

If you look carefully to the output, you will see that the symbols are not loaded, as we did not configure the path to the pdb files (debug information files) of our binary ("Symbols can not be loaded because symbol path is not initialized."). So we have to provide the path to the PDB files, by going to File -> Symbol File Path menu and by adding the path to our pdb files. The PDB files are always located in the build folder, where the .exe or .dll file is generated. DO NOT FORGET to check the reload option located on the bottom left of the Symbol Search Path window. And then validate.

At this time, WinDbg is able to locate the line of code in the application where the exception occurs. When you just have the pdb file but not the source files, WinDbg will not shows up any source code, but will give you the exact location in the source code.

MemException!GenerateNullPointerException+14 [d:\nbesson\projects\vs2005\memexception\memexception\memexception.cpp @ 16]
00011028 0030c2e5 strb r3, [r2]

Known Issues with symbols
Sometimes, WinDbg is unable to find the debug files to locate the source code during the analyze of the dump file. In this case you have to make sure that files hasn't been renamed during copy on the device.
Use the following command to get the link to the source code :
- .sympath : to check the symboles folder, if missing folder go to "File->Symbol File Path" or hit Ctrl+S, add the folder and do not forget to reload
- .reload : to reload symbols
- !sym noisy : to enable verbosity on symbol files access
and finaly if after all those steps the symbol files is not loaded, use the .reload /f <binary file name> to force the symbols loading for this specific binary.

Now enjoy debugging !


Monday, October 12, 2009

Windows Mobile Network Analyzer PowerToy

Checking network capabilities and configuration of a Windows Mobile device is always tricky. You are used to do it under Windows, but same tools are not user friendly on a touch device.

This week end, I had to check the network capabilities of my Windows Mobile 6.1 device, to get the Bluetooth PANU working. I found the Windows Mobile Network Analyzer PowerToy from Microsoft website. This application check the Ip Configuration and the ping feature on the device like ipconfig and ping. A complete Log file is generated, providing the details on the network configuration.

This tool save my Sunday :-)

- Nicolas