PRB: MAPILogonEx() Returns 0x80070057- MAPI_E_INVALID_PARAMETER

ID: Q185139


The information in this article applies to:


SYMPTOMS

When you attempt to execute MAPILogonEx() from within a service without using the MAPI_NO_MAIL flag, the following error occurs:

0x80070057 (MAPI_E_INVALID_PARAMETER)
MAPILogon() will not fail when executed from within a service because MAPILogon automatically adds the MAPI_NO_MAIL flag when executed from within a service.


CAUSE

Prior to Exchange 5.0 and Windows NT 4.0 SP3, the MAPI spooler was not designed to be used within a Windows NT service.

A Windows NT service runs in a security context distinct from the desktop's security context and distinct from that of other Windows NT services. In fact, each thread within a service may have its own security context. In versions previous to 5.0, MAPI design failed to accommodate this fact on two points:

The information above was obtained from the article "Using MAPI From a Windows NT Service," available on the Microsoft Web site at the following address:
http://msdn.microsoft.com/isapi/msdnlib.idc?theURL=/library/sdkdoc/mapi/book_9jqc.htm


RESOLUTION

Update the MAPI DLLs to at least 4.00.995.51. These updates come with Office 97 Service Release 1, as well as updates to the Exchange Client and Server. Alternately, you could add the MAPI_NO_MAIL flag when calling MAPILogonEx() from within a service.


REFERENCES

For information on MAPI versions and the clients they are installed with, please see the following article in the Microsoft Knowledge Base:

Q172036 INFO: MAPI Version Cross Reference

Additional query words: MAPI32 MAPILogonEx


Keywords          : kbMsg kbMAPI100 
Version           : WINDOWS:1.0,8.00; winnt:4.0
Platform          : WINDOWS winnt 
Issue type        : kbprb 

Last Reviewed: May 11, 1999