# Wine/amd64 issues after upgrading to 9.0-RELEASE



## ecd (Jan 16, 2012)

I've been using wine on amd64 under 8.2-RELEASE with no issues for months and on different systems. I have been utilizing ivoras' pre-built packages at http://people.freebsd.org/~ivoras/wine/

This past weekend, I've upgraded to 9.0-RELEASE smoothly, but I'm unable to fully load the game I play (Dark Age of Camelot) via wine.

I've tried using the latest wine 1.3 package on the above site. Then I tried the 1.2 package. Neither worked. I then tried building wine manually in a 32-bit chroot as described at http://wiki.freebsd.org/Wine. 

The major delta from my previous system is the 9.0-RELEASE upgrade. The game, wine and my nvidia-driver are the same versions.

Every attempt results in the same error. The game initially loads and patches itself, but the launching of the main game after selecting a server triggers a "Wine must close this program dialog" with the following spit into the terminal:


```
fixme:shdocvw:ClOleCommandTarget_Exec Unimplemented cmdid 35
fixme:shdocvw:ClOleCommandTarget_Exec Unimplemented cmdid 28
fixme:shdocvw:DocObjectService_FireDocumentComplete 0x2138c10 0x2138150 0
fixme:winsock:WS_setsockopt Unknown IPPROTO_TCP optname 0xffffff7f
fixme:winsock:WS_setsockopt Unknown IPPROTO_TCP optname 0xffffff7f
wine: Unhandled page fault on read access to 0x0000000c at address 0x452402 (thread 000b), starting debugger...
Unhandled exception: page fault on read access to 0x0000000c in 32-bit code (0x00452402).
wineserver: file_set_error() can't map error: Bad address
wineserver: file_set_error() can't map error: Bad address
wineserver: file_set_error() can't map error: Bad address
wineserver: file_set_error() can't map error: Bad address
Register dump:
 CS:0033 SS:003b DS:003b ES:003b FS:0013 GS:001b
 EIP:00452402 ESP:0033f878 EBP:0033fc8c EFLAGS:00010246(  R- --  I  Z- -P- )
 EAX:00000000 EBX:00000000 ECX:00110060 EDX:00110064
 ESI:009403e8 EDI:00941998
Stack dump:
0x0033f878:  0033fdac 00000000 00000000 02020101
0x0033f888:  536e6957 206b636f 00302e32 0033f924
0x0033f898:  6232a446 0000000a 009ac398 0000000a
0x0033f8a8:  00000000 00000000 00000000 00000000
0x0033f8b8:  00000000 00000000 00000000 00000000
0x0033f8c8:  00000000 00000000 00000000 00000000
Backtrace:
=>0 0x00452402 in game (+0x52402) (0x0033fc8c)
  1 0x00452ed9 in game (+0x52ed8) (0x0033fde8)
  2 0x0077cf07 in game (+0x37cf06) (0x0033ff10)
  3 0x62856eec call_process_entry+0xb() in kernel32 (0x0033ff28)
  4 0x6285a330 in kernel32 (+0x4a32f) (0x0033ff58)
  5 0x62343e80 call_thread_func+0xb() in ntdll (0x0033ff68)
  6 0x6234610d in ntdll (+0x5610c) (0x0033ffd8)
  7 0x62320efe in ntdll (+0x30efd) (0x0033ffe8)
  8 0x6204f62d wine_call_on_stack+0x1c() in libwine.so.1 (0x00000000)
0x00452402: movl        0xc(%eax),%eax
Modules:
Module  Address                 Debug info      Name (71 modules)
PE        400000- 242b000       Export          game
PE      10000000-100a4000       Deferred        libxml2
PE      21100000-21164000       Deferred        mss32
ELF     60000000-60002000       Deferred        <wine-loader>
ELF     62048000-62187000       Dwarf           libwine.so.1
ELF     62187000-621a8000       Deferred        libthr.so.3
ELF     621a8000-622c7000       Deferred        libc.so.7
ELF     622db000-6238b000       Dwarf           ntdll<elf>
  \-PE  622f0000-6238b000       \               ntdll
ELF     6238b000-623a5000       Deferred        libm.so.5
ELF     623a5000-623bf000       Deferred        wsock32<elf>
  \-PE  623b0000-623bf000       \               wsock32
ELF     623bf000-623ed000       Deferred        ws2_32<elf>
  \-PE  623d0000-623ed000       \               ws2_32
ELF     623ed000-62400000       Deferred        shfolder<elf>
  \-PE  623f0000-62400000       \               shfolder
ELF     62800000-6299b000       Dwarf           kernel32<elf>
  \-PE  62810000-6299b000       \               kernel32
ELF     6299b000-629ba000       Deferred        iphlpapi<elf>
  \-PE  629a0000-629ba000       \               iphlpapi
ELF     629ba000-62a14000       Deferred        advapi32<elf>
  \-PE  629d0000-62a14000       \               advapi32
ELF     62a14000-62a97000       Deferred        msvcrt<elf>
  \-PE  62a30000-62a97000       \               msvcrt
ELF     62a97000-62ac5000       Deferred        dinput<elf>
  \-PE  62aa0000-62ac5000       \               dinput
ELF     62ac5000-62bf5000       Deferred        user32<elf>
  \-PE  62ae0000-62bf5000       \               user32
ELF     62bf5000-62c8d000       Deferred        gdi32<elf>
  \-PE  62c00000-62c8d000       \               gdi32
ELF     62c8d000-62ca5000       Deferred        version<elf>
  \-PE  62c90000-62ca5000       \               version
ELF     62ca5000-62d3c000       Deferred        winmm<elf>
  \-PE  62cb0000-62d3c000       \               winmm
ELF     62d3c000-62da0000       Deferred        ddraw<elf>
  \-PE  62d40000-62da0000       \               ddraw
ELF     62da0000-62ec8000       Deferred        wined3d<elf>
  \-PE  62db0000-62ec8000       \               wined3d
ELF     62ec8000-62ee8000       Deferred        imm32<elf>
  \-PE  62ed0000-62ee8000       \               imm32
ELF     62ee8000-62f49000       Deferred        shlwapi<elf>
  \-PE  62f00000-62f49000       \               shlwapi
ELF     62f49000-63143000       Deferred        shell32<elf>
  \-PE  62f60000-63143000       \               shell32
ELF     63143000-63231000       Deferred        comctl32<elf>
  \-PE  63150000-63231000       \               comctl32
ELF     63231000-632a6000       Deferred        libfreetype.so.9
ELF     632af000-632c3000       Deferred        libz.so.6
ELF     632c3000-63367000       Deferred        winex11<elf>
  \-PE  632d0000-63367000       \               winex11
ELF     63367000-6336e000       Deferred        libsm.so.6
ELF     6336e000-63385000       Deferred        libice.so.6
ELF     63385000-63393000       Deferred        libxext.so.6
ELF     63393000-634ac000       Deferred        libx11.so.6
ELF     634ac000-634c3000       Deferred        libxcb.so.2
ELF     634c3000-634c6000       Deferred        libxau.so.6
ELF     634c6000-634cb000       Deferred        libxdmcp.so.6
ELF     634cb000-634cd000       Deferred        libpthread-stubs.so.0
ELF     634cd000-634d5000       Deferred        librpcsvc.so.5
ELF     634d5000-634da000       Deferred        libxxf86vm.so.1
ELF     634da000-634e2000       Deferred        libxrender.so.1
ELF     634e2000-634e9000       Deferred        libxrandr.so.2
ELF     634e9000-634f6000       Deferred        libxi.so.6
ELF     634f6000-634ff000       Deferred        libxcursor.so.1
ELF     634ff000-63504000       Deferred        libxfixes.so.3
ELF     63506000-6353a000       Deferred        uxtheme<elf>
  \-PE  63510000-6353a000       \               uxtheme
ELF     6356f000-6366d000       Deferred        ole32<elf>
  \-PE  63590000-6366d000       \               ole32
ELF     6366d000-636de000       Deferred        rpcrt4<elf>
  \-PE  63680000-636de000       \               rpcrt4
Threads:
process  tid      prio (all id:s are in hex)
0000000e services.exe
        0000001b    0
        00000016    0
        00000015    0
        00000014    0
        00000010    0
        0000000f    0
00000011 winedevice.exe
        00000017    0
        00000013    0
        00000012    0
00000018 plugplay.exe
        0000001c    0
        0000001a    0
        00000019    0
0000001d explorer.exe
        0000001e    0
00000041 login.dll
        00000046   15
        00000045   15
        00000044    0
        00000043   15
        00000042    0
00000047 (D) C:\Program Files\Electronic Arts\Dark Age of Camelot\game.dll
        0000000b    0 <==
Backtrace:
=>0 0x00452402 in game (+0x52402) (0x0033fc8c)
  1 0x00452ed9 in game (+0x52ed8) (0x0033fde8)
  2 0x0077cf07 in game (+0x37cf06) (0x0033ff10)
  3 0x62856eec call_process_entry+0xb() in kernel32 (0x0033ff28)
  4 0x6285a330 in kernel32 (+0x4a32f) (0x0033ff58)
  5 0x62343e80 call_thread_func+0xb() in ntdll (0x0033ff68)
  6 0x6234610d in ntdll (+0x5610c) (0x0033ffd8)
  7 0x62320efe in ntdll (+0x30efd) (0x0033ffe8)
  8 0x6204f62d wine_call_on_stack+0x1c() in libwine.so.1 (0x00000000)
fixme:font:WineEngRemoveFontResourceEx (L"C:\\Program Files\\Electronic Arts\\Dark Age of Camelot\\fonts\\B042004T.TTF",
 0, 0x0): stub
fixme:winmm:MMDRV_Exit Closing while ll-driver open
fixme:winmm:MMDRV_Exit Closing while ll-driver open
err:mmtime:TIME_MMTimeStop Timer still active?!
```


