COM Surrogate has stopped working in Windows Photo Viewer

Posted by  – April 28, 2011

Suddenly my Microsoft Windows 7 started to throw “COM Surrogate” error when I try to view any picture with its built-in Windows Photo Viewer. The advices which you can find in the internet says to reinstall Nero or codec packs. I have neither of them, but only more or less clean Windows installation and all its usual updates.
In a nutshell, “COM Surrogate” is DllHost.exe process created by any other process, which wants to execute some code from any DLL (code library), but it doesn’t want to execute the code in its own space since it does not trust the code in terms of stability. So it creates a “surrogate” to execute the code. If that DLL code dies during execution, only DllHost.exe surrogate process dies (giving us this “COM Surrogate has stopped working” error) and the initial process stills alive. If this killing code were executed in the initial process directly, then the initial process dies instead of surrogate.
Though actually we have no need to care what it is and what all this means and how things work. We want our photos being shown.
The error says “COM Surrogate has stopped working” and looks like this:
If you click on “View problem details” you get this or something similar:
Problem signature:
Problem Event Name:       APPCRASH
Application Name:         DllHost.exe
Application Version:     6.1.7600.16385
Application Timestamp:   4a5bc6b7
Fault Module Name:       ImagingEngine.dll
Fault Module Version:     6.1.7600.16385
Fault Module Timestamp:   4a5bda01
Exception Code:           c0000005
Exception Offset:         00017fce
OS Version:               6.1.7600.2.0.0.768.3
Locale ID:               1049
Additional Information 1: 0a9e
Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
Additional Information 3: 0a9e
Additional Information 4: 0a9e372d3b4ad19135b953a78882e789
If you will try to google for this error, you will probably find this and this and similar pages, which give you few more details on the surrogate technique and advices on how to solve this issue.
But as you can see in our case the key problem is ImagingEngine.dll, and it has nothing to do with Nero or video codec packs from those links above. More on that, symptoms of the problems are not the same as others’ ones: you have COM Surrogate error when you try to view an image, not when entering a folder with media files and their thumbnails.
So, to solve this, I’ve copied the whole “C:\Program Files\Windows Photo Viewer” folder from another healthy system. Though you cannot overwrite or delete these files on your computer, even in safe mode (probably these files are used and locked or are  in any other way protected) . But you can rename the old “Windows Photo Viewer” folder to something like “(delete me later)”, and then move your new folder into “Program Files”. Rebooting is not necessary — it helps immediately.
In other words, step by step solution for this “COM Surrogate” error is like this:
1. Retrieve the whole folder “C:\Program Files\Windows Photo Viewer” from another healthy computer using a USB disk or network or whatever (or use the links below).
2. Open your “C:\Program Files”.
3. Rename “Windows Photo Viewer” to “(delete me later)”.
4. Copy healthy “Windows Photo Viewer” folder from step 1  into “C:\Program Files”, so there will be “C:\Program Files\Windows Photo Viewer” folder with usual files.
5. Open your image, check that everything works.
6. Reboot.
7. Delete “C:\Program Files\(delete me later)” folder. Or keep it.
That’s it. Now all images and photos are opened with no COM Surrogate error.
If you have no other healthy system with these files, you can use mine. But note that it contains only Russian MUI files (you can add your own manually), and the files are as fresh as 2011-04-25: