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.

533 lines
12 KiB

  1. /*
  2. * Copyright (c) 1995-1998, Microsoft Corporation
  3. *
  4. * synceng.h - File synchronization engine API description.
  5. */
  6. #ifndef __SYNCENG_H__
  7. #define __SYNCENG_H__
  8. #ifdef __cplusplus
  9. extern "C" { /* Assume C declarations for C++. */
  10. #endif /* __cplusplus */
  11. /* Constants
  12. ************/
  13. /* Define API decoration for direct import of DLL functions. */
  14. #ifdef _SYNCENG_
  15. #define SYNCENGAPI
  16. #else
  17. #define SYNCENGAPI DECLSPEC_IMPORT
  18. #endif
  19. /* Macros
  20. *********/
  21. #ifndef DECLARE_STANDARD_TYPES
  22. /*
  23. * For a type "FOO", define the standard derived types PFOO, CFOO, and PCFOO.
  24. */
  25. #define DECLARE_STANDARD_TYPES(type) typedef type *P##type; \
  26. typedef const type C##type; \
  27. typedef const type *PC##type;
  28. #endif
  29. /* Types
  30. ********/
  31. /* return codes */
  32. typedef enum _twinresult
  33. {
  34. TR_SUCCESS,
  35. TR_RH_LOAD_FAILED,
  36. TR_SRC_OPEN_FAILED,
  37. TR_SRC_READ_FAILED,
  38. TR_DEST_OPEN_FAILED,
  39. TR_DEST_WRITE_FAILED,
  40. TR_ABORT,
  41. TR_UNAVAILABLE_VOLUME,
  42. TR_OUT_OF_MEMORY,
  43. TR_FILE_CHANGED,
  44. TR_DUPLICATE_TWIN,
  45. TR_DELETED_TWIN,
  46. TR_HAS_FOLDER_TWIN_SRC,
  47. TR_INVALID_PARAMETER,
  48. TR_REENTERED,
  49. TR_SAME_FOLDER,
  50. TR_SUBTREE_CYCLE_FOUND,
  51. TR_NO_MERGE_HANDLER,
  52. TR_MERGE_INCOMPLETE,
  53. TR_TOO_DIFFERENT,
  54. TR_BRIEFCASE_LOCKED,
  55. TR_BRIEFCASE_OPEN_FAILED,
  56. TR_BRIEFCASE_READ_FAILED,
  57. TR_BRIEFCASE_WRITE_FAILED,
  58. TR_CORRUPT_BRIEFCASE,
  59. TR_NEWER_BRIEFCASE,
  60. TR_NO_MORE
  61. }
  62. TWINRESULT;
  63. DECLARE_STANDARD_TYPES(TWINRESULT);
  64. /* handles */
  65. DECLARE_HANDLE(HBRFCASE);
  66. DECLARE_STANDARD_TYPES(HBRFCASE);
  67. DECLARE_HANDLE(HBRFCASEITER);
  68. DECLARE_STANDARD_TYPES(HBRFCASEITER);
  69. DECLARE_HANDLE(HTWIN);
  70. DECLARE_STANDARD_TYPES(HTWIN);
  71. DECLARE_HANDLE(HOBJECTTWIN);
  72. DECLARE_STANDARD_TYPES(HOBJECTTWIN);
  73. DECLARE_HANDLE(HFOLDERTWIN);
  74. DECLARE_STANDARD_TYPES(HFOLDERTWIN);
  75. DECLARE_HANDLE(HTWINFAMILY);
  76. DECLARE_STANDARD_TYPES(HTWINFAMILY);
  77. DECLARE_HANDLE(HTWINLIST);
  78. DECLARE_STANDARD_TYPES(HTWINLIST);
  79. DECLARE_HANDLE(HVOLUMEID);
  80. DECLARE_STANDARD_TYPES(HVOLUMEID);
  81. /* OpenBriefcase() flags */
  82. typedef enum _openbriefcaseflags
  83. {
  84. OB_FL_OPEN_DATABASE = 0x0001,
  85. OB_FL_TRANSLATE_DB_FOLDER = 0x0002,
  86. OB_FL_ALLOW_UI = 0x0004,
  87. OB_FL_LIST_DATABASE = 0x0008,
  88. ALL_OB_FLAGS = (OB_FL_OPEN_DATABASE |
  89. OB_FL_TRANSLATE_DB_FOLDER |
  90. OB_FL_ALLOW_UI |
  91. OB_FL_LIST_DATABASE)
  92. }
  93. OPENBRIEFCASEFLAGS;
  94. /* open briefcase information returned by GetOpenBriefcaseInfo() */
  95. typedef struct _openbrfcaseinfo
  96. {
  97. ULONG ulSize;
  98. DWORD dwFlags;
  99. HWND hwndOwner;
  100. HVOLUMEID hvid;
  101. TCHAR rgchDatabasePath[MAX_PATH];
  102. }
  103. OPENBRFCASEINFO;
  104. DECLARE_STANDARD_TYPES(OPENBRFCASEINFO);
  105. /*
  106. * briefcase information returned by FindFirstBriefcase() and
  107. * FindNextBriefcase()
  108. */
  109. typedef struct _brfcaseinfo
  110. {
  111. ULONG ulSize;
  112. TCHAR rgchDatabasePath[MAX_PATH];
  113. }
  114. BRFCASEINFO;
  115. DECLARE_STANDARD_TYPES(BRFCASEINFO);
  116. /* new object twin */
  117. typedef struct _newobjecttwin
  118. {
  119. ULONG ulSize;
  120. LPCTSTR pcszFolder1;
  121. LPCTSTR pcszFolder2;
  122. LPCTSTR pcszName;
  123. }
  124. NEWOBJECTTWIN;
  125. DECLARE_STANDARD_TYPES(NEWOBJECTTWIN);
  126. /* NEWFOLDERTWIN flags */
  127. typedef enum _newfoldertwinflags
  128. {
  129. NFT_FL_SUBTREE = 0x0001,
  130. ALL_NFT_FLAGS = NFT_FL_SUBTREE
  131. }
  132. NEWFOLDERTWINFLAGS;
  133. /* new folder twin */
  134. typedef struct _newfoldertwin
  135. {
  136. ULONG ulSize;
  137. LPCTSTR pcszFolder1;
  138. LPCTSTR pcszFolder2;
  139. LPCTSTR pcszName;
  140. DWORD dwAttributes;
  141. DWORD dwFlags;
  142. }
  143. NEWFOLDERTWIN;
  144. DECLARE_STANDARD_TYPES(NEWFOLDERTWIN);
  145. #ifndef _COMPARISONRESULT_DEFINED_
  146. /* comparison results */
  147. typedef enum _comparisonresult
  148. {
  149. CR_FIRST_SMALLER = -1,
  150. CR_EQUAL = 0,
  151. CR_FIRST_LARGER = +1
  152. }
  153. COMPARISONRESULT;
  154. DECLARE_STANDARD_TYPES(COMPARISONRESULT);
  155. #define _COMPARISONRESULT_DEFINED_
  156. #endif
  157. /* file stamp conditions */
  158. typedef enum _filestampcondition
  159. {
  160. FS_COND_UNAVAILABLE,
  161. FS_COND_DOES_NOT_EXIST,
  162. FS_COND_EXISTS
  163. }
  164. FILESTAMPCONDITION;
  165. DECLARE_STANDARD_TYPES(FILESTAMPCONDITION);
  166. /* file stamp */
  167. typedef struct _filestamp
  168. {
  169. FILESTAMPCONDITION fscond;
  170. FILETIME ftMod;
  171. DWORD dwcbLowLength;
  172. DWORD dwcbHighLength;
  173. FILETIME ftModLocal;
  174. }
  175. FILESTAMP;
  176. DECLARE_STANDARD_TYPES(FILESTAMP);
  177. /* volume description flags */
  178. typedef enum _volumedescflags
  179. {
  180. /* dwSerialNumber is valid. */
  181. VD_FL_SERIAL_NUMBER_VALID = 0x0001,
  182. /* rgchVolumeLabel is valid. */
  183. VD_FL_VOLUME_LABEL_VALID = 0x0002,
  184. /* rgchNetResource is valid. */
  185. VD_FL_NET_RESOURCE_VALID = 0x0004,
  186. /* flag combinations */
  187. ALL_VD_FLAGS = (VD_FL_SERIAL_NUMBER_VALID |
  188. VD_FL_VOLUME_LABEL_VALID |
  189. VD_FL_NET_RESOURCE_VALID)
  190. }
  191. VOLUMEDESCFLAGS;
  192. /* volume description */
  193. typedef struct _volumedesc
  194. {
  195. ULONG ulSize;
  196. DWORD dwFlags;
  197. DWORD dwSerialNumber;
  198. TCHAR rgchVolumeLabel[MAX_PATH];
  199. TCHAR rgchNetResource[MAX_PATH];
  200. }
  201. VOLUMEDESC;
  202. DECLARE_STANDARD_TYPES(VOLUMEDESC);
  203. /* RECNODE states */
  204. typedef enum _recnodestate
  205. {
  206. RNS_NEVER_RECONCILED,
  207. RNS_UNAVAILABLE,
  208. RNS_DOES_NOT_EXIST,
  209. RNS_DELETED,
  210. RNS_NOT_RECONCILED,
  211. RNS_UP_TO_DATE,
  212. RNS_CHANGED
  213. }
  214. RECNODESTATE;
  215. DECLARE_STANDARD_TYPES(RECNODESTATE);
  216. /* RECNODE actions */
  217. typedef enum _recnodeaction
  218. {
  219. RNA_NOTHING,
  220. RNA_COPY_FROM_ME,
  221. RNA_COPY_TO_ME,
  222. RNA_MERGE_ME,
  223. RNA_DELETE_ME
  224. }
  225. RECNODEACTION;
  226. DECLARE_STANDARD_TYPES(RECNODEACTION);
  227. /* RECNODE flags */
  228. typedef enum _recnodeflags
  229. {
  230. RN_FL_FROM_OBJECT_TWIN = 0x0001,
  231. RN_FL_FROM_FOLDER_TWIN = 0x0002,
  232. RN_FL_DELETION_SUGGESTED = 0x0004,
  233. ALL_RECNODE_FLAGS = (RN_FL_FROM_OBJECT_TWIN |
  234. RN_FL_FROM_FOLDER_TWIN |
  235. RN_FL_DELETION_SUGGESTED)
  236. }
  237. RECNODEFLAGS;
  238. /* reconciliation node */
  239. typedef struct _recnode
  240. {
  241. struct _recnode *prnNext;
  242. HVOLUMEID hvid;
  243. LPCTSTR pcszFolder;
  244. HOBJECTTWIN hObjectTwin;
  245. struct _recitem *priParent;
  246. FILESTAMP fsLast;
  247. FILESTAMP fsCurrent;
  248. RECNODESTATE rnstate;
  249. RECNODEACTION rnaction;
  250. DWORD dwFlags;
  251. DWORD dwUser;
  252. }
  253. RECNODE;
  254. DECLARE_STANDARD_TYPES(RECNODE);
  255. /* RECITEM actions */
  256. typedef enum _recitemaction
  257. {
  258. RIA_NOTHING,
  259. RIA_DELETE,
  260. RIA_COPY,
  261. RIA_MERGE,
  262. RIA_BROKEN_MERGE
  263. }
  264. RECITEMACTION;
  265. DECLARE_STANDARD_TYPES(RECITEMACTION);
  266. /* reconciliation item */
  267. typedef struct _recitem
  268. {
  269. struct _recitem *priNext;
  270. LPCTSTR pcszName;
  271. HTWINFAMILY hTwinFamily;
  272. ULONG ulcNodes;
  273. PRECNODE prnFirst;
  274. RECITEMACTION riaction;
  275. DWORD dwUser;
  276. }
  277. RECITEM;
  278. DECLARE_STANDARD_TYPES(RECITEM);
  279. /* reconciliation list */
  280. typedef struct _reclist
  281. {
  282. ULONG ulcItems;
  283. PRECITEM priFirst;
  284. HBRFCASE hbr;
  285. }
  286. RECLIST;
  287. DECLARE_STANDARD_TYPES(RECLIST);
  288. /* ReconcileItem() flags */
  289. typedef enum _reconcileitemflags
  290. {
  291. RI_FL_ALLOW_UI = 0x0001,
  292. RI_FL_FEEDBACK_WINDOW_VALID = 0x0002,
  293. ALL_RI_FLAGS = (RI_FL_ALLOW_UI |
  294. RI_FL_FEEDBACK_WINDOW_VALID)
  295. }
  296. RECONCILEITEMFLAGS;
  297. /* reconciliation status update information */
  298. typedef struct _recstatusupdate
  299. {
  300. ULONG ulProgress;
  301. ULONG ulScale;
  302. }
  303. RECSTATUSUPDATE;
  304. DECLARE_STANDARD_TYPES(RECSTATUSUPDATE);
  305. /* CREATERECLISTPROC messages */
  306. typedef enum _createreclistprocmsg
  307. {
  308. CRLS_BEGIN_CREATE_REC_LIST,
  309. CRLS_DELTA_CREATE_REC_LIST,
  310. CRLS_END_CREATE_REC_LIST
  311. }
  312. CREATERECLISTPROCMSG;
  313. DECLARE_STANDARD_TYPES(CREATERECLISTPROCMSG);
  314. /* CreateRecList() status callback function */
  315. typedef BOOL (CALLBACK *CREATERECLISTPROC)(CREATERECLISTPROCMSG, LPARAM, LPARAM);
  316. /* RECSTATUSPROC messages */
  317. typedef enum _recstatusprocmsg
  318. {
  319. RS_BEGIN_COPY,
  320. RS_DELTA_COPY,
  321. RS_END_COPY,
  322. RS_BEGIN_MERGE,
  323. RS_DELTA_MERGE,
  324. RS_END_MERGE,
  325. RS_BEGIN_DELETE,
  326. RS_DELTA_DELETE,
  327. RS_END_DELETE
  328. }
  329. RECSTATUSPROCMSG;
  330. DECLARE_STANDARD_TYPES(RECSTATUSPROCMSG);
  331. /* ReconcileItem() status callback function */
  332. typedef BOOL (CALLBACK *RECSTATUSPROC)(RECSTATUSPROCMSG, LPARAM, LPARAM);
  333. /* FOLDERTWIN flags */
  334. typedef enum _foldertwinflags
  335. {
  336. FT_FL_SUBTREE = 0x0001,
  337. ALL_FT_FLAGS = FT_FL_SUBTREE
  338. }
  339. FOLDERTWINFLAGS;
  340. /* folder twin */
  341. typedef struct _foldertwin
  342. {
  343. const struct _foldertwin *pcftNext;
  344. HFOLDERTWIN hftSrc;
  345. HVOLUMEID hvidSrc;
  346. LPCTSTR pcszSrcFolder;
  347. HFOLDERTWIN hftOther;
  348. HVOLUMEID hvidOther;
  349. LPCTSTR pcszOtherFolder;
  350. LPCTSTR pcszName;
  351. DWORD dwFlags;
  352. DWORD dwUser;
  353. }
  354. FOLDERTWIN;
  355. DECLARE_STANDARD_TYPES(FOLDERTWIN);
  356. /* folder twin list */
  357. typedef struct _foldertwinlist
  358. {
  359. ULONG ulcItems;
  360. PCFOLDERTWIN pcftFirst;
  361. HBRFCASE hbr;
  362. }
  363. FOLDERTWINLIST;
  364. DECLARE_STANDARD_TYPES(FOLDERTWINLIST);
  365. /* FOLDERTWIN status codes */
  366. typedef enum _foldertwinstatus
  367. {
  368. FTS_DO_NOTHING,
  369. FTS_DO_SOMETHING,
  370. FTS_UNAVAILABLE
  371. }
  372. FOLDERTWINSTATUS;
  373. DECLARE_STANDARD_TYPES(FOLDERTWINSTATUS);
  374. /* Prototypes
  375. *************/
  376. /* briefcase interface */
  377. SYNCENGAPI TWINRESULT WINAPI OpenBriefcase(LPCTSTR, DWORD, HWND, PHBRFCASE);
  378. SYNCENGAPI TWINRESULT WINAPI SaveBriefcase(HBRFCASE);
  379. SYNCENGAPI TWINRESULT WINAPI CloseBriefcase(HBRFCASE);
  380. SYNCENGAPI TWINRESULT WINAPI DeleteBriefcase(LPCTSTR);
  381. SYNCENGAPI TWINRESULT WINAPI GetOpenBriefcaseInfo(HBRFCASE, POPENBRFCASEINFO);
  382. SYNCENGAPI TWINRESULT WINAPI ClearBriefcaseCache(HBRFCASE);
  383. SYNCENGAPI TWINRESULT WINAPI FindFirstBriefcase(PHBRFCASEITER, PBRFCASEINFO);
  384. SYNCENGAPI TWINRESULT WINAPI FindNextBriefcase(HBRFCASEITER, PBRFCASEINFO);
  385. SYNCENGAPI TWINRESULT WINAPI FindBriefcaseClose(HBRFCASEITER);
  386. /* twin interface */
  387. SYNCENGAPI TWINRESULT WINAPI AddObjectTwin(HBRFCASE, PCNEWOBJECTTWIN, PHTWINFAMILY);
  388. SYNCENGAPI TWINRESULT WINAPI AddFolderTwin(HBRFCASE, PCNEWFOLDERTWIN, PHFOLDERTWIN);
  389. SYNCENGAPI TWINRESULT WINAPI ReleaseTwinHandle(HTWIN);
  390. SYNCENGAPI TWINRESULT WINAPI DeleteTwin(HTWIN);
  391. SYNCENGAPI TWINRESULT WINAPI GetObjectTwinHandle(HBRFCASE, LPCTSTR, LPCTSTR, PHOBJECTTWIN);
  392. SYNCENGAPI TWINRESULT WINAPI IsFolderTwin(HBRFCASE, LPCTSTR, PBOOL);
  393. SYNCENGAPI TWINRESULT WINAPI CreateFolderTwinList(HBRFCASE, LPCTSTR, PFOLDERTWINLIST *);
  394. SYNCENGAPI TWINRESULT WINAPI DestroyFolderTwinList(PFOLDERTWINLIST);
  395. SYNCENGAPI TWINRESULT WINAPI IsOrphanObjectTwin(HOBJECTTWIN, PBOOL);
  396. SYNCENGAPI TWINRESULT WINAPI CountSourceFolderTwins(HOBJECTTWIN, PULONG);
  397. SYNCENGAPI TWINRESULT WINAPI AnyTwins(HBRFCASE, PBOOL);
  398. /* twin list interface */
  399. SYNCENGAPI TWINRESULT WINAPI CreateTwinList(HBRFCASE, PHTWINLIST);
  400. SYNCENGAPI TWINRESULT WINAPI DestroyTwinList(HTWINLIST);
  401. SYNCENGAPI TWINRESULT WINAPI AddTwinToTwinList(HTWINLIST, HTWIN);
  402. SYNCENGAPI TWINRESULT WINAPI AddAllTwinsToTwinList(HTWINLIST);
  403. SYNCENGAPI TWINRESULT WINAPI RemoveTwinFromTwinList(HTWINLIST, HTWIN);
  404. SYNCENGAPI TWINRESULT WINAPI RemoveAllTwinsFromTwinList(HTWINLIST);
  405. /* reconciliation list interface */
  406. SYNCENGAPI TWINRESULT WINAPI CreateRecList(HTWINLIST, CREATERECLISTPROC, LPARAM, PRECLIST *);
  407. SYNCENGAPI TWINRESULT WINAPI DestroyRecList(PRECLIST);
  408. SYNCENGAPI TWINRESULT WINAPI ReconcileItem(PCRECITEM, RECSTATUSPROC, LPARAM, DWORD, HWND, HWND);
  409. SYNCENGAPI TWINRESULT WINAPI BeginReconciliation(HBRFCASE);
  410. SYNCENGAPI TWINRESULT WINAPI EndReconciliation(HBRFCASE);
  411. SYNCENGAPI TWINRESULT WINAPI GetFolderTwinStatus(HFOLDERTWIN, CREATERECLISTPROC, LPARAM, PFOLDERTWINSTATUS);
  412. /* file stamp interface */
  413. SYNCENGAPI TWINRESULT WINAPI GetFileStamp(LPCTSTR, PFILESTAMP);
  414. SYNCENGAPI TWINRESULT WINAPI CompareFileStamps(PCFILESTAMP, PCFILESTAMP, PCOMPARISONRESULT);
  415. /* volume ID interface */
  416. SYNCENGAPI TWINRESULT WINAPI IsPathOnVolume(LPCTSTR, HVOLUMEID, PBOOL);
  417. SYNCENGAPI TWINRESULT WINAPI GetVolumeDescription(HVOLUMEID, PVOLUMEDESC);
  418. #ifdef __cplusplus
  419. } /* End of extern "C" {. */
  420. #endif /* __cplusplus */
  421. #endif /* ! __SYNCENG_H__ */