/* * _WMSUI.H * * This is the internal header file for the wmsui DLL. Only stuff * that would require someone to rebuild all of the WMSUI components * should go in this header file. */ // Structures required for Global, Instance or Thread memory // Create a form which will perform a verb VOID NoteRun(NOTERUN * pnoterun, MAILWINDOWINFO * pmwi); /* * I M A P I F o r m o n S t a n d a r d F o r m s */ // First and count of forms we support #define clsidFormBase CLSID_IPM #define cclsidForm 6 // The form support cookie jar typedef struct _nfjar { DWORD dwRegister[cclsidForm]; } NFJAR; // Initialize form support HRESULT ScInitNoteform(NFJAR * pnfjar); // Deinitialize form support VOID DeinitNoteform(NFJAR * pnfjar); /* * V i e w C o n t e x t S u p p o r t * * Each object supporting the IMAPIViewContext and IMAPIMessageSite * interfaces created by Capone is a "dog" which belongs to a "pack". * A pack contains the smarts to figure out what the prev/next * message is; dogs only contain a pointer to the pack, some * pack-defined data, and their entry ID. Dogs may be transferred * between packs; when the window corresponding to a pack closes, * the pack can either close all the dogs or give them to the central * pack. */ // Predeclare structures struct _vdog; struct _vpack; struct _msgatt; // View dog predeclaration typedef struct _vdog; // View dog IMAPIViewContext interface typedef struct _vdog_mvc { IMAPIViewContextVtbl * lpVtbl; // Virtual table struct _vdog * pvdog; // Pointer to top of object } VDOG_MVC; // View dog IMAPIViewAdviseSink interface typedef struct _vdog_mvas { IMAPIViewAdviseSinkVtbl * lpVtbl; // Virtual table struct _vdog * pvdog; // Pointer to top of object } VDOG_MVAS; // View dog IMAPIMessageSite interface typedef struct _vdog_mms { IMAPIMessageSiteVtbl * lpVtbl; // Virtual table struct _vdog * pvdog; // Pointer to top of object } VDOG_MMS; // View dog full declaration typedef struct _vdog { ULONG cRef; // Reference count struct _vpack * pvpack; // Pointer to pack struct _vdog * pvdogNext; // Pointer to next dog in pack DWORD dwTag; // Data used by pack BIT fModal : 1; // Is form modal? BIT fUnused : 15; // For future use LPMAPIFORM pfrm; // Our form LPMAPIFORMADVISESINK pmfas; // Our form's advise sink DWORD dwConnectionMvas; // Advise connection for our mvas struct _msgatt * pmsgatt; // Used for embedded messages LPMAPISESSION pses; // Session LPADRBOOK pab; // Address book LPMAPIFORMMGR pfrmmgr; // Form manager LPMDB pmdb; // Store LPMAPIFOLDER pfld; // Folder LPMESSAGE pmsg; // Message itself ULONG msgflag; // Message flags (if cbMsgClass != 0) VDOG_MVC vdogmvc; // MAPIViewContext interface VDOG_MVAS vdogmvas; // MAPIViewAdviseSink interface VDOG_MMS vdogmms; // MAPIMessageSite interface LPENTRYID peid; // Entry id (initially follows) ULONG cbMsgClass; // Size of message class which follows ULONG cbEid; // Size of entry id (initially follows) } VDOG; // Map a view dog interface to the view dog structure #define PvdogFromPunk(_p) (((VDOG * *)(_p))[1]) // MAPIViewContext pack virtual table typedef struct { STDMETHOD_(VOID, ReleaseDog) (struct _vpack * pvpack, struct _vdog * pvdog) PURE; STDMETHOD(GetStatus) (struct _vpack * pvpack, struct _vdog * pvdog, DWORD FAR * pdwDir) PURE; STDMETHOD(ActivateNext) (struct _vpack * pvpack, struct _vdog * pvdog, DWORD dwDir, LPCRECT prcPos) PURE; STDMETHOD(ActivateNextGuts) (struct _vpack * pvpack, struct _vdog * pvdog, DWORD dwDir, struct _vdog * * ppvdogNext, EXTEN * * ppexten, SRow * prw) PURE; STDMETHOD(CopyMessage) (struct _vpack * pvpack, struct _vdog * pvdog, LPMAPIFOLDER pfld) PURE; STDMETHOD(MoveMessage) (struct _vpack * pvpack, struct _vdog * pvdog, LPMAPIFOLDER pfld) PURE; STDMETHOD(DeleteMessage) (struct _vpack * pvpack, struct _vdog * pvdog) PURE; STDMETHOD(SaveMessage) (struct _vpack * pvpack, struct _vdog * pvdog) PURE; STDMETHOD(SubmitMessage) (struct _vpack * pvpack, struct _vdog * pvdog) PURE; } VpackVtbl; // MAPIViewContext pack typedef struct _vpack { VpackVtbl * lpVtbl; // Pack virtual table struct _vdog * pvdogFirst; // Pointer to first dog in pack DWORD dwTag; // Data used by pack } VPACK; // Generic versions of some of the functions STDMETHODIMP VPACK_ActivateNext(VPACK * pvpack, VDOG * pvdog, DWORD dwDir, LPCRECT prcPos); STDMETHODIMP VPACK_CopyMessage(VPACK * pvpack, VDOG * pvdog, LPMAPIFOLDER pfld); STDMETHODIMP VPACK_MoveMessage(VPACK * pvpack, VDOG * pvdog, LPMAPIFOLDER pfld); STDMETHODIMP VPACK_DeleteMessage(VPACK * pvpack, VDOG * pvdog); STDMETHODIMP VPACK_SaveMessage(VPACK * pvpack, VDOG * pvdog); STDMETHODIMP VPACK_SubmitMessage(VPACK * pvpack, VDOG * pvdog); // Create a new dog into the given pack STDAPI VDOG_New(VPACK * pvpack, LPENTRYID peid, ULONG cbEid, LPMAPISESSION pses, LPADRBOOK pab, LPMDB pmdb, LPMAPIFOLDER pfld, LPTSTR szMsgClass, ULONG msgflag, VDOG * * ppvdog); // Initialize the central pack VOID CentralPackInit(EXTEN * pexten); // Create a dog in the central pack HRESULT NewCentralPackPmvc(LPMAPITABLE pmt, LPENTRYID peid, ULONG cbEid, LPMAPISESSION pses, LPADRBOOK pab, LPMDB pmdb, LPMAPIFOLDER pfld, LPTSTR szMsgClass, ULONG msgflag, VDOG * * ppvdog); // Move all dogs from my pack into the central pack VOID MergePackIntoCentralPack(VPACK * pvpackSrc, LPMAPITABLE pmt); // Create a dog in the modal pack STDAPI NewModalPackPmvc (VPACK * pvpack, VDOG * * ppvdog, HWND hwnd, LPMAPISESSION pses); // Get the message class associated with a dog #define SzMsgClassFromPvdog(_pvdog) \ ((LPTSTR) ((_pvdog)->cbMsgClass ? \ (((LPBYTE) ((_pvdog) + 1))) : NULL)) // Get the entry ID associated with a dog #define PeidOrigFromPvdog(_pvdog) \ ((LPENTRYID) ((_pvdog)->cbEid ? \ (((LPBYTE) ((_pvdog) + 1)) + pvdog->cbMsgClass) : NULL)) // The friendly prev/next helper HRESULT HrPrevNextRw(LPMAPISESSION pses, LPMAPITABLE pmt, LPENTRYID peid, ULONG cbEid, DWORD dwDir, LPSRow prw); /* * P r i n t i n g */ /* * Attachment Enumerator */ typedef LPATTACH (CALLBACK * ATTENUMPROC)(DWORD dwCookie, BOOL fFirst); /* * Message details * * This structure is to help the print code print the message body, and/or * get the list of attachments. If the MSGENUMPROC doesn't have any of the * information, or wishes the print code to use the standard methods, just * fill in hwndRE or pfnCallback with NULL. */ typedef struct _msgdetails { // For printing the message body HWND hwndRE; // A pre-rendered version of the body // For enumerating attachments, in case caller has attachments already open DWORD dwCookie; // Cookie ATTENUMPROC pfnCallback; // Callback to enumerate attachments } MSGDETAILS; /* * Message Enumerator */ typedef LPMESSAGE (CALLBACK * MSGENUMPROC)(DWORD dwCookie, MSGDETAILS *pmsgdetails, BOOL fFirst); typedef struct _msgenum { DWORD dwCookie; MSGENUMPROC pfnCallback; } MSGENUM; /* * A b o u t D i a l o g */ VOID DoHelpAbout(HWND hwnd); /* * File and Message attachment drag and drop to the viewer */ #define CF_ATTACH TEXT("MailAttachment") SCODE ScDropAttachOnViewer(LPMAPISESSION pses, LPMAPIFOLDER pfld, LPDATAOBJECT pdataobj); VOID MakeMsgFileNameFromSz(LPTSTR szFileName, LPTSTR sz, BOOL fIsFileName); /* * P r e f e r e n c e s */ INT DisplayMailPrefs(HWND hwnd, LPMAPISESSION pses, EXTEN * pexten); INT DisplaySpellPrefs(HWND hwnd, LPMAPISESSION pses); /* * H e l p e r F u n c t i o n s */ // Debugging helpers #ifdef DEBUG VOID CALLBACK TestAllocating(VOID); VOID CALLBACK TraceAdrlist(TAG tag, LPADRLIST pal); #else #define TestAllocating() ; #define TraceAdrlist(_tag, _pal) ; #endif // MAPI session helpers #ifndef RTDEF SCODE ScOpenDefaultMdb(HWND hwnd, LPMAPISESSION pses, LPMDB * ppmdb); #else SCODE _loadds ScOpenDefaultMdb(HWND hwnd, LPMAPISESSION pses, LPMDB * ppmdb); #endif /* RTDEF */ SCODE ScGetDefaultMdbEid(LPMAPISESSION pses, LPSRow prw); SCODE ScResetDefaultMdb(HWND hwnd, LPMAPISESSION pses); VOID EmptyTheDeletedMailFolder(LPMAPISESSION pses); SCODE ScGetTheDeletedMailFolder(LPMAPISESSION pses, LPMDB pmdb, LPMAPIFOLDER pfld, LPMAPIFOLDER * ppfldWaste); SCODE ScCreateSpecialFolder(LPMAPISESSION pses, LPMDB pmdb, ULONG ulPropTag, LPTSTR szTitle, LPTSTR szComment, BOOL fUseSubtree, BOOL fInbox, short sFldType, BOOL fNoValidate); SCODE ScCreateUniqueFolder(LPMAPIFOLDER pfld, ULONG ulFolderType, LPTSTR szBaseFolderName, LPTSTR szComment, LPIID lpInterface, ULONG ulFlags, LPMAPIFOLDER FAR * ppfld); SCODE ScOpenMsgStore(LPMAPISESSION pses, ULONG ulUIParam, ULONG cbEntryID, LPENTRYID lpEntryID, LPIID lpInterface, ULONG ulFlags, LPMDB FAR * lppMDB, BOOL fDefault); VOID UpdateIPMSubtreeDisplayName(LPMAPISESSION pses, LPMDB pmdb, LPSPropValue pval); // MAPI form helpers typedef struct _formdata { ICACHE icacheMdb; ICACHE icacheFld; } FORMDATA; VOID FormDoVerb(HWND hwnd, LPMAPISESSION pses, LPMDB pmdb, LPMAPIFOLDER pfld, LPMESSAGE pmsg, ULONG cbEidMsg, LPENTRYID peidMsg, LPTSTR szMsgFile, LPTSTR szMessageClass, ULONG msgflag, LONG iverb, VDOG * pvdog, LPRECT prcPos, EXTEN * pexten, LPMONIKER pmk, LPMAPIFORM * ppfrm); VOID CentralFormDoVerb(LPMAPIFORMMGR pfrmmgr, HWND hwnd, LPMAPISESSION pses, LPMDB pmdb, LPMAPIFOLDER pfld, LPMESSAGE pmsg, ULONG cbEidMsg, LPENTRYID peidMsg, LPTSTR szMsgFile, LPTSTR szMessageClass, ULONG msgflag, LONG iverb, VDOG * pvdog, LPRECT prcPos, EXTEN * pexten, LPMONIKER pmk, LPMAPIFORM * ppfrm); VOID CentralFormDoVerbSzMsgFile(LPTSTR szMsgFile, LONG iverb); VOID CentralFormComposeNewNote(FORMDATA * pformdata); // Caches #define ifldCacheView 0 #define ifldCacheSrchRoot 1 #define ifldCacheCommonView 2 #define ifldCacheInbox 3 #define ifldCacheOutbox 4 #define ifldCacheSentMail 5 #define ifldCacheWastebasket 6 #define ifldCacheIPM 7 #define ifldCacheRoot 8 #define cfldCache 9 // Not really a cached folder Should // always be one more the cfldCache, used by the views subsystem // when working with the magic remote folder #define ifldCacheRemote cfldCache+1 SCODE ScGetCachedFldFromMdb(LPMAPISESSION pses, LPMDB pmdb, INT ifldCache, BOOL fCreate, LPMAPIFOLDER * ppfld); SCODE ScGetCachedMtFromMdb(LPMAPISESSION pses, LPMDB pmdb, INT imtCache, LPMAPITABLE * ppmt); BOOL FInCache(LPMAPISESSION pses, LPMDB pmdb, INT ifldCache); ULONG UlValidFolderMask(LPMAPISESSION pses, LPMDB pmdb); ULONG UlStoreSupportMask(LPMAPISESSION pses, LPMDB pmdb); #define imtCacheMsgStores 10 // Cached GetMsgStoresTable() #define imtCacheView 0 #define imtCacheCommonView 1 #define cmtCache 2 #define ivalCacheViewVD_EntryID 0 #define ivalCacheViewVD_Flags 1 #define ivalCacheViewVD_Folder 2 #define ivalCacheViewVD_LinkTo 3 #define ivalCacheViewVD_Name 4 #define ivalCacheViewVD_Version 5 #define cvalCacheView 6 // MAPI Session helpers SCODE ScMapiLogon(ULONG ulUIParam, LPTSTR lpszProfileName, LPTSTR lpszPassword, FLAGS flFlags, ULONG ulReserved); #ifdef RTDEF VOID _loadds SetSession(LPMAPISESSION pses); #endif /* RTDEF */ // MAPI message helpers SCODE ScCreateMsg (LPMAPISESSION pses, LPMDB pmdbDef, LPMAPIFOLDER pfld, LPMESSAGE * ppmsg); SCODE ScSetSentMailProps(LPMESSAGE pmsg, LPMDB pmdbDef, BOOL fSaveInSentMail); SCODE ScGetMsgflag(LPMESSAGE pmsg, DWORD * pmsgflag); SCODE ScCopyPmsgToPatt(LPMESSAGE pmsg, LPATTACH patt); SCODE ScCopyPmsgToPstg(LPMESSAGE pmsg, LPSTORAGE pstg); VOID LoadMDBs(LPMAPISESSION pses); VOID CleanMDBs(VOID); // Date/time helpers //$ FUTURE: Create macros which take advantage of Chicago's GetDate/TimeString INT CchGetShortTime(TCHAR * szStr); INT CchGetShortDate(TCHAR * szStr); INT CchFileTimeToLongDateTimeSz(FILETIME * pft, TCHAR * szStr, BOOL fNoSeconds); VOID GetInternationalDateTime(VOID); // Dialog helpers BOOL FGetDefaultProfile(LPSTR szDefaultProfile); /* * C o m m o n P r o p e r t i e s */ // Define our own property tag so that we can send rich text // Start of Capone properties range #define ID_CAPONE_BASE 0x6900 // Start of Capone non-transportable properties range #define ID_CAPONE_LOCAL_BASE 0x7D00 // We take over a couple of the "Message-class defined content" properties //$ REVIEW: Should these be declared here? // property to carry failed "send as" name from NDR into resend note #define PR_NDR_FROM_ENTRYID PROP_TAG(PT_BINARY, ID_CAPONE_BASE + 4) #define PR_NDR_FROM_NAME PROP_TAG(PT_TSTRING, ID_CAPONE_BASE + 5) #define PR_NDR_FROM_SEARCH_KEY PROP_TAG(PT_BINARY, ID_CAPONE_BASE + 6) struct _fd; #if defined (WIN16) /* * EXEINFO * * Used to keep track of apps which we have launched */ typedef struct _exeinfo { HINSTANCE hinst; HWND hwnd; HANDLE htask; HWND hwndParent; // Who launched this app ? UINT uiMsg; // What message to send LPADVISESINK padvsink; // To call OnClose() when app ends } EXEINFO; #endif /* * F o r m C a c h e */ // Forward Form Cache Entryreference typedef struct _fce FCE; /* Form Cache Entry * - each node in the collison chain */ typedef struct _fce { LPTSTR szMsgClass; // Key used for hashing. The message class // 1. Hicon HICON hIcon; // hIcon associated with this msg class INT ihbmp; // index to the hbmp array // -1 means no associated bitmap in hbmp // if hbmp is not NULL and can be selected into // the hdcMem, then ihbmp>=0 &&