Back to index

lightning-sunbird  0.9+nobinonly
Functions
mapihook.h File Reference
#include <structs.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

LONG ProcessNetscapeMAPIHook (WPARAM wParam, LPARAM lParam)

Function Documentation

LONG ProcessNetscapeMAPIHook ( WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 115 of file mapihook.cpp.

{
  PCOPYDATASTRUCT      pcds = (PCOPYDATASTRUCT) lParam;
  MAPIIPCType       *ipcInfo; 
#ifdef WIN32   
  HANDLE            hSharedMemory;
#endif

       if (lParam == NULL)
       {
              return(MAPI_E_FAILURE);
       }

  //
  // Get shared memory info structure pointer...
  //
  ipcInfo = (MAPIIPCType *)pcds->lpData;
  if (ipcInfo == NULL)
       {
              return(MAPI_E_FAILURE);
       }

  //
  // Now connect to shared memory...or just set the
  // pointer for Win16
  //
#ifdef WIN32
  CSharedMem *sMem = NSOpenExistingSharedMemory((LPCTSTR) ipcInfo->smemName, &hSharedMemory);
  if (!sMem)
       {
              return(MAPI_E_FAILURE);
       }
#else
  if (!ipcInfo->lpsmem)
  {
    return(MAPI_E_FAILURE);
  }
#endif

  TRACE("MAPI: MAPIHook Message ID = %d\n", pcds->dwData);
       switch (pcds->dwData) 
       {
  // MAPILogon
  case NSCP_MAPILogon:
    {
     MAPILogonType     *logonInfo;
#ifdef WIN32
    logonInfo = (MAPILogonType *) &(sMem->m_buf[0]);
#else    
    logonInfo = (MAPILogonType *) ipcInfo->lpsmem;
#endif

    if (!logonInfo)
    {
      return(MAPI_E_FAILURE);
    }
  
    logonInfo->ipcWorked = 1;         // Set the worked flag
    return(ProcessMAPILogon(logonInfo));
    break;
    }

  // MAPILogoff
  case NSCP_MAPILogoff:
    {
    MAPILogoffType     *logoffInfo;
 
#ifdef WIN32
    logoffInfo = (MAPILogoffType *) &(sMem->m_buf[0]);
#else    
    logoffInfo = (MAPILogoffType *) ipcInfo->lpsmem;
#endif

    if (!logoffInfo)
    {
      return(MAPI_E_FAILURE);
    }

    logoffInfo->ipcWorked = 1;         // Set the worked flag
    return(ProcessMAPILogoff(logoffInfo));
    break;
    }

  // NSCP_MAPISendMail
  case NSCP_MAPISendMail:
     {
     MAPISendMailType     *sendMailPtr;
#ifdef WIN32
    sendMailPtr = (MAPISendMailType *) &(sMem->m_buf[0]);
#else    
    sendMailPtr = (MAPISendMailType *) ipcInfo->lpsmem;
#endif

    if (!sendMailPtr)
    {
      return(MAPI_E_FAILURE);
    }

    sendMailPtr->ipcWorked = 1;         // Set the worked flag
    return(ProcessMAPISendMail(sendMailPtr));
    break;
    }

  // MAPISendDocuments
  case NSCP_MAPISendDocuments:
     {
     MAPISendDocumentsType     *sendDocPtr;
#ifdef WIN32
    sendDocPtr = (MAPISendDocumentsType *) &(sMem->m_buf[0]);
#else    
    sendDocPtr = (MAPISendDocumentsType *) ipcInfo->lpsmem;
#endif

    if (!sendDocPtr)
    {
      return(MAPI_E_FAILURE);
    }

    sendDocPtr->ipcWorked = 1;         // Set the worked flag
    return(ProcessMAPISendDocuments(sendDocPtr));
    break;
    }

  // MAPIFindNext
  case NSCP_MAPIFindNext:
    {
    MAPIFindNextType    *findInfo;
 
#ifdef WIN32
    findInfo = (MAPIFindNextType *) &(sMem->m_buf[0]);
#else    
    findInfo = (MAPIFindNextType *) ipcInfo->lpsmem;
#endif

    if (!findInfo)
    {
      return(MAPI_E_FAILURE);
    }

    findInfo->ipcWorked = 1;         // Set the worked flag
    return(ProcessMAPIFindNext(findInfo));
    break;
    }

  // MAPIDeleteMail
  case NSCP_MAPIDeleteMail:
    {
    MAPIDeleteMailType    *delInfo;
 
#ifdef WIN32
    delInfo = (MAPIDeleteMailType *) &(sMem->m_buf[0]);
#else    
    delInfo = (MAPIDeleteMailType *) ipcInfo->lpsmem;
#endif

    if (!delInfo)
    {
      return(MAPI_E_FAILURE);
    }

    delInfo->ipcWorked = 1;         // Set the worked flag
    return(ProcessMAPIDeleteMail(delInfo));
    break;
    }

  // MAPIResolveName
  case NSCP_MAPIResolveName:
    {
    MAPIResolveNameType    *nameInfo;
 
#ifdef WIN32
    nameInfo = (MAPIResolveNameType *) &(sMem->m_buf[0]);
#else    
    nameInfo = (MAPIResolveNameType *) ipcInfo->lpsmem;
#endif

    if (!nameInfo)
    {
      return(MAPI_E_FAILURE);
    }

    nameInfo->ipcWorked = 1;         // Set the worked flag
    return(ProcessMAPIResolveName(nameInfo));
    break;
    }

  // MAPIDetails
  case NSCP_MAPIDetails:
    {
    MAPIDetailsType    *detailInfo;
 
#ifdef WIN32
    detailInfo = (MAPIDetailsType *) &(sMem->m_buf[0]);
#else    
    detailInfo = (MAPIDetailsType *) ipcInfo->lpsmem;
#endif

    if (!detailInfo)
    {
      return(MAPI_E_FAILURE);
    }

    detailInfo->ipcWorked = 1;         // Set the worked flag
    return(ProcessMAPIDetails(detailInfo));
    break;
    }

  // MAPIReadMail
  case NSCP_MAPIReadMail:
    {
    MAPIReadMailType    *readInfo;
 
#ifdef WIN32
    readInfo = (MAPIReadMailType *) &(sMem->m_buf[0]);
#else    
    readInfo = (MAPIReadMailType *) ipcInfo->lpsmem;
#endif

    if (!readInfo)
    {
      return(MAPI_E_FAILURE);
    }

    readInfo->ipcWorked = 1;         // Set the worked flag
    return(ProcessMAPIReadMail(readInfo));
    break;
    }

  // NSCP_MAPISaveMail
  case NSCP_MAPISaveMail:
     {
     MAPISendMailType     *sendMailPtr;
#ifdef WIN32
    sendMailPtr = (MAPISendMailType *) &(sMem->m_buf[0]);
#else    
    sendMailPtr = (MAPISendMailType *) ipcInfo->lpsmem;
#endif

    if (!sendMailPtr)
    {
      return(MAPI_E_FAILURE);
    }

    sendMailPtr->ipcWorked = 1;         // Set the worked flag
    return(ProcessMAPISaveMail(sendMailPtr));
    break;
    }

  // MAPIAddress
  case NSCP_MAPIAddress:
    {
    MAPIAddressType    *addrInfo;
 
#ifdef WIN32
    addrInfo = (MAPIAddressType *) &(sMem->m_buf[0]);
#else    
    addrInfo = (MAPIAddressType *) ipcInfo->lpsmem;
#endif

    if (!addrInfo)
    {
      return(MAPI_E_FAILURE);
    }

    addrInfo->ipcWorked = 1;         // Set the worked flag
    return(ProcessMAPIAddress(addrInfo));
    }
  
  case NSCP_MAPIFree:   // This should never hit Communicator, but if it does
#ifdef WIN16
    return(SUCCESS_SUCCESS);       // Just return
#else
    return(S_OK);       // Just return 
#endif

       default:
    return(MAPI_E_NOT_SUPPORTED);     // Should never hit here!
              break;
       }

       return(SUCCESS_SUCCESS);
}

Here is the call graph for this function: