Mobile Development: a native remote desktop client (rdesktop port win32)

The famous rdesktop running natively on windows ce and windows mobile

Intro and Background

Some times ago I found that message of Jay Sorg and retrieved a copy of his code for a native rdesktop win32 version. I played a little and got the code compile with Visual Studio 2005 with the Windows Mobile SDK.

I tried to implement windows clipboard support to enhance the transfer of texts between the client and server, but unfortunately I was not successful yet. Hopefully someone jumps in and helps enhancing the code and adds some features.

Rdesktop is open source and you can go with the wince implementation here, but if it does not work for you, you have either change the code yourself (and publish it) or find someone that is able to do for you.

There is a template uiports/xxxwin.c in the actual rdesktop source you can use as a starter to compile the actual rdesktop version for windows mobile if you manage to get all the dependencies to work. If you success, forget this post and go with this version (maybe you leave me a note?).

Why another Remote Desktop/Terminal Server Client?

The Windows Mobile Remote Desktop Client (or Remote Desktop Mobile, RDM) lacks some useful features available in the Windows CE version or the Desktop Windows version:

  • No automated login
  • No kiosk mode
  • Function keys are not sent to server

The first item is essential if you like to start a Terminal Server session without user intervention.

The second item is important for using RDM in a production environment.

The third item is useful to run applications on the Terminal Server (TS) that use Function keys.

Commercial RDM

There are some commercial remote desktop clients available for windows mobile:

  • Mochasoft RDP client
    “Windows 200x servers and terminal servers are not supported, as to a Microsoft patent license.”
  • zaDesktop
    This is currently in an early state.
  • RDP Finster
    Not really clear where this comes from.

I assume some of the commercials are either using mstscax or rdesktop code. Some time ago MS published the RDP documentation. Maybe the commercial apps did start from there. Going with the TSC COM library mststcax would be great, but who has the doc for this? For desktop PCs it is documented but not for windows mobile. If someone has a doc to this leave me a note. Then we can start to write a TSC around this library.

There are also some rewritten TSC for the desktop not using mstscax. One is called ProperJavaRDP and maybe a good starting point to rewrite a dotnet based native TSC for windows mobile.

Usage of the free opensource rdesktop-ce

You can start winrdesktop on windows mobile either with an ini file or with command line arguments:

Sample winrdesktop.ini

(place either in program dir or in root)

[main]
server=192.168.128.5
port=3389
username=YourUserName
password=YourPassword
bpp=16
geometry=1024x768
#fullscreen

server : provide the server IP or DNS host name
port : provide the port to use for RDP, usually 3389
username : provide the login user name for the terminal client session
password : provide the password of the user
bpp : define the bits per pixel to be used (number of colors per pixel)
geometry : define the size of the remote desktop window width x height An application to be used on windows mobile devices should match the screen size of the device. For example 240×320 (QVGA). Otherwise the user has to scroll the window to get access to all of the remote screen.
fullscreen : currently not supported


UPDATE 23. nov 2010:

fullscreen now supported. Fullscreen will switch rdesktop to not show a caption and no menu bar. If geometry matches the device’s screen size, there will also be no scrollbars.

This screenshot was taken of an app I wrote running on a Windows 2003 server of a QVGA device with following winrdesktop.ini:

[main]
server=192.168.128.5
port=3389
username=rdesktop
password=rdesktop
bpp=16
geometry=240x320
fullscreen

Rdesktop usage

Command line

WinRDesktop [-g widthxheight] [-t port] [-a bpp]
    [-f] [-u username] [-p password] [-d domain]
    [-s shell] [-c working directory] [-n host name]
    server-name-or-ip

options are the same as in winrdesktop.ini plus:

-d domain : specify the domain of the user login
-s shell : define a shell to use on TSC
-c working directory : define a working directory for the session
-n host name : specify the host name to use for the client (visible on TSC)

OUTDATED: DO NOT USE, look for latest at github!

Restrictions of current code

See googlecode issues for a list of known restrictions.

Downloads

Windows Mobile Executable and INI sample file at googlecode
Source code: see googlecode

