Thursday, February 28, 2008

Windows Mobile Trojan

WindowsForDevices post an article on the first trojan discovered by MacAfee's Avert Lab on WiMo devices. This trojan opens security permission on the device and can contaminate other devices using SDCards.

Read full article ...

- Nicolas

Tuesday, February 26, 2008

Readers contribution

First of all, thanks all for your fidelity.

To exactly match your expectation in term of content, I'm opening a suggestion emailbox to submit your questions and ideas for the next articles to publish on this blog.

You can send your requests to : nbesson DOT blog AT gmail DOT com
Again, thanks for your help.

- Nicolas

Tuesday, February 19, 2008

Smart Device deployment and debugging using VS2005

When developing smart device application, in C# or C++ (Win32 or MFC) using Visual Studio 2005, you have different solutions for the deployment and debugging of your application.

ActiveSync :

This is the easiest way as it just required the support of ActiveSync in your Run Time image and a Serial or USB Function interface correctly setup. When connecting the device to you development computer ActiveSync should start and connect to the device. VS2005 is setup to use the ActiveSync link automatically for the deployment and debugging. No particular actions are required for this connection type.

KITL :

If you have the chance to have a KITL connection between the device and Platform Builder, you can directly use this connection with another instance of VS2005.

Pre-requisite

Before been able to use the KITL connection from VS2005, you have to create and setup a device configuration. To do so you have to open the Connectivity Options window in the VS2005 instance running the Platform Builder plug-in. Use the Create Device button to add a new device to the list of devices identified by Platform Builder. Associate this new device to an SDK if you got one or to the Generic Platform Builder OSDesign in the drop list as shown bellow.


Then select this new device and setup the Transport and Download information as you are usually doing it with your target device. Then attach and download the Runtime image to the target. This VS2005 instance will be use to debug the OS, and not your application. You will be able to add break point in the drivers and/or OAL.

Connect

In the second VS2005’s instance start/load your application solution and go to the Tools menu followed by Options then Device Tools group, select Devices, select the device created previously in the list and edit the Properties. Check that the Transport configuration is KITL. Validate all the open windows and close.


Now your system is ready to deploy and debug your application on the device using the KITL layer.

Corecon :

Corecon use the network interface to communicate with Visual Studio and requires to launch two applications on the device, but before you need least the following files on your device:

  • clientshutdown.exe
  • CMAccept.exe
  • ConmanClient2.exe
  • DeviceDMA.dll
  • eDbgTL.dll
  • TcpConnectionA.dll

Those files can be directly integrated in the nk.bin using the project.bib file or copied on the device at runtime using USB flash key or FTP connection.

Those files are not provided directly with the Windows Embedded CE 5.0/6.0 development environment, but are located in the VS2005 folders in the folder :

c:\Program Files\Microsoft Shared\CoreCon\1.0\Target\wce400\ProcessorType\

Binary versions are available for all processors supported by WinCE (ProcessorType).

Pre-requisite

The two applications, CMAccept and Conmanclient2 have to be launched manually when a connection to VS2005 is required. To do so you have to get a way to launch them, using the explorer window on the device, or using a telnet connection. You will also need the IP address of your device to correctly setup VS2005 connection. Without this IP address VS2005 would not be able to connect to the device.

Launch and connect

Under VS2005 you have to select and edit the device connection property by going to the menu Tools followed by Options then Device Tools group, select Devices, select the device in the list and edit the Properties.

In the Properties window select the Transport as TCP Connect Transport and then Configure. In the Configure window check the Use Specific IP address andx enter the IP address of the device. Validate all the open windows and close.


On the device you have to launch the ConmanClient2 application, followed by CMAccept. At this time you have approximately 3 minutes to connect the VS2005/2008 instance with your target. Elapsing this time you will have to launch the CMAccept application again before trying to connect.

In the VS2005, select the device in the device drop box list and click on Tools followed by Connect To Device. The connection may succeed and you should be able to start the deployment and/or debugging.

Those three configuration are using different communication layers but will provide the same set of functionalities for the deployment and debugging of Smart Device applications.

[Updated on 02/19/2008]
For the Windows Mobile user, to get all the steps for those platforms, you can check out the article on the Fabien blog.

- Nicolas

Monday, February 18, 2008

Catalog item notification

BSP components (drivers, or custom applications) require some attention from the user and should notify him. A catalog description of a you can easily integrates a notification messages that will show up when user will add this component to the OSDesign, like the one displayed when adding the FTP server or Telnet server to an OSDesigns.




