NAVmoble - the pocket-sized ERP
Optimized for Microsoft Dynamics NAV and Windows Mobile powered devices

Sunday, July 29, 2007

Visual Studio 2008: Device Security Manager

In my post “How to” Series: Windows Mobile Security Configurations, I said that if you want to deal with the device security configurations you may download the Security Configuration Manager Powertoy for Windows Mobile.(there are some other options as well)
If you have the Visual Studio 2008 Beta 2 installed, you do not need this powertoy anymore. It is part of VS 2008,now.

Just cradle the device( or emulator) , launch the Device Security Manager and start locking,unlocking and installing device certificates :).

I just noticed Mark Arteaga has collected some resources related to Windows Mobile Security. Check them out.

“How to” Series: Windows Mobile Security Configurations
Windows Mobile Security resources from Mark Arteaga

Tuesday, July 24, 2007

"How To" Series: Reading Device Owner Information on Windows Mobile

I noticed recently, that some guys asked(in the forums) how to read the device owner information from .NET Compact Framework.

The Device Owner information may be obtained from the device's registry. It is stored under the following registry key: HKEY_CURRENT_USER\ControlPanel\Owner

Note that, this key may be missing on a fresh device. The key is populated after the owner sets his/her information.

The registry key HKEY_CURRENT_USER\ControlPanel\Owner has two interesting values:
"Owner" and "Owner Notes". These values holds binary data.
The "Owner" value contains the following owner information attributes: Name, Company, Phone, E-mail, Address. The "Owner Notes" value contains the Notes of the owner :)
Reading Owner notes is simple like:
RegistryKey key = Registry.CurrentUser.OpenSubKey("ControlPanel\\Owner");
byte[] data = key.GetValue("Owner Notes") as byte[];
string notes = UnicodeEncoding.Unicode.GetString(data, 0, data.Length).TrimEnd('\0');

The tricky part is to "decode" the "Owner" binary data, which contains multiple fixed-length values. In order to deal with it , we have to know the exact length of every device owner attribute:

  • Name: 72 bytes
  • Company: 72 bytes
  • Address: 372 bytes
  • Phone: 48 bytes
  • Email: 74 bytes

So, reading the "Owner" info is easy as:
RegistryKey key = Registry.CurrentUser.OpenSubKey("ControlPanel\\Owner");
byte[] data = key.GetValue("Owner") as byte[];
string name = UnicodeEncoding.Unicode.GetString(data,0,72).TrimEnd('\0');
string company = UnicodeEncoding.Unicode.GetString(data,72,72).TrimEnd('\0');
string address = UnicodeEncoding.Unicode.GetString(data, 144, 372).TrimEnd('\0');
string phone = UnicodeEncoding.Unicode.GetString(data, 516, 48).TrimEnd('\0');
string email = UnicodeEncoding.Unicode.GetString(data, 566, 74).TrimEnd('\0');

You may obtain the full source code from here

Monday, July 16, 2007

Internet Explorer Mobile:One-Column Layout

Fig 1. One Column Layout

I had a complaint from a customer of mine, that the Internet Explorer Mobile(Windows Mobile 5.0) does not render their HTML reports in a tabular form.
At first, I was wondering if they found a defect in our custom HTML exporting feature.Then I realize what happened.

We're using a sequence of TABLE,TR and TD tags to have our HTML content rendered into a tabular form. Some of the users accidentally had switched on the One Column feature of the Mobile Internet Explorer. This layout forces the Mobile Internet Explorer to render all content in a single column without horizontal scrolling.

Fig.2: Default layout

IE Mobile Team Weblog
Wikipedia for IE Mobile

Friday, July 13, 2007

Windows Mobile Device Management

Developing and deploying a software solution is almost never a single act.
After the solution is deployed, it has to be monitored and continuously updated to meet the ever-changing business environment. So, what we developers do is to utilize existing or implementing a custom strategy for automatic software updating.
However, sometimes the business needs to update not only a particular application, but also changing the application environment (underlying OS for example).
The remote computer management is a common practice(there are a lot of tools) these days. However, the remote management of mobile devices(like PDA-s and smart phones ) is not so common. For example on the Windows platform, we have a Remote Desktop and Terminal Services out of the box. And this is not the case for the Windows Mobile devices (there are third party solutions).
Fortunately, there is a solution for this kind of problems, when dealing with Windows Mobile based devices. The out-of-the-box solution is called Windows Mobile Device Management. Windows Mobile provides infrastructure for remote management based on an industry standards published by Open Mobile Aliance(OMA) . Windows Mobile devices support additional extras as well - not mentioned in the OMA specifications.

