Monday, 30 April 2007

Using Multi/Dual Core Processors with Platform Builder

If you’re lucky enough to have a dual core development PC, try adding this to your PC environment variables to enable parallel builds on both CPUs:


You’ll then see in taskmanager that your CPU usage goes up to 100% now instead of just past 50%!

Removable disk timeouts in CE

Ever wondered why it takes ages for the Windows CE filesystem to remove SDCards from the filesystem after physically removing the card?

Well its because there are two FATFS registry settings which affect this behaviour. Also these are the reason why after a resume an SDCard can take 12 seconds to become responsive again if a ReadFile operation was called when the driver was powering down for the suspend.

Specifies the time delay in milliseconds between unmounting and detaching a device.
Used during suspend/resume cycles where a block driver might unload and reload on resume.
Default is 5000 microseconds.

Specifies the amount of time waited before re-trying an I/O operation on an unavailable device.
This subkey is not present in the default registry, but may be added by the OEM. If this value is not specified, it is assumed to be three times that of PNPUnloadDelay

See :

The default is set in CE5.0 as 4 seconds to unmount the volume after device removal, this is the delay you see in explorer. And 3 x 4 seconds if any IO operation fails (i.e. if an app is reading/writing to an SDCard whilst the device is suspending/resuming)

Wednesday, 25 April 2007

Bluetooth (serial) SPP using Sockets...!

If you wondered how to connect to a BT serial device using SPP over sockets... heres how!

// create your BT socket

// Create the connection information, this is the RFComm protocol for SPP
memset (&sa, 0, sizeof(sa));
sa.addressFamily = AF_BTH;
sa.btAddr = device;
sa.port = BT_PORT_ANY;
sa.serviceClassId = RFCOMM_PROTOCOL_UUID;
// connect...
connect (s, (SOCKADDR *)&sa, sizeof(sa))

Once connected you can use send/recieve to send over the SPP connection:

send (connectedSocket, (char*)str, len,0)
recv( connectedSocket, str, len,0)

This way you don't have to map serial ports, this was tested on Windows XP but should also work on windows CE.

It was tested printing GPS information from a TOMTOM reciever.

CE6.0 and DumpMem()

There is a known issue with DumpMem() in Ce6.0. It does not correctly format the memory and only the memory offsets are shown. This is evident no matter which debug stream is used.

Debug in CE6.0 and PB6.0

Platform builder 6.0 supports two options for the way debug messages are handled.

Sync Mode

Here the target device waits until the host displays the debug message. The advantage being that you see messages when they were sent but it does slow down the target device.

Async Mode

Here the target device runs as fast as possible. The debug message is queued on the host to allow the device to continue. Debug is only displayed on the host as time permits.

These debug modes are available via the host's registry.

HKCU\Software\Microsoft\Platform Builder\6.00\Debug
DWORD value "SynchronousDebugMessage"
0 == ASYNC
1 == SYNC

Tuesday, 24 April 2007

How to get IMEI, SIM number, Operator and country

Whilst working on my current project I discovered how to get the following information out of Windows Mobile.
  • The Modem IMEI number
  • The SIM number (not the phone number)
  • The SIM operator
  • The SIM operator ID and cell country
These can all be obtained via TAPI. The IMEI and SIM number are available via the lineGetGeneralInfo API. These are returned as the SerialNumber and SubscriberNumber. The SIM operator, ID and cell country are returned by a call to the lineGetCurrentOperator API. Check out about more ExTAPI calls on MSDN here.

Monday, 23 April 2007

Taking control of the "Back" button on Windows Mobile

Ever wanted to know how to get control of the "Back" button on Windows Mobile? The answer can be found in this MSDN article.

Thursday, 19 April 2007

How to get your phone number

Just discovered how to pragmatically get your phone number from Window Mobile. This is documented well on the Windows Mobile Team Blog Site here.

Wednesday, 18 April 2007

EVC 4.0 Remote Tools

Having problems with EVC 4.0 tools greyed out and pointing to the wrong SDK? A collegue of mine has just found the answer. The workaround is in the online EVC 4.0 Release Notes:

View the file properties of the directories:
C:\Program Files\Common Files\Microsoft Shared\Windows CE Tools\Platman\Bin
C:\Program Files\Common Files\Microsoft Shared\Windows CE Tools\Platman\Bin\WCE500

Click the "Advance" button
Click to check the "For fast searching, allow Indexing Service to index this folder" check box
Click "OK"

Vista and ActiveSync

For the Vista users out there you have probably discovered that ActiveSync is no longer supported. What you should be using is Windows Mobile Device Center more info and available for download from Microsoft here.

One unfortunate oversight is that it will not currently Sync with the new Vista Windows Calendar or Email applications. Microsoft, however, are planning a new service release that will support this applications in the future.

Signing Windows Mobile Application Code using Miicrosoft Visual Studio 2005