113 Comments

  1. Ernst says:

    Hi
    We found your remote client desktop. He works on a Intermec CK3 perfectly. Is it possible to compile a version without the additive (:ART) with scanning?

    I don’t have VS2005, in VS2008 i can’t compile it.

    Thanks
    best regards
    Ernst Wieland

  2. admin says:

    Hello

    first, this not my code it is derived from Jay Sorg’s post.

    I will place a compiled version with :ART asap.

    thanks for reading

    Josef

  3. admin says:

    Done, compiled version without :ART as postamble: http://code.google.com/p/rdesktop-ce/downloads/detail?name=winrdesktop_r28.zip&can=2&q=

    I also uploaded a VS2008 solution and project file (needs WM6 SDK!) at the googlecode site

  4. Ernst says:

    Hi
    Thank you for your fast support.

    An error exists still: If a short bar code becomes scanned after a long bar code, the old indications at the end of the short bar code are inserted.
    123456, then 999 => 999456 is idicated

    We will use 20 CK3 of Intermec.

    Ernst

  5. admin says:

    uups

    I will take a look at this the next days

    EDIT: Fixed within r36: http://code.google.com/p/rdesktop-ce/downloads/detail?name=winrdesktop_r36.zip

    Sorry

    Josef

  6. Mike M says:

    Does this work with Server 2008 R2? I’m getting this error when I connect:

    ERROR: modulus len 0x108

  7. admin says:

    Dont know, tested against win2003 x86 server

    Cant verify please try to fix yourself.

  8. Hello,

    I am using your remote desktop client on a CV30 with Windows Mobile 5. Evertything works fine, this is finally a good working remote desktop client. But i have a small problem that the Z is entered as a Y and the Y as a Z.

    Keyboard settings which are used on the W2003 server are Irish.

    Do you have a idea what could be the problem?

    Hope you can help.

    regards,

    jordy broekhuizen

  9. admin says:

    Hello

    great to here it works for you. The keyboard works the following way:
    The clients key press has a scan code attached (see WM_KEYDOWN/WM_KEYUP). Only this scan code is transfered to the server and so the ‘translation’ back to a keypress event is done with the servers keyboard driver settings (see http://www.quadibloc.com/comp/scan.htm for keyboard scancode tables). This means, if you press the key to the right of the T on your keyboard, the keyboard driver generates a scancode xy which the windows driver translates to Y for a qwerty keyboard setup and to Z for a qwertz keyboard setup.

    The local (client) keypress are handled in win32.c (see for example handle_WM_KEYDOWN in http://code.google.com/p/rdesktop-ce/source/browse/trunk/source/win32.c). These functions try do there very best to translate chars back to scancodes as WinCE does not support scancodes (see also the extensive comments in win32.c).

    See also the source code and look at winscancodes.h (http://code.google.com/p/rdesktop-ce/source/browse/trunk/source/winscancodes.h). There you have to exchange the scancodes in these lines:
    { L”y”, 0x59, 0xc02c0001, 0x002c , TRUE },
    { L”z”, 0x5a, 0xc0150001, 0x0015 , TRUE },
    to UNTESTED:
    { L”y”, 0x59, 0xc0150001, 0x0015 , TRUE },
    { L”z”, 0x5a, 0xc02c0001, 0x002c , TRUE },
    This table ‘translates’ the keypress char to scancodes to be sent to the server.

    Hopefully this is all you have to change. I only tested english client against english server.

    regards

    Josef

  10. Hello Josef,

    thank you for the fast response. I am not known with making this working or compiling. Can you send me the executable with the keys changed.

    Regards,

    jordy Broekhuizen

  11. admin says:

    I have uploaded a new version for you at http://code.google.com/p/rdesktop-ce/downloads/list
    Please try winrdesktop_r41_qwertz.zip

  12. Eugene says:

    Hello!
    I try execute rdesktop-ce on Symbol mc9060 with CE5 or WM5 OS and all time result is – “The file ‘winrdesktop’ cannot be opened. Either is not signed with a trusted certificate, or one of its components cannot be found.”
    Why?
    Please help…

  13. admin says:

    Which rdesktop ce release did you try?

    Possibly your device only runs signed apps and then I cannot help.

  14. Tom says:

    Hi,

    I have also found the same error trying execute releases of rdesktop_ce on my HTC with WM6. I suspect, that lack of certificate isn’t a problem, because my device can accept unsigned apps.
    Maybe ‘on of its components’ is a problem? Rdesktop uses itcscan.dll, but this library doesn’t exist on my device.

  15. Tom says:

    Hi,

    I have found similar error trying to execute rdesktop_ce. But my device can accept unsigned apps, so maybe problem isn’t caused by lack of certificate.
    The second part of message says ‘or one of its components cannot be found’. This program uses itcscan.dll, which is missing on my device.

  16. admin says:

    Then you have to compile it yourself without USE_SCANNER defined: see win32.c

    //use barcode scanner code?
    #define USE_SCANNER
    //#undef USE_SCANNER

    If USE_SCANNER is defined during compile, the intermec barcode reader code is integrated which needs itcscan.dll.

  17. Tom says:

    Hmmm, unfortunately I don’t have right compiler in order to make .exe file :/
    Could be possible to compile such version and add to download repository?
    A few mates are using smartphones (also HTC, but Touch Pro) but also without this library.

  18. Eugene says:

    Hi!
    Please send link for itcscan.dll

    Thanks!

  19. admin says:

    Just placing itcscan.dll will not help.

    I have uploaded winrdesktop_exe_r43_without_scanner.zip for all the developers without compilers

    Please look at http://code.google.com/p/rdesktop-ce/downloads/list

  20. Eugene says:

    Thanks!
    r43 on WM5 (symbol MC9060) half running (busy icon is desplayed) and after 2 second say error message “ERROR: modulus len 0x108”.
    Prev message about missing components not displayed now.

  21. admin says:

    Check your server settings. RdesktopCE only supports RDP4 format, not RDP5 nor RDC6.

    There are also some posts in internet about “ERROR: modulus len 0x108”.

    Tested OK against win2k3 server with default setting (security Client compatible)

  22. Tom says:

    Hello,

    thanks for new version – it works well – now I can connect with desired resolution (which feature is missing in M$ tool).
    After some small test I have question:
    1- how to emulate right mouse button? In M$ rdp client you have to hold styler at the screen for a while.
    2- none of the keys is right correctly at server side (apart from arrows keys). Maybe there are big differencies in scan codes between smartphone and handheld models? For example, pressing ‘w’ changes window size, pressing ‘del’ sends ‘del’ and ‘7’. If different devices has other scan codes and there are various keyboards on the server side (qwerty/qwertz…) maybe would be reasonable to move conversion table out of application code and create external file?

    Best regards-
    Tom

  23. Eugene says:

    Hello!
    Thanks for helping!
    You BEST!
    Really problem resolved if connect to server with RDP4 protocol.

  24. Hello,

    is it also possible to insert the DOMAIN name in the .ini file?

    regards,

    jordy

  25. josef says:

    Hello Jordy

    this parameter is already usable:
    if (strcmp(param1, “-d”) == 0 || strcmp(param1, “domain”) == 0)

    {

    state = 7;

    }
    Just insert a line

    domain=MyDomainName

    into the .ini file and it should work.

    Josef

  26. admin says:

    See the wiki at code.google.com

    Modulu 0x108 is shown if the server does not accept the clients request to use RDP4 protocol. Check your server settings.

  27. walter says:

    Hello,
    I tried to use the rdo client but the keyboard has some problem; for example if I use the Enter I have sa result “=” and Enter, this happens also for other keys. I read it may be a RDP4 protocol problem, but the original versione of rdp client (installed in wm6.5) works fine.
    I prefer this client because it has Function Keys.
    Is it a way to have the correct keyboard?

    Thank you

    Walter

  28. admin says:

    You have to write your own key translation code table. The app here only supports english-to-english.

  29. walter says:

    Thank you for your answer,
    the problem is not the nationality but a key.
    For example is I hit the key “a” on the keyboard I have two code as return “a F7” (I tested it with 2 program for the scancode).
    It happens also for the other keys (b= “b f8”, c= “c f9”, enter= “enter =”

    I think also Tom in this discussion as same problem.

    Do you think is it possible to solve with a next release?

    Thank you

  30. admin says:

    I have never seen this. I tested on ruggedized devices with builtin hardware keyboards and via the SIP, there was never such translation.

    What scancode test app did you try to check? Does the keyboard (which device) really post so ugly codes (b makes b+F8)? Did you check with my keytest2AK?

    If you rubbish in you will rubbish out.

  31. walter says:

    I used keytest.exe and checkscancode.exe but the problem is visible with all the application; for example if I use office for mobile windows and I hit enter I see a carriage return anche the symbol “=”.
    In this discussion TOM sai “… pressing ‘del’ sends ‘del’ and ’7′…”

    The device is a motorola barcode with a standard mobile windows 6.5
    The original version of rdp client works well (also other terminal client I downloaded) but only your application has the function keys working. In this case the function key doesn’t produce two character but only the exact scancode I pressed for the function key

  32. walter says:

    I’m sorry… I made a mistake on the previous post when I spoke about office for windows mobile; the problem is only on terminal server so the problem of scancode is only on TS so on office or notepad (on office for windows mobile all works)

  33. admin says:

    So, you are using keytest/checkscancode on the terminal server side

    Do you see the problem only with SIP or Hardware keyboard or both?

    What did you setup for remote desktop client protocol on the terminal server?

  34. walter says:

    Yes I used keytest on the terminal server side.

    I have the problem with hardware keyboard. Right now I tested the same with “osk” keyboard but it worked

    On the terminal server I use rdp 5.2 (it is a w2k3), I can’t change it for this I asked if you plained a new release working with other rdp protocol not only rdp4

  35. admin says:

    Hello walter

    I am sorry, but I am unable to do a RDP5 version due to lack of knowledge.

    The post was also done to find helping hands on this with the project but there was NO ONE that offered any help only people asking for feature adds.

    So we are stuck with RDP4 currently.

    According to your hardware keyboard issue: Can you please check the hardware keyboard scancodes etc with keytest3AK (look at my AllPostsList) on the device?

    regards

    Josef

  36. walter says:

    Hello,
    I understand your point of view about the development 😉
    I’m sorry but I’m not so expert to help you to develope a new release.

    I tried your keytest3AK and the scancode is correct (as I supposed) so the problem is only with rdp protocol 🙁

    I search a lot on internet and I tried several version but anybody has a software with working function keys, I’d buy it if I find it!
    Do you if it si exist?

    Bye and thank you for all

  37. Dennis Griesheimer says:

    Hi,

    I am using a CN50 with Windows Mobile 6.5 Professional and i am encountering the same problems as Jordy. The keypad is qwerty and when i use the y or z button the result is switched. So a Y is a Z and vice versa.
    I have tried all the other executables provided but none of them seem to work. I have tried to remap the keys with the keyboard remapper for the cn50 but when scanning barcodes the problem remains. We then tried to create a german keyboard on the remote client which is running Windows XP and then it seems to work (apart from the special keys like !@#$%). How can we fix this problem?

    Cheers,

    Dennis

  38. admin says:

    Hello Dennis

    this post was intended to find co-workers but no-one did attempt to do so. I have no resources of doing all the changes and enhancements.
    The problem you see is caused by the code designed for english to english connections only.
    When you press a key a char is produced and the char has to be translated to a KeyDown/KeyUp event with a keyboard scancode. RDP uses only scancodes transmission and no char transmission. If you look at the code, you will find a translation table for chars to scancodes. This table has to be adjusted for non english-to-english connections.
    Special chars like the double quotes have to send with a shift code. For example: you press Shift+2 on a german keyboard to get the char “, but on english keyboards you will get a @ with Shift+2. The chars-to-scancode table has also to be adjusted for these special chars.

    Sorry

    Josef

  39. […] If you are not the coder you may use UnregisterFunc1 (see my post “Freedom for Function Keys“). But be warned, there are applications that even then will not process Function Keys or do not forward them. For example Internet Explorer Mobile (IEM) will NOT process Function Keys except for internal functions like help or full-screen. Another bad example is Remote Desktop Mobile (RDM). It does not support Function Keys, even if you un-register them before you launch RDM, Function Keys will NOT be processed or transmitted to the host application. An alternative to RDM with function key support is rdesktopCE. […]

  40. TIm says:

    Eugene-
    You say in your Feb. 28 comment that the RDP is working great with your MC9060. I am having the same issue and would like to try the RDP but want to make sure that the barcode scanner still works with the r43 version of the RDP.

    thanks!

  41. TIm says:

    Admin-

    does the r43 work for devices that have integrated barcode scanners? I am using the MC9060 and want to try the r43 version of the RDP but want to make sure the integrated barcode scanner will still work?

    THanks!!

  42. admin says:

    Hi all motorola users

    I dont have a motorola and so I cannot implement and test a native scanning option with rdesktop. The native scanner support available in rdesktop is for intermec only.
    You can still use a non-scanner version on non-intermec devices, but these will support wedged scanner data only.

    Any contributors on the code? Not yet. The source code is available and you may start your own development.

    Josef

  43. TIm says:

    Admin-

    The Motorola MC9060 uses datawedge which allows for barcode scanning into applications that accept keyboard input. Does the r43 version of the RDP accept keyboard wedge input?

    tks
    Tim

  44. Josef says:

    The r43 works as any other win app and supports keyboard input. There is no active barcode scanner code as you can read here: http://code.google.com/p/rdesktop-ce/downloads/list

  45. TIm says:

    We are having problems running the r43 on the MC9060’s. We are trying to connect to a 2008 R2 server. When we load and try to run the r43 client it comes up with the following error “ERROR: modulus len 0×108”. How do we change the RDP protocol on our server to RDP4?

  46. TIm says:

    Is there a newer version of the rdesktop-ce that will work with rdp 6 or 7?

  47. TIm says:

    is r43 the most current version?

  48. Josef says:

    HELLO TIM

    I dont support W2K8 server issues.

    This is open source, if you have any issues, try to fix it yourself.

    No, there is no version that supports RDP 6 nor 7.

    Sorry

    Josef

  49. Vasiliy says:

    How run winrdesktop on Windows Mobile 6.1 ?
    I just copy winrdesktop.exe into Application\ dir on Motorola MC70, but this file not launch, error message appear on screen.

  50. admin says:

    Hello

    you have to provide an ini file with the remote server address and other options. Alternatively you can use a lnk file and provide server, user name, password etc to the app.

    Here is an example ini file: http://code.google.com/p/rdesktop-ce/source/browse/trunk/source/winrdesktop.ini

    See also the history file: http://code.google.com/p/rdesktop-ce/source/browse/trunk/source/_history.txt

Leave a Reply