Automated Login for Remote Desktop Mobile II

Update 18. nov 2011: fixed some bugs, as mentioned by Patrick S. (great to see, that some take and use the code):

  • screen_width and height for WriteRDP()
  • read FitToScreen from reg in readReg()
  • check for already running process of startOnExit in startTSC(). Although I think check for running a process multiple times should be done in the target process.

Update 16. may 2011: converted code for VS2008(windows mobile 6 sdk), see Downloads at bottom

UPDATE 23 june 2010: new registry option to switch between MouseClick and Keyboard simulation:

REGEDIT4
[HKEY_LOCAL_MACHINE\Software\RDP_autologin]
"FitToScreen"="1"
"FullScreen"="1"
"Status"="connecting..."
"Save Password"="1"
"Domain"=""
"Password"="Intermec+2004"
"Username"="rdesktop"
"Computer"="192.168.0.130"
"DesktopWidth"=640
"DesktopHeight"=480
"startOnExit"="\rdp_keepBusy.exe"
"execargs"="noRDPstart"
"UseMouseClick"="0"    //added with version 3 to switch between mouse and keyboard simulation

 

Some days ago I published my RDP_Autologin code: RDP_Autologin

As there were some screen metrics hardcoded and more and more devices come with a VGA screen the hardcoded QVGA values will not match. So I extended the first version and implemented some additional logic and settings.

First, the emulated screen tap has been adjusted to depend on the device screen width and height. For that I included the HIRES_AWARE resource to get the real screen size.

...
	DWORD dX = (0xFFFF / iScreenWidth) * (80); // changed from 13 to width=240, 1/3=80
	DWORD dY = (0xFFFF / iScreenHeight) * (iScreenHeight - 13);
...
BOOL getScreenSize(){
	int iScreenX = GetSystemMetrics(SM_CXSCREEN);
	int iScreenY = GetSystemMetrics(SM_CYSCREEN);
	DEBUGMSG(1, (L"\ngetScreenSize: x=%i, y=%i\n", iScreenX, iScreenY));
	if(iScreenX>0)
		iScreenWidth=iScreenX;
	if(iScreenY>0)
		iScreenHeight=iScreenY;
	if(iScreenX+iScreenY > 0){
		_itow(iScreenWidth, sScreenWidth, 10);
		_itow(iScreenHeight, sScreenHeight, 10);
		return TRUE;
	}
	else
		return FALSE;
}
...

The rdp file defaults for desktop width and height will also be calculated but you can set the default to use via the registry.

REGEDIT4

[HKEY_LOCAL_MACHINE\SOFTWARE\RDP_autologin]
"startOnExit"="\Windows\rdp_keepbusy.exe" "DesktopHeight"=dword:000001E0 "DesktopWidth"=dword:00000280
"Computer"="192.168.0.2"
"FitToScreen"="0"
"FullScreen"="0"
"Username"="rdesktop"
"Password"="xxxx"
"Domain"=""
"Save Password"="1"
"Status"="connecting..."

As you can see, I added a line where you can specify an application that will be started at the end of the autoconnect process: startOnExit.

Downloads:

evc4 source code: [Download not found]

Armv4i executable: [Download not found]

NEW: Version 3 adds new option to let the app use MouseClick or Keyboard Simulation

Update 18. nov 2011: [Download not found]

Exe File (ArmV4i) [Download not found]

eVC4 source code [Download not found]

NEW: VS2008 code and exe [Download not found]

Update 4.march 2011: Please also see http://blogs.msdn.com/b/raffael/archive/2009/09/11/remote-desktop-mobile-rdp-client-disconnects-after-10-minutes-of-inactivity.aspx about idle timeout

 

