ReactOS 0.4.15-dev-7931-gfd331f1
mapi32_main.c
Go to the documentation of this file.
1/*
2 * MAPI basics
3 *
4 * Copyright 2001, 2009 CodeWeavers Inc.
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"
27#include "initguid.h"
28#include "mapix.h"
29#include "mapiform.h"
30#include "mapi.h"
31#include "wine/debug.h"
32#include "util.h"
33
35
38
39/***********************************************************************
40 * DllMain (MAPI32.init)
41 */
43{
44 TRACE("(%p,%d,%p)\n", hinstDLL, fdwReason, fImpLoad);
45
46 switch (fdwReason)
47 {
49 hInstMAPI32 = hinstDLL;
52 break;
54 if (fImpLoad) break;
55 TRACE("DLL_PROCESS_DETACH: %d objects remaining\n", MAPI_ObjectCount);
57 break;
58 }
59 return TRUE;
60}
61
62/***********************************************************************
63 * DllGetClassObject (MAPI32.27)
64 */
66{
67 if (mapiFunctions.DllGetClassObject)
68 {
69 HRESULT ret = mapiFunctions.DllGetClassObject(rclsid, iid, ppv);
70
71 TRACE("ret: %x\n", ret);
72 return ret;
73 }
74
75 FIXME("\n\tCLSID:\t%s,\n\tIID:\t%s\n", debugstr_guid(rclsid), debugstr_guid(iid));
76
77 *ppv = NULL;
79}
80
81/***********************************************************************
82 * DllCanUnloadNow (MAPI32.28)
83 *
84 * Determine if this dll can be unloaded from the callers address space.
85 *
86 * PARAMS
87 * None.
88 *
89 * RETURNS
90 * S_OK, if the dll can be unloaded,
91 * S_FALSE, otherwise.
92 */
94{
96
97 if (mapiFunctions.DllCanUnloadNow)
98 {
99 ret = mapiFunctions.DllCanUnloadNow();
100 TRACE("(): provider returns %d\n", ret);
101 }
102
103 return MAPI_ObjectCount == 0 ? ret : S_FALSE;
104}
105
106/***********************************************************************
107 * MAPIInitialize
108 *
109 * Initialises the MAPI library. In our case, we pass through to the
110 * loaded Extended MAPI provider.
111 */
113{
114 TRACE("(%p)\n", init);
115
118
120}
121
122/***********************************************************************
123 * MAPILogon
124 *
125 * Logs on to a MAPI provider. If available, we pass this through to a
126 * Simple MAPI provider. Otherwise, we maintain basic functionality
127 * ourselves.
128 */
131{
132 TRACE("(0x%08lx %s %p 0x%08x 0x%08x %p)\n", uiparam,
134
137
138 if (session) *session = 1;
139 return SUCCESS_SUCCESS;
140}
141
142/***********************************************************************
143 * MAPILogoff
144 *
145 * Logs off from a MAPI provider. If available, we pass this through to a
146 * Simple MAPI provider. Otherwise, we maintain basic functionality
147 * ourselves.
148 */
151{
152 TRACE("(0x%08lx 0x%08lx 0x%08x 0x%08x)\n", session,
153 uiparam, flags, reserved);
154
156 return mapiFunctions.MAPILogoff(session, uiparam, flags, reserved);
157
158 return SUCCESS_SUCCESS;
159}
160
161/***********************************************************************
162 * MAPILogonEx
163 *
164 * Logs on to a MAPI provider. If available, we pass this through to an
165 * Extended MAPI provider. Otherwise, we return an error.
166 */
169{
170 TRACE("(0x%08lx %s %p 0x%08x %p)\n", uiparam,
172
175
176 return E_FAIL;
177}
178
180{
181 if (mapiFunctions.MAPIOpenLocalFormContainer)
182 return mapiFunctions.MAPIOpenLocalFormContainer(ppfcnt);
183
184 FIXME("(%p) Stub\n", ppfcnt);
185 return E_FAIL;
186}
187
188/***********************************************************************
189 * MAPIUninitialize
190 *
191 * Uninitialises the MAPI library. In our case, we pass through to the
192 * loaded Extended MAPI provider.
193 *
194 */
196{
197 TRACE("()\n");
198
199 /* Try to uninitialise the Extended MAPI library */
202}
203
205{
206 if (mapiFunctions.MAPIAdminProfiles)
207 return mapiFunctions.MAPIAdminProfiles(ulFlags, lppProfAdmin);
208
209 FIXME("(%u, %p): stub\n", ulFlags, lppProfAdmin);
210 *lppProfAdmin = NULL;
211 return E_FAIL;
212}
213
215 ULONG editfields, LPSTR labels, ULONG nRecips, lpMapiRecipDesc lpRecips,
216 FLAGS flags, ULONG reserved, LPULONG newRecips, lpMapiRecipDesc * lppNewRecips)
217{
219 return mapiFunctions.MAPIAddress(session, uiparam, caption, editfields, labels,
220 nRecips, lpRecips, flags, reserved, newRecips, lppNewRecips);
221
223}
224
227{
230
232}
233
236{
238 return mapiFunctions.MAPIDetails(session, uiparam, recip, flags, reserved);
239
241}
242
244 LPSTR seed_msg_id, FLAGS flags, ULONG reserved, LPSTR msg_id)
245{
247 return mapiFunctions.MAPIFindNext(session, uiparam, msg_type, seed_msg_id, flags, reserved, msg_id);
248
250}
251
254{
257
259}
260
263{
265 return mapiFunctions.MAPIResolveName(session, uiparam, name, flags, reserved, recip);
266
268}
269
272{
275
277}
#define msg(x)
Definition: auth_time.c:54
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
DWORD LPVOID fImpLoad
Definition: misc.cpp:155
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_FAIL
Definition: ddrawi.h:102
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define DECLSPEC_HIDDEN
Definition: precomp.h:8
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define DLL_PROCESS_DETACH
Definition: compat.h:130
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
void unload_mapi_providers(void)
Definition: util.c:1135
void load_mapi_providers(void)
Definition: util.c:1023
MAPI_FUNCTIONS mapiFunctions
Definition: util.c:49
r reserved
Definition: btrfs.c:3006
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define debugstr_guid
Definition: kernel32.h:35
#define debugstr_a
Definition: kernel32.h:31
#define profile
Definition: kernel32.h:12
#define debugstr_w
Definition: kernel32.h:32
DECLSPEC_HIDDEN LONG MAPI_ObjectCount
Definition: mapi32_main.c:36
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
Definition: mapi32_main.c:42
DECLSPEC_HIDDEN HINSTANCE hInstMAPI32
Definition: mapi32_main.c:37
HRESULT WINAPI DllCanUnloadNow(void)
Definition: mapi32_main.c:93
VOID WINAPI MAPIUninitialize(void)
Definition: mapi32_main.c:195
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
Definition: mapi32_main.c:65
HRESULT WINAPI MAPIOpenLocalFormContainer(LPVOID *ppfcnt)
Definition: mapi32_main.c:179
MAPILOGON MAPILogon
Definition: mapi.h:215
MAPIREADMAIL MAPIReadMail
Definition: mapi.h:219
MAPIADDRESS MAPIAddress
Definition: mapi.h:188
#define MAPI_E_NOT_SUPPORTED
Definition: mapi.h:152
MAPILOGOFF MAPILogoff
Definition: mapi.h:211
MAPIDETAILS MAPIDetails
Definition: mapi.h:196
MAPIRESOLVENAME MAPIResolveName
Definition: mapi.h:223
#define SUCCESS_SUCCESS
Definition: mapi.h:122
MAPIDELETEMAIL MAPIDeleteMail
Definition: mapi.h:192
MAPISAVEMAIL MAPISaveMail
Definition: mapi.h:227
ULONG_PTR LHANDLE
Definition: mapi.h:30
ULONG * LPULONG
Definition: mapi.h:38
ULONG FLAGS
Definition: mapi.h:36
ULONG_PTR * LPLHANDLE
Definition: mapi.h:30
MAPIFINDNEXT MAPIFindNext
Definition: mapi.h:200
#define MAPI_E_NOT_INITIALIZED
Definition: mapicode.h:77
struct IMAPISession * LPMAPISESSION
Definition: mapix.h:35
IProfAdmin * LPPROFADMIN
Definition: mapix.h:32
MAPIADMINPROFILES MAPIAdminProfiles
Definition: mapix.h:111
MAPIINITIALIZE MAPIInitialize
Definition: mapix.h:80
MAPILOGONEX MAPILogonEx
Definition: mapix.h:92
msg_id
Definition: edit.c:43
static WCHAR password[]
Definition: url.c:33
long LONG
Definition: pedump.c:60
#define REFIID
Definition: guiddef.h:118
#define REFCLSID
Definition: guiddef.h:117
msg_type
Definition: rpc_msg.h:77
#define TRACE(s)
Definition: solgame.cpp:4
LPMAPILOGOFF MAPILogoff
Definition: util.h:37
LPMAPILOGON MAPILogon
Definition: util.h:38
LPMAPILOGONEX MAPILogonEx
Definition: util.h:39
LPMAPIDELETEMAIL MAPIDeleteMail
Definition: util.h:33
LPMAPIINITIALIZE MAPIInitialize
Definition: util.h:36
LPMAPISAVEMAIL MAPISaveMail
Definition: util.h:42
LPMAPIFINDNEXT MAPIFindNext
Definition: util.h:35
LPMAPIRESOLVENAME MAPIResolveName
Definition: util.h:41
LPMAPIREADMAIL MAPIReadMail
Definition: util.h:40
LPMAPIADDRESS MAPIAddress
Definition: util.h:32
LPMAPIUNINITIALIZE MAPIUninitialize
Definition: util.h:46
LPMAPIDETAILS MAPIDetails
Definition: util.h:34
Definition: name.c:39
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59
int ret
#define WINAPI
Definition: msvc.h:6
#define S_FALSE
Definition: winerror.h:2357
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:2663
static int init
Definition: wintirpc.c:33
char * LPSTR
Definition: xmlstorage.h:182
WCHAR * LPWSTR
Definition: xmlstorage.h:184