Tera Copy Not Being Initiated

Bug #624386 reported by Krishna on 2010-08-26
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Wine
Fix Released
Medium
wine1.2 (Ubuntu)
Undecided
Unassigned

Bug Description

Binary package hint: wine1.2

I just installed a software Tera Copy, a windows software, using Wine..

The installation was successful, but the Software is not being initiated when I try to open it..

ProblemType: Bug
DistroRelease: Ubuntu 10.04
Package: wine 1.1.42-0ubuntu4
ProcVersionSignature: Ubuntu 2.6.32-24.41-generic 2.6.32.15+drm33.5
Uname: Linux 2.6.32-24-generic i686
Architecture: i386
Date: Thu Aug 26 08:02:31 2010
InstallationMedia: Ubuntu 10.04 LTS "Lucid Lynx" - Release i386 (20100429)
PackageArchitecture: all
ProcEnviron:
 LANG=en_IN.utf8
 SHELL=/bin/bash
SourcePackage: wine1.2

Krishna (krishnab) wrote :

I just installed a software Tera Copy, a windows software, using Wine..

The installation was successful, but the Software is not being initiated when I try to open it..

https://bugs.launchpad.net/bugs/624386

Confirmed in 1.3.1
Terminal just outputs an error of
err:seh:setup_exception_record stack overflow 2260 bytes in thread 0009 eip 7bc3f08e esp 00230a5c stack 0x230000-0x231000-0x330000

Jack Leigh (leighman) wrote :

Has it produced a desktop or menu icon?
If so, please do right-click -> Properties and copy the information from 'Command'
please open a terminal (Applications -> Accessories -> Terminal) and paste that command in the terminal and run it, then paste what you get here (or upload it as a file, if it is large)

Looking at a description of it, it unfortunately looks like the kind of thing which will not work. What are you trying to use it for?
Thanks

Krishna (krishnab) wrote :

Command
---------------
env WINEPREFIX="/home/krishna/.wine" wine "C:\Program Files\TeraCopy\TeraCopy.exe"

Output
----------
err:seh:setup_exception_record stack overflow 1140 bytes in thread 0009 eip 7bc3e718 esp 00230ebc stack 0x230000-0x231000-0x330000

In GUI, the taskbar shows "starting tera copy" for a few seconds and then vanishes.

Its a windows software to enhance the copying facilities. To increase the copying speed to USB, pausing copy, resuming etc..

With wine-1.3.1-182-g56b8d5d, I get:
austin@midna:~/.wine/drive_c/Program Files/TeraCopy$ wine TeraCopy.exe
fixme:psapi:EnumDeviceDrivers ((nil), 0, 0x6fea70): stub
fixme:psapi:EnumDeviceDrivers (0x580000, 64, 0x6fea70): stub

and it hangs. Though based on the program's description, it may be installing device drivers, which won't work in wine.

Jack Leigh (leighman) on 2010-08-26
Changed in wine1.2 (Ubuntu):
status: New → Confirmed
Jack Leigh (leighman) wrote :

I'm not sure it will be any use if you are running it on linux but upstream will know more.
I can confirm it on wine 1.3.1 so looks like a genuine bug - if you have time can you please report it, with the error from here, at http://bugs.winehq.org/ ?
else I can do it.

Krishna (krishnab) wrote :

ok.. Thank you for your confirmation. I have filed the bug in Wine too..

Changed in wine:
status: Unknown → New

0009:Call KERNEL32.CreateFileA(00525527 "\\\\.\\SICE",80000000,00000003,00000000,00000003,00000080,00000000) ret=0051ecd1
0009:Ret KERNEL32.CreateFileA() retval=ffffffff ret=0051ecd1
0009:Call KERNEL32.CreateFileA(00525530 "\\\\.\\NTICE",80000000,00000003,00000000,00000003,00000080,00000000) ret=0051ecd1
0009:Ret KERNEL32.CreateFileA() retval=ffffffff ret=0051ecd1
0009:Call KERNEL32.CreateFileA(0052553a "\\\\.\\NTFIRE",80000000,00000003,00000000,00000003,00000080,00000000) ret=0051ecd1
0009:Ret KERNEL32.CreateFileA() retval=ffffffff ret=0051ecd1

Looks like copyprotection?

