2. Open an entry id of an IMAP store.
3. Open ipm subtree of the store by clicking on it in the hierarchy tree.
4. Close the window related to this IMAP store.
5. Logoff (in main window).
6. MAPIUninitialize (in main window).
After this process MFCMAPI will hang.
When I am using logon WITH displaying stores (or select it after logon) then MAPIUninitialize does not hang.
(I have a default exchange store, and two other IMAP store in the used profile.)
There's a reason I pop a dialog saying "don't do this unless you know what you're doing" on the MAPIUninitialize. With your repro steps, MFCMAPI still has objects in the IMAP store open when you call MAPIUninitialize. I didn't repro a hang, but I did repro a crash, which I would expect when MFCMAPI then tries to deal with those objects but MAPI is uninitialized.
Do you have a real world use case with the IMAP provider that requires you to call MAPIUninitialize? Please bring it up under the Discussions tab.