## Friday, October 23, 2009

### Wine and Missing MFC42.DLL

Every once in a while I need to run a Window$application. If the application at hand is a standalone application that does not require installation, I'll usually attempt to run it first with Wine, instead of launching a full blown WinXP virtual machine. Using Wine is a no brainer: wine /path/to/application.exe <command-line-arguments> and if the file happens to have executable permissions (chmod +x ...) then it's even easier - just launch it like any other script or binary executable, by typing /path/to/application.exe <command-line-arguments> Last time I tried it I hit a problem: err:module:import_dll Library MFC42.DLL (which is needed by L"Z:\\path\\to\\application.exe") not found err:module:LdrInitializeThunk Main exe initialization for L"Z:\\path\\to\\application.exe" failed, status c0000135 This means that a required DLL is missing - in this case it's MFC42.DLL. This specific DLL is needed for (older) GUI applications that use MFC, and it isn't part of Wine. Whatever you do if this happens to you - don't try getting this DLL from any of the websites that Google will list when you search for it. Google marks quite a few of these sites as sites that can harm your computer. You have been warned. Window$ users can get MFC42.DLL and other DLLs by installing the Microsoft Visual C++ Redistributable Package.

The recommended way of doing this under Wine is to follow the instructions on the Wine wiki:
wget http://www.kegel.com/wine/winetricks
2. make it executable:
chmod +x winetricks
(optional: place the file in a system directory such as /usr/local/bin)
3. install cabextract:
aptitude install cabextract
(actually, I'm not sure it's necessary for fixing the MFC problem, but it's definitely recommended for fixing other Wine problems)
4. run
winetricks mfc42
The winetricks script has lots of other options for fixing a host of issues and installing a rather long list of third party packages that are not part of Wine.

Bottoms Up!

[25 Feb 2012] UPDATE: winetricks has been packaged in Debian/testing for quite a while - so I recommend that you don't install it manually as per steps 1 thru 3 above, but rather use one of the package managers to do it for you:
aptitude install winetricks

1. Thanks, I was having this exact problem, following these instructions fixed it perfectly!

2. Thank you very much!
Your post helped me to solve the same problem!
;-)

3. Hi, when I try to run winetricks, it says "command not found". I made it executable, but I don't know where it is, so I can't tell if it's in a system directory or not.

4. Well, you can use

find ~/ -name "winetricks"

to find it, but I guess it's right there in the same directory where you downloaded it to (maybe on your desktop? - firefox seems to default to that location)

If you downloaded it with wget, as I suggested, then just run

./winetricks

(note the ./) in the same shell you used to download the file in.

If all else fails, try downloading the file again, but this time please use

pwd

in the shell to note where you are downloading the file to...

Good luck.

5. Thanks, but it seems I somehow managed to install it correctly. Though the program I needed it for just returned errors (it was an installation program for a driver I needed).
But thanks anyway, if I ever need help with this again, I know where to turn!

Matt.

6. Your post is very useful to understand how resolve problem similar to mfc42.dll missing. Thank you very much!

7. Thank you! Outstanding, concise, effective fix for an all too common problem. Last time I had to deal with this it took ~2 hours to patch together. This time, your fix got me there in under 2 minutes. Again, THANK YOU!!!

8. Saved my life :)

9. Thanks very much. It actually fixed the problem. The only step I was missing was that winetricks was copied to the folder I was in.

Thanks again.

10. Perfect that did the trick !

Thanks a bunch !

11. marvelous.. nice trick.. thanks

12. THanks a looooooooooooooot, super!

13. Very usefull, thank you

14. Very cool. Perfect. Pierre

15. Excellent - Solved my problem.Great post!
I'm using Debian Wheezy, & winetricks and cabextract are both Debian packages, so 'apt-get' did the job.
Wine has really come of age now - time & again recently I've used it to run something only available as a Win .exe with 100% success - you couldn't say that a decade ago :-)

16. I won't be original probably, but thanks, it really helped! ;]

17. For a couple of years I was trying to get this to run in Ubuntu. I found this page and withing about 5 min it is running FAST!!!
My hat is certainly off to you!!!!! Thanks you 100000 times. I love this program!!!

18. Thanks for the help. Save my day!

19. This comment has been removed by the author.

20. Although "unknown" removed their post, I think it may be true that vc6redist86_enu.exe is no longer available from the MS download centre(I get a 404). Is this the same file:
Certainly worth checking if winetricks still works 100%

22. If you can make a video of this process it would be a lot easier. I just want to play a game and it is too complicated for me. thnx anyways!

23. Thank you very much, it solved my problem.

24. Thanks! You solved it!