PRB: MessageBox() after MAPIUninitialize Causes Access Violation
ID: Q243066
|
The information in this article applies to:
-
Extended Messaging Application Programming Interface (MAPI), version 1.0
-
Microsoft Exchange Server, versions 5.5 SP2, 5.5 SP3
SYMPTOMS
With Mapi32.dll version 5.5.2448.0(SP2) and 5.5.2650.12(SP3), if you log on to an offline profile with a MAPI_NO_MAIL flag and select "Work Offline", after MAPIUninitialize() call, MessageBox function stops with an access violation.
RESOLUTION
The possible workarounds are:
- Remove the MAPI_NO_MAIL flag.
- Call MessageBox function right before MAPIUninitialize().
MORE INFORMATIONSteps to Reproduce Behavior
- Create an offline profile "ServerOffline", and make sure you can log on to work offline using Microsoft Outlook.
- Compile and run the following program. When it prompts you to either "Connect" or "Work Offline", choose "Work Offline".
- An Access Violation occurs when calling MessageBox (NULL, "Done", "Info", MB_OK);
// link with mapi32.dll
// Create an offline profile "ServerOffline"
#include <mapix.h>
#include <stdio.h>
void main()
{
HRESULT hr = S_OK;
LPMAPISESSION lpSession = NULL;
MessageBox(NULL, "Begin", "Info", MB_OK);
hr = MAPIInitialize(NULL);
hr = MAPILogonEx(0, "ServerOffline", NULL,
MAPI_NEW_SESSION | MAPI_NO_MAIL | MAPI_EXTENDED | MAPI_PASSWORD_UI, &lpSession);
hr = lpSession->Logoff(0, 0, 0);
if (lpSession) lpSession->Release();
//MessageBox(NULL, "Before Uninitialize", "Info", MB_OK);
MAPIUninitialize();
MessageBox(NULL, "Done", "Info", MB_OK);
}
REFERENCES
For additional information about configuring the Microsoft Exchange Service to work offline, please click the article number below
to view the article in the Microsoft Knowledge Base:
Q195436 Remote Mail, Offline Folders, and Working Offline
Additional query words:
"Work Offline" MAPI_NO_MAIL
Keywords : kbMAPI kbMsg kbVC kbGrpMsg kbDSupport
Version : WINDOWS:1.0; winnt:5.5 SP2,5.5 SP3
Platform : WINDOWS winnt
Issue type : kbprb
|