Owen Rudge : mapi32: Load and store MAPI function pointers after loading MAPI providers.

Alexandre Julliard julliard at winehq.org
Fri Sep 18 13:37:38 CDT 2009


Module: wine
Branch: master
Commit: 69156f5ae26546f01bafe3795e3f194e34e9de80
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=69156f5ae26546f01bafe3795e3f194e34e9de80

Author: Owen Rudge <orudge at codeweavers.com>
Date:   Fri Sep 18 15:15:40 2009 +0100

mapi32: Load and store MAPI function pointers after loading MAPI providers.

---

 dlls/mapi32/util.c |   29 +++++++++++++++++++++++++++++
 dlls/mapi32/util.h |   22 ++++++++++++++++++++++
 2 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/dlls/mapi32/util.c b/dlls/mapi32/util.c
index 6044749..6a6a5cd 100644
--- a/dlls/mapi32/util.c
+++ b/dlls/mapi32/util.c
@@ -48,6 +48,8 @@ static const BYTE digitsToHex[] = {
   0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,10,11,12,13,
   14,15 };
 
+MAPI_FUNCTIONS mapiFunctions;
+
 /**************************************************************************
  *  ScInitMapiUtil (MAPI32.33)
  *
@@ -1029,6 +1031,33 @@ void load_mapi_providers(void)
     load_mapi_provider(hkeyMail, regkey_dllpath, &mapi_provider);
     load_mapi_provider(hkeyMail, regkey_dllpath_ex, &mapi_ex_provider);
 
+    /* Now try to load our function pointers */
+    ZeroMemory(&mapiFunctions, sizeof(mapiFunctions));
+
+    /* Simple MAPI functions */
+    if (mapi_provider)
+    {
+        mapiFunctions.MAPIAddress = (void*) GetProcAddress(mapi_provider, "MAPIAddress");
+        mapiFunctions.MAPIDeleteMail = (void*) GetProcAddress(mapi_provider, "MAPIDeleteMail");
+        mapiFunctions.MAPIDetails = (void*) GetProcAddress(mapi_provider, "MAPIDetails");
+        mapiFunctions.MAPIFindNext = (void*) GetProcAddress(mapi_provider, "MAPIFindNext");
+        mapiFunctions.MAPILogoff = (void*) GetProcAddress(mapi_provider, "MAPILogoff");
+        mapiFunctions.MAPILogon = (void*) GetProcAddress(mapi_provider, "MAPILogon");
+        mapiFunctions.MAPIReadMail = (void*) GetProcAddress(mapi_provider, "MAPIReadMail");
+        mapiFunctions.MAPIResolveName = (void*) GetProcAddress(mapi_provider, "MAPIResolveName");
+        mapiFunctions.MAPISaveMail = (void*) GetProcAddress(mapi_provider, "MAPISaveMail");
+        mapiFunctions.MAPISendDocuments = (void*) GetProcAddress(mapi_provider, "MAPISendDocuments");
+        mapiFunctions.MAPISendMail = (void*) GetProcAddress(mapi_provider, "MAPISendMail");
+    }
+
+    /* Extended MAPI functions */
+    if (mapi_ex_provider)
+    {
+        mapiFunctions.MAPIInitialize = (void*) GetProcAddress(mapi_ex_provider, "MAPIInitialize");
+        mapiFunctions.MAPILogonEx = (void*) GetProcAddress(mapi_ex_provider, "MAPILogonEx");
+        mapiFunctions.MAPIUninitialize = (void*) GetProcAddress(mapi_ex_provider, "MAPIUninitialize");
+    }
+
 cleanUp:
     RegCloseKey(hkeyMail);
     HeapFree(GetProcessHeap(), 0, appKey);
diff --git a/dlls/mapi32/util.h b/dlls/mapi32/util.h
index 450d671..69b1603 100644
--- a/dlls/mapi32/util.h
+++ b/dlls/mapi32/util.h
@@ -22,7 +22,29 @@
 
 #define _MAPI_UTIL_H
 
+#include <mapi.h>
+#include <mapix.h>
+
 extern void load_mapi_providers(void);
 extern void unload_mapi_providers(void);
 
+typedef struct MAPI_FUNCTIONS {
+    LPMAPIADDRESS        MAPIAddress;
+    LPMAPIDELETEMAIL     MAPIDeleteMail;
+    LPMAPIDETAILS        MAPIDetails;
+    LPMAPIFINDNEXT       MAPIFindNext;
+    LPMAPIINITIALIZE     MAPIInitialize;
+    LPMAPILOGOFF         MAPILogoff;
+    LPMAPILOGON          MAPILogon;
+    LPMAPILOGONEX        MAPILogonEx;
+    LPMAPIREADMAIL       MAPIReadMail;
+    LPMAPIRESOLVENAME    MAPIResolveName;
+    LPMAPISAVEMAIL       MAPISaveMail;
+    LPMAPISENDMAIL       MAPISendMail;
+    LPMAPISENDDOCUMENTS  MAPISendDocuments;
+    LPMAPIUNINITIALIZE   MAPIUninitialize;
+} MAPI_FUNCTIONS;
+
+extern MAPI_FUNCTIONS mapiFunctions;
+
 #endif




More information about the wine-cvs mailing list