Leaked source code of windows server 2003
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.

244 lines
7.1 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1998.
  5. //
  6. // File: schedif.h
  7. //
  8. // Contents: interfaces for synchronization scheduling
  9. //
  10. // Interfaces: IEnumSyncSchedules
  11. // ISyncSchedule
  12. // IEnumSyncItems
  13. //
  14. // Classes: CEnumSyncSchedules
  15. // CSyncSchedule
  16. // CEnumSyncItems
  17. //
  18. // Notes:
  19. //
  20. // History: 27-Feb-98 Susia Created.
  21. //
  22. //--------------------------------------------------------------------------
  23. #ifndef _SYNCSCHED_IF_
  24. #define _SYNCSCHED_IF_
  25. #define MAX_SCHEDULENAMESIZE (GUID_SIZE + 1 + MAX_DOMANDANDMACHINENAMESIZE + 1)
  26. //+--------------------------------------------------------------
  27. //
  28. // Class: CEnumSyncSchedules
  29. //
  30. // History: 27-Feb-98 SusiA Created
  31. //
  32. //---------------------------------------------------------------
  33. class CEnumSyncSchedules : public IEnumSyncSchedules
  34. {
  35. public:
  36. CEnumSyncSchedules(IEnumWorkItems *pIEnumWorkItems,
  37. ITaskScheduler *pITaskScheduler);
  38. ~CEnumSyncSchedules();
  39. // IUnknown members
  40. STDMETHODIMP QueryInterface(REFIID, LPVOID FAR *);
  41. STDMETHODIMP_(ULONG) AddRef();
  42. STDMETHODIMP_(ULONG) Release();
  43. // IEnumSyncSchedules methods
  44. STDMETHODIMP Next(ULONG celt,
  45. SYNCSCHEDULECOOKIE *pSyncSchedCookie,
  46. ULONG *pceltFetched);
  47. STDMETHODIMP Skip(ULONG celt);
  48. STDMETHODIMP Reset(void);
  49. STDMETHODIMP Clone(IEnumSyncSchedules **ppEnumSyncSchedules);
  50. private:
  51. ULONG m_cRef;
  52. IEnumWorkItems *m_pIEnumWorkItems;
  53. ITaskScheduler *m_pITaskScheduler;
  54. BOOL IsSyncMgrSched(LPCWSTR pwstrTaskName);
  55. BOOL IsSyncMgrSchedHidden(LPCWSTR pwstrTaskName);
  56. BOOL VerifyScheduleSID(LPCWSTR pwstrTaskName);
  57. BOOL CheckForTaskNameKey(LPCWSTR pwstrTaskName);
  58. };
  59. typedef CEnumSyncSchedules *LPENUMSYNCSCHEDULES;
  60. typedef struct tagCACHELIST {
  61. struct tagCACHELIST *pNext;
  62. CLSID phandlerID;
  63. SYNCMGRITEMID itemID;
  64. DWORD dwCheckState;
  65. } CACHELIST;
  66. //+--------------------------------------------------------------
  67. //
  68. // Class: CSyncSchedule
  69. //
  70. // History: 27-Feb-98 SusiA Created
  71. //
  72. //---------------------------------------------------------------
  73. class CSyncSchedule : public ISyncSchedulep
  74. {
  75. public:
  76. CSyncSchedule(ITask *pITask);
  77. ~CSyncSchedule();
  78. // IUnknown members
  79. STDMETHODIMP QueryInterface(REFIID, LPVOID FAR *);
  80. STDMETHODIMP_(ULONG) AddRef();
  81. STDMETHODIMP_(ULONG) Release();
  82. // ISyncSchedule methods
  83. STDMETHODIMP GetFlags(DWORD *pdwFlags);
  84. STDMETHODIMP SetFlags(DWORD dwFlags);
  85. STDMETHODIMP GetConnection(DWORD *pcchConnectionName,
  86. LPWSTR pwszConnectionName,
  87. DWORD *pdwConnType);
  88. STDMETHODIMP SetConnection(LPCWSTR pwszConnectionName,
  89. DWORD dwConnType);
  90. STDMETHODIMP GetScheduleName(DWORD *pcbSize,
  91. LPWSTR pwszScheduleName);
  92. STDMETHODIMP SetScheduleName(LPCWSTR pwszScheduleName);
  93. STDMETHODIMP GetScheduleCookie(SYNCSCHEDULECOOKIE *pSyncSchedCookie);
  94. STDMETHODIMP SetAccountInformation(LPCWSTR pwszAccountName,
  95. LPCWSTR pwszPassword);
  96. STDMETHODIMP GetAccountInformation(DWORD *pcbSize,
  97. LPWSTR pwszAccountName);
  98. STDMETHODIMP GetTrigger(ITaskTrigger ** ppTrigger);
  99. STDMETHODIMP GetNextRunTime(SYSTEMTIME * pstNextRun);
  100. STDMETHODIMP GetMostRecentRunTime(SYSTEMTIME * pstRecentRun);
  101. STDMETHODIMP EditSyncSchedule(HWND hParent,
  102. DWORD dwReserved);
  103. STDMETHODIMP AddItem(LPSYNC_HANDLER_ITEM_INFO pHandlerItemInfo);
  104. STDMETHODIMP RegisterItems( REFCLSID pHandlerID,
  105. SYNCMGRITEMID *pItemID);
  106. STDMETHODIMP UnregisterItems( REFCLSID pHandlerID,
  107. SYNCMGRITEMID *pItemID);
  108. STDMETHODIMP SetItemCheck(REFCLSID pHandlerID,
  109. SYNCMGRITEMID *pItemID, DWORD dwCheckState);
  110. STDMETHODIMP GetItemCheck(REFCLSID pHandlerID,
  111. SYNCMGRITEMID *pItemID, DWORD *pdwCheckState);
  112. STDMETHODIMP EnumItems(REFCLSID pHandlerID,
  113. IEnumSyncItems **ppEnumItems);
  114. STDMETHODIMP Save();
  115. STDMETHODIMP GetITask(ITask **ppITask);
  116. // ISyncSchedulp methods
  117. STDMETHODIMP GetHandlerInfo(REFCLSID pHandlerID,LPSYNCMGRHANDLERINFO *ppSyncMgrHandlerInfo);
  118. private:
  119. SCODE Initialize(LPTSTR ptstrGUIDName, LPTSTR ptstrFriendlyName);
  120. SCODE LoadAllHandlers();
  121. SCODE LoadOneHandler(REFCLSID pHandlerID);
  122. SCODE SetDefaultCredentials();
  123. SCODE GetScheduleGUIDName(DWORD *pcbSize,
  124. LPTSTR ptszScheduleName);
  125. SCODE CacheItemCheckState(REFCLSID phandlerID,
  126. SYNCMGRITEMID itemID,
  127. DWORD dwCheckState);
  128. SCODE RetreiveCachedItemCheckState(REFCLSID phandlerID,
  129. SYNCMGRITEMID itemID,
  130. DWORD *pdwCheckState);
  131. SCODE ApplyCachedItemsCheckState(REFCLSID phandlerID);
  132. SCODE PurgeCachedItemsCheckState(REFCLSID phandlerID);
  133. SCODE WriteOutAndPurgeCache(void);
  134. CACHELIST *m_pFirstCacheEntry;
  135. ULONG m_cRef;
  136. ITask *m_pITask;
  137. //
  138. // Since we don't expose functions to get and set
  139. // the GUID name, this one is a TCHAR for ease of writing the registry
  140. TCHAR m_ptstrGUIDName[MAX_PATH + 1];
  141. WCHAR m_pwszFriendlyName[MAX_PATH + 1];
  142. WCHAR m_pwszConnectionName[RAS_MaxEntryName + 1];
  143. DWORD m_dwConnType;
  144. BOOL m_fCleanReg;
  145. LPCONNECTIONSETTINGS m_pConnectionSettings;
  146. CHndlrQueue *m_HndlrQueue;
  147. WORD m_iTrigger;
  148. ITaskTrigger *m_pITrigger;
  149. BOOL m_fNewSchedule;
  150. friend class CSyncMgrSynchronize;
  151. friend class CSchedSyncPage;
  152. };
  153. typedef CSyncSchedule *LPSYNCSCHEDULE;
  154. //+--------------------------------------------------------------
  155. //
  156. // Class: CEnumSyncItems
  157. //
  158. // History: 27-Feb-98 SusiA Created
  159. //
  160. //---------------------------------------------------------------
  161. class CEnumSyncItems : public IEnumSyncItems
  162. {
  163. friend class CEnumSyncItems;
  164. public:
  165. CEnumSyncItems(REFGUID pHandlerId, CHndlrQueue *pHndlrQueue);
  166. ~CEnumSyncItems();
  167. // IUnknown members
  168. STDMETHODIMP QueryInterface(REFIID, LPVOID FAR *);
  169. STDMETHODIMP_(ULONG) AddRef();
  170. STDMETHODIMP_(ULONG) Release();
  171. // IEnumSyncItems methods
  172. STDMETHODIMP Next(ULONG celt,
  173. LPSYNC_HANDLER_ITEM_INFO rgelt,
  174. ULONG * pceltFetched);
  175. STDMETHODIMP Skip(ULONG celt);
  176. STDMETHODIMP Reset(void);
  177. STDMETHODIMP Clone(IEnumSyncItems ** ppEnumSyncItems);
  178. private:
  179. SCODE SetHandlerAndItem(WORD wHandlerID, WORD wItemID);
  180. ULONG m_cRef;
  181. GUID m_HandlerId;
  182. WORD m_wItemId;
  183. WORD m_wHandlerId;
  184. CHndlrQueue *m_HndlrQueue;
  185. BOOL m_fAllHandlers;
  186. };
  187. typedef CEnumSyncItems *LPENUMSYNCITEMS;
  188. #endif // _SYNCSCHED_IF_