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.

430 lines
14 KiB

  1. /*
  2. * wabimp.h
  3. *
  4. * Internal header for wabimp.dll
  5. *
  6. * Copyright 1996-1997 Microsoft Corporation. All Rights Reserved.
  7. */
  8. //
  9. // MACROS
  10. //
  11. // Test for PT_ERROR property tag
  12. #define PROP_ERROR(prop) (prop.ulPropTag == PROP_TAG(PT_ERROR, PROP_ID(prop.ulPropTag)))
  13. #define ToUpper(c) (c >= 'a' && c <= 'z') ? ('A' + c - 'a') : c
  14. //
  15. // Property Tags:
  16. //
  17. #define MAX_SCHEMA_PROPID 0x3FFF
  18. #define MIN_NAMED_PROPID 0x8000
  19. // MSN Address properties
  20. #define PR_MSNINET_ADDRESS PROP_TAG(PT_TSTRING, 0x6001)
  21. #define PR_MSNINET_DOMAIN PROP_TAG(PT_TSTRING, 0x6002)
  22. //
  23. // Error values
  24. //
  25. #define WAB_W_BAD_EMAIL MAKE_MAPI_S(0x1000)
  26. #define WAB_W_END_OF_FILE MAKE_MAPI_S(0x1001)
  27. // Misc defines
  28. #define NOT_FOUND ((ULONG)-1)
  29. #define INDEX_FIRST_MIDDLE_LAST ((ULONG)-2)
  30. #define NUM_EXPORT_WIZARD_PAGES 2
  31. #define NUM_IMPORT_WIZARD_PAGES 2
  32. // Netscape, Eudora, Athena16 importer defines
  33. #define NETSCAPE 500
  34. #define EUDORA 501
  35. #define ATHENA16 502
  36. #define MAX_FILE_NAME 500 // BUGBUG: Should be MAX_PATH?
  37. #define MAX_STRING_SIZE 30 // BUGBUG: Should be larger?
  38. #define MAX_MESSAGE 500
  39. #define ATHENASTRUCTURE 190
  40. #define ATHENAADROFFSET 28
  41. #define EUDORA_STRUCT 16
  42. // Athena
  43. #define MAX_NAME_SIZE 80
  44. #define MAX_EMA_SIZE 80
  45. #define hrINVALIDFILE 600 // BUGBUG: Should use MAKE_MAPI_E
  46. #define hrMemory 601 // BUGBUG: Should use MAPI_E_NOT_ENOUGH_MEMORY
  47. //
  48. // Types
  49. //
  50. // Index of icons in the bitmap
  51. enum {
  52. iiconStateUnchecked,
  53. iiconStateChecked,
  54. iiconStMax
  55. };
  56. typedef enum {
  57. INDEX_EXPORT_PAB = 0,
  58. INDEX_EXPORT_CSV
  59. } INDEX_EXPORT, *LPINDEX_EXPORT;
  60. typedef enum {
  61. CONFIRM_YES,
  62. CONFIRM_NO,
  63. CONFIRM_YES_TO_ALL,
  64. CONFIRM_NO_TO_ALL,
  65. CONFIRM_ERROR,
  66. CONFIRM_ABORT
  67. } CONFIRM_RESULT, *LPCONFIRM_RESULT;
  68. typedef struct _ReplaceInfo {
  69. LPTSTR lpszDisplayName; // Conflicting display name
  70. LPTSTR lpszEmailAddress; // Conflicting email address
  71. CONFIRM_RESULT ConfirmResult; // Results from dialog
  72. BOOL fExport; // TRUE if this is an export operation
  73. union {
  74. LPWAB_IMPORT_OPTIONS lpImportOptions;
  75. LPWAB_EXPORT_OPTIONS lpExportOptions;
  76. };
  77. } REPLACE_INFO, * LPREPLACE_INFO;
  78. typedef enum {
  79. ERROR_OK,
  80. ERROR_ABORT
  81. } ERROR_RESULT, *LPERROR_RESULT;
  82. typedef struct _ErrorInfo {
  83. LPTSTR lpszDisplayName; // Problem display name
  84. LPTSTR lpszEmailAddress; // Problem email address
  85. ERROR_RESULT ErrorResult; // Results from dialog
  86. ULONG ids; // string resource identifier for error message
  87. BOOL fExport; // TRUE if this is an export operation
  88. union {
  89. LPWAB_IMPORT_OPTIONS lpImportOptions;
  90. LPWAB_EXPORT_OPTIONS lpExportOptions;
  91. };
  92. } ERROR_INFO, * LPERROR_INFO;
  93. typedef struct _EntrySeen {
  94. SBinary sbinPAB; // MAPI entry
  95. SBinary sbinWAB; // WAB entry
  96. } ENTRY_SEEN, * LPENTRY_SEEN;
  97. typedef struct _TargetInfo {
  98. LPTSTR lpRegName;
  99. LPTSTR lpDescription;
  100. LPTSTR lpDll;
  101. LPTSTR lpEntry;
  102. union {
  103. LPWAB_EXPORT lpfnExport;
  104. LPWAB_IMPORT lpfnImport;
  105. };
  106. } TARGET_INFO, *LPTARGET_INFO;
  107. enum {
  108. iconPR_DEF_CREATE_MAILUSER = 0,
  109. iconPR_DEF_CREATE_DL,
  110. iconMax
  111. };
  112. enum {
  113. ieidPR_ENTRYID = 0,
  114. ieidMax
  115. };
  116. enum {
  117. iptaColumnsPR_OBJECT_TYPE = 0,
  118. iptaColumnsPR_ENTRYID,
  119. iptaColumnsPR_DISPLAY_NAME,
  120. iptaColumnsPR_EMAIL_ADDRESS,
  121. iptaColumnsMax
  122. };
  123. typedef struct _PropNames {
  124. ULONG ulPropTag; // property tag
  125. BOOL fChosen; // use this property tag
  126. ULONG ids; // string id
  127. LPTSTR lpszName; // string (read in from resources)
  128. LPTSTR lpszCSVName; // name of CSV field (from import file)
  129. } PROP_NAME, *LPPROP_NAME;
  130. // PAB
  131. // State Identifiers
  132. typedef enum {
  133. STATE_IMPORT_MU,
  134. STATE_IMPORT_NEXT_MU,
  135. STATE_IMPORT_DL,
  136. STATE_IMPORT_NEXT_DL,
  137. STATE_IMPORT_FINISH,
  138. STATE_IMPORT_ERROR,
  139. STATE_IMPORT_CANCEL,
  140. STATE_EXPORT_MU,
  141. STATE_EXPORT_NEXT_MU,
  142. STATE_EXPORT_DL,
  143. STATE_EXPORT_NEXT_DL,
  144. STATE_EXPORT_FINISH,
  145. STATE_EXPORT_ERROR,
  146. STATE_EXPORT_CANCEL
  147. } PAB_STATE, *LPPAB_STATE;
  148. // NetScape
  149. typedef struct tagDistList {
  150. int AliasID;
  151. struct tagDistList *lpDist;
  152. } NSDistList, NSDISTLIST, *LPNSDISTLIST;
  153. typedef struct tagAdrBook {
  154. ULONG AliasID; // The AliasID value
  155. BOOL Sbinary;
  156. BOOL DistList;
  157. TCHAR *Address;
  158. TCHAR *NickName;
  159. TCHAR *Entry;
  160. TCHAR *Description;
  161. LPNSDISTLIST lpDist;
  162. } NSAdrBook, NSADRBOOK, *LPNSADRBOOK;
  163. // Eudora
  164. typedef struct tagEudDistList {
  165. BOOL flag; // To check whether it is a alias or a simple address
  166. TCHAR *NickName;
  167. TCHAR *Address;
  168. TCHAR *Description;
  169. int AliasID; // ID of the member if it is a simple address
  170. struct tagEudDistList *lpDist; //pointer to the next entry of DL.
  171. } EudDistList, EUDDISTLIST, *LPEUDDISTLIST;
  172. typedef struct tagEUDAdrBook {
  173. TCHAR *Address;
  174. TCHAR *NickName;
  175. TCHAR *Description;
  176. LPEUDDISTLIST lpDist;
  177. } EudAdrBook, EUDADRBOOK, *LPEUDADRBOOK;
  178. // Athena16
  179. typedef struct tagABCREC {
  180. TCHAR DisplayName[MAX_NAME_SIZE + 1];
  181. TCHAR EmailAddress[MAX_EMA_SIZE + 1];
  182. } ABCREC, *LPABCREC;
  183. #define CBABCREC sizeof(ABCREC)
  184. extern const TCHAR szTextFilter[];
  185. extern const TCHAR szAllFilter[];
  186. extern const UCHAR szQuote[];
  187. extern const TCHAR szMSN[];
  188. extern const TCHAR szMSNINET[];
  189. extern const TCHAR szCOMPUSERVE[];
  190. extern const TCHAR szFAX[];
  191. extern const TCHAR szSMTP[];
  192. extern const TCHAR szMS[];
  193. extern const TCHAR szEX[];
  194. extern const TCHAR szX400[];
  195. extern const TCHAR szMSA[];
  196. extern const TCHAR szMAPIPDL[];
  197. extern const TCHAR szEmpty[];
  198. extern const TCHAR szAtSign[];
  199. #define cbAtSign (2 * sizeof(TCHAR))
  200. extern const TCHAR szMSNpostfix[];
  201. #define cbMSNpostfix (9 * sizeof(TCHAR))
  202. extern const TCHAR szCOMPUSERVEpostfix[];
  203. #define cbCOMPUSERVEpostfix (16 * sizeof(TCHAR))
  204. extern PROP_NAME rgPropNames[];
  205. extern LPPROP_NAME lpImportMapping;
  206. extern HINSTANCE hInst;
  207. extern HINSTANCE hInstApp;
  208. extern LPENTRY_SEEN lpEntriesSeen;
  209. extern ULONG ulEntriesSeen;
  210. extern ULONG ulMaxEntries;
  211. extern LPSPropValue lpCreateEIDsWAB;
  212. extern LPSPropValue lpCreateEIDsMAPI;
  213. extern ULONG ulcEntries;
  214. #ifndef _WABIMP_C
  215. #define ExternSizedSPropTagArray(_ctag, _name) \
  216. extern const struct _SPropTagArray_ ## _name \
  217. { \
  218. ULONG cValues; \
  219. ULONG aulPropTag[_ctag]; \
  220. } _name
  221. ExternSizedSPropTagArray(iptaColumnsMax, ptaColumns);
  222. ExternSizedSPropTagArray(ieidMax, ptaEid);
  223. ExternSizedSPropTagArray(iconMax, ptaCon);
  224. #endif
  225. //
  226. // WABIMP.C
  227. //
  228. HRESULT OpenWabContainer(LPABCONT *lppWabContainer, LPADRBOOK lpAdrBook);
  229. BOOL GetFileToImport(HWND hwnd, LPTSTR szFileName, DWORD cchFileName, int type);
  230. INT_PTR CALLBACK ReplaceDialogProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
  231. INT_PTR CALLBACK ErrorDialogProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
  232. HRESULT GetRegistryPath(LPTSTR szFileName, ULONG cchSize, int type);
  233. HRESULT GetExistEntry(LPABCONT lpWabContainer, LPSBinary lpsbinary, ULONG ucount,
  234. LPTSTR szDisplayName, LPTSTR szNickName);
  235. void FreeRowSet(LPSRowSet lpRows);
  236. LPTSTR LoadAllocString(int StringID);
  237. LPTSTR LoadStringToGlobalBuffer(int StringID);
  238. ULONG SizeLoadStringToGlobalBuffer(int StringID);
  239. HRESULT FillMailUser(HWND hwnd, LPABCONT lpWabContainer, LPSPropValue sProp,
  240. LPWAB_IMPORT_OPTIONS lpOptions, void *lpeudAdrBook, LPSBinary lpsbinary,
  241. ULONG ul,int type);
  242. INT_PTR CALLBACK ComDlg32DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  243. void WABFreeProws(LPSRowSet prows);
  244. LPTSTR PropStringOrNULL(LPSPropValue lpspv);
  245. LPTSTR GetEMSSMTPAddress(LPMAPIPROP lpObject, LPVOID lpBase);
  246. void FreeSeenList(void);
  247. extern ULONG CountRows(LPMAPITABLE lpTable, BOOL fMAPI);
  248. extern void WABFreePadrlist(LPADRLIST lpAdrList);
  249. extern SCODE WABFreeBuffer(LPVOID lpBuffer);
  250. extern SCODE WABAllocateMore(ULONG cbSize, LPVOID lpObject, LPVOID FAR * lppBuffer);
  251. extern SCODE WABAllocateBuffer(ULONG cbSize, LPVOID FAR * lppBuffer);
  252. extern INT_PTR CALLBACK ErrorDialogProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
  253. extern LPTSTR FindStringInProps(LPSPropValue lpspv, ULONG ulcProps, ULONG ulPropTag);
  254. extern LPSBinary FindAdrEntryID(LPADRLIST lpAdrList, ULONG index);
  255. extern void SetGlobalBufferFunctions(LPWABOBJECT lpWABObject);
  256. BOOL IsSpace(LPTSTR lpChar);
  257. HRESULT SaveFileDialog(HWND hWnd,
  258. LPTSTR szFileName,
  259. LPCTSTR lpFilter1,
  260. ULONG idsFileType1,
  261. LPCTSTR lpFilter2,
  262. ULONG idsFileType2,
  263. LPCTSTR lpFilter3,
  264. ULONG idsFileType3,
  265. LPCTSTR lpDefExt,
  266. ULONG ulFlags,
  267. HINSTANCE hInst,
  268. ULONG idsTitle,
  269. ULONG idsSaveButton);
  270. HRESULT OpenFileDialog(HWND hWnd,
  271. LPTSTR szFileName,
  272. LPCTSTR lpFilter1,
  273. ULONG idsFileType1,
  274. LPCTSTR lpFilter2,
  275. ULONG idsFileType2,
  276. LPCTSTR lpFilter3,
  277. ULONG idsFileType3,
  278. LPCTSTR lpDefExt,
  279. ULONG ulFlags,
  280. HINSTANCE hInst,
  281. ULONG idsTitle,
  282. ULONG idsOpenButton);
  283. int __cdecl ShowMessageBoxParam(HWND hWndParent, int MsgId, int ulFlags, ...);
  284. extern void WABFreePadrlist(LPADRLIST lpAdrList);
  285. extern SCODE WABFreeBuffer(LPVOID lpBuffer);
  286. extern SCODE WABAllocateMore(ULONG cbSize, LPVOID lpObject, LPVOID FAR * lppBuffer);
  287. extern SCODE WABAllocateBuffer(ULONG cbSize, LPVOID FAR * lppBuffer);
  288. extern void SetGlobalBufferFunctions(LPWABOBJECT lpWABObject);
  289. HRESULT LoadWABEIDs(LPADRBOOK lpAdrBook, LPABCONT * lppContainer);
  290. //
  291. // NetScape
  292. //
  293. HRESULT MigrateUser(HWND hwnd, LPWAB_IMPORT_OPTIONS lpOptions,
  294. LPWAB_PROGRESS_CALLBACK lpProgressCB, LPADRBOOK lpAdrBook);
  295. HRESULT ParseAddressBook(HWND hwnd, LPTSTR szFileName, LPWAB_IMPORT_OPTIONS lpOptions,
  296. LPWAB_PROGRESS_CALLBACK lpProgressCB, LPADRBOOK lpAdrBook);
  297. HRESULT ParseAddress(HWND hwnd, LPTSTR szBuffer, LPWAB_IMPORT_OPTIONS lpOptions,
  298. LPWAB_PROGRESS_CALLBACK lpProgressCB, LPADRBOOK lpAdrBook);
  299. HRESULT GetAdrBuffer(LPTSTR *szBuffer, LPTSTR *szAdrBuffer);
  300. HRESULT ProcessAdrBuffer(HWND hwnd,LPTSTR AdrBuffer, LPWAB_IMPORT_OPTIONS lpOptions,
  301. LPWAB_PROGRESS_CALLBACK lpProgressCB, LPADRBOOK lpAdrBook);
  302. BOOL GetAdrLine(LPTSTR *szCurPointer, LPTSTR *szBuffer, LPTSTR *szDesc);
  303. HRESULT ProcessLn(LPTSTR *szL, LPTSTR *szDesc, NSADRBOOK *nsAdrBook, LPTSTR *szBuffer);
  304. ULONG GetAddressCount(LPTSTR AdrBuffer);
  305. LPTSTR GetAdrStart(LPTSTR szBuffer);
  306. LPTSTR GetDLNext(LPTSTR szBuffer);
  307. LPTSTR GetAdrEnd(LPTSTR szBuffer);
  308. ULONG GetAddrCount(LPTSTR AdrBuffer);
  309. HRESULT FillDistList(HWND hwnd, LPABCONT lpWabContainer, LPSPropValue sProp,
  310. LPWAB_IMPORT_OPTIONS lpOptions, LPNSADRBOOK lpnAdrBook, LPSBinary lpsbinary,
  311. LPADRBOOK lpAdrBook);
  312. HRESULT FillWABStruct(LPSPropValue rgProps, NSADRBOOK *nsAdrBook);
  313. HRESULT CreateDistEntry(LPABCONT lpWabContainer, LPSPropValue sProp,
  314. ULONG ulCreateEntries, LPMAPIPROP *lppMailUserWab);
  315. LPNSDISTLIST FreeNSdistlist(LPNSDISTLIST lpDist);
  316. //
  317. // Eudora
  318. //
  319. HRESULT MigrateEudoraUser(HWND hwnd, LPABCONT lpWabContainer,
  320. LPWAB_IMPORT_OPTIONS lpOptions, LPWAB_PROGRESS_CALLBACK lpProgressCB,
  321. LPADRBOOK lpAdrBook);
  322. ULONG ParseEudAddress(LPTSTR szFileName,LPEUDADRBOOK *lpeudAdrBook);
  323. HRESULT ParseAddressTokens(LPTSTR szBuffer,LPTSTR szAdrBuffer, UINT ulCount,
  324. LPTSTR *szAliaspt, EUDADRBOOK *EudAdrBook);
  325. HRESULT CreateAdrLineBuffer(LPTSTR *szAdrline, LPTSTR szAdrBuffer, ULONG ulAdrOffset,
  326. ULONG ulAdrSize);
  327. HRESULT ParseAdrLineBuffer(LPTSTR szAdrLine, LPTSTR *szAliasptr, ULONG uToken,
  328. EUDADRBOOK *EudAdrBook);
  329. BOOL SearchAdrName(LPTSTR szAdrCur);
  330. INT SearchName(LPTSTR *szAliasptr, LPTSTR szAdrCur);
  331. HRESULT ImportEudUsers(HWND hwnd,LPTSTR szFileName, LPABCONT lpWabContainer,
  332. LPSPropValue sProp, LPEUDADRBOOK lpeudAdrBook, ULONG ulCount,
  333. LPWAB_IMPORT_OPTIONS lpOptions, LPWAB_PROGRESS_CALLBACK lpProgressCB,
  334. LPADRBOOK lpAdrBook);
  335. HRESULT FillEudDistList(HWND hWnd, LPABCONT lpWabContainer, LPSPropValue sProp,
  336. LPWAB_IMPORT_OPTIONS lpOptions, LPEUDADRBOOK lpeudAdrBook, LPSBinary lpsbinary,
  337. LPADRBOOK lpAdrBook, ULONG ul);
  338. HRESULT FillEudWABStruct(LPSPropValue rgProps, EUDADRBOOK *eudAdrBook);
  339. void FillEudDiststruct(LPSPropValue rgProps, EUDADRBOOK *eudAdrBook);
  340. LPEUDDISTLIST FreeEuddistlist(LPEUDDISTLIST lpDist);
  341. char* Getstr(char* szSource, char* szToken);
  342. ULONG ShiftAdd(int offset, TCHAR *szBuffer);
  343. //
  344. // Athena16
  345. //
  346. HRESULT MigrateAthUser(HWND hwnd, LPWAB_IMPORT_OPTIONS lpOptions,
  347. LPWAB_PROGRESS_CALLBACK lpProgressCB, LPADRBOOK lpAdrBook) ;
  348. HRESULT ParseAthAddressBook(HWND hwnd, LPTSTR szFileName,
  349. LPWAB_IMPORT_OPTIONS lpOptions, LPWAB_PROGRESS_CALLBACK lpProgressCB,
  350. LPADRBOOK lpAdrBook);
  351. HRESULT FillAthenaUser(HWND hwnd, LPABCONT lpWabContainer, LPSPropValue sProp,
  352. LPWAB_IMPORT_OPTIONS lpOptions, LPABCREC lpabcrec);
  353. //
  354. // Functions in csvpick.c
  355. //
  356. int APIENTRY PickExportProps(LPPROP_NAME rgPropNames);
  357. HRESULT ExportWizard(HWND hWnd, LPTSTR szFileName, ULONG cchSize, LPPROP_NAME rgPropNames);
  358. HRESULT ImportWizard(HWND hWnd, LPTSTR szFileName, ULONG cchSize, LPPROP_NAME rgPropNames,
  359. LPTSTR szSep, LPPROP_NAME * lppImportMapping, LPULONG lpcFields, LPHANDLE lphFile);
  360. //
  361. // Functions in csvparse.c
  362. //
  363. HRESULT ReadCSVLine(HANDLE hFile, LPTSTR szSep, ULONG * lpcItems, PUCHAR ** lpprgItems);
  364. // Functions in pab.c
  365. HRESULT HrLoadPrivateWABPropsForCSV(LPADRBOOK );
  366. LPWABOPEN lpfnWABOpen;