The term used in the literature is actually provisioning.

Windows Mobile supports 2 OMA standards for provisioning:

The first one is based on a client-server conversation by using a communication session between the device(client) and a special DM(device management) server. During this conversation the server may query device in order to get data from it and may send provisioning instructions to change particular settings over the device. The communication is based on TCP/IP ,so any TCP/IP capable infrastructure may be used(GPRS,WiFi,...). This post will not talk about this kind of provisioning...

The second one called OMA Client Provisioning is based on deploying(sending) a special xml file on the device ,which contains provisioning instructions. There are various instructions supported by Windows Mobile, which allows for:
- Managing connectivity (GPRS,VPN,WiFi,...) settings of the device
- Managing e-mail accounts in he Pocket Outlook
- Managing Pocket IE favorites
- Managing device registry(adding,modifying and deleting registry keys)
- Managing security settings
... and even more...

The instructions are grouped by functional areas and referred as Configuration Providers. The Configuration Provider actually is the software component, which processes particular type of instructions.
Check out the available configuration providers.

The provisioning files may be delivered to the device throughout the following channels:
  • ROM image
    provisioning files may be deployed in the device's ROM and applied on cold boot.

  • RAPI and ActiveSync
    the rapiconfig.exe is placed in the tools directory of the SDK

  • Deployment as .CAB or .CPF file
    Provisioning files may be packaged in a CAB files and deployed on the device like any other CAB file( ActiveSync,LAN, SD/MMC card, etc)

  • OTA (Over-the-air) Provisioning
    this includes various techniques like DM Server, WAP Push, SMS, E-mail, HTTP(web site download)

  • Custom file delivery and the Windows Mobile Configuration Manager API
    The developers may use the managed WindowsMobile.Configuration.ConfigurationProvider (Part from the Windows Mobile 5 SDK) to "execute" provisioning files. Your application may receive provisioning files through various comm channels( SMS, E-mails, Web Services ,... what ever) and pass them to the configuration provider for execution.
Open Mobile Aliance
OMA DM Provisioning for Windows Mobile
OMA Client Provisioning for Windows Mobile
Configuration providers supported by Windows Mobile
Managing Windows Mobile 5.0

Tuesday, July 10, 2007

"How To" Series: Retrieving IMSI and IMEI on Windows Mobile

I had to retrieve the IMSI and IMEI on Windows Mobile for a particular project.
What I needed actually was the IMSI , because it may be used in OMA Client Provisoning through WAP Push scenarios. It may be very practical for the enterprise to manage its devices remotely and I will post more on that topic later on.

In order to retreive IMSI and IMEI, one have to deal with the Telephony API and PInvoke. In general the magic is done by invoking the native lineGetGeneralInfo routine from TAPI.
You may download the full source code from here

the original code article may be found here

There is another approach as well - buy the Telephony library from OpenNETCF

What is IMSI
What is IMEI
OMA Client Provisoning for Windows Mobile
The sample source code

Wednesday, July 04, 2007

Sofia .NET User Group Meeting Summary(July'07)

The regular monthly meeting of Sofia .NET User Group just finished. We had a great presenter - Dino Esposito, who scratched some of the topics around the Workflows and Multi-tier Applications.
We gladly consumed the snacks, kindly provided by the sponsors (Crossroad, Microsoft)

You may be part of the Sofia .NET User Group activities by registering here

Following some photos as usual:

Sunday, July 01, 2007

Dino Esposito at the Sofia .NET User Group

It's time to have our regular monthly meeting again!
This time Dino Esposito will talk about "Design, Host and Deploy Workflows in Multi-tier Applications".
The event will happen in Hotel Vega,Sofia ,04.July at 18:30. The places may be limited - so hurry up and register on the Sofia NET User Group web site
This gotta be a wicked session ,so be there!

The event is organized with the help of Martin Kulov, Crossroad and the local Microsoft office.

Dino Esposito will have a 2 days course named "Wicked ASP.NET Programming Seminar" on 4th and 5th July .He will cover very interesting ASP.NET related topics. You may check out the details on the event's web site

Sofia .NET User Group Registration
Wicked ASP.NET Programming Seminar

The session in front of the Sofia .NET User Group(04.Jully.2007,18:30h) will be broadcasted live.