(In reply to comment #3)
> 0009:Call KERNEL32.CreateFileA(00525527
> "\\\\.\\SICE",80000000,00000003,00000000,00000003,00000080,00000000)
> ret=0051ecd1
> 0009:Ret KERNEL32.CreateFileA() retval=ffffffff ret=0051ecd1
> 0009:Call KERNEL32.CreateFileA(00525530
> "\\\\.\\NTICE",80000000,00000003,00000000,00000003,00000080,00000000)
> ret=0051ecd1
> 0009:Ret KERNEL32.CreateFileA() retval=ffffffff ret=0051ecd1
> 0009:Call KERNEL32.CreateFileA(0052553a
> "\\\\.\\NTFIRE",80000000,00000003,00000000,00000003,00000080,00000000)
> ret=0051ecd1
> 0009:Ret KERNEL32.CreateFileA() retval=ffffffff ret=0051ecd1
>
> Looks like copyprotection?

Those lines are probably harmless, presumably the application is checking for the presence of a kernel debugger like SoftICE.

Changed in wine:
status: New → Confirmed

As per upstream, this is a wishlist bug. Should be marked as such.

Changed in wine:
importance: Unknown → Medium

Still not starting with Wine-1.3.13.

Protection ID says:

Scanning -> C:\Program Files\TeraCopy\TeraCopy.exe
File Type : 32-Bit Exe (Subsystem : Win GUI / 2), Size : 957952 (0E9E00h) Byte(s)
-> File has 698880 (0AAA00h) bytes of appended data starting at offset 03F400h
[File Heuristics] -> Flag : 00000000000001011100001000110111 (0x0005C237)
[!] Obsidium [unknown version - higher than 1.3.6.1] detected !

Looks like a software protection method.

In , Focht (focht) wrote :

Hello,

the newer (beta) 2.2x versions work out of the box because the main exe has the protection removed (though the most important ui feature -> drap and drop of files doesn't work).

http://www.codesector.com/files/teracopy22beta3.exe

$ sha1sum teracopy22beta3.exe
3a572d728f0a63c4e9bb72e244efe658018369bf teracopy22beta3.exe

Version 2.12 from: http://www.codesector.com/files/teracopy.exe dies very early.

$ sha1sum teracopy.exe
257b6305cc636ee09df92caffda3048a0c727f37 teracopy.exe

$ wine --version
wine-1.3.22-31-g98394f2

Lots of anti-debugging trickery ... marking for later analysis.

Regards

In , Focht (focht) wrote :
Download full text (3.9 KiB)

Hello again,

well that sucked ... debugging this braindamage is nasty. I'm starting to dream opcodes :|

That Obsidum code is full of short branching in between opcodes to fool disassemblers and debuggers ... very annoying.
Various anti debugging tricks and hooking/emulating/stealing of API entry code.

Fortunately this stuff can be bypassed, you need to pass all exceptions (single step, div by zero, access violations, invalid opcode ...) to app installed SEHs.
Also don't use soft breakpoints on API entries (int 3) it detects this.
Hardware breakpoints are also reset in every SEH.

CheckRemoteDebuggerPresent() needs to be "adjusted" to prevent detection. Wine doesn't lie about this ;-)

+relay actually harms the protector and yields strange results (grrr lost some hours due to this problem)

Without +relay we're left with little diagnostics.
Most anti-debugging tricks work out of the box, until this place:

--- snip ---
0021:trace:seh:raise_exception code=80000003 flags=0 addr=0x7b835a2b ip=7b835a2c tid=0021
0021:trace:seh:raise_exception eax=7b8366e5 ebx=0053015c ecx=7b810000 edx=7b8942dc esi=0032fce8 edi=00341e94
0021:trace:seh:raise_exception ebp=0032fcd8 esp=0032fcd8 cs=0073 ds=007b es=007b fs=0033 gs=003b flags=00000202
0021:trace:seh:call_vectored_handlers calling handler at 0x686a7de9 code=80000003 flags=0
0021:trace:seh:call_vectored_handlers handler at 0x686a7de9 returned 0
0021:trace:seh:call_stack_handlers calling handler at 0x531597 code=80000003 flags=0
0021:trace:seh:call_stack_handlers handler at 0x531597 returned 0
0021:trace:seh:raise_exception code=c0000005 flags=0 addr=0x51fd1a ip=0051fd1a tid=0021
0021:trace:seh:raise_exception info[0]=00000001
0021:trace:seh:raise_exception info[1]=3ed59644
0021:trace:seh:raise_exception eax=b2850111 ebx=a4aac3f0 ecx=00008500 edx=00000028 esi=0000db31 edi=0051fd26
0021:trace:seh:raise_exception ebp=0032fce4 esp=0032fcd8 cs=0073 ds=007b es=007b fs=0033 gs=003b flags=00010286
0021:trace:seh:call_vectored_handlers calling handler at 0x686a7de9 code=c0000005 flags=0
0021:trace:seh:call_vectored_handlers handler at 0x686a7de9 returned 0
0021:err:seh:raise_exception Exception frame is not in stack limits => unable to dispatch exception.
--- snip ---

The protector calls DebugBreak() on purpose to force exception handler invocation and change execution flow by modifying its own context, so called "continuations".
context->eip, context->esp are set to new targets.
There is also reset of Dr0-Dr3,Dr7 to harm debuggers.

Upon return from exception handler, the new context is made active and execution proceeds.
After some hours I came across this snippet (some junk opcodes removed):

--- snip ---
0051AB65 396D EC CMP DWORD PTR SS:[EBP-14],EBP
0051AB68 EB 04 JMP SHORT 0051AB6E
...
<explodes somewhere>
...
--- snip ---

There is a check in continuation code for frame pointer validity and this is where Wine gets it wrong ...

kernel32.DebugBreak Source:

http://source.winehq.org/git/wine.git/blob/0fd822f46526df49f5fa29627afbace7ce3d242c:/dlls/kernel32/debugger.c#l360

kernel32.DebugBreak Disassembly:

--- snip ---
7B8366E5 55 PUSH EBP
7B8366E6 89E5 MOV EBP...

Read more...

In , Focht (focht) wrote :

Hello,

the kernel32.DebugBreak problem is fixed by commit: http://source.winehq.org/git/wine.git/commitdiff/5f06809ab3339e2001de57f18be988146915bb7b

Thanks.

The app spins in endless loop now - but that's a different problem...

Regaeds

Changed in wine:
status: Confirmed → Fix Released

Closing bugs fixed in 1.3.23.

dino99 (9d9) wrote :

this is no more a supported version

Changed in wine1.2 (Ubuntu):
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.