shlwapi: Always close find handle (Coverity).
[wine/multimedia.git] / dlls / winemapi / main.c
blob0627aa2993bbaa4f7a5563e1c9cc1e310f13a312
1 /*
2 * Wine MAPI provider
4 * Copyright 2009 Owen Rudge for CodeWeavers
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.
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.
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
21 #include <stdarg.h>
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winerror.h"
26 #include "objbase.h"
27 #include "mapidefs.h"
28 #include "mapi.h"
29 #include "mapix.h"
30 #include "wine/debug.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(winemapi);
34 /***********************************************************************
35 * DllMain (MAPI32.init)
37 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
39 TRACE("(%p,%d,%p)\n", hinstDLL, fdwReason, fImpLoad);
40 return TRUE;
43 ULONG 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)
47 FIXME("(stub)\n");
48 return MAPI_E_NOT_SUPPORTED;
51 ULONG WINAPI MAPIDeleteMail(LHANDLE session, ULONG_PTR uiparam, LPSTR msg_id,
52 FLAGS flags, ULONG reserved)
54 FIXME("(stub)\n");
55 return MAPI_E_NOT_SUPPORTED;
58 ULONG WINAPI MAPIDetails(LHANDLE session, ULONG_PTR uiparam, lpMapiRecipDesc recip,
59 FLAGS flags, ULONG reserved)
61 FIXME("(stub)\n");
62 return MAPI_E_NOT_SUPPORTED;
65 ULONG WINAPI MAPIFindNext(LHANDLE session, ULONG_PTR uiparam, LPSTR msg_type,
66 LPSTR seed_msg_id, FLAGS flags, ULONG reserved, LPSTR msg_id)
68 FIXME("(stub)\n");
69 return MAPI_E_NOT_SUPPORTED;
72 ULONG WINAPI MAPILogon(ULONG_PTR uiparam, LPSTR profile, LPSTR password,
73 FLAGS flags, ULONG reserved, LPLHANDLE session)
75 TRACE("(0x%08lx %s %p 0x%08x 0x%08x %p)\n", uiparam,
76 debugstr_a(profile), password, flags, reserved, session);
78 if (session)
79 *session = 1;
81 return SUCCESS_SUCCESS;
84 ULONG WINAPI MAPILogoff(LHANDLE session, ULONG_PTR uiparam, FLAGS flags,
85 ULONG reserved)
87 TRACE("(0x%08lx 0x%08lx 0x%08x 0x%08x)\n", session,
88 uiparam, flags, reserved);
90 return SUCCESS_SUCCESS;
93 ULONG WINAPI MAPIReadMail(LHANDLE session, ULONG_PTR uiparam, LPSTR msg_id,
94 FLAGS flags, ULONG reserved, lpMapiMessage msg)
96 FIXME("(stub)\n");
97 return MAPI_E_NOT_SUPPORTED;
100 ULONG WINAPI MAPIResolveName(LHANDLE session, ULONG_PTR uiparam, LPSTR name,
101 FLAGS flags, ULONG reserved, lpMapiRecipDesc *recip)
103 static const char smtp[] = "SMTP:";
105 SCODE scode;
106 char *p;
108 TRACE("(0x%08lx 0x%08lx %s 0x%08x 0x%08x %p)\n", session, uiparam,
109 debugstr_a(name), flags, reserved, recip);
111 if (!name || !strlen(name))
112 return MAPI_E_FAILURE;
114 scode = MAPIAllocateBuffer(sizeof(**recip) + sizeof(smtp) + strlen(name),
115 (LPVOID *)recip);
116 if (scode != S_OK)
117 return MAPI_E_INSUFFICIENT_MEMORY;
119 ZeroMemory(*recip, sizeof(**recip));
120 p = (char *)(*recip + 1);
121 strcpy(p, smtp);
122 strcpy(p + sizeof(smtp) - 1, name);
124 (*recip)->ulRecipClass = MAPI_TO;
125 (*recip)->lpszName = p + sizeof(smtp) - 1;
126 (*recip)->lpszAddress = p;
127 return SUCCESS_SUCCESS;
130 ULONG WINAPI MAPISaveMail(LHANDLE session, ULONG_PTR uiparam, lpMapiMessage msg,
131 FLAGS flags, ULONG reserved, LPSTR msg_id)
133 FIXME("(stub)\n");
134 return MAPI_E_NOT_SUPPORTED;