Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
2.2 KiB

  1. #ifndef __MSGUTILS_H__
  2. #define __MSGUTILS_H__
  3. HRESULT CreateDummyISMTPServer(
  4. DWORD dwInstance,
  5. LPSTR szLogFileName,
  6. ISMTPServer **ppServer
  7. );
  8. HRESULT CreateStoreDriver(
  9. DWORD dwInstance,
  10. ISMTPServer *pServer,
  11. IMailMsgStoreDriver **ppStore
  12. );
  13. HRESULT CreateUnboundMailMsg(
  14. IMailMsgProperties **ppMsg
  15. );
  16. HRESULT BindMailMsg(
  17. IMailMsgProperties *ppMsg,
  18. IMailMsgStoreDriver *pStore,
  19. IMailMsgPropertyStream *pStream,
  20. HANDLE hFile
  21. );
  22. HRESULT CreateBoundMailMsg(
  23. IMailMsgStoreDriver *pStore,
  24. IMailMsgProperties **ppMsg
  25. );
  26. HRESULT GenerateRandomProperties(
  27. IMailMsgProperties *pMsg,
  28. DWORD dwNumGlobalProperties,
  29. DWORD dwAvgGlobalPropertyLength,
  30. DWORD dwNumRecipients,
  31. DWORD dwAvgUserNameLength,
  32. DWORD dwAvgDomainNameLength,
  33. DWORD dwNumRecipientProperties,
  34. DWORD dwAvgRecipientPropertyLength
  35. );
  36. class CDummySMTPServer : public ISMTPServer
  37. {
  38. public:
  39. CDummySMTPServer(
  40. DWORD dwInstance,
  41. LPSTR szLogFileName
  42. )
  43. {
  44. m_dwInstance = dwInstance;
  45. if (szLogFileName)
  46. lstrcpy(m_szLogFileName, szLogFileName);
  47. else
  48. *m_szLogFileName = '\0';
  49. m_hLogFile = INVALID_HANDLE_VALUE;
  50. m_ulRefCount = 1;
  51. }
  52. ~CDummySMTPServer()
  53. {
  54. if (m_hLogFile != INVALID_HANDLE_VALUE)
  55. CloseHandle(m_hLogFile);
  56. }
  57. HRESULT Init();
  58. STDMETHOD(QueryInterface)(REFIID iid, void **ppvObject);
  59. STDMETHOD_(ULONG, AddRef)(void) {return(InterlockedIncrement(&m_ulRefCount));};
  60. STDMETHOD_(ULONG, Release) (void)
  61. {
  62. LONG lRefCount = InterlockedDecrement(&m_ulRefCount);
  63. if (lRefCount == 0)
  64. {
  65. delete this;
  66. }
  67. return(lRefCount);
  68. };
  69. STDMETHOD (AllocMessage)(
  70. IMailMsgProperties **ppMsg
  71. );
  72. STDMETHOD (SubmitMessage)(
  73. IMailMsgProperties *pMsg
  74. );
  75. STDMETHOD (TriggerLocalDelivery)(IMailMsgProperties *pMsg, DWORD dwRecipientCount, DWORD * pdwRecipIndexes);
  76. STDMETHOD (ReadMetabaseString)(DWORD MetabaseId, LPBYTE Buffer, DWORD * BufferSize, BOOL fSecure);
  77. STDMETHOD (ReadMetabaseDword)(DWORD MetabaseId, DWORD * dwValue);
  78. STDMETHOD (ServerStartHintFunction)();
  79. STDMETHOD (ServerStopHintFunction)();
  80. private:
  81. LONG m_ulRefCount;
  82. DWORD m_dwInstance;
  83. char m_szLogFileName[MAX_PATH * 2];
  84. HANDLE m_hLogFile;
  85. };
  86. #endif