• Sign in
 
  •  
  • MSDN Blogs
  • Microsoft Blog Images
  • More ...

  • Blog Home
  • About
  • Email Blog Author
  • Share this
  • RSS for posts
  • Atom
  • RSS for comments
  • CDO (25)
  • Code Snippet (43)
  • Custom Providers (17)
  • Debugging (7)
  • DevMsgTeam (301)
  • Documentation (109)
  • DST (8)
  • EWS (7)
  • Exchange (109)
  • Gotchas (97)
  • Hotfix (28)
  • MAPI (240)
  • MAPI Download (54)
  • MFCMAPI (101)
  • MSDN (59)
  • Non Dev (11)
  • OOM (17)
  • Outlook (171)
  • Outlook 2007 Auxiliary Reference (45)
  • Outlook Integration API (12)
  • Protocol Docs (20)
  • PST/OST (23)
  • Referrals (8)
  • Vista (12)
  • WrapPST (18)
Links:
  • Download MFCMAPI
  • MFCMAPI on Facebook
  • Troubleshooting Outlook Crashes
  • Office Update Center
  • Developer Messaging Team Blog
This site is provided "AS IS" with no warranties, and confers no rights. Use of included code samples are subject to the terms specified in the Terms of Use.
Archives
  • May 2013 (3)
  • April 2013 (1)
  • March 2013 (2)
  • February 2013 (2)
  • January 2013 (2)
  • December 2012 (4)
  • November 2012 (2)
  • October 2012 (2)
  • September 2012 (1)
  • August 2012 (3)
  • June 2012 (2)
  • May 2012 (1)
  • April 2012 (3)
  • March 2012 (3)
  • February 2012 (3)
  • January 2012 (1)
  • December 2011 (3)
  • November 2011 (1)
  • October 2011 (3)
  • September 2011 (1)
  • August 2011 (1)
  • July 2011 (4)
  • June 2011 (3)
  • May 2011 (3)
  • April 2011 (3)
  • March 2011 (5)
  • February 2011 (1)
  • January 2011 (2)
  • December 2010 (1)
  • November 2010 (4)
  • October 2010 (1)
  • September 2010 (3)
  • August 2010 (5)
  • July 2010 (3)
  • June 2010 (3)
  • May 2010 (1)
  • April 2010 (3)
  • March 2010 (3)
  • February 2010 (3)
  • January 2010 (2)
  • December 2009 (3)
  • November 2009 (5)
  • October 2009 (4)
  • September 2009 (5)
  • August 2009 (5)
  • July 2009 (11)
  • June 2009 (6)
  • May 2009 (5)
  • April 2009 (3)
  • March 2009 (18)
  • February 2009 (10)
  • January 2009 (3)
  • December 2008 (2)
  • November 2008 (2)
  • October 2008 (5)
  • September 2008 (4)
  • August 2008 (10)
  • July 2008 (6)
  • June 2008 (8)
  • May 2008 (2)
  • April 2008 (4)
  • March 2008 (2)
  • February 2008 (2)
  • January 2008 (5)
  • December 2007 (3)
  • November 2007 (2)
  • October 2007 (3)
  • September 2007 (1)
  • August 2007 (4)
  • July 2007 (5)
  • June 2007 (3)
  • May 2007 (4)
  • April 2007 (1)
  • March 2007 (6)
  • February 2007 (3)
  • January 2007 (2)
  • December 2006 (4)
  • November 2006 (3)
  • October 2006 (1)
  • August 2006 (1)
  • June 2006 (5)
  • May 2006 (5)
  • December 2005 (1)
  • November 2005 (4)
  • October 2005 (2)
  • September 2005 (1)
  • April 2005 (3)
  • December 2004 (2)
  • September 2004 (2)
  • August 2004 (3)
  • July 2004 (3)

MAPI Store Providers and Outlook 2003

MSDN Blogs > SGriffin's MAPI Internals > MAPI Store Providers and Outlook 2003

MAPI Store Providers and Outlook 2003

Stephen Griffin - MSFT
8 Jul 2004 12:12 PM
  • Comments 13

Put this together from a posting I made to the MAPI-L list and a couple cases I worked recently:

