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.

388 lines
17 KiB

  1. //--------------------------------------------------------------------------
  2. // Structs.h
  3. //--------------------------------------------------------------------------
  4. #ifndef __STRUCTS_H
  5. #define __STRUCTS_H
  6. //--------------------------------------------------------------------------
  7. // OBJECTDB_SIGNATURE
  8. //--------------------------------------------------------------------------
  9. #define OBJECTDB_SIGNATURE 0xfe12adcf
  10. #define BTREE_ORDER 40
  11. #define BTREE_MIN_CAP 20
  12. //--------------------------------------------------------------------------
  13. // OBJECTDB_VERSION_V5B1
  14. //--------------------------------------------------------------------------
  15. #define OBJECTDB_VERSION_PRE_V5 2
  16. #define OBJECTDB_VERSION_V5 5
  17. #define ACACHE_VERSION_PRE_V5 9
  18. #define FLDCACHE_VERSION_PRE_V5 2
  19. #define UIDCACHE_VERSION_PRE_V5 4
  20. //--------------------------------------------------------------------------
  21. // ALLOCATEPAGE
  22. //--------------------------------------------------------------------------
  23. typedef struct tagALLOCATEPAGE {
  24. DWORD faPage;
  25. DWORD cbPage;
  26. DWORD cbUsed;
  27. } ALLOCATEPAGE, *LPALLOCATEPAGE;
  28. //--------------------------------------------------------------------------
  29. // TABLEHEADERV5B1
  30. //--------------------------------------------------------------------------
  31. typedef struct tagTABLEHEADERV5B1 {
  32. DWORD dwSignature; // 4
  33. WORD wMinorVersion; // 6
  34. WORD wMajorVersion; // 8
  35. DWORD faRootChain; // 12
  36. DWORD faFreeRecordBlock; // 16
  37. DWORD faFirstRecord; // 20
  38. DWORD faLastRecord; // 24
  39. DWORD cRecords; // 28
  40. DWORD cbAllocated; // 32
  41. DWORD cbFreed; // 34
  42. DWORD dwReserved1; // 38
  43. DWORD dwReserved2; // 42
  44. DWORD cbUserData; // 46
  45. DWORD cDeletes; // 50
  46. DWORD cInserts; // 54
  47. LONG cActiveThreads; // 58
  48. DWORD dwReserved3; // 62
  49. DWORD cbStreams; // 66
  50. DWORD faFreeStreamBlock; // 70
  51. DWORD faFreeChainBlock; // 74
  52. DWORD faNextAllocate; // 78
  53. DWORD dwNextId; // 82
  54. ALLOCATEPAGE AllocateRecord; // 94
  55. ALLOCATEPAGE AllocateChain; // 106
  56. ALLOCATEPAGE AllocateStream; // 118
  57. BYTE fCorrupt; // 119
  58. BYTE fCorruptCheck; // 120
  59. BYTE rgReserved[190]; // 310
  60. } TABLEHEADERV5B1, *LPTABLEHEADERV5B1;
  61. //--------------------------------------------------------------------------
  62. // TABLEHEADERV5
  63. //--------------------------------------------------------------------------
  64. typedef struct tagTABLEHEADERV5 {
  65. DWORD dwSignature; // 4
  66. CLSID clsidExtension; // 20
  67. DWORD dwMinorVersion; // 24
  68. DWORD dwMajorVersion; // 28
  69. DWORD cbUserData; // 32
  70. DWORD rgfaIndex[32]; // 160
  71. DWORD faFirstRecord; // 164
  72. DWORD faLastRecord; // 168
  73. ALLOCATEPAGE AllocateRecord; // 180
  74. ALLOCATEPAGE AllocateChain; // 192
  75. ALLOCATEPAGE AllocateStream; // 204
  76. DWORD faFreeRecordBlock; // 208
  77. DWORD faFreeStreamBlock; // 212
  78. DWORD faFreeChainBlock; // 216
  79. DWORD faNextAllocate; // 220
  80. DWORD cbAllocated; // 224
  81. DWORD cbFreed; // 228
  82. DWORD cbStreams; // 232
  83. DWORD cRecords; // 236
  84. DWORD dwNextId; // 240
  85. DWORD fCorrupt; // 244
  86. DWORD fCorruptCheck; // 248
  87. DWORD cActiveThreads; // 252
  88. BYTE rgReserved[58]; // 310
  89. } TABLEHEADERV5, *LPTABLEHEADERV5;
  90. //--------------------------------------------------------------------------
  91. // CHAINNODEV5B1
  92. //--------------------------------------------------------------------------
  93. typedef struct tagCHAINNODEV5B1 {
  94. DWORD faRecord;
  95. DWORD cbRecord;
  96. DWORD faRightChain;
  97. } CHAINNODEV5B1, *LPCHAINNODEV5B1;
  98. //--------------------------------------------------------------------------
  99. // CHAINBLOCKV5B1
  100. //--------------------------------------------------------------------------
  101. typedef struct tagCHAINBLOCKV5B1 {
  102. DWORD faStart;
  103. LONG cNodes;
  104. DWORD faLeftChain;
  105. CHAINNODEV5B1 rgNode[BTREE_ORDER + 1];
  106. } CHAINBLOCKV5B1, *LPCHAINBLOCKV5B1;
  107. #define CB_CHAIN_BLOCKV5B1 (sizeof(CHAINBLOCKV5B1) - sizeof(CHAINNODEV5B1))
  108. //--------------------------------------------------------------------------
  109. // CHAINNODEV5 - 492 bytes
  110. //--------------------------------------------------------------------------
  111. typedef struct tagCHAINNODEV5 {
  112. DWORD faRecord;
  113. DWORD faRightChain;
  114. DWORD cRightNodes; /* $V2$ */
  115. } CHAINNODEV5, *LPCHAINNODEV5;
  116. //--------------------------------------------------------------------------
  117. // CHAINBLOCKV5 - 20 Bytes
  118. //--------------------------------------------------------------------------
  119. typedef struct tagCHAINBLOCKV5 {
  120. DWORD faStart;
  121. DWORD faLeftChain;
  122. DWORD faParent; /* $V2$ */
  123. BYTE iParent; /* $V2$ */
  124. BYTE cNodes;
  125. WORD wReserved; /* $V2$ */
  126. DWORD cLeftNodes; /* $V2$ */
  127. CHAINNODEV5 rgNode[BTREE_ORDER + 1];
  128. } CHAINBLOCKV5, *LPCHAINBLOCKV5;
  129. #define CB_CHAIN_BLOCKV5 (sizeof(CHAINBLOCKV5))
  130. //--------------------------------------------------------------------------
  131. // RECORDBLOCKV5B1
  132. //--------------------------------------------------------------------------
  133. typedef struct tagRECORDBLOCKV5B1 {
  134. DWORD faRecord;
  135. DWORD cbRecord;
  136. DWORD faNext;
  137. DWORD faPrevious;
  138. } RECORDBLOCKV5B1, *LPRECORDBLOCKV5B1;
  139. //--------------------------------------------------------------------------
  140. // RECORDBLOCKV5
  141. //--------------------------------------------------------------------------
  142. typedef struct tagRECORDBLOCKV5 {
  143. DWORD faRecord;
  144. DWORD cbRecord;
  145. DWORD dwVersion; /* $V2$ */
  146. WORD wFlags; /* $V2$ */
  147. WORD cColumns; /* $V2$ */
  148. WORD wFormat; /* $V2$ */
  149. WORD wReserved; /* $V2$ */
  150. DWORD faNext;
  151. DWORD faPrevious;
  152. } RECORDBLOCKV5, *LPRECORDBLOCKV5;
  153. //--------------------------------------------------------------------------
  154. // STREAMBLOCK
  155. //--------------------------------------------------------------------------
  156. typedef struct tagSTREAMBLOCK {
  157. DWORD faThis;
  158. DWORD cbBlock;
  159. DWORD cbData;
  160. DWORD faNext;
  161. } STREAMBLOCK, *LPSTREAMBLOCK;
  162. // --------------------------------------------------------------------------------
  163. // Old Storage Migration Version and Signatures
  164. // --------------------------------------------------------------------------------
  165. #define MSGFILE_VER 0x00010003 // 1.0003
  166. #define MSGFILE_MAGIC 0x36464d4a
  167. #define CACHEFILE_VER 0x00010004 // 1.0004
  168. #define CACHEFILE_MAGIC 0x39464d4a
  169. #define MAIL_BLOB_VER 0x00010010 // 1.8 Opie Likes to change this a lot !!!
  170. #define MSGHDR_MAGIC 0x7f007f00 // as bytes "0x00, 0x7f, 0x00, 0x7f"
  171. #define MSG_HEADER_VERSISON ((WORD)1)
  172. // --------------------------------------------------------------------------------
  173. // MBXFILEHEADER
  174. // --------------------------------------------------------------------------------
  175. #pragma pack(4)
  176. typedef struct tagMBXFILEHEADER {
  177. DWORD dwMagic;
  178. DWORD ver;
  179. DWORD cMsg;
  180. DWORD msgidLast;
  181. DWORD cbValid;
  182. DWORD dwFlags;
  183. DWORD dwReserved[15];
  184. } MBXFILEHEADER, *LPMBXFILEHEADER;
  185. #pragma pack()
  186. // --------------------------------------------------------------------------------
  187. // MBXMESSAGEHEADER
  188. // --------------------------------------------------------------------------------
  189. #pragma pack(4)
  190. typedef struct tagMBXMESSAGEHEADER {
  191. DWORD dwMagic;
  192. DWORD msgid;
  193. DWORD dwMsgSize;
  194. DWORD dwBodySize;
  195. } MBXMESSAGEHEADER, *LPMBXMESSAGEHEADER;
  196. #pragma pack()
  197. // --------------------------------------------------------------------------------
  198. // IDXFILEHEADER
  199. // --------------------------------------------------------------------------------
  200. #pragma pack(4)
  201. typedef struct tagIDXFILEHEADER {
  202. DWORD dwMagic;
  203. DWORD ver;
  204. DWORD cMsg;
  205. DWORD cbValid;
  206. DWORD dwFlags;
  207. DWORD verBlob;
  208. DWORD dwReserved[14];
  209. } IDXFILEHEADER, *LPIDXFILEHEADER;
  210. #pragma pack()
  211. // --------------------------------------------------------------------------------
  212. // IDXMESSAGEHEADER
  213. // --------------------------------------------------------------------------------
  214. #pragma pack(4)
  215. typedef struct tagIDXMESSAGEHEADER {
  216. DWORD dwState;
  217. DWORD dwLanguage;
  218. DWORD msgid;
  219. DWORD dwHdrOffset;
  220. DWORD dwSize;
  221. DWORD dwOffset;
  222. DWORD dwMsgSize;
  223. DWORD dwHdrSize;
  224. BYTE rgbHdr[4];
  225. } IDXMESSAGEHEADER, *LPIDXMESSAGEHEADER;
  226. #pragma pack()
  227. // --------------------------------------------------------------------------------
  228. // FOLDERUSERDATAV4
  229. // --------------------------------------------------------------------------------
  230. typedef struct tagFOLDERUSERDATAV4 {
  231. DWORD cbCachedArticles;
  232. DWORD cCachedArticles;
  233. FILETIME ftOldestArticle;
  234. DWORD dwFlags;
  235. DWORD dwNextArticleNumber;
  236. TCHAR szServer[256];
  237. TCHAR szGroup[256];
  238. DWORD dwUIDValidity;
  239. BYTE rgReserved[1020];
  240. } FOLDERUSERDATAV4, *LPFOLDERUSERDATAV4;
  241. // --------------------------------------------------------------------------------
  242. // FLDINFO
  243. // --------------------------------------------------------------------------------
  244. #pragma pack(1)
  245. typedef struct tagFLDINFO {
  246. DWORD idFolder;
  247. CHAR szFolder[259];
  248. CHAR szFile[260];
  249. DWORD idParent;
  250. DWORD idChild;
  251. DWORD idSibling;
  252. DWORD tySpecial;
  253. DWORD cChildren;
  254. DWORD cMessages;
  255. DWORD cUnread;
  256. DWORD cbTotal;
  257. DWORD cbUsed;
  258. BYTE bHierarchy;
  259. DWORD dwImapFlags;
  260. BYTE bListStamp;
  261. BYTE bReserved[3];
  262. DWORD_PTR idNewFolderId;
  263. } FLDINFO, *LPFLDINFO;
  264. #pragma pack()
  265. // --------------------------------------------------------------------------------
  266. // IDXMESSAGEHEADER
  267. // --------------------------------------------------------------------------------
  268. #define GROUPLISTVERSION 0x3
  269. #pragma pack(1)
  270. typedef struct tagGRPLISTHEADER {
  271. DWORD dwVersion;
  272. CHAR szDate[14];
  273. DWORD cGroups;
  274. } GRPLISTHEADER, *LPGRPLISTHEADER;
  275. #pragma pack()
  276. // --------------------------------------------------------------------------------
  277. // Sublist Structures
  278. // --------------------------------------------------------------------------------
  279. #define SUBFILE_VERSION5 0xFFEAEA05
  280. #define SUBFILE_VERSION4 0xFFEAEA04
  281. #define SUBFILE_VERSION3 0xFFEAEA03
  282. #define SUBFILE_VERSION2 0xFFEAEA02
  283. typedef struct tagSUBLISTHEADER {
  284. DWORD dwVersion;
  285. DWORD cSubscribed;
  286. } SUBLISTHEADER, *LPSUBLISTHEADER;
  287. #define GSF_SUBSCRIBED 0x00000001
  288. #define GSF_MARKDOWNLOAD 0x00000002 // We use this to persist the groups which have been marked for download
  289. #define GSF_DOWNLOADHEADERS 0x00000004
  290. #define GSF_DOWNLOADNEW 0x00000008
  291. #define GSF_DOWNLOADALL 0x00000010
  292. #define GSF_GROUPTYPEKNOWN 0x00000020
  293. #define GSF_MODERATED 0x00000040
  294. #define GSF_BLOCKED 0x00000080
  295. #define GSF_NOPOSTING 0x00000100
  296. typedef struct tagGROUPSTATUS5 {
  297. DWORD dwFlags; // subscription status, posting, etc.
  298. DWORD dwReserved; // reserved for future use
  299. ULONG ulServerHigh; // highest numbered article on server
  300. ULONG ulServerLow; // lowest numbered article on server
  301. ULONG ulServerCount; // count of articles on server
  302. ULONG ulClientHigh; // highest numbered article known to client
  303. ULONG ulClientLow; // lowest numbered article known to client
  304. ULONG ulClientCount; // count of articles known to client
  305. ULONG ulClientUnread; // count of unread articles known to client
  306. ULONG cbName; // length of group name string (including \0)
  307. ULONG cbReadRange; // length of read range data
  308. ULONG cbKnownRange; // length of known range data
  309. ULONG cbMarkedRange; // length of marked range data
  310. ULONG cbRequestedRange; // length of range of data req from server
  311. DWORD dwCacheFileIndex; // cache file number
  312. } GROUPSTATUS5, * PGROUPSTATUS5;
  313. typedef struct tagGROUPSTATUS4 {
  314. DWORD dwFlags; // subscription status, posting, etc.
  315. DWORD dwReserved; // reserved for future use
  316. ULONG ulServerHigh; // highest numbered article on server
  317. ULONG ulServerLow; // lowest numbered article on server
  318. ULONG ulServerCount; // count of articles on server
  319. ULONG ulClientHigh; // highest numbered article known to client
  320. ULONG ulClientLow; // lowest numbered article known to client
  321. ULONG ulClientCount; // count of articles known to client
  322. ULONG ulClientUnread; // count of unread articles known to client
  323. ULONG cbName; // length of group name string (including \0)
  324. ULONG cbReadRange; // length of read range data
  325. ULONG cbKnownRange; // length of known range data
  326. ULONG cbMarkedRange; // length of marked range data
  327. ULONG cbRequestedRange; // length of range of data req from server
  328. } GROUPSTATUS4, * PGROUPSTATUS4;
  329. typedef struct tagGROUPSTATUS3 {
  330. DWORD dwFlags; // subscription status, posting, etc.
  331. DWORD dwReserved; // reserved for future use
  332. ULONG ulServerHigh; // highest numbered article on server
  333. ULONG ulServerLow; // lowest numbered article on server
  334. ULONG ulServerCount; // count of articles on server
  335. ULONG ulClientHigh; // highest numbered article known to client
  336. ULONG ulClientLow; // lowest numbered article known to client
  337. ULONG ulClientCount; // count of articles known to client
  338. ULONG ulClientUnread; // count of unread articles known to client
  339. ULONG cbName; // length of group name string (including \0)
  340. ULONG cbReadRange; // length of read range data
  341. ULONG cbKnownRange; // length of known range data
  342. ULONG cbMarkedRange; // length of marked range data
  343. } GROUPSTATUS3, * PGROUPSTATUS3;
  344. typedef struct tagGROUPSTATUS2 {
  345. BOOL fSubscribed; // subscription status
  346. BOOL fPosting; // posting allowed?
  347. ULONG ulServerHigh; // highest numbered article on server
  348. ULONG ulServerLow; // lowest numbered article on server
  349. ULONG ulServerCount; // count of articles on server
  350. ULONG ulClientHigh; // highest numbered article known to client
  351. ULONG ulClientLow; // lowest numbered article known to client
  352. ULONG ulClientCount; // count of articles known to client
  353. ULONG ulClientUnread; // count of unread articles known to client
  354. ULONG cbName; // length of group name string (including \0)
  355. ULONG cbReadRange; // length of read range data
  356. ULONG cbKnownRange; // length of known range data
  357. } GROUPSTATUS2, * PGROUPSTATUS2;
  358. #endif // __STRUCTS_H