[[Summary: C:\Windows\system32\pvmjpg21.dll can cause Vista to crash in various ways including "COM Surrogate" errors. Deleting or renaming it can fix the problem, but may cause your camera to stop working. Seek updated software. Techniques are shown for tracking down similar problems]]

Just upgraded to Vista? Com surrogate stopped working when you look at folders with movies in them? Windows Movie Maker crashing when you play movies?

What’s probably happening is that some video driver on your system is making something else crash. It’s probably a bit of software left behind from some obscure camera or video editing software you installed, possibly years ago. It’s just been hanging around, waiting for you to upgrade to Vista, so it can slyly crash on you.

This annoys me somewhat, because I know that Vista, deep down in there somewhere, actually knows what crashed. It’s not COM Surrogate, it’s not Windows Movie Maker, it’s just some little POS .dll there. Windows knows, so why can’t it tell me?

We have to ask nicely, and by nicely I mean sixteen century feudal Japan nicely. We have to ask in a most formal and precise manner, and any deviation will result in the Vista shogunate either ignoring us, or chopping off our heads.

What we are doing is “debugging”. The first step of which is to reproduce the problem. In my case I simply had to start up Windows Movie Maker, drag a clip into the timeline, and hit play, and it crashes. Now it you were a powerful samuri programmer, you might already have Visual Studio installed, and you might get the option to “debug”, and you could in fact do much of the following in that. But I’m going to assume you don’t, and you also don’t feel like waiting three hours to install it, so instead we need a simpler little debugger.

Luckily microsoft have one, which brings us to the real step 1.

Step 1 - Download and install WinDbg (aka: “Debugging Tools for Windows”)
You know the drill, go here:
http://www.microsoft.com/whdc/devtools/debugging/installx86.mspx#a
And download and run the install program (like, click on “Install 32-bit version 6.9.3.113 [17.5 MB]“);
Then just accept the defaults, and install.
[Update:  I used version 6.7.5.1, which is also linked on that page.  I've not tried the new version, but I'd assume it works the same, but better]

Step 2 - Enable it as the default debugger
Open a command prompt (Click start, type cmd, press enter)
type cd “c:\Program Files\Debugging Tools for Windows”
type windbg -I

A window should pop up telling you that it has been installed as the default debugger. You are now ready to debug. Remain calm.

Step 3 - Make it crash (just do what you did before to make it crash)

Step 4 - Debug.
If all went well, a window will pop up, it might first ask you if you want to Save information for workspace …, do as you feel fit here, you can click no, and tell them not to ask you again. You will then get a window, the last few lines of which will look like:

ModLoad: 67b90000 67c7a000 C:\Program Files\QuickTime\QTSystem\QuickTimeImage.qtx
ModLoad: 677d0000 678b1000 C:\Program Files\QuickTime\QTSystem\QuickTimeInternetExtras.qtx
ModLoad: 07980000 079eb000 C:\Program Files\QuickTime\QTSystem\QuickTimeMPEG.qtx
ModLoad: 67e50000 67e9f000 C:\Program Files\QuickTime\QTSystem\QuickTimeMPEG4.qtx
ModLoad: 67ea0000 67f25000 C:\Program Files\QuickTime\QTSystem\QuickTimeMPEG4Authoring.qtx
ModLoad: 67c80000 67d0a000 C:\Program Files\QuickTime\QTSystem\QuickTimeMusic.qtx
ModLoad: 07510000 07543000 C:\Program Files\QuickTime\QTSystem\QuickTimeQD3D.qtx
ModLoad: 67550000 6760c000 C:\Program Files\QuickTime\QTSystem\QuickTimeStreaming.qtx
ModLoad: 680a0000 680f5000 C:\Program Files\QuickTime\QTSystem\QuickTimeStreamingAuthoring.qtx
ModLoad: 68100000 68121000 C:\Program Files\QuickTime\QTSystem\QuickTimeStreamingExtras.qtx
ModLoad: 67650000 6770a000 C:\Program Files\QuickTime\QTSystem\QuickTimeVR.qtx
ModLoad: 07690000 076da000 C:\Windows\system32\pvmjpg21.dll
(1384.1620): Access violation - code c0000005 (!!! second chance !!!)
eax=00010710 ebx=080dd710 ecx=0810db20 edx=000a0000 esi=080ccb18 edi=00000001
eip=080dd710 esp=0768eaf0 ebp=0768ecbc iopl=0 nv up ei pl nz na po nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00010202
080dd710 8b442408 mov eax,dword ptr [esp+8] ss:0023:0768eaf8=00000001

What this is doing is telling you what happend in Vista’s guts just before it went belly up. The very last few things are meaningless details, but the interesting thing here is the last ModLoad line:

ModLoad: 07690000 076da000 C:\Windows\system32\pvmjpg21.dll

Now this might actually be all we need. It looks like the last thing it did was load this dll. A quick internet search tells us it’s something to do with video. If I go look in the C:\Windows\system32\ I see the file is dated from 2001. Now that in itself is reason to be suspicious. But we can do one more step, just to be sure:

Step 5 - Look at the call stack. Not as complex as it sounds, select “call stack” from the “view” menu, and a new window will open looking like (in my case):

WARNING: Frame IP not in any known module. Following frames may be wrong.
0×80dd710
pvmjpg21!DllUnregisterServer+0×5ec9
pvmjpg21!DllUnregisterServer+0×4f20
pvmjpg21!DllUnregisterServer+0×431e
pvmjpg21!DllUnregisterServer+0xca4

Again, this is just telling us the very last thing that happened before the crash. And we can see the last four things we all in pvmjpg21.dll, which kind of seals the deal.

Step 6 - Fix it. Fixing it might be as simple as deleting it, if it’s part of something that you no longer use (i.e., deleting C:\Windows\system32\pvmjpg21.dll). But it’s quite possible for the file to be needed, and yet still crash. In that case you might want to find an update. First you’ve got to find what actually uses this file. You could do that (as I did) by deleting it, and then seeing what stops working. You can also right click on the file, and then click “Properties”, and it might tell you what it’s attached to. In this case it says it’s the “PICVideo Motion JPEG Compressor”. Unfortunately I don’t have anything called PICVideo installed. But you might be lucky and get a useful name. Then off to their web site, and look for an update.

So what we now have is a tool that gives us a few more clues as to what is causing those inscrutable crashes. It gives you a little more power than Microsoft really wants you to have, as it gives you the power to really mess things up if you go and delete the wrong DLL. So unless you are pretty sure of what you are doing, then you might want to proceed with caution. But if your COM Surrogate has stopped working ten times today, then perhaps you deserve to know the reason why.