This post deals with signing code against the Windows Mobile SDK developers certificates. If you have not already installed the SDK certificates on your device see this post. The first step is to install the SDK certificates on your development machine:

  • Navigate to C:\Program Files\Windows CE Tools\wce500\Windows Mobile 5.0 SDk\Tools
  • Double-click on the SDKSamplePrivDeveloper.pfx file
  • Press the "Next" button on the "Welcome to the Certificate Import Wizard" dialogue
  • Press the "Next" button on the "File to Import" dialogue
  • Press the "Next" button on the "Password" dialogue
  • Press the "Next" button on the "Certificate Store" dialogue
  • Press the "Finish" button on the "Completing the Certificate Import Wizard" dialogue
  • Press "Ok" on "Completed" dialogue
  • Repeat the process for the SDKSampleUnprovDeveoper.pfx file

Having installed the certificates you will now need to sign your CAB's, DLL's and EXE's against them. This is done as follows:

  • Open your Microsoft Visual Studio project solution
  • Select from the menu Project->Properties
  • Expand the "Configuration Properties" tree in the left-hand pane
  • Expand the "Authenticode Signing" in the "Configuration Properties" tree
  • Select "General"
  • In the right-hand pane change the "Authenticode Signature" selection to "Yes"
  • Select the "Certificate" field and press the "browse" ellipse to the left
  • Select the certificate you wish to sign against marked "TEST USE ONLY - Sample Privileged Root for Windows Mobile SDK" or "TEST USE ONLY - Sample UnPrivileged Root for Windows Mobile SDK" and hit OK
  • Select "OK" to properties dialogue

On your next build Visual Studio will now automatically sign your executable.

Visual Studio 2005 and Windows CE6.0 Problems

Running VS2005 with a custom CE6.0 SDK requires installing Visual Studio 2005 SP1 (see without this the application can fail to deploy to the platform correctly.

Also SP1 is needed when running on Windows Vista.

Unlocking a Smartphone for development

To develop on a Windows Smartphone you will first need to get the SDK certificates to sign against installed. This is a non-trivial process which involves a couple of registry entry changes and the installation of a CAB file.
First a signed registry editor must be located to run on your target device. These can be found by doing an Internet search for "REGEDIT.EXE". When found copy the EXE onto the device, launch it and change the following registry values:
  • Navigate to HKLM\Security\Policies\Policies\
  • Change the "00001001" value to a decimal 1
  • Change the "00001005" value to a decimal 40
  • Reboot the device
At this point your Smartphone is "Unlocked" to run any code. In the development environment we want to be able to sign code against the correct privileged certificates. The next step is to install these certificates.
  • First install the Windows Mobile Smartphone SDK. This is available here from Microsoft.
  • Copy the file C:\Program Files\Windows CE Tools\wce500\Windows Mobile 5.0 Smartphone SDK\Tools\ onto the device.
  • Launch the CAB file.
  • Reboot the device.
It is now advisable to "Re-lock" your Smartphone so that you can check you are signing your application against the right security certificates. This is done by launching "REGEDIT.EXE" and changing the following registry values:
  • Navigate to HKLM\Security\Policies\Policies\
  • Change the "00001001" value to a decimal 2
  • Change the "00001005" value to a decimal 16
  • Reboot the device
See Stuart Preston's Blog for more information.

Cellcore on Windows CE6.0

Cellcore is the telephony component used on Windows Mobile, this enables voice, data and text functions via a GSM modem.

CE6.0 comes with two examples modem drivers (RIL - Radio Interface Layers) for the TTPCom and Enfora Modems.

Most of the sources, headers and registry entries can be found under the CE6.0 tree here:


Here you’ll also find the 710 Multiplexer, this component effectively splits the single serial port that the modem is available on into two virtual serial ports (default is COM9 and COM7).

To make phone calls Cellcore uses TAPI (Telephone Application Programming Interface) see some of the Smartphone/PocketPC SDK examples for some coding examples.

Making data calls can be done using RAS Dial up, but the RAS setup needs to specify the APN for the data connection. There are no examples under Windows Mobile as this is all handled in Connection Manager on WinMobile.

CE6.0 comes with a WWANDIS component which looks like it virtualises data connections to have a ‘Virtual Ethernet’ driver over GPRS, but there aren’t any docs I can find, anyone know how this works?

Mike Hall has a demo of Cellcore in action on an electronic picture frame… see Mikes Cellcore Demo

C4All The start of a new era

This is the first post of what we hope will be many. The contributors want to share their combined experiences of the Windows Embedded operating systems. So who are these contributors?

Rob Nock
  • Spent 9 Years working with Mitsubishi PC Division (Apricot Computers) and has been with Intrinsyc since 1999.
  • Both jobs have led to in depth experience with embedded systems.
  • Worked on Windows CE from version 3.0 up to 6.0.
  • Worked on Windows Mobile 5.0 and 6.0.
  • Ported BSP's, written numerous drivers and applications.

Graeme Wintle

  • Previous to Intrinsyc (also since 1999 - Rob started the same day!) working at Nokia Telecoms and GST Technology
  • 15 Years of experience in the embedded space
  • Experience ranging from OS Porting to Application design on Windows CE and Windows Mobile
  • 17 hardware platforms under my porting belt so far...!