The problem is with MAPI store providers that just don't work when loaded under Outlook 2003. The developers of the providers, when they contact us, are usually convinced the problem is a bug in Outlook 2003 since the providers “worked perfectly” under Outlook XP. My experience though, is that the problem is that Outlook 2003 demands so much more of the MAPI spec than previous versions of Outlook that bugs which have always been in these providers are now exposed. What's very interesting though is that I'm seeing the same bugs over and over in these providers. I hope to highlight the source of these bugs and offer some ideas on how to correct them.

There is a book which is very much coveted in the MAPI development community: Inside MAPI. One of the samples in this book is MSLMS, the Microsoft Sample Local Message Store. For what it is, sample code demonstrating how to write a message store provider, it's great. I'm not aware of any other sample message store out there. So it does not suprise me that a number of people choose to base their provider on the code in MSLMS. As such, they tend to inherit the same bugs and design flaws present in the sample.

I recently spent a couple days hacking on the MSLMS sample so that it could load under Outlook 2003. Here's a short list of the problems I found and what I had to do to fix them:

  • Two heaps we're being allocated for the Provider object, then used in all objects - the heaps were destroyed when the Provider object was destroyed, meaning we'd crash if any object had a longer lifetime. Fixed this by introducing DLLMain and creating/destroying the heaps on module load and unload. Putting this code in DLLMain may not be safe, but it stopped the crash for now. In production code, I'd find a better solution.
  • PR_RECORD_KEY abuse: This bug will stop a provider cold in Outlook 2003.In a number of tables, PR_RECORD_KEY for all objects was
    returning the store's record key instead of the key associated with the individual objects. Since Outlook 2003 depends on PR_RECORD_KEY to cache objects, this error effectively meant nothing in the provider could be rendered. The fix is to make sure PR_RECORD_KEY is unique for all objects and can be accessed through the object and contents tables and hierarchy tables.
  • GetNamesFromIDs deviated far from the MAPI spec. Suppose we make this call asking for two IDs, one which does exist and one which doesn't. MSLMS would return an array with one result, leaving the caller with no way to determine which ID got matched to a name. The correct thing to do is return an array with two entries - one being the matched name and the other indicating an error.
  • Multivalued string and multivalued binary props - The code which handled property persistance failed both of these cases. These properties can get quite complex, with a number of internal pointers. From what I could tell, it did attempt to address them, but it failed to fix up all of the internal pointers when flattening the data structures on save and unflattening them on load. In addition to failing to persist data, this bug also lead to a number of crashes due to the invalid pointers.
  • Named properties were being excluded from contents tables: Don't know why they were being blocked, but this meant Outlook couldn't get to some data on items that it expected to be able to retrieve through the contents table.

Those are just the problems I fixed. Here are some I didn't:

  • PR_RECORD_KEY (again): MSLMS assumes it can always use PR_ENTRY_ID when asked for PR_RECORD_KEY. This assumption breaks down on attachments, where objects do have PR_RECORD_KEY, but do not have PR_ENTRY_ID.
  • MV_INSTANCE: This somewhat obscure flag is at the heart of Outlook's code for handling the Group By box. MSLMS doesn't support the flag. Another effect is that Contact Address books cannot be hosted in MSLMS because the contab32 address book provider depends on the underlying store provider having support for this flag.

Anyone who has based their message store provider on MSLMS (even if it was “What would MSLMS do?“ and not just borrowing the code) needs to review their code and ensure they've addressed all of the above bugs before they approve their provider for support under Outlook 2003.

  • 13 Comments
