Windows NT Service Client Applications

To enable client applications that are written as Windows NT services to operate with MAPI-compliant service providers, MAPI imposes several limitations and requirements. Simple MAPI, CMC, and MAPI clients have the following limitations:

All client applications, whether or not they are implemented as Windows NT services, must call MAPIInitialize to initialize the MAPI libraries. A call to OleInitialize is also necessary to use the OLE libraries. Both MAPIInitialize and OleInitialize make calls to CoInitialize to initialize the Component Object Model (COM) libraries. Clients that are Windows NT services must set a special flag, MAPI_NT_SERVICE, in the ulFlags member of the MAPIINIT_0 structure that is passed to MAPIInitialize and in the ulFlags parameter that is passed to MAPILogonEx to inform MAPI of their special implementation.

Windows NT service clients written with the MAPI client interface have a few additional requirements:

Note The requirement that the account belong to the Administrators group will be removed in a future release of Windows NT.

    To handle messages in an initialization thread, a MAPI client that is implemented as a Windows NT service
  1. Calls MsgWaitForMultipleObjects when the main thread blocks.
  2. Calls the GetMessage, TranslateMessage, and DispatchMessage sequence of Windows functions to handle the message when MsgWaitForMultipleObjects returns the sum of the value of the nCount parameter and the value of WAIT_OBJECT_0, indicating that a message is in the queue.
    To produce application log entries through asserts and error traces
  1. Use the debug version of MAPI.
  2. Add the following lines to the debug initialization file, MAPIDGB.INI:
    [General]
    
    DebugTrace=1
    EventLog=1