blob: 0627aa2993bbaa4f7a5563e1c9cc1e310f13a312 [file] [log] [blame]
Owen Rudge38cb7be2009-12-16 10:44:28 -06001/*
2 * Wine MAPI provider
3 *
4 * Copyright 2009 Owen Rudge for CodeWeavers
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21#include <stdarg.h>
22
23#include "windef.h"
24#include "winbase.h"
25#include "winerror.h"
26#include "objbase.h"
Owen Rudge44784352009-12-16 11:22:34 -060027#include "mapidefs.h"
Owen Rudge38cb7be2009-12-16 10:44:28 -060028#include "mapi.h"
Alexander Morozove5dee7d2011-01-13 16:56:24 +030029#include "mapix.h"
Owen Rudge38cb7be2009-12-16 10:44:28 -060030#include "wine/debug.h"
31
32WINE_DEFAULT_DEBUG_CHANNEL(winemapi);
33
34/***********************************************************************
35 * DllMain (MAPI32.init)
36 */
37BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
38{
39 TRACE("(%p,%d,%p)\n", hinstDLL, fdwReason, fImpLoad);
40 return TRUE;
41}
Owen Rudge44784352009-12-16 11:22:34 -060042
43ULONG WINAPI MAPIAddress(LHANDLE session, ULONG_PTR uiparam, LPSTR caption,
44 ULONG editfields, LPSTR labels, ULONG nRecips, lpMapiRecipDesc lpRecips,
45 FLAGS flags, ULONG reserved, LPULONG newRecips, lpMapiRecipDesc * lppNewRecips)
46{
Francois Gougetc61732c2010-03-20 15:23:18 +010047 FIXME("(stub)\n");
Owen Rudge44784352009-12-16 11:22:34 -060048 return MAPI_E_NOT_SUPPORTED;
49}
50
51ULONG WINAPI MAPIDeleteMail(LHANDLE session, ULONG_PTR uiparam, LPSTR msg_id,
52 FLAGS flags, ULONG reserved)
53{
Francois Gougetc61732c2010-03-20 15:23:18 +010054 FIXME("(stub)\n");
Owen Rudge44784352009-12-16 11:22:34 -060055 return MAPI_E_NOT_SUPPORTED;
56}
57
58ULONG WINAPI MAPIDetails(LHANDLE session, ULONG_PTR uiparam, lpMapiRecipDesc recip,
59 FLAGS flags, ULONG reserved)
60{
Francois Gougetc61732c2010-03-20 15:23:18 +010061 FIXME("(stub)\n");
Owen Rudge44784352009-12-16 11:22:34 -060062 return MAPI_E_NOT_SUPPORTED;
63}
64
65ULONG WINAPI MAPIFindNext(LHANDLE session, ULONG_PTR uiparam, LPSTR msg_type,
66 LPSTR seed_msg_id, FLAGS flags, ULONG reserved, LPSTR msg_id)
67{
Francois Gougetc61732c2010-03-20 15:23:18 +010068 FIXME("(stub)\n");
Owen Rudge44784352009-12-16 11:22:34 -060069 return MAPI_E_NOT_SUPPORTED;
70}
71
72ULONG WINAPI MAPILogon(ULONG_PTR uiparam, LPSTR profile, LPSTR password,
73 FLAGS flags, ULONG reserved, LPLHANDLE session)
74{
75 TRACE("(0x%08lx %s %p 0x%08x 0x%08x %p)\n", uiparam,
76 debugstr_a(profile), password, flags, reserved, session);
77
78 if (session)
79 *session = 1;
80
81 return SUCCESS_SUCCESS;
82}
83
84ULONG WINAPI MAPILogoff(LHANDLE session, ULONG_PTR uiparam, FLAGS flags,
85 ULONG reserved)
86{
87 TRACE("(0x%08lx 0x%08lx 0x%08x 0x%08x)\n", session,
88 uiparam, flags, reserved);
89
90 return SUCCESS_SUCCESS;
91}
92
93ULONG WINAPI MAPIReadMail(LHANDLE session, ULONG_PTR uiparam, LPSTR msg_id,
94 FLAGS flags, ULONG reserved, lpMapiMessage msg)
95{
Francois Gougetc61732c2010-03-20 15:23:18 +010096 FIXME("(stub)\n");
Owen Rudge44784352009-12-16 11:22:34 -060097 return MAPI_E_NOT_SUPPORTED;
98}
99
100ULONG WINAPI MAPIResolveName(LHANDLE session, ULONG_PTR uiparam, LPSTR name,
101 FLAGS flags, ULONG reserved, lpMapiRecipDesc *recip)
102{
Alexander Morozove5dee7d2011-01-13 16:56:24 +0300103 static const char smtp[] = "SMTP:";
104
105 SCODE scode;
106 char *p;
107
108 TRACE("(0x%08lx 0x%08lx %s 0x%08x 0x%08x %p)\n", session, uiparam,
109 debugstr_a(name), flags, reserved, recip);
110
111 if (!name || !strlen(name))
112 return MAPI_E_FAILURE;
113
114 scode = MAPIAllocateBuffer(sizeof(**recip) + sizeof(smtp) + strlen(name),
115 (LPVOID *)recip);
116 if (scode != S_OK)
117 return MAPI_E_INSUFFICIENT_MEMORY;
118
119 ZeroMemory(*recip, sizeof(**recip));
120 p = (char *)(*recip + 1);
121 strcpy(p, smtp);
122 strcpy(p + sizeof(smtp) - 1, name);
123
124 (*recip)->ulRecipClass = MAPI_TO;
125 (*recip)->lpszName = p + sizeof(smtp) - 1;
126 (*recip)->lpszAddress = p;
127 return SUCCESS_SUCCESS;
Owen Rudge44784352009-12-16 11:22:34 -0600128}
129
130ULONG WINAPI MAPISaveMail(LHANDLE session, ULONG_PTR uiparam, lpMapiMessage msg,
131 FLAGS flags, ULONG reserved, LPSTR msg_id)
132{
Francois Gougetc61732c2010-03-20 15:23:18 +0100133 FIXME("(stub)\n");
Owen Rudge44784352009-12-16 11:22:34 -0600134 return MAPI_E_NOT_SUPPORTED;
135}