Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenmapi32_main.c
Go to the documentation of this file.
00001 /* 00002 * MAPI basics 00003 * 00004 * Copyright 2001, 2009 CodeWeavers Inc. 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 00019 */ 00020 00021 #include <stdarg.h> 00022 00023 #include "windef.h" 00024 #include "winbase.h" 00025 #include "winerror.h" 00026 #include "objbase.h" 00027 #include "initguid.h" 00028 #include "mapix.h" 00029 #include "mapiform.h" 00030 #include "mapi.h" 00031 #include "wine/debug.h" 00032 #include "util.h" 00033 00034 WINE_DEFAULT_DEBUG_CHANNEL(mapi); 00035 00036 LONG MAPI_ObjectCount = 0; 00037 HINSTANCE hInstMAPI32; 00038 00039 /*********************************************************************** 00040 * DllMain (MAPI32.init) 00041 */ 00042 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad) 00043 { 00044 TRACE("(%p,%d,%p)\n", hinstDLL, fdwReason, fImpLoad); 00045 00046 switch (fdwReason) 00047 { 00048 case DLL_PROCESS_ATTACH: 00049 hInstMAPI32 = hinstDLL; 00050 DisableThreadLibraryCalls(hinstDLL); 00051 load_mapi_providers(); 00052 break; 00053 case DLL_PROCESS_DETACH: 00054 TRACE("DLL_PROCESS_DETACH: %d objects remaining\n", MAPI_ObjectCount); 00055 unload_mapi_providers(); 00056 break; 00057 } 00058 return TRUE; 00059 } 00060 00061 /*********************************************************************** 00062 * DllGetClassObject (MAPI32.27) 00063 */ 00064 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv) 00065 { 00066 if (mapiFunctions.DllGetClassObject) 00067 { 00068 HRESULT ret = mapiFunctions.DllGetClassObject(rclsid, iid, ppv); 00069 00070 TRACE("ret: %x\n", ret); 00071 return ret; 00072 } 00073 00074 FIXME("\n\tCLSID:\t%s,\n\tIID:\t%s\n", debugstr_guid(rclsid), debugstr_guid(iid)); 00075 00076 *ppv = NULL; 00077 return CLASS_E_CLASSNOTAVAILABLE; 00078 } 00079 00080 /*********************************************************************** 00081 * DllCanUnloadNow (MAPI32.28) 00082 * 00083 * Determine if this dll can be unloaded from the callers address space. 00084 * 00085 * PARAMS 00086 * None. 00087 * 00088 * RETURNS 00089 * S_OK, if the dll can be unloaded, 00090 * S_FALSE, otherwise. 00091 */ 00092 HRESULT WINAPI DllCanUnloadNow(void) 00093 { 00094 HRESULT ret = S_OK; 00095 00096 if (mapiFunctions.DllCanUnloadNow) 00097 { 00098 ret = mapiFunctions.DllCanUnloadNow(); 00099 TRACE("(): provider returns %d\n", ret); 00100 } 00101 00102 return MAPI_ObjectCount == 0 ? ret : S_FALSE; 00103 } 00104 00105 /*********************************************************************** 00106 * MAPIInitialize 00107 * 00108 * Initialises the MAPI library. In our case, we pass through to the 00109 * loaded Extended MAPI provider. 00110 */ 00111 HRESULT WINAPI MAPIInitialize(LPVOID init) 00112 { 00113 TRACE("(%p)\n", init); 00114 00115 if (mapiFunctions.MAPIInitialize) 00116 return mapiFunctions.MAPIInitialize(init); 00117 00118 return MAPI_E_NOT_INITIALIZED; 00119 } 00120 00121 /*********************************************************************** 00122 * MAPILogon 00123 * 00124 * Logs on to a MAPI provider. If available, we pass this through to a 00125 * Simple MAPI provider. Otherwise, we maintain basic functionality 00126 * ourselves. 00127 */ 00128 ULONG WINAPI MAPILogon(ULONG_PTR uiparam, LPSTR profile, LPSTR password, 00129 FLAGS flags, ULONG reserved, LPLHANDLE session) 00130 { 00131 TRACE("(0x%08lx %s %p 0x%08x 0x%08x %p)\n", uiparam, 00132 debugstr_a(profile), password, flags, reserved, session); 00133 00134 if (mapiFunctions.MAPILogon) 00135 return mapiFunctions.MAPILogon(uiparam, profile, password, flags, reserved, session); 00136 00137 if (session) *session = 1; 00138 return SUCCESS_SUCCESS; 00139 } 00140 00141 /*********************************************************************** 00142 * MAPILogoff 00143 * 00144 * Logs off from a MAPI provider. If available, we pass this through to a 00145 * Simple MAPI provider. Otherwise, we maintain basic functionality 00146 * ourselves. 00147 */ 00148 ULONG WINAPI MAPILogoff(LHANDLE session, ULONG_PTR uiparam, FLAGS flags, 00149 ULONG reserved ) 00150 { 00151 TRACE("(0x%08lx 0x%08lx 0x%08x 0x%08x)\n", session, 00152 uiparam, flags, reserved); 00153 00154 if (mapiFunctions.MAPILogoff) 00155 return mapiFunctions.MAPILogoff(session, uiparam, flags, reserved); 00156 00157 return SUCCESS_SUCCESS; 00158 } 00159 00160 /*********************************************************************** 00161 * MAPILogonEx 00162 * 00163 * Logs on to a MAPI provider. If available, we pass this through to an 00164 * Extended MAPI provider. Otherwise, we return an error. 00165 */ 00166 HRESULT WINAPI MAPILogonEx(ULONG_PTR uiparam, LPWSTR profile, 00167 LPWSTR password, ULONG flags, LPMAPISESSION *session) 00168 { 00169 TRACE("(0x%08lx %s %p 0x%08x %p)\n", uiparam, 00170 debugstr_w(profile), password, flags, session); 00171 00172 if (mapiFunctions.MAPILogonEx) 00173 return mapiFunctions.MAPILogonEx(uiparam, profile, password, flags, session); 00174 00175 return E_FAIL; 00176 } 00177 00178 HRESULT WINAPI MAPIOpenLocalFormContainer(LPVOID *ppfcnt) 00179 { 00180 if (mapiFunctions.MAPIOpenLocalFormContainer) 00181 return mapiFunctions.MAPIOpenLocalFormContainer(ppfcnt); 00182 00183 FIXME("(%p) Stub\n", ppfcnt); 00184 return E_FAIL; 00185 } 00186 00187 /*********************************************************************** 00188 * MAPIUninitialize 00189 * 00190 * Uninitialises the MAPI library. In our case, we pass through to the 00191 * loaded Extended MAPI provider. 00192 * 00193 */ 00194 VOID WINAPI MAPIUninitialize(void) 00195 { 00196 TRACE("()\n"); 00197 00198 /* Try to uninitialise the Extended MAPI library */ 00199 if (mapiFunctions.MAPIUninitialize) 00200 mapiFunctions.MAPIUninitialize(); 00201 } 00202 00203 HRESULT WINAPI MAPIAdminProfiles(ULONG ulFlags, LPPROFADMIN *lppProfAdmin) 00204 { 00205 if (mapiFunctions.MAPIAdminProfiles) 00206 return mapiFunctions.MAPIAdminProfiles(ulFlags, lppProfAdmin); 00207 00208 FIXME("(%u, %p): stub\n", ulFlags, lppProfAdmin); 00209 *lppProfAdmin = NULL; 00210 return E_FAIL; 00211 } 00212 00213 ULONG WINAPI MAPIAddress(LHANDLE session, ULONG_PTR uiparam, LPSTR caption, 00214 ULONG editfields, LPSTR labels, ULONG nRecips, lpMapiRecipDesc lpRecips, 00215 FLAGS flags, ULONG reserved, LPULONG newRecips, lpMapiRecipDesc * lppNewRecips) 00216 { 00217 if (mapiFunctions.MAPIAddress) 00218 return mapiFunctions.MAPIAddress(session, uiparam, caption, editfields, labels, 00219 nRecips, lpRecips, flags, reserved, newRecips, lppNewRecips); 00220 00221 return MAPI_E_NOT_SUPPORTED; 00222 } 00223 00224 ULONG WINAPI MAPIDeleteMail(LHANDLE session, ULONG_PTR uiparam, LPSTR msg_id, 00225 FLAGS flags, ULONG reserved) 00226 { 00227 if (mapiFunctions.MAPIDeleteMail) 00228 return mapiFunctions.MAPIDeleteMail(session, uiparam, msg_id, flags, reserved); 00229 00230 return MAPI_E_NOT_SUPPORTED; 00231 } 00232 00233 ULONG WINAPI MAPIDetails(LHANDLE session, ULONG_PTR uiparam, lpMapiRecipDesc recip, 00234 FLAGS flags, ULONG reserved) 00235 { 00236 if (mapiFunctions.MAPIDetails) 00237 return mapiFunctions.MAPIDetails(session, uiparam, recip, flags, reserved); 00238 00239 return MAPI_E_NOT_SUPPORTED; 00240 } 00241 00242 ULONG WINAPI MAPIFindNext(LHANDLE session, ULONG_PTR uiparam, LPSTR msg_type, 00243 LPSTR seed_msg_id, FLAGS flags, ULONG reserved, LPSTR msg_id) 00244 { 00245 if (mapiFunctions.MAPIFindNext) 00246 return mapiFunctions.MAPIFindNext(session, uiparam, msg_type, seed_msg_id, flags, reserved, msg_id); 00247 00248 return MAPI_E_NOT_SUPPORTED; 00249 } 00250 00251 ULONG WINAPI MAPIReadMail(LHANDLE session, ULONG_PTR uiparam, LPSTR msg_id, 00252 FLAGS flags, ULONG reserved, lpMapiMessage msg) 00253 { 00254 if (mapiFunctions.MAPIReadMail) 00255 return mapiFunctions.MAPIReadMail(session, uiparam, msg_id, flags, reserved, msg); 00256 00257 return MAPI_E_NOT_SUPPORTED; 00258 } 00259 00260 ULONG WINAPI MAPIResolveName(LHANDLE session, ULONG_PTR uiparam, LPSTR name, 00261 FLAGS flags, ULONG reserved, lpMapiRecipDesc *recip) 00262 { 00263 if (mapiFunctions.MAPIResolveName) 00264 return mapiFunctions.MAPIResolveName(session, uiparam, name, flags, reserved, recip); 00265 00266 return MAPI_E_NOT_SUPPORTED; 00267 } 00268 00269 ULONG WINAPI MAPISaveMail(LHANDLE session, ULONG_PTR uiparam, lpMapiMessage msg, 00270 FLAGS flags, ULONG reserved, LPSTR msg_id) 00271 { 00272 if (mapiFunctions.MAPISaveMail) 00273 return mapiFunctions.MAPISaveMail(session, uiparam, msg, flags, reserved, msg_id); 00274 00275 return MAPI_E_NOT_SUPPORTED; 00276 } Generated on Sun May 27 2012 04:24:37 for ReactOS by
1.7.6.1
|