By adding that kind of notification message Platform Builder will also display an exclamation mark icon next to the check box of the catalog component. The notification message and title can personalized, for that add to a specific component the Notification Html (body message) and the Notification Title (shown in bold in the notification window) as shown bellow.


- Nicolas

Monday, February 11, 2008

Dynamic JIT Debugging [Updated]

Booting a device with the debugger is sometime a real challenge due to the stability of the device. So loading the debugger later could be the solution. To do so, we have to include the JIT debugger files in the Windows Embedded CE binary image, to launch it when required.
If the debugger is not launched exceptions are not handled correctly, and second chance exceptions neither.

Inclusion of the JIT Debugger
In the project.bib file of the current OSDesign, add the following lines in the FILES section :
kd.dll $(_FLATRELEASEDIR)\kd.dll NK SHK
osaxst0.dll $(_FLATRELEASEDIR)\osaxst0.dll NK SHK
osaxst1.dll $(_FLATRELEASEDIR)\osaxst1.dll NK SHK

The files are added to the FILES instead of the MODULE section to ensure that the debugger will not be launched 'till you launch it manually.
[Update 07/25/08] You can also include the loaddbg.exe file to the runtime image to avoid the loading of this files over KITL. But do not include hd.dll, otherwise the debugger will be started automatically at startup.

OSDesign configuration
Select the following options for the OSDesign:
- Unselect Kernel debugger
- Enable KITL

Launch the debugger
To launch the debugger when required, you just have to launch the loaddbg.exe application using the target control window.
s loaddbg.exe
Note : When activating the debugger, the system may take few seconds load all the symbols files from your hard drive.

- Nicolas

Monday, January 14, 2008

Automatically add files to an SDK

When building an SDK using Platform Builder 6.0 (and previous), you may need to include your own files. Those files are the list of IOcontrols of drivers you implemented, or header files required to link to a new library that you want to provide in your SDK. In that case you have to include those files to your SDKs.
The first one is a manual inclusion of those files using the configuration wizard of the SDK. That’s mean that every time you generates the SDK you have to take care of those files.
The second solution is to automated this mechanism by copying those files to a specific folder that will be used automatically by the wizard during the generation of the SDK.

Identification of the sdk folder :
The SDK tool uses the content of the cesysgen folder (located in your OSDesign folder), and the sdk folder located in the same folder as the cesysgen and OAK folder.
$(_PROJECTROOT)\sdk or $(_PROJECTSDKROOT)
The SDK tool adds the content of the sdk\Inc and sdk\Lib folder to the SDK msi file. So you must store the files you need to provide with the SDK in those sub folders. Doing it manually is never the solution, so by asking the Windows embedded CE build environment to do it, it is more reliable. This could be done during the build of those libraries or drivers.

Add an automated task :
Using the sources files you can add dependencies and enable automated task for the build engine. You could also use the postlink macro, but this is not the purpose of this article.
In the sources file add the following lines :
#------------------------------------------------------------------------------
# SDK files
#------------------------------------------------------------------------------
# Enable copy to the SDK directory
WINCETARGETFILES=$(WINCETARGETFILES) CopyFilesToSDK
SDK_FILES=gpio_iocontrol.h driverheadertoshare.h

Any target files that you specify using WINCETARGETFILES are added to the list of dependencies that must be satisfied to generate a successful build. Also by listing the files you need for your SDK in the SDK_ FILES variable, you will generate a list actions that will be solved later in the makefile.inc.
In association to the sources file you must provide a makefile.inc (located in the same folder), this file is proceeded after your sources files during the build. In this file you must satisfy the dependency list, so it must contain information about the CopyFilesToSDK.

Makefile.inc content will be something like this :
CopyFilesToSDK:
#REM copy the files listed in SDK_FILES to $(_PROJECTSDKROOT)
....
The copy will be done in batch script language and executed by the build engine.
After the build of the driver or the library, you may find all your required files in the $(_PROJECTSDKROOT) folder.
In this article I described only one list of files to be proceeded, but it make sense to have two lists, one for the header files and the sdk\Inc folder and another one for the sdk\Lib folder for the libraries.

-Nicolas

Thursday, January 3, 2008

Happy New Year

I wish you an Happy New Year 2008.

For this new year, I'm glad to announce that I have been awarded as Windows Embedded MVP for the second time. So thanks to the Mike Fosmire and the MVP team for this award.

- Nicolas