----------



## ecd (Jan 17, 2012)

OP here for an update:

Tried installing FreeBSD 9.0-RELEASE x86 (not amd64). Same results.
Tried installing FreeBSD 8.2-RELEASE amd64. Same results. Odd though, since that setup was nearly the exact same as what I had 5 days ago before I got into this mess and it worked fine.

So, I'm fairly lost now. My nvidia-driver may be a slightly different version. I'll be checking into that. I'm also starting to check into testing it out on linux to help rule out a change to the game or to wine (only starting to; trying to get anything done in Linux feels messy after FreeBSD).


----------



## ecd (Jan 22, 2012)

I've found the solution to this problem, finally. It isn't FreeBSD's fault in any way, but more likely just the way this particular game was implemented and my own incompetence.

I used the IDA disassembler on the game.dll file, went to the offset from the error message and found the following subroutine:

```
lea   eax, [ebp+name]
push  eax
call  gethostbyname
mov   eax, [eax+0Ch] ; the offset from the error message
mov   eax, [eax]
push  dword ptr [eax]
call  inet_ntoa
lea   edx, [ebp+var_178]
```
After some research (my assembly skills are rusty), I realized the issue. My system's hostname was set to "foo.local", but my DNS only knew of "foo". The call to 'gethostbyname' returned null and the code didn't handle it. I updated my DNS settings (or I could have updated /etc/hosts), and everything was working again.

Just a silly mistake with a confusing result. If I also just noticed the warnings Xorg was spitting out on startup related to "bad display name", that would've been a quicker solution.


----------

