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.

246 lines
6.6 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. LPTSTR ptstrGUIDName,
  78. LPTSTR ptstrFriendlyName);
  79. ~CSyncSchedule();
  80. // IUnknown members
  81. STDMETHODIMP QueryInterface(REFIID, LPVOID FAR *);
  82. STDMETHODIMP_(ULONG) AddRef();
  83. STDMETHODIMP_(ULONG) Release();
  84. // ISyncSchedule methods
  85. STDMETHODIMP GetFlags(DWORD *pdwFlags);
  86. STDMETHODIMP SetFlags(DWORD dwFlags);
  87. STDMETHODIMP GetConnection(DWORD *pcbSize,
  88. LPWSTR pwszConnectionName,
  89. DWORD *pdwConnType);
  90. STDMETHODIMP SetConnection(LPCWSTR pwszConnectionName,
  91. DWORD dwConnType);
  92. STDMETHODIMP GetScheduleName(DWORD *pcbSize,
  93. LPWSTR pwszScheduleName);
  94. STDMETHODIMP SetScheduleName(LPCWSTR pwszScheduleName);
  95. STDMETHODIMP GetScheduleCookie(SYNCSCHEDULECOOKIE *pSyncSchedCookie);
  96. STDMETHODIMP SetAccountInformation(LPCWSTR pwszAccountName,
  97. LPCWSTR pwszPassword);
  98. STDMETHODIMP GetAccountInformation(DWORD *pcbSize,
  99. LPWSTR pwszAccountName);
  100. STDMETHODIMP GetTrigger(ITaskTrigger ** ppTrigger);
  101. STDMETHODIMP GetNextRunTime(SYSTEMTIME * pstNextRun);
  102. STDMETHODIMP GetMostRecentRunTime(SYSTEMTIME * pstRecentRun);
  103. STDMETHODIMP EditSyncSchedule(HWND hParent,
  104. DWORD dwReserved);
  105. STDMETHODIMP AddItem(LPSYNC_HANDLER_ITEM_INFO pHandlerItemInfo);
  106. STDMETHODIMP RegisterItems( REFCLSID pHandlerID,
  107. SYNCMGRITEMID *pItemID);
  108. STDMETHODIMP UnregisterItems( REFCLSID pHandlerID,
  109. SYNCMGRITEMID *pItemID);
  110. STDMETHODIMP SetItemCheck(REFCLSID pHandlerID,
  111. SYNCMGRITEMID *pItemID, DWORD dwCheckState);
  112. STDMETHODIMP GetItemCheck(REFCLSID pHandlerID,
  113. SYNCMGRITEMID *pItemID, DWORD *pdwCheckState);
  114. STDMETHODIMP EnumItems(REFCLSID pHandlerID,
  115. IEnumSyncItems **ppEnumItems);
  116. STDMETHODIMP Save();
  117. STDMETHODIMP GetITask(ITask **ppITask);
  118. // ISyncSchedulp methods
  119. STDMETHODIMP GetHandlerInfo(REFCLSID pHandlerID,LPSYNCMGRHANDLERINFO *ppSyncMgrHandlerInfo);
  120. private:
  121. SCODE Initialize();
  122. SCODE LoadAllHandlers();
  123. SCODE LoadOneHandler(REFCLSID pHandlerID);
  124. SCODE SetDefaultCredentials();
  125. SCODE GetScheduleGUIDName(DWORD *pcbSize,
  126. LPTSTR ptszScheduleName);
  127. SCODE CacheItemCheckState(REFCLSID phandlerID,
  128. SYNCMGRITEMID itemID,
  129. DWORD dwCheckState);
  130. SCODE RetreiveCachedItemCheckState(REFCLSID phandlerID,
  131. SYNCMGRITEMID itemID,
  132. DWORD *pdwCheckState);
  133. SCODE ApplyCachedItemsCheckState(REFCLSID phandlerID);
  134. SCODE PurgeCachedItemsCheckState(REFCLSID phandlerID);
  135. SCODE WriteOutAndPurgeCache(void);
  136. CACHELIST *m_pFirstCacheEntry;
  137. ULONG m_cRef;
  138. ITask *m_pITask;
  139. //
  140. // Since we don't expose functions to get and set
  141. // the GUID name, this one is a TCHAR for ease of writing the registry
  142. TCHAR m_ptstrGUIDName[MAX_PATH + 1];
  143. WCHAR m_pwszFriendlyName[MAX_PATH + 1];
  144. WCHAR m_pwszConnectionName[RAS_MaxEntryName + 1];
  145. DWORD m_dwConnType;
  146. BOOL m_fCleanReg;
  147. LPCONNECTIONSETTINGS m_pConnectionSettings;
  148. CHndlrQueue *m_HndlrQueue;
  149. WORD m_iTrigger;
  150. ITaskTrigger *m_pITrigger;
  151. BOOL m_fNewSchedule;
  152. friend class CSyncMgrSynchronize;
  153. friend class CSchedSyncPage;
  154. };
  155. typedef CSyncSchedule *LPSYNCSCHEDULE;
  156. //+--------------------------------------------------------------
  157. //
  158. // Class: CEnumSyncItems
  159. //
  160. // History: 27-Feb-98 SusiA Created
  161. //
  162. //---------------------------------------------------------------
  163. class CEnumSyncItems : public IEnumSyncItems
  164. {
  165. friend class CEnumSyncItems;
  166. public:
  167. CEnumSyncItems(REFGUID pHandlerId, CHndlrQueue *pHndlrQueue);
  168. ~CEnumSyncItems();
  169. // IUnknown members
  170. STDMETHODIMP QueryInterface(REFIID, LPVOID FAR *);
  171. STDMETHODIMP_(ULONG) AddRef();
  172. STDMETHODIMP_(ULONG) Release();
  173. // IEnumSyncItems methods
  174. STDMETHODIMP Next(ULONG celt,
  175. LPSYNC_HANDLER_ITEM_INFO rgelt,
  176. ULONG * pceltFetched);
  177. STDMETHODIMP Skip(ULONG celt);
  178. STDMETHODIMP Reset(void);
  179. STDMETHODIMP Clone(IEnumSyncItems ** ppEnumSyncItems);
  180. private:
  181. SCODE SetHandlerAndItem(WORD wHandlerID, WORD wItemID);
  182. ULONG m_cRef;
  183. GUID m_HandlerId;
  184. WORD m_wItemId;
  185. WORD m_wHandlerId;
  186. CHndlrQueue *m_HndlrQueue;
  187. BOOL m_fAllHandlers;
  188. };
  189. typedef CEnumSyncItems *LPENUMSYNCITEMS;
  190. #endif // _SYNCSCHED_IF_