67 Comments

  1. Joel says:

    We have Intermec CK71 that lists under Version:
    Windows Embedded Handheld 6.5 Classic

    CE OS 5.2.29217 (Build 29217.5.3.12.26)

    Looking to autologin Remote Desktop Mobile

    What specifically is needed to accomplish this start to finish?

    Thanks

  2. Joel says:

    Hi Josef,

    We have Intermec CK71 running Windows Embedded Handheld 6.5 Classic
    CE OS 5.2.29217 (Build 29217.5.3.12.26)

    We have RDP Autologin Version 5 (10. Feb 2015) working as such:
    RDP_autoLogin.exe is in Handheld\Windows\StartUp so it will automatically start for us upon handheld reboot
    Is there a way to delay Autologin so Wifi has time to connect first?
    Before installing RDM_KeepBusy I already had MyRDM Version 2 Raffaele Limosani (Remote Desktop Mobile (RDP Client) disconnects after 10 minutes of inactivity) in Handheld\Windows\StartUp so it would automatically start upon handheld reboot
    We liked that this prevented RDP time out, but handheld wouldn’t sleep.
    Then I tried using RDM_KeepBusy, but had the same results.
    Is there a way to get handheld to sleep with RDM_KeepBusy or MyRDM Version 2 Raffaele Limosani running?

    When we used RDP Autologin Version 3:
    Exe File (ArmV4i) DOWNLOAD:RDP Autologin Version 3 – New version with Mouse or Keyboard simulation switch in registry: UseMouseClick=DWORD 0/1 (Hits: 1010, size: 6.56 kB)

    Values for Status, Computer, User name, Password, Domain, Save password all work
    Under Options Value for Full screen worked, but I couldn’t get FitToScreen=1 to work.
    And I don’t think Version 3 has option for Color Value.

    Using MyRDM Version 2 Raffaele Limosani and put:
    Remote Desktop Mobile.Ink in Handheld\Windows\StartUp
    our RDP session didn’t time out, and our handheld went to sleep
    We liked that handheld went to sleep, because it saved battery power.

    Appreciate your help

  3. josef says:

    Hello Joel

    as far as I understand you are looking for a delay before RDP_Autologin starts or another way to ensure that there is a working network connection before the start.

    First, the latest RDP_Autologin binary is at https://github.com/hjgode/rdp-auto-login/blob/master/rdp-auto-login/Windows%20Mobile%206%20Professional%20SDK%20(ARMV4I)/Debug/RDP_autoLogin.exe?raw=true. Possibly that fixes your issue with FitRemoteDesktop.

    About your complain about the device not going to sleep when RDM_KeepBusy is running, you are the first one that raise that. You should go with Raffaele’s solution. I do not have any code in RDM_KeepBusy that explicitely prevents a sleep. You may also play with the various ‘simulation’ settings in registry.

    Some devices will power off the network adapter when going to sleep. That will result in a disconnect after the device resumes (assuming that Remote Dektop Mobile will disconnect before the network adapter is connected again).

    Using a fixed delay before RDM_Autologin does start it’s work may or may not help with a missing network connection. But this will be a unreliable solution. Even adding code that does wait for a connection may not be the solution you like. What, if RDM has a disconnect? Then you are back at the main dialog without an autologin.

    Honeywell offers Intermec launcher that enables you to lock down the device and offers some starter icons. These can be configured to be available only if a network is detected. If you use that, the device will start into the Launcher and RDP_Autologin will then be available if a network is detected.

    What do you like? I can add easily some delay at the start of RDP_Autologin.

    ~Josef

    BTW: the full source is available. You may code yourself or hire some to change the code to your like.

  4. Joel says:

    Thanks Josef,

    I was able to find solution to delay autostart until after wifi connects. I also found a way to get around idle timeout without using mouse emulator.
    Do you have an RDP_autoLogin.exe that is similiar to version 4 or 5 so I can have all my settings, but doesn’t use RDM_KeepBusy?

    Appreciate it,

    Joel

  5. Joel says:

    I delete “startOnExit”=”\Windows\rdp_keepbusy.exe” in Registry so I should be all set.

    Thanks

  6. josef says:

    Hello Joel

    yes, that is the setting that makes RDP_Autologin start an external app. There is also a tool to change the settings via a helper application available on my site: AutoLoginSettings. See http://www.hjgode.de/wp/2012/07/30/mobile-development-rdp-autologin-v5/

    ~josef

  7. Joel says:

    Josef,

    New Setup, same handheld.

    Intermec CK71 that lists under Version:
    Windows Embedded Handheld 6.5 Classic
    CE OS 5.2.29217 (Build 29217.5.3.12.26)

    We now are using Intermec Launcher. Inside Intermec Launcher we have RDP_autoLogin.exe (Version 5)
    When reboot Handheld everything is good.
    When log out of RDP session and hit Connect on RDP screen all good.
    But if log out of RDP session and close RDP screen this brings us to the Intermec Launcher screen. Here I hit RDP_autoLogin and it starts working but then gets stuck.

    Can you help?

    Joel

  8. Joel says:

    I should’ve also mentioned that we are using iLauncher version 2.20
    And in the Menu.ini file for iLauncher we have it set to automatically launch applications.
    I also tried it without automatically launch applications in iLauncher but RDP_autoLogin.exe still gets stuck.

  9. josef says:

    FIRST, use the latest binary: https://github.com/hjgode/rdp-auto-login/blob/master/rdp-auto-login/Windows%20Mobile%206%20Professional%20SDK%20(ARMV4I)/Debug/RDP_autoLogin.exe?raw=true

    This is a developer blog, I would gain a lot of money if I would sell binaries. If you have an issue, you can download the code and fix yourself.

    I was unable to reproduce your issue. I assume you are using an outdated binary. Test procedure:
    Start rdp_autologin
    Remote Desktop session is automatically connected
    Exit Remote Desktop app after session loaded
    Started rdp_autologin again
    Remote Desktop session is automatically connected

    So, there is no issue with running rdp_autologin multiple times one after the other.

  10. Joel says:

    Thank you
    What I call Version 6 or later worked!
    Can you tell me what Version you call this latest one and what date stamp I can refer to it?
    https://github.com/hjgode/rdp-auto-login/blob/master/rdp-auto-login/Windows%20Mobile%206%20Professional%20SDK%20(ARMV4I)/Debug/RDP_autoLogin.exe?raw=true
    Thanks

  11. josef says:

    I am sorry, but I do not use or expose a version number, there are only the commits at gihub.com.

    Please alway use the latest one.

  12. Joel says:

    Side topic.

    I am looking for someone who can do:
    Objective C
    C
    C++

    Thanks,

    Joel

  13. soundofthunder says:

    Hi
    I would like to use your program on windowsCE terminal.
    Trying to load the source code with VS2008, the opening attempt fails with an error saying the plateform used is not available on my VS2008!
    Do you think there is a way I can get access to your source code?
    Thanks
    EB

  14. soundofthunder says:

    Hi Josef

    Based on your source code, we attempted to build a WindowsCE autologin with RDP based on CETSC.EXE instead of the one used with Windows Mobile.
    We succeeded in building a new exe and we ware able to send login and password into the cetsc window using keybd_event which is a quite hard and non controlable method.
    My wondering is whether you could help in adapting the program in to windowsCE using this kind of instruction you used to send data to the rdp window:
    SendDlgItemMessage(hTscDialog, 0x3f1, WM_SETTEXT, 0, (LPARAM)(LPCTSTR) strText);
    for which we would need to find out the correct arg intended to WindowsCE and CETSC environnement.
    If you don’t mind, please send me a private message, so that we could find a way for us to build our exe and for you to find any kind of satisfaction you would consider.

    Thanks a lot for your attention.
    EB

  15. josef says:

    Hello EB

    for Windows CE you normally need no separate autologin app, the ‘normal’ cetsc.exe supports using rdp files for autologin. But this depends on the Windows CE build of the OEM.
    A second option is to build your own cetsc, the source code is part of the free downloadable platform builder for your windows CE version.

    To find the right target ‘windows’ to use settext etc., you can use the scanTscWindow (see https://github.com/hjgode/rdp-auto-login/blob/master/rdp-auto-login/tscDialog.cpp). The dialog IDs etc are set in myDlgItems.
    Another option to get the IDs of the dialog items is to use zDump (see http://www.hjgode.de/wp/tag/zdump/),

    regards

    Josef

  16. josef says:

    Hi EB

    the VS2008 Code is written with a Windows Mobile 6 Pro SDK installed. These are coded into the project file. If you do not have the WM6pro SDK installed, the project will not load.

    ~Josef

  17. Hi Josef
    First of all, thanks a lot for your attention and quick replies 🙂
    Regarding what you wrote:
    “for Windows CE you normally need no separate autologin app, the ‘normal’ cetsc.exe supports using rdp files for autologin”
    you are right that we can pass a rdp file as arg to cetsc to load rdp configuration.
    Unfortunately, for some dark security reasons, Microsoft stopped supporting saving username and password in rdp files from Win CE 5.0!
    The username can be loaded from the registry but we found no way to load password!
    That’s why, the way you treated the issue with WM, is a solution for us, sure not very clean, but this works.
    Indeed, if we can build our own cetsc, then it’s much more better but we do n’t know at all where to download the downloadable plateform: The unit is a Symbol industrial terminal that the manufacturer compile WinCE with some built in drivers for screens, wifi… and i’m not sure we could rebuild the plateform.
    If you have any idea to suggest in how to build our own cetsc, let me know, please.
    Otherwise, I thank you again and we will continue to work based on your links to send credentials to cetsc window, as it seems to be a good option for us.
    If you send me a private message, so that we could have a discussion on this RDP issue, I would really appreciate 🙂
    Best regards.
    EB

Leave a Reply