WineHQ
Bug Tracking Database – Bug 21107

 Bugzilla

 

Last modified: 2014-01-03 13:10:17 UTC  

Portable RDP 6 client fails on startup, claiming "An error occurred. Try to reconnect." (MoleBox application virtualization scheme)

Bug 21107 - Portable RDP 6 client fails on startup, claiming "An error occurred. Try to reconnect." (MoleBox application virtualization scheme)
Portable RDP 6 client fails on startup, claiming "An error occurred. Try to r...
Status: CLOSED FIXED
AppDB: Show Apps affected by this bug
Product: Wine
Classification: Unclassified
Component: ntdll
1.1.32
x86 Linux
: P2 normal
: ---
Assigned To: Mr. Bugs
http://tsplus.net/PortableRDP6.exe
: download, obfuscation
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2009-12-21 15:13 UTC by sv
Modified: 2014-01-03 13:10 UTC (History)
2 users (show)

See Also:
Regression SHA1:
Fixed by SHA1: aa4ebeb57c66c8a98cf50c9ce7f7e47cf88d1271
Distribution: ---
Staged patchset:


Attachments
log (607 bytes, text/plain)
2009-12-21 15:13 UTC, sv
Details
wine crash when using rdp 7 to connect to win2008r2 term server with tls enabled. (16.37 KB, text/plain)
2011-03-09 12:46 UTC, skhehra
Details
patch (3.69 KB, patch)
2013-12-28 12:53 UTC, Nikolay Sivov
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description sv 2009-12-21 15:13:54 UTC
Created attachment 25349 [details]
log

can install portable RDP, but can't run it, see attachement for log
Comment 1 Andrew Nguyen 2009-12-22 01:59:32 UTC
I'm confirming with wine-1.1.35-56-g13a9c03. Some cursory tracing makes me suspect that the application depends on various Terminal Services components for its operation. The application installer can be downloaded from (http://tsplus.net/PortableRDP6.exe).
Comment 2 Andrew Nguyen 2009-12-22 02:02:29 UTC
Interestingly, I notice that copying mstscax.dll from the redist available at http://www.microsoft.com/downloads/details.aspx?familyid=72158B4E-B527-45E4-AF24-D02938A95683&displaylang=en into the program directory allows mstsc.exe to spawn. It seems the essence of the program is to spawn some copy of mstsc.exe.
Comment 3 skhehra 2011-03-09 12:46:07 UTC
Created attachment 33582 [details]
wine crash when using rdp 7 to connect to win2008r2 term server with tls enabled.
Comment 4 Anastasius Focht 2013-12-26 11:36:51 UTC
Hello folks,

looks like a variation of bug 21790
The file 'portableRDP6.exe' is an executable created by AutoIt3/Aut2Exe.
It unwraps some MUI resource dlls, mstsc.exe and starts the main executable 'mstsc.exe'.

'mstsc.exe' itself is sandboxed/wrapped with 'MoleBox', an application virtualization and software protection scheme similar to Thinstall and Xenocode.
It ships and maps the native 'mstscax.dll' component as in-memory resource.

Relevant part of trace log:

--- snip ---
$ pwd
/home/focht/.wine/drive_c/Program Files/RDP6 Portable client

