ReactOS  0.4.13-dev-247-g0f29b3f
sendmail.c
Go to the documentation of this file.
1 /*
2  * MAPISendMail implementation
3  *
4  * Copyright 2005 Hans Leidekker
5  * Copyright 2009 Owen Rudge for CodeWeavers
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20  */
21 
22 #include "config.h"
23 #include "wine/port.h"
24 
25 #include <stdio.h>
26 #include <stdarg.h>
27 
28 #define COBJMACROS
29 
30 #include "windef.h"
31 #include "winbase.h"
32 #include "winerror.h"
33 #include "winuser.h"
34 #include "objbase.h"
35 #include "objidl.h"
36 #include "mapi.h"
37 #include "mapix.h"
38 #include "mapiutil.h"
39 #include "mapidefs.h"
40 #include "winreg.h"
41 #include "shellapi.h"
42 #include "shlwapi.h"
43 #include "wine/debug.h"
44 #include "util.h"
45 #include "res.h"
46 
48 
49 #define READ_BUF_SIZE 4096
50 
51 #define STORE_UNICODE_OK 0x00040000
52 
54 {
55  LPSTR str;
56  DWORD len;
57 
58  if (!wstr)
59  return NULL;
60 
61  len = WideCharToMultiByte(CP_ACP, 0, wstr, -1, NULL, 0, NULL, NULL);
63  WideCharToMultiByte(CP_ACP, 0, wstr, -1, str, len, NULL, NULL);
64 
65  return str;
66 }
67 
69 {
70  LPWSTR wstr;
71  DWORD len;
72 
73  if (!str)
74  return NULL;
75 
76  len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
77  wstr = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
78  MultiByteToWideChar(CP_ACP, 0, str, -1, wstr, len);
79 
80  return wstr;
81 }
82 
83 /*
84  Internal function to send a message via Extended MAPI. Wrapper around the Simple
85  MAPI function MAPISendMail.
86 */
88  FLAGS flags)
89 {
90  ULONG tags[] = {1, 0};
91  char *subjectA = NULL, *bodyA = NULL;
92  ULONG retval = MAPI_E_FAILURE;
93  IMAPISession *session = NULL;
94  BOOL unicode_aware = FALSE;
95  IMAPITable* msg_table;
96  LPSRowSet rows = NULL;
97  IMsgStore* msg_store;
98  IMAPIFolder* folder = NULL, *draft_folder = NULL;
99  LPENTRYID entry_id;
101  ULONG entry_len;
102  DWORD obj_type;
103  IMessage* msg;
104  ULONG values;
105  HRESULT ret;
106 
107  TRACE("Using Extended MAPI wrapper for MAPISendMail\n");
108 
109  /* Attempt to log on via Extended MAPI */
110 
112  TRACE("MAPILogonEx: %x\n", ret);
113 
114  if (ret != S_OK)
115  {
116  retval = MAPI_E_LOGIN_FAILURE;
117  goto cleanup;
118  }
119 
120  /* Open the default message store */
121 
122  if (IMAPISession_GetMsgStoresTable(session, 0, &msg_table) == S_OK)
123  {
124  /* We want the default store */
125  SizedSPropTagArray(2, columns) = {2, {PR_ENTRYID, PR_DEFAULT_STORE}};
126 
127  /* Set the columns we want */
128  if (IMAPITable_SetColumns(msg_table, (LPSPropTagArray) &columns, 0) == S_OK)
129  {
130  while (1)
131  {
132  if (IMAPITable_QueryRows(msg_table, 1, 0, &rows) != S_OK)
133  {
134  MAPIFreeBuffer(rows);
135  rows = NULL;
136  }
137  else if (rows->cRows != 1)
138  {
139  FreeProws(rows);
140  rows = NULL;
141  }
142  else
143  {
144  /* If it's not the default store, try the next row */
145  if (!rows->aRow[0].lpProps[1].Value.b)
146  {
147  FreeProws(rows);
148  continue;
149  }
150  }
151 
152  break;
153  }
154  }
155 
156  IMAPITable_Release(msg_table);
157  }
158 
159  /* Did we manage to get the right store? */
160  if (!rows)
161  goto logoff;
162 
163  /* Open the message store */
164  IMAPISession_OpenMsgStore(session, 0, rows->aRow[0].lpProps[0].Value.bin.cb,
165  (ENTRYID *) rows->aRow[0].lpProps[0].Value.bin.lpb, NULL,
166  MDB_NO_DIALOG | MAPI_BEST_ACCESS, &msg_store);
167 
168  /* We don't need this any more */
169  FreeProws(rows);
170 
171  /* Check if the message store supports Unicode */
173  ret = IMsgStore_GetProps(msg_store, (LPSPropTagArray) tags, 0, &values, &props);
174 
175  if ((ret == S_OK) && (props[0].Value.l & STORE_UNICODE_OK))
176  unicode_aware = TRUE;
177  else
178  {
179  /* Don't convert to ANSI */
181  {
182  WARN("No Unicode-capable mail client, and MAPI_FORCE_UNICODE is specified. MAPISendMail failed.\n");
184  IMsgStore_Release(msg_store);
185  goto logoff;
186  }
187  }
188 
189  /* First open the inbox, from which the drafts folder can be opened */
190  if (IMsgStore_GetReceiveFolder(msg_store, NULL, 0, &entry_len, &entry_id, NULL) == S_OK)
191  {
192  IMsgStore_OpenEntry(msg_store, entry_len, entry_id, NULL, 0, &obj_type, (LPUNKNOWN*) &folder);
193  MAPIFreeBuffer(entry_id);
194  }
195 
197 
198  /* Open the drafts folder, or failing that, try asking the message store for the outbox */
199  if ((folder == NULL) || ((ret = IMAPIFolder_GetProps(folder, (LPSPropTagArray) tags, 0, &values, &props)) != S_OK))
200  {
201  TRACE("Unable to open Drafts folder; opening Outbox instead\n");
203  ret = IMsgStore_GetProps(msg_store, (LPSPropTagArray) tags, 0, &values, &props);
204  }
205 
206  if (ret != S_OK)
207  goto logoff;
208 
209  IMsgStore_OpenEntry(msg_store, props[0].Value.bin.cb, (LPENTRYID) props[0].Value.bin.lpb,
210  NULL, MAPI_MODIFY, &obj_type, (LPUNKNOWN *) &draft_folder);
211 
212  /* Create a new message */
213  if (IMAPIFolder_CreateMessage(draft_folder, NULL, 0, &msg) == S_OK)
214  {
215  ULONG token;
216  SPropValue p;
217 
218  /* Define message properties */
219  p.ulPropTag = PR_MESSAGE_FLAGS;
220  p.Value.l = MSGFLAG_FROMME | MSGFLAG_UNSENT;
221 
222  IMessage_SetProps(msg, 1, &p, NULL);
223 
224  p.ulPropTag = PR_SENTMAIL_ENTRYID;
225  p.Value.bin.cb = props[0].Value.bin.cb;
226  p.Value.bin.lpb = props[0].Value.bin.lpb;
227  IMessage_SetProps(msg, 1,&p, NULL);
228 
229  /* Set message subject */
230  if (message->lpszSubject)
231  {
232  if (unicode_aware)
233  {
234  p.ulPropTag = PR_SUBJECT_W;
235  p.Value.lpszW = message->lpszSubject;
236  }
237  else
238  {
239  subjectA = convert_from_unicode(message->lpszSubject);
240 
241  p.ulPropTag = PR_SUBJECT_A;
242  p.Value.lpszA = subjectA;
243  }
244 
245  IMessage_SetProps(msg, 1, &p, NULL);
246  }
247 
248  /* Set message body */
249  if (message->lpszNoteText)
250  {
251  LPSTREAM stream = NULL;
252 
253  if (IMessage_OpenProperty(msg, unicode_aware ? PR_BODY_W : PR_BODY_A, &IID_IStream, 0,
255  {
256  if (unicode_aware)
257  IStream_Write(stream, message->lpszNoteText, (lstrlenW(message->lpszNoteText)+1) * sizeof(WCHAR), NULL);
258  else
259  {
260  bodyA = convert_from_unicode(message->lpszNoteText);
261  IStream_Write(stream, bodyA, strlen(bodyA)+1, NULL);
262  }
263 
264  IStream_Release(stream);
265  }
266  }
267 
268  /* Add message attachments */
269  if (message->nFileCount > 0)
270  {
271  ULONG num_attach = 0;
272  unsigned int i;
273 
274  for (i = 0; i < message->nFileCount; i++)
275  {
276  IAttach* attachment = NULL;
277  char *filenameA = NULL;
278  SPropValue prop[4];
280  HANDLE file;
281 
282  if (!message->lpFiles[i].lpszPathName)
283  continue;
284 
285  /* Open the attachment for reading */
286  file = CreateFileW(message->lpFiles[i].lpszPathName, GENERIC_READ, FILE_SHARE_READ,
288 
289  if (file == INVALID_HANDLE_VALUE)
290  continue;
291 
292  /* Check if a display filename has been given; if not, get one ourselves from path name */
293  filename = message->lpFiles[i].lpszFileName;
294 
295  if (!filename)
296  {
297  int j;
298 
299  filename = message->lpFiles[i].lpszPathName;
300 
301  for (j = lstrlenW(message->lpFiles[i].lpszPathName)-1; j >= 0; j--)
302  {
303  if (message->lpFiles[i].lpszPathName[i] == '\\' ||
304  message->lpFiles[i].lpszPathName[i] == '/')
305  {
306  filename = &message->lpFiles[i].lpszPathName[i+1];
307  break;
308  }
309  }
310  }
311 
312  TRACE("Attachment %u path: '%s'; filename: '%s'\n", i, debugstr_w(message->lpFiles[i].lpszPathName),
314 
315  /* Create the attachment */
316  if (IMessage_CreateAttach(msg, NULL, 0, &num_attach, &attachment) != S_OK)
317  {
318  TRACE("Unable to create attachment\n");
319  CloseHandle(file);
320  continue;
321  }
322 
323  /* Set the attachment properties */
324  ZeroMemory(prop, sizeof(prop));
325 
326  prop[0].ulPropTag = PR_ATTACH_METHOD;
327  prop[0].Value.ul = ATTACH_BY_VALUE;
328 
329  if (unicode_aware)
330  {
332  prop[1].Value.lpszW = (LPWSTR) filename;
334  prop[2].Value.lpszW = (LPWSTR) filename;
335  }
336  else
337  {
339 
341  prop[1].Value.lpszA = (LPSTR) filenameA;
343  prop[2].Value.lpszA = (LPSTR) filenameA;
344 
345  }
346 
348  prop[3].Value.l = -1;
349 
350  if (IAttach_SetProps(attachment, 4, prop, NULL) == S_OK)
351  {
352  LPSTREAM stream = NULL;
353 
354  if (IAttach_OpenProperty(attachment, PR_ATTACH_DATA_BIN, &IID_IStream, 0,
356  {
358  DWORD size = 0, read, written;
359 
360  while (ReadFile(file, data, READ_BUF_SIZE, &read, NULL) && (read != 0))
361  {
362  IStream_Write(stream, data, read, &written);
363  size += read;
364  }
365 
366  TRACE("%d bytes written of attachment\n", size);
367 
368  IStream_Commit(stream, STGC_DEFAULT);
369  IStream_Release(stream);
370 
371  prop[0].ulPropTag = PR_ATTACH_SIZE;
372  prop[0].Value.ul = size;
373  IAttach_SetProps(attachment, 1, prop, NULL);
374 
376  num_attach++;
377  }
378  }
379 
380  CloseHandle(file);
382 
384  }
385  }
386 
388 
389  /* Prepare the message form */
390 
391  if (IMAPISession_PrepareForm(session, NULL, msg, &token) == S_OK)
392  {
393  ULONG access = 0, status = 0, message_flags = 0, pc = 0;
394  ULONG pT[2] = {1, PR_MSG_STATUS};
395 
396  /* Retrieve message status, flags, access rights and class */
397 
398  if (IMessage_GetProps(msg, (LPSPropTagArray) pT, 0, &pc, &props) == S_OK)
399  {
400  status = props->Value.ul;
402  }
403 
404  pT[1] = PR_MESSAGE_FLAGS;
405 
406  if (IMessage_GetProps(msg, (LPSPropTagArray) pT, 0, &pc, &props) == S_OK)
407  {
408  message_flags = props->Value.ul;
410  }
411 
412  pT[1] = PR_ACCESS;
413 
414  if (IMessage_GetProps(msg, (LPSPropTagArray) pT, 0, &pc, &props) == S_OK)
415  {
416  access = props->Value.ul;
418  }
419 
420  pT[1] = PR_MESSAGE_CLASS_A;
421 
422  if (IMessage_GetProps(msg, (LPSPropTagArray) pT, 0, &pc, &props) == S_OK)
423  {
424  /* Show the message form (edit window) */
425 
426  ret = IMAPISession_ShowForm(session, 0, msg_store, draft_folder, NULL,
427  token, NULL, 0, status, message_flags, access,
428  props->Value.lpszA);
429 
430  switch (ret)
431  {
432  case S_OK:
433  retval = SUCCESS_SUCCESS;
434  break;
435 
436  case MAPI_E_USER_CANCEL:
437  retval = MAPI_E_USER_ABORT;
438  break;
439 
440  default:
441  TRACE("ShowForm failure: %x\n", ret);
442  break;
443  }
444  }
445  }
446 
448  }
449 
450  /* Free up the resources we've used */
451  IMAPIFolder_Release(draft_folder);
453  IMsgStore_Release(msg_store);
454 
455  HeapFree(GetProcessHeap(), 0, subjectA);
456  HeapFree(GetProcessHeap(), 0, bodyA);
457 
458 logoff: ;
459  IMAPISession_Logoff(session, 0, 0, 0);
460  IMAPISession_Release(session);
461 
462 cleanup: ;
464  return retval;
465 }
466 
467 /**************************************************************************
468  * MAPISendMail (MAPI32.211)
469  *
470  * Send a mail.
471  *
472  * PARAMS
473  * session [I] Handle to a MAPI session.
474  * uiparam [I] Parent window handle.
475  * message [I] Pointer to a MAPIMessage structure.
476  * flags [I] Flags.
477  * reserved [I] Reserved, pass 0.
478  *
479  * RETURNS
480  * Success: SUCCESS_SUCCESS
481  * Failure: MAPI_E_FAILURE
482  *
483  */
486 {
488 
489  /* Check to see if we have a Simple MAPI provider loaded */
491  return mapiFunctions.MAPISendMail(session, uiparam, message, flags, reserved);
492 
493  /* Check if we have an Extended MAPI provider - if so, use our wrapper */
494  if (MAPIInitialize(NULL) == S_OK)
495  {
497  ULONG ret;
498 
499  ZeroMemory(&messageW, sizeof(MapiMessageW));
500 
501  /* Convert the entries we need to Unicode */
502  messageW.lpszSubject = convert_to_unicode(message->lpszSubject);
503  messageW.lpszNoteText = convert_to_unicode(message->lpszNoteText);
504  messageW.nFileCount = message->nFileCount;
505 
506  if (message->nFileCount && message->lpFiles)
507  {
508  lpMapiFileDescW filesW;
509  unsigned int i;
510 
511  filesW = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MapiFileDescW) * message->nFileCount);
512 
513  for (i = 0; i < message->nFileCount; i++)
514  {
515  filesW[i].lpszPathName = convert_to_unicode(message->lpFiles[i].lpszPathName);
516  filesW[i].lpszFileName = convert_to_unicode(message->lpFiles[i].lpszFileName);
517  }
518 
519  messageW.lpFiles = filesW;
520  }
521 
522  ret = sendmail_extended_mapi(session, uiparam, &messageW, flags);
523 
524  /* Now free everything we allocated */
525  if (message->nFileCount && message->lpFiles)
526  {
527  unsigned int i;
528 
529  for (i = 0; i < message->nFileCount; i++)
530  {
531  HeapFree(GetProcessHeap(), 0, messageW.lpFiles[i].lpszPathName);
532  HeapFree(GetProcessHeap(), 0, messageW.lpFiles[i].lpszFileName);
533  }
534 
535  HeapFree(GetProcessHeap(), 0, messageW.lpFiles);
536  }
537 
538  HeapFree(GetProcessHeap(), 0, messageW.lpszSubject);
539  HeapFree(GetProcessHeap(), 0, messageW.lpszNoteText);
540 
541  return ret;
542  }
543 
544  /* Display an error message since we apparently have no mail clients */
546  LoadStringW(hInstMAPI32, IDS_SEND_MAIL, msg_title, ARRAY_SIZE(msg_title));
547 
548  MessageBoxW((HWND) uiparam, error_msg, msg_title, MB_ICONEXCLAMATION);
549 
550  return MAPI_E_NOT_SUPPORTED;
551 }
552 
554 {
556 
557  if (!recipW)
558  return NULL;
559 
560  if (dest)
561  ret = dest;
562  else
564 
565  ret->ulRecipClass = recipW->ulRecipClass;
566  ret->lpszName = convert_from_unicode(recipW->lpszName);
567  ret->lpszAddress = convert_from_unicode(recipW->lpszAddress);
568  ret->ulEIDSize = recipW->ulEIDSize;
569  ret->lpEntryID = recipW->lpEntryID;
570 
571  return ret;
572 }
573 
574 /**************************************************************************
575  * MAPISendMailW (MAPI32.256)
576  *
577  * Send a mail.
578  *
579  * PARAMS
580  * session [I] Handle to a MAPI session.
581  * uiparam [I] Parent window handle.
582  * message [I] Pointer to a MAPIMessageW structure.
583  * flags [I] Flags.
584  * reserved [I] Reserved, pass 0.
585  *
586  * RETURNS
587  * Success: SUCCESS_SUCCESS
588  * Failure: MAPI_E_FAILURE
589  *
590  */
593 {
595 
596  /* Check to see if we have a Simple MAPI provider loaded */
598  return mapiFunctions.MAPISendMailW(session, uiparam, message, flags, reserved);
599 
600  /* Check if we have an Extended MAPI provider - if so, use our wrapper */
601  if (MAPIInitialize(NULL) == S_OK)
602  return sendmail_extended_mapi(session, uiparam, message, flags);
603 
605  {
606  MapiMessage messageA;
607  ULONG ret;
608 
611 
612  /* Convert to ANSI and send to MAPISendMail */
613  ZeroMemory(&messageA, sizeof(MapiMessage));
614 
615  messageA.lpszSubject = convert_from_unicode(message->lpszSubject);
616  messageA.lpszNoteText = convert_from_unicode(message->lpszNoteText);
617  messageA.lpszMessageType = convert_from_unicode(message->lpszMessageType);
618  messageA.lpszDateReceived = convert_from_unicode(message->lpszDateReceived);
619  messageA.lpszConversationID = convert_from_unicode(message->lpszConversationID);
620  messageA.flFlags = message->flFlags;
621  messageA.lpOriginator = convert_recipient_from_unicode(message->lpOriginator, NULL);
622  messageA.nRecipCount = message->nRecipCount;
623  messageA.nFileCount = message->nFileCount;
624 
625  if (message->nRecipCount && message->lpRecips)
626  {
627  lpMapiRecipDesc recipsA;
628  unsigned int i;
629 
630  recipsA = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MapiRecipDesc) * message->nRecipCount);
631 
632  for (i = 0; i < message->nRecipCount; i++)
633  {
634  convert_recipient_from_unicode(&message->lpRecips[i], &recipsA[i]);
635  }
636 
637  messageA.lpRecips = recipsA;
638  }
639 
640  if (message->nFileCount && message->lpFiles)
641  {
642  lpMapiFileDesc filesA;
643  unsigned int i;
644 
645  filesA = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MapiFileDesc) * message->nFileCount);
646 
647  for (i = 0; i < message->nFileCount; i++)
648  {
649  filesA[i].flFlags = message->lpFiles[i].flFlags;
650  filesA[i].nPosition = message->lpFiles[i].nPosition;
651  filesA[i].lpszPathName = convert_from_unicode(message->lpFiles[i].lpszPathName);
652  filesA[i].lpszFileName = convert_from_unicode(message->lpFiles[i].lpszFileName);
653  filesA[i].lpFileType = message->lpFiles[i].lpFileType;
654  }
655 
656  messageA.lpFiles = filesA;
657  }
658 
659  ret = mapiFunctions.MAPISendMail(session, uiparam, &messageA, flags, reserved);
660 
661  /* Now free everything we allocated */
662  if (message->lpOriginator)
663  {
664  HeapFree(GetProcessHeap(), 0, messageA.lpOriginator->lpszName);
666  HeapFree(GetProcessHeap(), 0, messageA.lpOriginator);
667  }
668 
669  if (message->nRecipCount && message->lpRecips)
670  {
671  unsigned int i;
672 
673  for (i = 0; i < message->nRecipCount; i++)
674  {
675  HeapFree(GetProcessHeap(), 0, messageA.lpRecips[i].lpszName);
676  HeapFree(GetProcessHeap(), 0, messageA.lpRecips[i].lpszAddress);
677  }
678 
679  HeapFree(GetProcessHeap(), 0, messageA.lpRecips);
680  }
681 
682  if (message->nFileCount && message->lpFiles)
683  {
684  unsigned int i;
685 
686  for (i = 0; i < message->nFileCount; i++)
687  {
688  HeapFree(GetProcessHeap(), 0, messageA.lpFiles[i].lpszPathName);
689  HeapFree(GetProcessHeap(), 0, messageA.lpFiles[i].lpszFileName);
690  }
691 
692  HeapFree(GetProcessHeap(), 0, messageA.lpFiles);
693  }
694 
695  HeapFree(GetProcessHeap(), 0, messageA.lpszSubject);
696  HeapFree(GetProcessHeap(), 0, messageA.lpszNoteText);
697  HeapFree(GetProcessHeap(), 0, messageA.lpszDateReceived);
699 
700  return ret;
701  }
702 
703  /* Display an error message since we apparently have no mail clients */
705  LoadStringW(hInstMAPI32, IDS_SEND_MAIL, msg_title, ARRAY_SIZE(msg_title));
706 
707  MessageBoxW((HWND) uiparam, error_msg, msg_title, MB_ICONEXCLAMATION);
708 
709  return MAPI_E_NOT_SUPPORTED;
710 }
711 
713  LPSTR filenames, ULONG reserved)
714 {
716  return mapiFunctions.MAPISendDocuments(uiparam, delim, paths, filenames, reserved);
717 
718  return MAPI_E_NOT_SUPPORTED;
719 }
LPSTR lpszName
Definition: mapi.h:71
GLenum attachment
Definition: glext.h:6295
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2327
#define IMAPIFolder_GetProps(p, a, b, c, d)
Definition: mapidefs.h:1128
ULONG ulEIDSize
Definition: mapi.h:83
#define KEEP_OPEN_READONLY
Definition: mapidefs.h:916
Definition: tftpd.h:59
#define TRUE
Definition: types.h:120
const char * tags[7 *8]
Definition: apphelp.c:213
#define CloseHandle
Definition: compat.h:398
Definition: fci.c:115
#define IDS_SEND_MAIL
Definition: res.h:28
static const WCHAR * error_msg[8]
Definition: odbccp32.c:63
#define WideCharToMultiByte
Definition: compat.h:101
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
LPSTR lpszPathName
Definition: mapi.h:45
#define PR_STORE_SUPPORT_MASK
Definition: mapitags.h:412
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
ULONG ulPropTag
Definition: mapidefs.h:408
#define PR_ENTRYID
Definition: mapitags.h:341
#define KEEP_OPEN_READWRITE
Definition: mapidefs.h:917
#define CP_ACP
Definition: compat.h:99
#define PR_MESSAGE_CLASS_A
Definition: mapitags.h:63
#define MAPI_E_UNICODE_NOT_SUPPORTED
Definition: mapi.h:153
#define WARN(fmt,...)
Definition: debug.h:111
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666
ULONG cb
Definition: mapidefs.h:289
static const WCHAR messageW[]
Definition: error.c:31
#define PR_SUBJECT_W
Definition: mapitags.h:99
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
#define MSGFLAG_UNSENT
Definition: mapidefs.h:1269
#define ZeroMemory
Definition: winbase.h:1635
#define MDB_NO_DIALOG
Definition: mapidefs.h:171
PWSTR lpszFileName
Definition: mapi.h:56
interface IStream * LPSTREAM
Definition: objfwd.h:10
#define PR_ACCESS
Definition: mapitags.h:355
unsigned short b
Definition: mapidefs.h:380
#define PR_SUBJECT_A
Definition: mapitags.h:100
VOID WINAPI FreeProws(LPSRowSet lpRowSet)
Definition: prop.c:689
lpMapiRecipDesc lpOriginator
Definition: mapi.h:96
char * LPSTR
Definition: xmlstorage.h:182
ULONG nPosition
Definition: mapi.h:44
const char * filename
Definition: ioapi.h:135
#define PR_RENDERING_POSITION
Definition: mapitags.h:475
#define MAPI_FORCE_UNICODE
Definition: mapi.h:181
#define lstrlenW
Definition: compat.h:407
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
LPWSTR lpszW
Definition: mapidefs.h:386
#define IMAPITable_QueryRows(p, a, b, c)
Definition: mapidefs.h:831
#define FILE_SHARE_READ
Definition: compat.h:125
#define IMAPITable_SetColumns(p, a, b)
Definition: mapidefs.h:819
PWSTR lpszName
Definition: mapi.h:81
uint32_t ULONG_PTR
Definition: typedefs.h:63
lpMapiFileDesc lpFiles
Definition: mapi.h:100
#define MB_ICONEXCLAMATION
Definition: winuser.h:779
#define IMsgStore_GetReceiveFolder(p, a, b, c, d, e)
Definition: mapidefs.h:990
LPSTR lpszAddress
Definition: mapi.h:72
#define IMAPIFolder_CreateMessage(p, a, b, c)
Definition: mapidefs.h:1144
#define PR_ATTACH_LONG_FILENAME_A
Definition: mapitags.h:468
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
MAPIFREEBUFFER MAPIFreeBuffer
Definition: mapi.h:206
#define MAPI_USE_DEFAULT
Definition: mapidefs.h:161
lpMapiRecipDesc lpRecips
Definition: mapi.h:98
LONG l
Definition: mapidefs.h:376
unsigned int BOOL
Definition: ntddk_ex.h:94
#define IMessage_CreateAttach(p, a, b, c, d)
Definition: mapidefs.h:1255
static LPUNKNOWN
Definition: ndr_ole.c:49
#define IMessage_GetProps(p, a, b, c, d)
Definition: mapidefs.h:1243
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat token
Definition: glfuncs.h:210
#define debugstr_w
Definition: kernel32.h:32
#define PR_ATTACH_FILENAME_W
Definition: mapitags.h:463
MAPIUNINITIALIZE MAPIUninitialize
Definition: mapix.h:84
#define ATTACH_BY_VALUE
Definition: mapidefs.h:1324
r reserved
Definition: btrfs.c:2673
ULONG_PTR LHANDLE
Definition: mapi.h:30
const WCHAR * str
LPMAPISENDDOCUMENTS MAPISendDocuments
Definition: util.h:45
smooth NULL
Definition: ftsmooth.c:416
#define PR_ATTACH_FILENAME_A
Definition: mapitags.h:464
LPMAPISENDMAIL MAPISendMail
Definition: util.h:43
#define IMAPIFolder_Release(p)
Definition: mapidefs.h:1124
MAPILOGONEX MAPILogonEx
Definition: mapix.h:92
#define IMessage_Release(p)
Definition: mapidefs.h:1239
#define OPEN_EXISTING
Definition: compat.h:426
#define MAPI_E_LOGIN_FAILURE
Definition: mapi.h:129
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define IMAPISession_ShowForm(p, a, b, c, d, e, f, g, h, i, j, k)
Definition: mapix.h:178
#define PR_BODY_A
Definition: mapitags.h:236
#define PR_IPM_DRAFTS_ENTRYID
Definition: mapitags.h:455
DECLSPEC_HIDDEN HINSTANCE hInstMAPI32
Definition: mapi32_main.c:37
LPSTR lpszFileName
Definition: mapi.h:46
#define MAPI_E_NOT_SUPPORTED
Definition: mapi.h:152
LPSTR lpszNoteText
Definition: mapi.h:91
#define TRACE(s)
Definition: solgame.cpp:4
union _PV Value
Definition: mapidefs.h:410
#define IMessage_SaveChanges(p, a)
Definition: mapidefs.h:1242
#define IAttach_Release(p)
Definition: mapidefs.h:1306
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
SBinary bin
Definition: mapidefs.h:385
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
ULONG ul
Definition: mapidefs.h:377
#define PR_MSG_STATUS
Definition: mapitags.h:325
#define WINAPI
Definition: msvc.h:8
const char file[]
Definition: icontest.c:11
#define MSGFLAG_FROMME
Definition: mapidefs.h:1271
FLAGS flFlags
Definition: mapi.h:95
ULONG WINAPI MAPISendDocuments(ULONG_PTR uiparam, LPSTR delim, LPSTR paths, LPSTR filenames, ULONG reserved)
Definition: sendmail.c:712
unsigned long DWORD
Definition: ntddk_ex.h:95
static CHAR filenameA[MAX_PATH]
Definition: storage32.c:42
#define PR_ATTACH_DATA_BIN
Definition: mapitags.h:458
#define PR_BODY_W
Definition: mapitags.h:235
LPSTR lpszMessageType
Definition: mapi.h:92
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define IMessage_OpenProperty(p, a, b, c, d, e)
Definition: mapidefs.h:1245
GLbitfield flags
Definition: glext.h:7161
#define PR_SENTMAIL_ENTRYID
Definition: mapitags.h:313
ULONG ulRecipClass
Definition: mapi.h:80
int ret
PVOID lpEntryID
Definition: mapi.h:84
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
#define IMessage_SetProps(p, a, b, c)
Definition: mapidefs.h:1246
LPSTR lpszConversationID
Definition: mapi.h:94
Definition: parse.h:22
GLuint GLuint stream
Definition: glext.h:7522
MAPI_FUNCTIONS mapiFunctions
Definition: util.c:50
#define IDS_NO_MAPI_CLIENT
Definition: res.h:27
GLenum GLsizei len
Definition: glext.h:6722
unsigned char BYTE
Definition: mem.h:68
LPBYTE lpb
Definition: mapidefs.h:290
#define PR_ATTACH_LONG_FILENAME_W
Definition: mapitags.h:467
#define GENERIC_READ
Definition: compat.h:124
static lpMapiRecipDesc convert_recipient_from_unicode(lpMapiRecipDescW recipW, lpMapiRecipDesc dest)
Definition: sendmail.c:553
#define IMAPISession_GetMsgStoresTable(p, a, b)
Definition: mapix.h:161
#define PR_DEFAULT_STORE
Definition: mapitags.h:411
#define IMAPISession_Release(p)
Definition: mapix.h:158
static LPSTR convert_from_unicode(LPCWSTR wstr)
Definition: sendmail.c:53
#define IMAPISession_OpenMsgStore(p, a, b, c, d, e, f)
Definition: mapix.h:162
GLsizei const GLuint * paths
Definition: glext.h:11717
LPSTR lpszA
Definition: mapidefs.h:384
#define IMsgStore_OpenEntry(p, a, b, c, d, e, f)
Definition: mapidefs.h:988
ULONG flFlags
Definition: mapi.h:43
ULONG nFileCount
Definition: mapi.h:99
#define S_OK
Definition: intsafe.h:59
#define PR_ATTACH_SIZE
Definition: mapitags.h:335
LPVOID lpFileType
Definition: mapi.h:47
WINE_DEFAULT_DEBUG_CHANNEL(mapi)
#define IMAPISession_PrepareForm(p, a, b, c)
Definition: mapix.h:180
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
#define ARRAY_SIZE(a)
Definition: main.h:24
#define MAPI_EXTENDED
Definition: mapi.h:165
ULONG cRows
Definition: mapidefs.h:424
#define READ_BUF_SIZE
Definition: sendmail.c:49
#define MAPI_E_USER_ABORT
Definition: mapi.h:126
ULONG WINAPI MAPISendMailW(LHANDLE session, ULONG_PTR uiparam, lpMapiMessageW message, FLAGS flags, ULONG reserved)
Definition: sendmail.c:591
static LPWSTR convert_to_unicode(LPSTR str)
Definition: sendmail.c:68
#define MAPI_NEW_SESSION
Definition: mapi.h:162
#define PR_ATTACH_METHOD
Definition: mapitags.h:466
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define MultiByteToWideChar
Definition: compat.h:100
#define PR_MESSAGE_FLAGS
Definition: mapitags.h:310
#define CreateFileW
Definition: compat.h:400
#define msg(x)
Definition: auth_time.c:54
#define MAPI_CREATE
Definition: mapidefs.h:154
#define SUCCESS_SUCCESS
Definition: mapi.h:122
#define MAPI_MODIFY
Definition: mapidefs.h:153
static const WCHAR props[]
Definition: wbemdisp.c:288
#define IAttach_SetProps(p, a, b, c)
Definition: mapidefs.h:1313
LPSPropValue lpProps
Definition: mapidefs.h:418
#define STORE_UNICODE_OK
Definition: sendmail.c:51
MAPIINITIALIZE MAPIInitialize
Definition: mapix.h:80
PWSTR lpszPathName
Definition: mapi.h:55
unsigned int ULONG
Definition: retypes.h:1
#define IMAPISession_Logoff(p, a, b, c)
Definition: mapix.h:175
char * cleanup(char *str)
Definition: wpickclick.c:99
#define MAPI_BEST_ACCESS
Definition: mapidefs.h:765
ULONG nRecipCount
Definition: mapi.h:97
static char * dest
Definition: rtl.c:135
PWSTR lpszAddress
Definition: mapi.h:82
GLfloat GLfloat p
Definition: glext.h:8902
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define IMsgStore_GetProps(p, a, b, c, d)
Definition: mapidefs.h:975
ULONG FLAGS
Definition: mapi.h:36
ULONG WINAPI MAPISendMail(LHANDLE session, ULONG_PTR uiparam, lpMapiMessage message, FLAGS flags, ULONG reserved)
Definition: sendmail.c:484
#define IAttach_SaveChanges(p, a)
Definition: mapidefs.h:1309
LPSTR lpszSubject
Definition: mapi.h:90
#define MAPI_E_FAILURE
Definition: mapi.h:127
BOOL WINAPI ReadFile(IN HANDLE hFile, IN LPVOID lpBuffer, IN DWORD nNumberOfBytesToRead, OUT LPDWORD lpNumberOfBytesRead OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:123
LPSTR lpszDateReceived
Definition: mapi.h:93
#define IMsgStore_Release(p)
Definition: mapidefs.h:971
#define IAttach_OpenProperty(p, a, b, c, d, e)
Definition: mapidefs.h:1312
LPMAPISENDMAILW MAPISendMailW
Definition: util.h:44
SRow aRow[MAPI_DIM]
Definition: mapidefs.h:425
static ULONG sendmail_extended_mapi(LHANDLE mapi_session, ULONG_PTR uiparam, lpMapiMessageW message, FLAGS flags)
Definition: sendmail.c:87
#define HeapFree(x, y, z)
Definition: compat.h:394
#define PR_IPM_OUTBOX_ENTRYID
Definition: mapitags.h:423
#define MAPI_E_USER_CANCEL
Definition: mapicode.h:102
#define SizedSPropTagArray(n, id)
Definition: mapidefs.h:276
_CRTIMP int __cdecl read(_In_ int _FileHandle, _Out_writes_bytes_(_MaxCharCount) void *_DstBuf, _In_ unsigned int _MaxCharCount)
Definition: fci.c:126
Definition: ps.c:97
#define IMAPITable_Release(p)
Definition: mapidefs.h:813