Sunday, October 28, 2007

Detecting what .Net CF version is installed on your device

Are you looking for help detecting what .Net CF version is installed on your device? Do you need to find out if it’s already installed or not? I’ll try to give you some help in both topics.

For the end-user, the easiest way to find the .Net CF version installed on Windows Mobile prior to WM6, is using the “Remove programs” option in the device “Settings” menu. In the list of software installed on your device you can find the .Net CF including the version. If you cannot find the Microsoft .Net Compact Framework there, it’s not installed on your device. Please be careful and do NOT uninstall .Net CF accidentally.
Some devices (i.e. Windows Mobile 6 devices) have .Net CF included on ROM (out of the box). On those devices the previous method cannot help. The best end-user method to detect the .Net CF version on your device is using “cgacutil.exe”. You can find this app using a file explorer in the “\Windows” folder on your device. Running “cgacutil.exe” you’ll see the .Net CF versions installed on your device (i.e. a message showing [3.5.7121.0, 2.0.7045.0] means your device have .Net CF 3.5 Beta 2 and 2.0 SP2). If you cannot find “cgautil.exe” on your device, .Net CF is not installed.

If you’re a developer, probably you’ll need a way to programmatically detect if .Net CF is installed and/or what version is installed on the device. To check if .Net CF is installed, you can use kind of a native code installer, and look on the device registry for the following Key:

[HKEY_LOCAL_MACHINE\Software\Microsoft\.NETCompactFramework]

You’ll find a dword value for each .Net CF version installed on your device with the version as the name (i.e. two dword values named “3.5.7121.0” and “2.0.7045.0”). The value can be “1” or “0”. A “1” value means the version is installed on ROM and a “0” value means it has been installed manually and can be uninstalled. If you cannot find the registry key or any value in there, the .Net CF is not installed on the device.
Finally, from your .Net CF application you can detect the current version using:

Environment.Version

In a device with several .Net CF versions installed, you can also configure your application to run on a specific version. Take a look at this article to learn a little bit more about it.

What about friendly version names? Here you have a list of .Net CF versions:

  • 1.0.2268.0: 1.0 RTM
  • 1.0.3111.0: 1.0 SP1
  • 1.0.3226.0: 1.0 SP2 (Recalled)
  • 1.0.3227.0: 1.0 SP2 Beta
  • 1.0.3316.0: 1.0 SP2 RTM
  • 1.0.4177.0: 1.0 SP3 Beta
  • 1.0.4292.0: 1.0 SP3 RTM
  • 2.0.4037.0: 2.0 May CTP
  • 2.0.4135.0: 2.0 Beta 1
  • 2.0.4317.0: 2.0 November CTP
  • 2.0.4278.0: 2.0 December CTP
  • 2.0.5056.0: 2.0 Beta 2
  • 2.0.5238.0: 2.0 RTM
  • 2.0.6103.0: 2.0 SP1 Beta
  • 2.0.6129.0: 2.0 SP1 RTM
  • 2.0.7045.0: 2.0 SP2 RTM
  • 3.5.7066.0: 3.5 Beta 1
  • 3.5.7121.0: 3.5 Beta 2

Tuesday, October 23, 2007

Internet Pass-through connectivity problems with ActiveSync and WMDC (Vista) - Error 0x80072f78

A friend called me few days ago asking for help connecting a Windows Mobile 5.0 Palm Treo to the internet via the Vista’s Windows Mobile Device Center (WMDC) pass-through. In this case the Smartphone was connected to the desktop thru Bluetooth, but this is not the first time I have to face this problem. Actually you can find the same problem even in USB connections, and not just using WMDC, also using ActiveSync 4.x.
One of the symptoms of this problem is an error 0x80072f78 trying to browse a site from the device, or just getting an ugly connectivity settings error.
If you’ve tried to solve this problem before looking for help on the web, probably you’ve found kind of a “black magic” solution: a registry tweak adding a new DWORD value named “AllowLSP”. But what is all of this about??
Let’s start from the beginning: LSP = Layered Service Provider. It’s a feature of Microsoft Winsock 2 Service Provider Interface (SPI). It makes possible to modify transport services, i.e. implementing a firewall. You can find more info here.

DTPT (Desktop Pass Through) allows the device to talk with the desktop network (or the internet if the desktop has internet access) while ActiveSync is running. It’s implemented as a socket level proxy technology, including a server side (ActiveSync or WMDC) and a client side implemented as a LSP (the DTPT LSP).

ActiveSync, from its version 4.2 and above, has changed the way it interacts with the Microsoft Windows networking stack to support Layered Service Providers (LSP) on outgoing Desktop-Pass-Through connections. In many corporate environments this provides improved compatibility and policy compliance.
Unfortunately, there are several cases where you can find LSPs interfering with ActiveSync communication. So, we need to enable ActiveSync on the desktop to function together with LSP applications
.

It requires to edit (or create) a DWORD registry key called “AllowLSP” on the desktop, in the following registry path:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows CE Services]

The possible decimal values are:

0: Bypass LSPs for incoming and outgoing connections.
1: Bypass LSPs for incoming connection and use LSPs for outgoing connection.
2: Use LSPs for incoming and bypass LPSs outgoing connections.
3: Use LSPs for incoming and outgoing connections.

The value which used to work in this case is “0”, because it bypasses LSPs as previous ActiveSync versions use to do. But if your computer environment relies on LSPs (a very common scenario in corporate networks), probably you’ll need to identify which LSP is causing the conflict and then decide whether you can uninstall the related software package. It’s doable running this command from a command prompt:

netsh winsock show catalog

As result you’ll find a list of each LSP installed on your machine. For sure this information is really cryptic, but it can be helpful in order to determine what you need to remove.
In some scenarios you can use the value of “2”. It allows LSPs for incoming connections but bypasses them for outgoing connections.
It’s highly probable that you need to reset your desktop (or restart activesync killing the “wcescomm.exe” process and launching ActiveSync manually) to reflect the changes.

Additionally, if you have a firewall running, please add the following processes to the application exception list:
  • Wcescomm.exe
  • WcesMgr.exe
  • RAPIMgr.exe
  • CEAPPMGR.exe

If this post cannot help you, probably you can find an answer in this link.

Hope you finally get your device connected to the internet thru ActiveSync!