Bug 2369 - SeamlessRDP sometimes displays the shapes of cmd.exe
Summary: SeamlessRDP sometimes displays the shapes of cmd.exe
Status: CLOSED FIXED
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: | rdesktop (deprecated) (show other bugs)
Version: trunk
Hardware: PC Linux
: P2 Normal
Target Milestone: 4.0.0
Assignee: Henrik Andersson
URL:
Keywords: astrand_tester
Depends on:
Blocks:
 
Reported: 2007-02-22 09:33 CET by Peter Åstrand
Modified: 2012-11-28 11:30 CET (History)
0 users

See Also:
Acceptance Criteria:


Attachments

Description Peter Åstrand cendio 2007-02-22 09:33:48 CET
SeamlessRDP sometimes displays the shapes of the cmd.exe that is used to start
the application. I've only seen this on Windows 2000, and only one time. I've
not been able to reproduce this.
Comment 1 Peter Åstrand cendio 2007-02-22 09:43:17 CET
If you give an invalid command, quite often, you will be able to see the cmd
window. It's not "stale" in this case, though, since it's still running, since
it's the program that gives the popup dialog with the error message. 

Perhaps one workaround could be to ignore Windows with the title
c:\winnt\system32\cmd.exe...
Comment 2 Peter Åstrand cendio 2008-04-02 10:07:16 CEST
SeamlessRDP has been adopted to ignore windows with class ConsoleWindowClass during enumeration (that it, on reconnects). As I understand it, though, this bug is not about reconnects. 
Comment 3 Henrik Andersson cendio 2012-06-11 07:29:35 CEST
tl-run-winapp-seamless uses cmd to bootstrap start of program as
cmd /c start <program>, On Windows2008 R2 the cmd windows does not
dissapear at all and this bug is reproducable every time.

The cmd window is stale, no content is rendered just a black window.
Comment 4 Henrik Andersson cendio 2012-09-07 07:20:33 CEST
The problem with stale cmd window ii windows2008r2 is fixed upstream in
commit r1668,so the need of removing our bootstrap of application using
cmd /c start <command> is not longer important.
Comment 5 Henrik Andersson cendio 2012-09-07 07:24:24 CEST
Fixed in commit r25753.

Tester should test running a cmd with and without subprocess
agains both 2008R2 and a WinXP.

-A -s "c:\Program Files\ThinLinc\WTS-Tools\seamlesrdpshell.exe cmd"
-A -s "c:\Program Files\ThinLinc\WTS-Tools\seamlesrdpshell.exe cmd.exe /k start notepad"
-A -s "c:\Program Files\ThinLinc\WTS-Tools\seamlesrdpshell.exe cmd /c start notepad"
Comment 6 Peter Åstrand cendio 2012-11-05 14:24:56 CET
(In reply to comment #5)
> Fixed in commit r25753.
> 
> Tester should test running a cmd with and without subprocess
> agains both 2008R2 and a WinXP.
> 
> -A -s "c:\Program Files\ThinLinc\WTS-Tools\seamlesrdpshell.exe cmd"

Should be:

-A -s "c:\Program Files\ThinLinc\WTSTools\seamlessrdpshell.exe cmd"

Result: cmd.exe is started but never displayed on the client side. tl-run-winapp-seamless "hangs". Is this really intented behaviour?


> -A -s "c:\Program Files\ThinLinc\WTSTools\seamlessrdpshell.exe cmd.exe /k start
> notepad"

Result: "Running a seamless console window is not supported"


> -A -s "c:\Program Files\ThinLinc\WTSTools\seamlessrdpshell.exe cmd /c start
> notepad"

Works. However, bug 4145 unfortunately happens all the time... 


Wrt the problem above: It it caused by a too simplistic check in seamlessrdpshell.exe:

+       /* Prevent start of a stand alone console window which is not supported. */
+       if ( (!strncmp(cmdline,"cmd ",4) || !strncmp(cmdline,"cmd.exe",7)) &&
+            !strstr(cmdline," /c ")) {
+               message("Running a seamless console window is not supported.");
+               goto unhook;
+       }
Comment 7 Peter Åstrand cendio 2012-11-05 14:50:56 CET
(In reply to comment #6)
> -A -s "c:\Program Files\ThinLinc\WTSTools\seamlessrdpshell.exe cmd"

In addition to this case, there are several other ways to fool the current logic, for example:

-A -s 'c:\Program Files\ThinLinc\WTSTools\seamlessrdpshell.exe "cmd"'

Besides, it's not really cmd.exe that is the problem, but rather console applications in general. This also fails:

-A -s 'c:\Program Files\ThinLinc\WTSTools\seamlessrdpshell.exe powershell'

So to do this "for real", I guess we need to either:

1) Check the subsystem type before launching the application

or

2) After launching it, check if it was a console application, and if so, terminate it. Not very elegant. 

There are some information here:

http://stackoverflow.com/questions/780465/winapi-createprocess-but-hide-the-process-window

Anyway, if I understand this correctly:

* This is not a regression

* The main problem ("SeamlessRDP sometimes displays the shapes of cmd.exe") has been fixed. 

...then as I understand it, the check is basically just a helpful error check, so perhaps it doesn't need to be perfect right now. Ie, perhaps fix later?
Comment 8 Peter Åstrand cendio 2012-11-05 15:36:51 CET
The problem with detecting cmd.exe has been moved to bug 4458. Closing.

Note You need to log in before you can comment on or make changes to this bug.