The Microsoft Office Outlook Connector Kills Winsock

It’s true. Kills it. Kills it dead. Ok – maybe that’s a bit strong. Here’s the issue. If you installed the Microsoft Office Outlook Connector, then ran an application (other than Outlook) which uses both MAPI and Winsock, the Winsock portion of your application is likely to find its connections torn down when you’re done using MAPI. This, of course, can be quite disconcerting.

A bit about the connector: The Microsoft Office Outlook Connector is a set of MAPI provider and an Outlook Add-in that allow Outlook to connect to Microsoft Windows Live Hotmail and Microsoft Office Live Mail accounts. The file msncon32.dll implements a store, transport, and address book provider. Incidentally, the store provider is a Wrapped PST. The Add-in allows for some custom UI.

The problem is with the connector’s connection monitor feature, which uses Winsock. This feature is designed only to run when the providers were loaded inside the Outlook process, presumably when it would have access to the Add-in. However, the code which cleans up after the feature was running no matter where the providers were loaded. Since this code assumed Winsock had been initialized with WSAStartup, it cleaned it up with a call to WSACleanup. This is harmless if Winsock isn’t being used, but if it is, this tears down Winsock before the rest of the application is expecting it to be torn down. Not ideal.

The fix, of course, is only to call WSACleanup if we’ve called WSAStartup. The latest version of the Outlook Connector does just that. You can get the connector here:

http://www.microsoft.com/downloads/details.aspx?familyid=9A2279B1-DF0A-46E1-AA93-7D4870871ECF

The file with the fix in it is msncon32.dll – the fixed version is 12.0.6423.1000. Any version of msncon32.dll prior to this build will exhibit the behavior of making the unmatched call to WSACleanup. If you’re looking to code around this issue for earlier builds, you could always stack an extra call to WSAStartup to counteract the extraneous WSACleanup.

BTW – this isn’t the only fix in the connector. I don’t know if we’ve published a list of fixes. I do know one of the fixes has to do with a failure to complete migration of more than 250 calendar items from some older system to Windows Live Calendar.