Here’s a fun trick. On a machine where you have the Exchange MAPI Download installed, create a file named “Program” in the root of the system drive. Then start MFCMAPI and open a profile with an Exchange mailbox in it. You’ll get this nice error:
“The MAPI Spooler could not be started. Close and then restart all mail-enabled applications. MAPI 1.0 [000004C7]”
Of course, restarting MAPI applications, or even rebooting, won’t help. You have to delete that file, “Program”, from the root of the system drive. Only then will the MAPI spooler start.
So – what happened here? We’re using CreateProcess to try to launch the spooler. The string we pass in for the command line looks like this: C:\Program Files (x86)\ExchangeMapi\MAPISP32.EXE –0001EFC1A5208C4
Note the distinct lack of quotes. As the documentation suggests, if you call this function with a path which has white space in it and no quotes, it will try to parse the path as if the first space separates the executable name from the parameters. So it looks for an executable named “C:\Program”. When it finds a file with that name which is not an executable, it returns an error. The lesson here is to make sure to properly quote paths passed to CreateProcess. Also, make sure you don’t have a file named “Program” in the root.
Outlook’s MAPI is not vulnerable to this problem since it no longer has a separate MAPI spooler process. I don’t believe we’ll be pursuing a fix to the Exchange MAPI download since the likelihood of such a file existing for legitimate purposes is low, and you need to be an administrator to even create it in the first place.
I just got word that the Outlook 2010 MAPI Reference has been updated. Among the bigger changes, we’ve completed the overhaul of the Nickname cache article to document where to find the cache in Outlook 2010 and we’ve consolidated all of the MAPI Constants into a single article. Read about more of the changes in the What’s New article.
We didn’t get it in to this update, but I want to remind everyone that we just published a new MAPI Stub Library over on Codeplex. Documentation for this library will probably find it’s way into the MSDN at some point, but until then, you can read the documentation I wrote as well as the FAQ.
The May 2011 Release (build 184.108.40.2066) is live: http://mfcmapi.codeplex.com.
This round, the focus was on a new MAPI stub library and Fuzz testing.
The new MAPI Stub Library is the product of months of hard work on the part of a few talented developers and testers in the Outlook organization. I did a good bit of testing myself and even fixed a few issues, but I did not have the honor of writing it. Incorporating this new stub library into MFCMAPI allowed me to ditch a good bit of my own import code. I highly recommend everyone to check this project out.
I found some internal tools to help with Fuzz testing. Using these, I was able to ferret out a number of issues with my SmartView parsers. I’ve actually found far fewer issues than I had expected, so it looks like my parsers were on solid footing already. I’ve fixed everything I’ve found, along with a number of issues reported through Windows Error Reporting.
Here's a change list - see the Issue Tracker on Codeplex for more details, or look at the code: