BUG: MAPI Crashes When Using COM Multithread Model!

D

dummy

Hi. I use MS Exchange 2000 SP3 with latest pack (September 2003 Exchange
2000 Server Post-Service Pack 3 Rollup).

I have initialized mapi & mapi session in MTA thread then I have running two
MTA threads that both run OpenMsgStore repeatedly and then close it.
After brief work period MAPI crashed!

My thread function seems like:

::CoInitializeEx(0, COINIT_MULTITHREADED);
MAPIINIT_0 mapiInit = { MAPI_INIT_VERSION, MAPI_NT_SERVICE |
MAPI_NOCOINIT };
::MapiInitialize(&mapiInit);

while(...)
{
LPMDB lpMDB = NULL;

hRes = threadParams.lpMapiSession->OpenMsgStore(NULL,
threadParams.cbEntryID,//size and...
threadParams.lpEntryID,//value of entry to open
NULL,//use default interface to open store
MDB_WRITE,//flags
&lpMDB);//where to put the store

if( lpMDB != NULL )
{
lpMDB->Release(); // <---I have access violation here!!!
}
}
....

call stack:
emsmdb32.dll!_HrSetErrCtx@16() + 0x1b
emsmdb32.dll!_RMSL_Destroy@4() + 0x26
emsmdb32.dll!_RMSL_MaybeDestroy@4() + 0x2a
emsmdb32.dll!_RMSL_Release@4() + 0x1f
mapi32.dll!ReleaseI() + 0xe
mapi32.dll!_CommonSupportRelease@4() + 0x32b
mapi32.dll!ReleaseI() + 0xe
emsmdb32.dll!_ROBJ_Destroy@4() + 0xce
emsmdb32.dll!_ROBJ_Release@4() + 0xaf

How to avoid this problem ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top