Article ID: 235059
Article Last Modified on 10/5/2005
APPLIES TO
- Microsoft Messaging Application Programming Interface
This article was previously published under Q235059
SYMPTOMS
When writing a multi-threaded apartment model in COM to set up more than one session, MAPI stops responding (crashes) with the following stack:
HrNewCommonSession() line 1037 + 46 bytes MAPILogonX() line 2444 + 45 bytes MAPILogonEx() line 2055 + 27 bytes CSession::M_ScDo_Logon() line 1167 + 70 bytes CSession::V_HrInvoke() line 246 + 8 bytes CDispatchObj::Invoke() line 1003 + 11 bytes _com_invoke_helper() + 655 bytes _com_dispatch_method() + 35 bytes _Session::Logon() line 17 + 52 bytes CContainer::Open() line 37 + 90 bytes RPCRT4! Invoke@12 + 40 bytes RPCRT4! NdrStubCall2@16 + 1248 bytes RPCRT4! CStdStubBuffer_Invoke@12 + 147 bytes OLE32! StubInvoke + 83 bytes OLE32! MTAInvoke + 21 bytes OLE32! STAInvoke + 86 bytes OLE32! CRpcChannelBuffer::AppInvoke + 131 bytes OLE32! ComInvoke + 513 bytes OLE32! ThreadDispatch + 21 bytes OLE32! 77b5c7a6() USER32! DispatchMessageWorker@8 + 135 bytes USER32! DispatchMessageA@4 + 11 bytes NtfyWaitForMultipleObjects() line 429 ScStartNtfyEngineMgr() line 1899 + 17 bytes ScInitMapiX() line 678 + 5 bytes MAPIInitialize() line 316 CDLL::S_ScAddLock() line 80 + 9 bytes DllGetClassObject() line 174 + 5 bytes OLE32! CDllCache::GetClassInterface + 161 bytes OLE32! CDllCache::Add + 250 bytes OLE32! CDllCache::GetOrLoadClass + 235 bytes OLE32! SearchCacheOrLoadInProc + 42 bytes OLE32! CoCreateInstanceEx@24 + 443 bytes OLE32! wCoCreateInstance + 38 bytes OLE32! CoCreateInstance@20 + 106 bytes RPCRT4! Invoke@12 + 40 bytes RPCRT4! NdrStubCall2@16 + 1248 bytes RPCRT4! CStdStubBuffer_Invoke@12 + 147 bytes OLE32! StubInvoke + 83 bytes OLE32! MTAInvoke + 21 bytes OLE32! STAInvoke + 86 bytes OLE32! CRpcChannelBuffer::AppInvoke + 131 bytes OLE32! ComInvoke + 513 bytes OLE32! ThreadDispatch + 21 bytes OLE32! 77b5c7a6() USER32! DispatchMessageWorker@8 + 135 bytes USER32! DispatchMessageW@4 + 11 bytes OLE32! CDllHost::WorkerThread + 223 bytes OLE32! DLLHostThreadEntry + 9 bytes OLE32! CRpcThread::WorkerLoop + 21 bytes OLE32! CRpcThreadCache::RpcWorkerThreadEntry + 26 bytes KERNEL32! BaseThreadSt
CAUSE
MAPI uses a message pump to do the initialization. Initializing with a multithreaded apartment model from a COM app using CDO, more than one initialize message will be sent (one for each thread in the apartment).
During initialization, MAPI creates another message pump, and then the second initialization is processed before the first completes. A profile object is not filled in the first initialization until the notification manager is started. Because MAPI re-enters the initialization functions the second time, the profile object will not be filled until the second initialization finishes, and the logon is completed. Unfortunately, the logon uses the profile object that is NULL because it isn't yet filled in the first initialization call.
RESOLUTION
A supported fix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Apply it only to computers that are experiencing this specific problem. This fix may receive additional testing. Therefore, if you are not severely affected by this problem, Microsoft recommends that you wait for the next Microsoft Exchange Server 5.5 service pack that contains this hotfix.
To resolve this problem immediately, contact Microsoft Product Support Services to obtain the fix. For a complete list of Microsoft Product Support Services phone numbers and information about support costs, visit the following Microsoft Web site:
NOTE: In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The typical support costs will apply to additional support questions and issues that do not qualify for the specific update in question.
The English version of this fix should have the following file attributes or later:
Date Time Version Size File name Platform ------------------------------------------------------------- 05-14-99 7:34am 5.5.2621.0 879,888 Mapi32.dll I386 05-14-99 7:33am 5.5.2621.0 1,392,912 Mapi32.dll Alpha
STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.
Keywords: kbbug kbfix kbqfe KB235059