[Bug 34687] New: Port Royale 2 crashes on startup (SymGetLineFromAddr() returns unix-style path for source file)

wine-bugs at winehq.org wine-bugs at winehq.org
Tue Oct 8 16:57:23 CDT 2013


http://bugs.winehq.org/show_bug.cgi?id=34687

             Bug #: 34687
           Summary: Port Royale 2 crashes on startup (SymGetLineFromAddr()
                    returns unix-style path for source file)
           Product: Wine
           Version: 1.7.3
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: minor
          Priority: P2
         Component: dbghelp
        AssignedTo: wine-bugs at winehq.org
        ReportedBy: focht at gmx.net
    Classification: Unclassified


Hello folks,

as the summary says ...
The game bundles a native version of 'dbghelp.dll' which is used in their
exception handling/stack analysis library code living in 'Walhalla.dll' to
provide more information.
Wine builtin is of course preferred/loaded.

The game engine uses custom C++ exception classes which retrieve some context
information using dbghelp.
After calling dbghelp.SymGetLineFromAddr(), strrchr() is used on the returned
IMAGEHLP_LINE64.FileName member.
This obviously won't work because Wine returns a unix-style path, leading to
crash.

'strrchr' returns NULL -> input to STL basic_string() ctor

--- snip ---
0025:Call dbghelp.SymGetModuleInfo64(ffffffff,7bc8d47f,00000000,0033ad20)
ret=00af4ad6
0025:Call KERNEL32.WideCharToMultiByte(00000000,00000000,00339794
L"ntdll",ffffffff,0033a44c,00000020,00000000,00000000) ret=7e5a69c2
0025:Ret  KERNEL32.WideCharToMultiByte() retval=00000006 ret=7e5a69c2
...
0025:Ret  dbghelp.SymGetModuleInfo64() retval=00000001 ret=00af4ad6
0025:Call ntdll.RtlAllocateHeap(00dd3000,00000000,00000020) ret=7c3416b3
0025:Ret  ntdll.RtlAllocateHeap() retval=00e29e78 ret=7c3416b3
0025:Call
dbghelp.SymGetSymFromAddr64(ffffffff,7bc8d47f,00000000,0033ad18,0033abe8)
ret=00af4b41
0025:Ret  dbghelp.SymGetSymFromAddr64() retval=00000001 ret=00af4b41
0025:Call ntdll.RtlAllocateHeap(00dd3000,00000000,00000020) ret=7c3416b3
0025:Ret  ntdll.RtlAllocateHeap() retval=0e9fefb0 ret=7c3416b3
0025:Call
dbghelp.SymGetLineFromAddr64(ffffffff,7bc8d47f,00000000,00000000,0033ab70)
ret=00af4b9d
0025:trace:seh:raise_exception code=c0000005 flags=0 addr=0x7e5c219e
ip=7e5c219e tid=0025
0025:trace:seh:raise_exception  info[0]=00000001
0025:trace:seh:raise_exception  info[1]=00000000
0025:trace:seh:raise_exception  eax=00000000 ebx=7e5d9000 ecx=0000000e
edx=0000000e esi=0033ab3c edi=0033ab04
0025:trace:seh:raise_exception  ebp=0033aae8 esp=0033aa90 cs=0023 ds=002b
es=002b fs=0063 gs=006b flags=00210202 
--- snip ---

The actual code:

--- snip ---
...
0113D393   MOV DWORD PTR SS:[ESP+40],EDX
0113D397   MOV DWORD PTR SS:[ESP+30],14
0113D39F   CALL DWORD PTR DS:[11E627C] ; dbghelp.SymGetLineFromAddr
0113D3A5   TEST EAX,EAX
0113D3A7   JE SHORT Walhalla.0113D3DE
0113D3A9   MOV EDX,DWORD PTR SS:[ESP+2C]
0113D3AD   PUSH 5C
0113D3AF   PUSH EDX
0113D3B0   CALL DWORD PTR DS:[11E61C0] ; MSVCR71.strrchr
0113D3B6   ADD ESP,8
0113D3B9   INC EAX
0113D3BA   PUSH EAX
0113D3BB   LEA ECX,DWORD PTR SS:[ESP+44]
0113D3BF   CALL DWORD PTR DS:[11E63BC] ;
stlport_.?assign@?$basic_string at DV?$char_traits at D@_STL@@V?$allocator at D@2@@_STL@@QAEAAV12 at PBD@Z
...
--- snip ---

Dump of IMAGEHLP_LINE64 structure returned by dbghelp.SymGetLineFromAddr:

--- snip ---
0033EF6C  0000000E
0033EF70  00000014
0033EF74  106AA4B4
0033EF78  0000035A
0033EF7C  0E62914C ASCII
"/home/focht/projects/wine/wine-git/dlls/ntdll/thread.c"
0033EF80  7BC8D471 ntdll.7BC8D471
--- snip ---

Source:
http://source.winehq.org/git/wine.git/blob/878ea7d9ea4bbb924a539ec2808867468d336675:/dlls/dbghelp/symbol.c#l1435

--- snip ---
1435 BOOL symt_fill_func_line_info(const struct module* module, const struct
symt_function* func,
1436 DWORD64 addr, IMAGEHLP_LINE64* line)
1437 {
...
1456     if (found)
1457     {
1458         line->FileName = (char*)source_get(module, dli->u.source_file);
1459         return TRUE;
1460     }
...
--- snip ---

Starting the game with 'WINEDLLOVERRIDES=dbghelp=n' works around

Regards

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the wine-bugs mailing list