Outlook, MAPI, Gotchas, Custom Providers, DevMsgTeam
  • Boris Yanushpolsky
    8 Jul 2004 1:03 PM
    Its good to see blogs on MAPI stuff as its pretty difficult to get any details on the internals of MAPI.
  • JasonJoh's [MSFT] WebLog
    13 Jul 2004 10:08 AM
  • SGriffin's [MSFT] WebLog
    30 Sep 2004 5:19 PM
  • Laughing John
    17 May 2005 3:15 AM
    Anyone out there got any idea where I can get a sample Message Store provider ? The only one I know of is "Inside MAPI". Can MS supply one ?
  • David
    13 Jun 2005 11:14 PM
    Stephen,

    Thank you for taking the time to update this blog. I am a newbie and the whole blog thing. I have a VERY simple Message Store Provider sample that I would like to share. I tried using MSLMS but got too frustrated with all the bugs. Even the sample code that comes with Inside MAPI states that their sample is not finished. What's up with that? Your sample was VERY helpful. I reomoved the whole Back End Database architecture to simplify the design and it looks great. I am stuck on a problem where Outlook XP seems to call CMSPLogon::Logoff just after getting the Entry IDS for the main folders (IPM Subtree, Trash, etc.) for no apparent reason. This causes some internal problems. I tracked it to MSMAPI32.DLL however I cannot seem to find a debug version of this DLL. Do you know where I might be able to locate debug versions of MAPI32.DLL and MSMAPI32.DLL?

    Thank you.
  • Bikash Rai
    28 Jun 2005 1:26 AM
    hello David,

    I was wondering if your could share your Store provider with me. I am trying to create a local pst store which will be read onlt in nature...

    Thanks ,
    Bikash
  • SGriffin's [MSFT] WebLog
    8 Aug 2005 3:17 PM
    A while back, I posted an article about the fixes Jason and I had to make to the MSLMS sample...
  • Simon Card
    22 Sep 2005 4:11 PM
    The link for the updated MSLMS sample is no longer valid. Does anyone have an updated link or copy available? http://stephen_griffin.members.winisp.net/mslms/mslms.zip
  • Stephen Griffin - MSFT
    27 Sep 2005 4:27 PM
    I just tried it and it's working for me. Perhaps winisp was temporarily down...
  • nirl
    28 Oct 2005 5:29 AM
    I'm having problems installing mslms sample and smpms sample (microsoft's sample from MSDN) on outlook 2003. I do not see any new service listed when I add a new "account" and choose "Additional server types". Here is what I did - Maybe I missed something ? I compiled both DLL's and put them under c:\windows\system32. I added the following entries in all mapisvc.ini files under [SERVICES] section SMPMS=Sample Message Store MSLMS=Sample Local Message Store I added the following entires at the bottom of the files: [SMPMS] Providers=SMS PR_SERVICE_DLL_NAME=smpms.dll PR_SERVICE_SUPPORT_FILES=smpms.dll PR_SERVICE_DELETE_FILES=smpms.dll PR_SERVICE_ENTRY_NAME=SMSServiceEntry PR_RESOURCE_FLAGS=SERVICE_NO_PRIMARY_IDENTITY [SMS] PR_PROVIDER_DLL_NAME=smpms.dll PR_RESOURCE_TYPE=MAPI_STORE_PROVIDER PR_RESOURCE_FLAGS=STATUS_DEFAULT_STORE PR_PROVIDER_DISPLAY=MAPI Sample Message Store PR_MDB_PROVIDER=385d475fecf1cd1193dc5aab3C478437 [MSLMS] Providers=MS_LMS PR_SERVICE_DLL_NAME=MSLMS.DLL PR_SERVICE_ENTRY_NAME=ServiceEntry PR_SERVICE_SUPPORT_FILES=MSLMS.DLL PR_SERVICE_DELETE_FILES=MSLMS.DLL PR_RESOURCE_FLAGS=SERVICE_NO_PRIMARY_IDENTITY WIZARD_ENTRY_NAME=WizardEntry [MS_LMS] PR_PROVIDER_DLL_NAME=MSLMS.DLL PR_RESOURCE_TYPE=MAPI_STORE_PROVIDER PR_RESOURCE_FLAGS=STATUS_DEFAULT_STORE PR_PROVIDER_DISPLAY=Sample Local Message Store PR_DISPLAY_NAME=Sample Mailbox
  • Stephen Griffin - MSFT
    28 Oct 2005 5:07 PM
    nirl, If you're using the MSLMS sample linked from here, there's an export on there called MergeWithMAPISVC. It takes care of adding the appropriate entries for MSLMS to the right MAPISVC.INF file. You can invoke it like this: rundll32 mslms32.dll MergeWithMAPISVC. Conversely, there's also a RemoveFromMAPISVC function. You can examine both of these functions to determine exactly what you should be putting in the MAPISVC.INF file. Steve
  • SGriffin's [MSFT] WebLog
    22 Aug 2007 3:58 PM

    A while back, I posted an article about the fixes Jason and I had to make to the MSLMS sample message

  • SGriffin's MAPI Internals
    15 Aug 2008 4:56 PM

    The first answer I give to customers asking for tips on making their store provider work with the latest

Page 1 of 1 (13 items)
  • © 2013 Microsoft Corporation.
  • Terms of Use
  • Trademarks
  • Privacy & Cookies
  • Report Abuse
  • 5.6.426.415