1 /***********************************************************************\
2 * mapi.d *
3 * *
4 * Windows API header module *
5 * *
6 * Translated from MinGW Windows headers *
7 * by Stewart Gordon *
8 * *
9 * Placed into public domain *
10 \***********************************************************************/
11 module win32.mapi;
12 version(Windows):
13
14 private import win32.windef;
15
16 // FIXME: check types and grouping of constants
17
18 enum {
19 SUCCESS_SUCCESS,
20 MAPI_USER_ABORT,
21 MAPI_E_USER_ABORT = MAPI_USER_ABORT,
22 MAPI_E_FAILURE,
23 MAPI_E_LOGIN_FAILURE,
24 MAPI_E_LOGON_FAILURE = MAPI_E_LOGIN_FAILURE,
25 MAPI_E_DISK_FULL = 4,
26 MAPI_E_INSUFFICIENT_MEMORY,
27 MAPI_E_ACCESS_DENIED,
28 MAPI_E_BLK_TOO_SMALL = MAPI_E_ACCESS_DENIED, // = 6
29 MAPI_E_TOO_MANY_SESSIONS = 8,
30 MAPI_E_TOO_MANY_FILES,
31 MAPI_E_TOO_MANY_RECIPIENTS,
32 MAPI_E_ATTACHMENT_NOT_FOUND,
33 MAPI_E_ATTACHMENT_OPEN_FAILURE,
34 MAPI_E_ATTACHMENT_WRITE_FAILURE,
35 MAPI_E_UNKNOWN_RECIPIENT,
36 MAPI_E_BAD_RECIPTYPE,
37 MAPI_E_NO_MESSAGES,
38 MAPI_E_INVALID_MESSAGE,
39 MAPI_E_TEXT_TOO_LARGE,
40 MAPI_E_INVALID_SESSION,
41 MAPI_E_TYPE_NOT_SUPPORTED,
42 MAPI_E_AMBIGUOUS_RECIPIENT,
43 MAPI_E_AMBIGUOUS_RECIP = MAPI_E_AMBIGUOUS_RECIPIENT,
44 MAPI_E_MESSAGE_IN_USE,
45 MAPI_E_NETWORK_FAILURE,
46 MAPI_E_INVALID_EDITFIELDS,
47 MAPI_E_INVALID_RECIPS,
48 MAPI_E_NOT_SUPPORTED // = 26
49 }
50
51 enum {
52 MAPI_ORIG,
53 MAPI_TO,
54 MAPI_CC,
55 MAPI_BCC
56 }
57
58 const MAPI_LOGON_UI = 0x0001;
59 const MAPI_NEW_SESSION = 0x0002;
60 const MAPI_FORCE_DOWNLOAD = 0x1000;
61 const MAPI_LOGOFF_SHARED = 0x0001;
62 const MAPI_LOGOFF_UI = 0x0002;
63 const MAPI_DIALOG = 0x0008;
64 const MAPI_UNREAD_ONLY = 0x0020;
65 const MAPI_LONG_MSGID = 0x4000;
66 const MAPI_GUARANTEE_FIFO = 0x0100;
67 const MAPI_ENVELOPE_ONLY = 0x0040;
68 const MAPI_PEEK = 0x0080;
69 const MAPI_BODY_AS_FILE = 0x0200;
70 const MAPI_SUPPRESS_ATTACH = 0x0800;
71 const MAPI_AB_NOMODIFY = 0x0400;
72 const MAPI_OLE = 0x0001;
73 const MAPI_OLE_STATIC = 0x0002;
74 const MAPI_UNREAD = 0x0001;
75 const MAPI_RECEIPT_REQUESTED = 0x0002;
76 const MAPI_SENT = 0x0004;
77
78 alias uint FLAGS, LHANDLE;
79 alias uint* LPLHANDLE, LPULONG;
80
81 struct MapiRecipDesc {
82 ULONG ulReserved;
83 ULONG ulRecipClass;
84 LPSTR lpszName;
85 LPSTR lpszAddress;
86 ULONG ulEIDSize;
87 LPVOID lpEntryID;
88 }
89 alias MapiRecipDesc* lpMapiRecipDesc;
90
91 struct MapiFileDesc {
92 ULONG ulReserved;
93 ULONG flFlags;
94 ULONG nPosition;
95 LPSTR lpszPathName;
96 LPSTR lpszFileName;
97 LPVOID lpFileType;
98 }
99 alias MapiFileDesc* lpMapiFileDesc;
100
101 struct MapiFileTagExt {
102 ULONG ulReserved;
103 ULONG cbTag;
104 LPBYTE lpTag;
105 ULONG cbEncoding;
106 LPBYTE lpEncoding;
107 }
108 alias MapiFileTagExt* lpMapiFileTagExt;
109
110 struct MapiMessage {
111 ULONG ulReserved;
112 LPSTR lpszSubject;
113 LPSTR lpszNoteText;
114 LPSTR lpszMessageType;
115 LPSTR lpszDateReceived;
116 LPSTR lpszConversationID;
117 FLAGS flFlags;
118 lpMapiRecipDesc lpOriginator;
119 ULONG nRecipCount;
120 lpMapiRecipDesc lpRecips;
121 ULONG nFileCount;
122 lpMapiFileDesc lpFiles;
123 }
124 alias MapiMessage* lpMapiMessage;
125
126 extern (Pascal) {
127 ULONG MAPILogon(ULONG, LPSTR, LPSTR, FLAGS, ULONG, LPLHANDLE);
128 ULONG MAPISendMail(LHANDLE, ULONG, lpMapiMessage, FLAGS, ULONG);
129 ULONG MAPISendDocuments(ULONG, LPSTR, LPSTR, LPSTR, ULONG);
130 ULONG MAPIReadMail(LHANDLE, ULONG, LPSTR, FLAGS, ULONG, lpMapiMessage*);
131 ULONG MAPIFindNext(LHANDLE, ULONG, LPSTR, LPSTR, FLAGS, ULONG, LPSTR);
132 ULONG MAPIResolveName(LHANDLE, ULONG, LPSTR, FLAGS, ULONG,
133 lpMapiRecipDesc*);
134 ULONG MAPIAddress(LHANDLE, ULONG, LPSTR, ULONG, LPSTR, ULONG,
135 lpMapiRecipDesc, FLAGS, ULONG, LPULONG, lpMapiRecipDesc*);
136 ULONG MAPIFreeBuffer(LPVOID);
137 ULONG MAPIDetails(LHANDLE, ULONG, lpMapiRecipDesc, FLAGS, ULONG);
138 ULONG MAPISaveMail(LHANDLE, ULONG, lpMapiMessage lpszMessage, FLAGS,
139 ULONG, LPSTR);
140 ULONG MAPIDeleteMail(LHANDLE lpSession, ULONG, LPSTR, FLAGS, ULONG);
141 ULONG MAPILogoff(LHANDLE, ULONG, FLAGS, ULONG);
142 // Netscape extensions
143 ULONG MAPIGetNetscapeVersion();
144 ULONG MAPI_NSCP_SynchronizeClient(LHANDLE, ULONG);
145
146 // Handles for use with GetProcAddress
147 alias ULONG function(ULONG, LPSTR, LPSTR, FLAGS, ULONG, LPLHANDLE)
148 LPMAPILOGON;
149 alias ULONG function(LHANDLE, ULONG, lpMapiMessage, FLAGS, ULONG)
150 LPMAPISENDMAIL;
151 alias ULONG function(ULONG, LPSTR, LPSTR, LPSTR, ULONG)
152 LPMAPISENDDOCUMENTS;
153 alias ULONG function(LHANDLE, ULONG, LPSTR, FLAGS, ULONG, lpMapiMessage*)
154 LPMAPIREADMAIL;
155 alias ULONG function(LHANDLE, ULONG, LPSTR, LPSTR, FLAGS, ULONG, LPSTR)
156 LPMAPIFINDNEXT;
157 alias ULONG function(LHANDLE, ULONG, LPSTR, FLAGS, ULONG,
158 lpMapiRecipDesc*) LPMAPIRESOLVENAME;
159 alias ULONG function(LHANDLE, ULONG, LPSTR, ULONG, LPSTR, ULONG,
160 lpMapiRecipDesc, FLAGS, ULONG, LPULONG, lpMapiRecipDesc*) LPMAPIADDRESS;
161 alias ULONG function(LPVOID lpv) LPMAPIFREEBUFFER;
162 alias ULONG function(LHANDLE, ULONG, lpMapiRecipDesc, FLAGS, ULONG)
163 LPMAPIDETAILS;
164 alias ULONG function(LHANDLE, ULONG, lpMapiMessage, FLAGS, ULONG, LPSTR)
165 LPMAPISAVEMAIL;
166 alias ULONG function(LHANDLE lpSession, ULONG, LPSTR, FLAGS, ULONG)
167 LPMAPIDELETEMAIL;
168 alias ULONG function(LHANDLE, ULONG, FLAGS, ULONG) LPMAPILOGOFF;
169 }