$ WINEDEBUG=+tid,+seh,+relay,+actctx wine ./portableRDP6.exe >>trace.txt 2>&1
...
0009:Call KERNEL32.CreateProcessW(00000000,008ce368 L"C:\\Program Files\\RDP6 Portable client\\mstsc.exe",00000000,00000000,00000000,00000400,00000000,00149080 L"C:\\Program Files\\RDP6 Portable client",008cda20,008cda10) ret=7e320efe
...
0025:Call KERNEL32.__wine_kernel_init() ret=7bc5a036
...
0009:Ret  KERNEL32.CreateProcessW() retval=00000001 ret=7e320efe 
...
0025:Call KERNEL32.GetFullPathNameA(00382cc8 "C:\\PROGRAM FILES\\RDP6 PORTABLE CLIENT\\mstscax.dll",00000400,00340e20,0033f4d4) ret=010b264d
0025:Ret  KERNEL32.GetFullPathNameA() retval=00000031 ret=010b264d 
...
0025:Call KERNEL32.GetModuleHandleA(00382ef8 "C:\\USERS\\FOCHT\\LOCAL SETTINGS\\APPLICATION DATA\\.#\\MBX@24@341CB8.###") ret=010b56ae
0025:Ret  KERNEL32.GetModuleHandleA() retval=4d710000 ret=010b56ae
0025:Call KERNEL32.LoadLibraryA(00382ef8 "C:\\USERS\\FOCHT\\LOCAL SETTINGS\\APPLICATION DATA\\.#\\MBX@24@341CB8.###") ret=010b56c3
0025:Ret  KERNEL32.LoadLibraryA() retval=4d710000 ret=010b56c3 
...
0025:Call user32.CreateWindowExW(00000000,01002c08 L"TSCAXHOST",00000000,46000000,00000000,00000000,00000778,0000041d,000800ea,00000000,01000000,00159ca8) ret=0101ca9b 
...
0025:Call KERNEL32.QueryActCtxW(80000010,4d88c000,00000000,00000001,0033f7e8,00000008,00000000) ret=4d773a6e
0025:trace:actctx:RtlQueryInformationActivationContext 80000010 0x4d88c000 (nil) 1 0x33f7e8 8 (nil)
0025:Ret  KERNEL32.QueryActCtxW() retval=00000001 ret=4d773a6e
...
0025:Call KERNEL32.GetModuleHandleExW(00000006,4d88c000,0033f7f0) ret=4d773aa2
0025:Ret  KERNEL32.GetModuleHandleExW() retval=00000001 ret=4d773aa2
...
0025:Call KERNEL32.MultiByteToWideChar(00000000,00000000,00382ef8 "C:\\PROGRAM FILES\\RDP6 PORTABLE CLIENT\\mstscax.dll",ffffffff,0033f7f8,00000105) ret=010bb056
0025:Ret  KERNEL32.MultiByteToWideChar() retval=00000032 ret=010bb056
...
0025:Call KERNEL32.CreateActCtxW(0033f7c8) ret=4d773b27
0025:trace:actctx:CreateActCtxW 0x33f7c8 00000088
0025:trace:actctx:RtlCreateActivationContext 0x33f7c8 00000088
0025:Ret  KERNEL32.CreateActCtxW() retval=ffffffff ret=4d773b27
...
0025:Call user32.MessageBoxW(00000000,0017e408 L"An error occurred.\r\n\r\nTry to reconnect. If the problem continues, contact the owner of the remote computer or your network administrator.",01054c90 L"Remote Desktop Connection",00000010) ret=7e2fbeb8 
--- snip ---

The failure to create the activation context seems the problem here.
As quick test I faked success in debugger and the client successfully displayed the RDP login dialog.

@comment 3

--- quote ---
wine crash when using rdp 7 to connect to win2008r2 term server with tls enabled.
--- quote ---

Please avoid polluting the bug with unrelated problems.

$ sha1sum PortableRDP6.exe 
af0a2e3b3ebd319642a2e843123abb1902f3b216  PortableRDP6.exe

$ du -sh PortableRDP6.exe 
2.5M	PortableRDP6.exe

$ wine --version
wine-1.7.9-158-g33fa552

Regards
Comment 5 Anastasius Focht 2013-12-26 12:53:55 UTC
Hello again,

actually it's expected that CreateActCtxW()/RtlCreateActivationContext() fails at this place due to invalid 'lpSource' argument (file/path only exists as mapping in memory).
The problem is what Wine returns as last error.

Application code in question (annotated):

--- snip ---
...
4D773B1B    8D85 A8FDFFFF   LEA EAX,[EBP-258]
4D773B21    50              PUSH EAX
4D773B22    E8 26FEFFFF     CALL 4D77394D      ; sub calls CreateActCtxW()
4D773B27    8985 C8FDFFFF   MOV DWORD PTR SS:[EBP-238],EAX 
4D773B2D    83F8 FF         CMP EAX,-1
4D773B30    75 2A           JNE SHORT 4D773B5C
4D773B32    FF15 7C14714D   CALL DWORD PTR DS:[4D71147C] ; GetLastError()
4D773B38    3D 14070000     CMP EAX,714        ; ERROR_RESOURCE_DATA_NOT_FOUND
4D773B3D    74 15           JE SHORT 4D773B54  ; good guy
4D773B3F    3D 15070000     CMP EAX,715        ; ERROR_RESOURCE_TYPE_NOT_FOUND
4D773B44    74 0E           JE SHORT 4D773B54  ; good guy
4D773B46    3D 17070000     CMP EAX,717        ; ERROR_RESOURCE_LANG_NOT_FOUND
4D773B4B    74 07           JE SHORT 4D773B54  ; good guy
4D773B4D    3D 16070000     CMP EAX,716        ; ERROR_RESOURCE_NAME_NOT_FOUND
4D773B52    75 65           JNE SHORT 4D773BB9 ; bad guy
4D773B54    33C0            XOR EAX,EAX
...
--- snip ---

Debugger session:

--- snip ---
Wine-dbg>bt

