none
activesync problem with wince 5.0 device

    Question

  • I have a wince 5.0 device. Unfortunately, when I try to link this device to a pc via USB cable, instead of launching activesync in both sides, a propriatery program is launched in wince device which only allows connection as a hard disk. Hence, I am not able to connect the device to PC and use activesync (I will use activesync to deploy programs from VS2005).

    I think, the name of the program which is launcehd in wince device after the connection is USBoption.exe since when I click this exe file, the same screen is shown.

    Please advice me how to create an activesync connection between this wince device and pc.

    Thanks in advance.

    PS: I am very sorry that I have used activex instead of activesync mistakenly in both subject and body.
    Sunday, September 27, 2009 11:59 PM

Answers

All replies

  • Hi,

    You may want to refer to ActiveSync rather than ActiveX in your post, in both the title and the body.

    Thanks

    Paul Diston
    http://www.smartmobiledevice.co.uk/
    Monday, September 28, 2009 7:11 AM
  • You need to do quite a few things 9 (connectoids etc.) to support ActiveSync on a Windows CE platform.

    Explore to \Windows folder on the device and locate repllog.exe. If found tap on it. This executable initiates ActiveSync process. What does it show on your platform?

    Regards,
    Onkar

    http://www.42gears.com
    [SureLock Studio: Locks down Enterprise Windows Mobile devices]
    Tuesday, September 29, 2009 2:11 AM
  • "Onkar", Thank you very much for your reply.

    When I tap repllog.exe , it displays  a window which says "Connecting to Host" and two buttons: Hide and cancel. In a second, the window disappears and a sound is heard. I tried this wihout any PC connection, because of the reason I will explain below.

    When I connect my device to PC, a screen with two buttons is displayed: One is for connecting the device as a USB hard disk and the other is for charging the device. If I tap "Usb hard disk" a connection is made with the PC but I can only transfer files. also, since I cannot run any program when this option is selected (I cannot get out of this window) I couldn't try replllog.exe.

    If I tap "Charge" button, then the PC doesnot recognise the device.

    I think, my first problem is to disable this program so that it doesnot get control when the device is connected to the PC. Instead, the system should run repllog.exe.

    Of course there are other problems. One of them is that, windows is in ROM and I cannot make any changes to the files in windows directory. I can copy files into the windows directory, but after a boot (soft or hard) these files disappear.

    Hopefully, I can edit registry (this was how I could unlock my device).

    Regards

    PS: My device is a navigation device running win CE 5.0. I have unlocked the device, i.e. now Win CE boots. I will try to use this device to run my programs written under VS2005 (when I copy the programs which were build for Mobile 6.0, they run perfectly, even SQLCE compact edition). I want to use activesync to debug my programs.

    Another question is, is it possible to use the device in portrait form instead of landscape, i.e. turn the device 90 degrees?
    Tuesday, September 29, 2009 7:48 AM
  • You can change the display orientation (portrait to landscape and vice-versa) by calling ChangeDisplaySettingsEx API . If you want to do it at startup, you can create a small program which calls this API and copy the application shortcut to \windows\startup folder.

    ActiveSync Issues:

    Unlike Windows Mobile, OEM can change/add/remove anything in a Windows CE based platform. There can be many reasons why ActiveSync might not work on your device. OEM might have simply removed a few registry entries and replaced them with the registry settings for harddisk/charging application.

    Check out the following:

    http://msdn.microsoft.com/en-us/library/ms861416.aspx

    You can try to configure the settings for USB activesync.

    - Onkar



    http://www.42gears.com
    [SureLock Studio: Locks down Enterprise Windows Mobile devices]
    Tuesday, September 29, 2009 9:29 AM
  • I have already tried this. In Visual Basic 2005, I used the statement
            SystemSettings.ScreenOrientation = ScreenOrientation.Angle90
    to change the orientation. But for every angle (90, 180, 270) except zero, I got an exception at
            microsoft.agl.common.misc.handlear...
    at
           microsoft.windowsce.forms.systemsettings.set_screenorientation

    If you have any information about what this happens, I will be very happy to know it.

    Meanwhile, I cannot put such a program under \windows\startup folder because whatever put under system directories (windows, program files, temp, etc.) disappears after a soft or hard boot.

    I think, the manufacturer has built a custom WinCE and replaced repllog.exe by his own routine in USB-triggered event. Hence, probably I have no chance to run activesync in my device (I have no idea about how to configure the settings for USB activesync).

    Thanks a lot for your valuable contributions.



    Tuesday, September 29, 2009 5:01 PM
  • You might want to check if screen rotation is supported on your device. Check out the following post:

    http://blogs.msdn.com/davidklinems/archive/2005/06/16/430000.aspx

    And compare your code with the following:

    http://blogs.msdn.com/davidklinems/archive/2006/04/17/577897.aspx

    - Onkar

    http://www.42gears.com
    [SureLock Studio: Locks down Enterprise Windows Mobile devices]
    Wednesday, September 30, 2009 11:25 AM
  • Hi Biriktiricix,
    Your manufacturer obviously included the Mass_Storage_Class in his image. The question is whether he added the Serial_Class. Check if the device has a file named "serialusbfn.dll".
    If it is there, I will post the registry settings I add to make the Serial_class the active one.

    As for the files not being persistent, try the following:
    Create the program you want and place it in a persistent storage. Add keys to HKLM\Init according to this (and this handles C# ) article to make the program launch as soon as the shell is up. In this program you can copy over files and they should be shadowed by your copy even if they are in the NK.bin (almost sure - never tried this).
    You can also add a driver that will load relatively early in the process and the driver can change the files you do not want to load.

    If you are correct about the usb triggering, you can find out the name of the program the manufacturer is running and put your own copy instead.

    Shai
    Wednesday, September 30, 2009 12:30 PM
  • Hi Shai,

    1. The device has "serialusbfn.dll" in windows directory. Hence, I will wait for your post for the registry settings.

    2. Running a program at startup is extremely clear with the above explanations. In fact, this was how I unlocked the device.

    3. When USB is triggered, USBoption.exe is invoked. This program only allows USB hard disk connection or recharging. Since this program is under windows, directory, I cannot replace it with replllog.exe for starting activesync comm. Unfortunately, I couldn't find this program in registry.

    Thanks for your help.

    Regards



    Wednesday, September 30, 2009 1:02 PM
  • What happens if you run over that application with your own file? Does your application execute?

    [HKEY_LOCAL_MACHINE\Drivers\USB\FunctionDrivers\Serial_Class]
    "Dll"="serialusbfn.dll"
    "DeviceName"="USBFNS1:"
    "Prefix"="COM"
    "DeviceArrayIndex"=dword:00000000
    "RxBufferSize"=dword:00004000
    "IClass"="{CC5195AC-BA49-48a0-BE17-DF6D1B0173DD}"
    "idVendor"=dword:00001286
    "Manufacturer"="Marvell"
    "idProduct"=dword:0000A6CD
    "Product"="WindowsCE.NET 6.0"
    "bcdDevice"=dword:00000000
    "Tsp"="Unimodem.dll"
    "DeviceType"=dword:00000000
    "Priority256"=dword:00000067
    "InterfaceSubClass"=dword:000000FF
    "InterfaceProtocol"=dword:000000FF
    "FriendlyName"="USB Cable:"
    "Index"=dword:00000002
    "CompositeFN_FunctionClass"=dword:0000000A
    "CompositeFN_FunctionSubclass"=dword:00000000
    "CompositeFN_FunctionProtocol"=dword:000000FF
    "CompositeFN_DisableIAD"=dword:00000001
    "CompositeFn_Disable"=dword:00000000

    [HKEY_LOCAL_MACHINE\Drivers\USB\FunctionDrivers\Serial_Class\Config]
    "EnableFlowHard"=dword:00000000
    "EnableFlowSoft"=dword:00000000

    Some of this is device specific to my system (too lazy to filter this).

    Under
    [HKEY_LOCAL_MACHINE\Drivers\USB\FunctionDrivers]
    DefaultClientDriver="Serial_Class"

    You set which USB function to load. In your case it should say "Mass_Storage_class".

    If your registry is persistent try to set the value to Serial_class and then you will have to figure how to make replogg auto connect you.

    BTW:
    I am familiar with Windows CE 6.0 and not 5.0, though on this subject I do not think there is a difference.

    Hope this helps,
    Shai

    • Edited by Shaihi Wednesday, September 30, 2009 1:47 PM disclaimer :)
    Wednesday, September 30, 2009 1:39 PM
  • I think I am in great trouble:

                  [HKEY_LOCAL_MACHINE\Drivers\USB\FunctionDrivers]
                  DefaultClientDriver="Serial_Class"

                  You set which USB function to load. In your case it should say "Mass_Storage_class".

    I changed this value to "Serial_Class". Additionally, I set the IsActivesync value to 1. Nothing changed (i.e. usboption.exe application is invoked). I looked at the registry and saw that these values are untouched.

    After a soft boot, I looked at these keys and saw that THEY ARE RESTORED TO THE ORIGINAL VALUES (i.e. ClientDriver was reset to "Mass_Storage_class" and IsActivesync was reset to 0). Since my registry may be edited (I have made several changes which are permanent and doesnot change after soft and hard boot) this change may only be made by a program.

    Regards

    PS:
    1. In my device, [HKEY_LOCAL_MACHINE\Drivers\USB\FunctionDrivers\Serial_Class] has nearly same values as you do (only some minor changes exist)

    2. I think while the company regenerating their WinCE, they have set their own program instead of repllog.exe (code taken from http://msdn.microsoft.com/en-us/library/ms861131.aspx). I have to find this section in registry and analyze it.

    By default, Repllog.exe is set up to be notified of any communications port events (NOTIFICATION_EVENT_RS232_DETECTED). If the driver sends this event, Repllog.exe starts automatically with the default parameters, as defined in the following section of datasync.db.

    ; @CESYSGEN IF DATASYNC_MODULES_REPLLOG
    Record :
    Field : 0001001f : "repllog.exe"
    Field : 0002001f : "AppRunAtRs232Detect"
    Field : 00030013 : 9
    End
    ; @CESYSGEN ENDIF

    Wednesday, September 30, 2009 5:49 PM
  • OK, I am afraid you are on your own at this point.
    A good site for hacking devices is: http://forum.xda-developers.com/

    Best of luck,
    Shai
    Thursday, October 01, 2009 7:46 AM
  • Thanks everyone for helping me.

    Regards

    biriktiricix
    Thursday, October 01, 2009 6:05 PM