Page fault with MFC42.DLL

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
adamvietnam
Level 1
Level 1
Posts: 5
Joined: Fri Jul 01, 2011 6:35 am

Page fault with MFC42.DLL

Post by adamvietnam »

Hi,

I get a crash when I dynamically link with MFC42.DLL but not when I link with MFC statically

I've created a simple test program to illustrate...

#include "stdafx.h"
#include "afxole.h"

Code: Select all

int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow) 
{
	
    COleDateTime curTime;
    curTime=COleDateTime::GetCurrentTime();
    CString nowStr;
    nowStr=curTime.Format("'%c'");  /* CRASHES HERE */
    printf("%s\n",nowStr);
    return 0;
}
My setup is as follows:

1. Build environment.

Visual Studio 6 Service Pack 6

2. Run environment

- Fresh Ubuntu 10.10 install (have tested with 10.04 / 11.04 with same results)
- Fresh install of Wine 1.4 (have tested with Wine 1.2.2 with same results)
- used winetricks to install vcrun6sp6 which automatically pulls in sp4 versions of mfc42, msvcirt, msvcp60)


When I run the above program the following output...


wine: Unhandled page fault on read access to 0x7666e3ac at address 0x759258ff (thread 001a), starting debugger...
Unhandled exception: page fault on read access to 0x7666e3ac in 32-bit code (0x759258ff).
Register dump:
CS:0073 SS:007b DS:007b ES:007b FS:0033 GS:003b
EIP:759258ff ESP:0032fb84 EBP:0032fc28 EFLAGS:00210246( R- -- I Z- -P- )
EAX:00320014 EBX:759edff4 ECX:0032fd2c EDX:00000000
ESI:7edff2f5 EDI:759ee35c
Stack dump:
0x0032fb84: 759cab25 0032fd2c 0032fcef 759ee3a0
0x0032fb94: 759cab25 00000000 00000000 7bc46411
0x0032fba4: 0012c830 759cab3f 759cc324 759cab2e
0x0032fbb4: 00000000 7dcd4848 ffffffef 00000005
0x0032fbc4: 00000000 00000000 ffffffff 00000000
0x0032fbd4: ffffffff 00000000 00000019 00000000
Backtrace:
=>0 0x759258ff in libc.so.6 (+0x908ff) (0x0032fc28)
1 0x759254ca in libc.so.6 (+0x904c9) (0x0032fcd4)
2 0x75926d10 __strftime_l+0x2f() in libc.so.6 (0x0032fcf0)
3 0x75924fd6 strftime+0x45() in libc.so.6 (0x0032fd10)
4 0x6820953d MSVCRT_strftime+0x7c() in msvcrt (0x0032fd70)
5 0x5f41ba0d in mfc42 (+0x1ba0c) (0x0032fdc8)
6 0x00401055 in oletest (+0x1054) (0x0032fe90)
7 0x7b853b9c call_process_entry+0xb() in kernel32 (0x0032fea8)
8 0x7b855feb in kernel32 (+0x45fea) (0x0032fee8)
9 0x7bc6ea20 call_thread_func+0xb() in ntdll (0x0032fef8)
10 0x7bc6ebf0 call_thread_entry_point+0x6f() in ntdll (0x0032ffc8)
11 0x7bc4a32a in ntdll (+0x3a329) (0x0032ffe8)
0x759258ff: movl 0x0(%edi,%eax,4),%eax
Modules:
Module Address Debug info Name (48 modules)
PE 400000- 404000 Export oletest
PE 5f400000-5f4f8000 Export mfc42
ELF 68000000-6801e000 Deferred ld-linux.so.2
ELF 6801e000-6815e000 Export libwine.so.1
ELF 6815e000-68178000 Deferred libpthread.so.0
ELF 68178000-6817c000 Deferred libdl.so.2
ELF 6817c000-681a2000 Deferred libm.so.6
ELF 681a2000-681ad000 Deferred libnss_nis.so.2
ELF 681ad000-681b9000 Deferred libnss_files.so.2
ELF 681b9000-68239000 Export msvcrt<elf>
\-PE 681d0000-68239000 \ msvcrt
ELF 68239000-682c4000 Deferred gdi32<elf>
\-PE 68240000-682c4000 \ gdi32
ELF 682c4000-6831e000 Deferred advapi32<elf>
\-PE 682d0000-6831e000 \ advapi32
ELF 6831e000-6844e000 Deferred user32<elf>
\-PE 68330000-6844e000 \ user32
ELF 6844e000-684c5000 Deferred libfreetype.so.6
ELF 684c5000-684da000 Deferred libz.so.1
ELF 684da000-6850a000 Deferred libfontconfig.so.1
ELF 6850a000-68531000 Deferred libexpat.so.1
ELF 68531000-685d3000 Deferred winex11<elf>
\-PE 68540000-685d3000 \ winex11
ELF 685d3000-685dc000 Deferred libsm.so.6
ELF 685dc000-685f5000 Deferred libice.so.6
ELF 685f5000-68605000 Deferred libxext.so.6
ELF 68605000-68722000 Deferred libx11.so.6
ELF 68722000-68727000 Deferred libuuid.so.1
ELF 68727000-68741000 Deferred libxcb.so.1
ELF 68741000-68745000 Deferred libxau.so.6
ELF 68745000-6874b000 Deferred libxdmcp.so.6
ELF 6874b000-6876c000 Deferred imm32<elf>
\-PE 68750000-6876c000 \ imm32
ELF 6876c000-68770000 Deferred libxinerama.so.1
ELF 68770000-68776000 Deferred libxxf86vm.so.1
ELF 68776000-68780000 Deferred libxrender.so.1
ELF 68780000-68788000 Deferred libxrandr.so.2
ELF 68788000-6878c000 Deferred libxcomposite.so.1
ELF 6878c000-68792000 Deferred libxfixes.so.3
ELF 68792000-6879c000 Deferred libxcursor.so.1
ELF 703b9000-703c1000 Deferred libnss_compat.so.2
ELF 75895000-759f2000 Export libc.so.6
ELF 79962000-79979000 Deferred libnsl.so.1
ELF 7b800000-7b97b000 Export kernel32<elf>
\-PE 7b810000-7b97b000 \ kernel32
ELF 7bc00000-7bcb7000 Export ntdll<elf>
\-PE 7bc10000-7bcb7000 \ ntdll
ELF 7bf00000-7bf04000 Deferred <wine-loader>
Threads:
process tid prio (all id:s are in hex)
0000000e services.exe
00000015 0
00000014 0
00000010 0
0000000f 0
00000011 winedevice.exe
00000016 0
00000013 0
00000012 0
00000019 (D) Z:\home\adminif\revsetup\ole\oletest.exe
0000001a 0 <==
0000001b explorer.exe
0000001c 0
Backtrace:
=>0 0x759258ff in libc.so.6 (+0x908ff) (0x0032fc28)
1 0x759254ca in libc.so.6 (+0x904c9) (0x0032fcd4)
2 0x75926d10 __strftime_l+0x2f() in libc.so.6 (0x0032fcf0)
3 0x75924fd6 strftime+0x45() in libc.so.6 (0x0032fd10)
4 0x6820953d MSVCRT_strftime+0x7c() in msvcrt (0x0032fd70)
5 0x5f41ba0d in mfc42 (+0x1ba0c) (0x0032fdc8)
6 0x00401055 in oletest (+0x1054) (0x0032fe90)
7 0x7b853b9c call_process_entry+0xb() in kernel32 (0x0032fea8)
8 0x7b855feb in kernel32 (+0x45fea) (0x0032fee8)
9 0x7bc6ea20 call_thread_func+0xb() in ntdll (0x0032fef8)
10 0x7bc6ebf0 call_thread_entry_point+0x6f() in ntdll (0x0032ffc8)
11 0x7bc4a32a in ntdll (+0x3a329) (0x0032ffe8)

If I rewrite the test program to call strftime rather than through MFC it works fine.

Does anybody have any suggestions of what I can try next to debug it?

Thanks

Adam
User avatar
DanKegel
Moderator
Moderator
Posts: 1164
Joined: Wed May 14, 2008 11:44 am

Post by DanKegel »

You could use a debugger or print statement and see what it's passing
strftime.

Or you could try it in a clean prefix with just 'winetricks mfc42', and
see if running with WINEDEBUG=+relay shows what strftime is being called with.

I'd suggest filing a bug report at bugs.winehq.org once you've gotten as far
as you can. Include both source and .exe.
adamvietnam
Level 1
Level 1
Posts: 5
Joined: Fri Jul 01, 2011 6:35 am

Post by adamvietnam »

Thanks Dan,

I think I've gotten to the bottom of it now but I'm not sure if its a bug or my misunderstanding.

I throught when I installed winetricks vc6run it would automatically override msvcrt / msvcirt - I actually had to override them manually through the winecfg ui.

Is this how its supposed to work? If so is there a way of doing it programmatically from a shell script.

Cheers,

Adam
Locked