Backtrace:
=>0 0x7bc32533 RtlCreateActivationContext+0x202(handle=<couldn't compute location>, ptr=<couldn't compute location>) [/home/focht/projects/wine/wine-git/dlls/ntdll/actctx.c:4522] in ntdll (0x0033f708)
  1 0x7b82723d CreateActCtxW+0x94(pActCtx=<couldn't compute location>) [/home/focht/projects/wine/wine-git/dlls/kernel32/actctx.c:124] in kernel32 (0x0033f778)
  2 0x4d773b27 in mbx@29@341cb8.### (+0x63b26) (0x0033fa18)
  3 0x4d773c05 in mbx@29@341cb8.### (+0x63c04) (0x0033fa24)
  4 0x4d773d07 in mbx@29@341cb8.### (+0x63d06) (0x0033fa60)
  5 0x4d776320 in mbx@29@341cb8.### (+0x6631f) (0x0033fb0c)
  6 0x4d779040 in mbx@29@341cb8.### (+0x6903f) (0x0033fb24)
  7 0x4d779773 in mbx@29@341cb8.### (+0x69772) (0x0033fb48)
  8 0x4d765308 in mbx@29@341cb8.### (+0x55307) (0x0033fbb0)
  9 0x4d767f6f in mbx@29@341cb8.### (+0x57f6e) (0x0033fbc8)
  10 0x4d777608 in mbx@29@341cb8.### (+0x67607) (0x0033fbf0)
  11 0x4d778e58 in mbx@29@341cb8.### (+0x68e57) (0x0033fc00)
  12 0x0101cad2 in mstsc (+0x1cad1) (0x0033fc70)
  13 0x010195f1 in mstsc (+0x195f0) (0x0033fc90)
  14 0x01019808 in mstsc (+0x19807) (0x0033fcd0)
  15 0x01028a47 in mstsc (+0x28a46) (0x0033fcf8)
  16 0x01034fa2 in mstsc (+0x34fa1) (0x0033fd54)
  17 0x01035277 in mstsc (+0x35276) (0x0033fd80)
  18 0x010354a4 in mstsc (+0x354a3) (0x0033fe10)
  19 0x010aba12 in mstsc (+0xaba11) (0x010b9ffc)

Wine-dbg>p *pActCtx
{cbSize=0x20, dwFlags=0x88, lpSource="C:\PROGRAM FILES\RDP6 PORTABLE CLIENT\mstscax.dll", wProcessorArchitecture=0xf7f0, wLangId=0x33, lpAssemblyDirectory="?", lpResourceName=*** invalid address 0x3 ***, lpApplicationName="", hModule=0x4d710000}
--- snip ---

Source: http://source.winehq.org/git/wine.git/blob/cb0ef08839e515d7a9053923d27ef8899978a263:/dlls/ntdll/actctx.c#l4478

--- snip ---
4478 NTSTATUS WINAPI RtlCreateActivationContext( HANDLE *handle, const void *ptr )
4479 {
4480     const ACTCTXW *pActCtx = ptr; /* FIXME: not the right structure */
4481     const WCHAR *directory = NULL;
4482     ACTIVATION_CONTEXT *actctx;
4483     UNICODE_STRING nameW;
4484     ULONG lang = 0;
4485     NTSTATUS status = STATUS_NO_MEMORY;
4486     HANDLE file = 0;
4487     struct actctx_loader acl;
...
4521     nameW.Buffer = NULL;
4522     if (pActCtx->lpSource)
4523     {
4524         if (!RtlDosPathNameToNtPathName_U(pActCtx->lpSource, &nameW, NULL, NULL))
4525         {
4526             status = STATUS_NO_SUCH_FILE;
4527             goto error;
4528         }
4529         status = open_nt_file( &file, &nameW );
4530         if (status)
4531         {
4532             RtlFreeUnicodeString( &nameW );
4533             goto error;
4534         }
4535     }
4582 error:
4583     if (file) NtClose( file );
4584     actctx_release( actctx );
4585     return status;
4586 }
--- snip ---

open_nt_file() -> NtOpenFile() return status=0xc0000034 -> STATUS_OBJECT_NAME_NOT_FOUND

As shown in application code snippet this is not expected.

Any ERROR_RESOURCE_xxx last error will be ok which means that ntdll.RtlCreateActivationContext() must return one of:

http://source.winehq.org/git/wine.git/blob/38ca35fe573c6d79cec49a580c1544fd992f498e:/include/ntstatus.h#l321

--- snip ---
321 #define STATUS_RESOURCE_DATA_NOT_FOUND ((NTSTATUS) 0xC0000089)
322 #define STATUS_RESOURCE_TYPE_NOT_FOUND ((NTSTATUS) 0xC000008A)
323 #define STATUS_RESOURCE_NAME_NOT_FOUND ((NTSTATUS) 0xC000008B)
--- snip ---

With that part fixed the RDP login gui is shown.

Regards
Comment 6 Nikolay Sivov 2013-12-27 06:44:30 UTC
Thanks for detailed analysis as usual, I'll prepare some tests for that.
Comment 7 Nikolay Sivov 2013-12-28 12:53:10 UTC
Created attachment 47026 [details]
patch

Here's a fix for this problem.
Comment 9 Alexandre Julliard 2014-01-03 13:10:17 UTC
Closing bugs fixed in 1.7.10.


Privacy Policy
If you have a privacy inquiry regarding this site, please write to [email protected]

Hosted By CodeWeavers