diff options
author | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2013-02-28 20:53:13 +0000 |
---|---|---|
committer | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2013-02-28 20:53:13 +0000 |
commit | 8d2147e6365c47acb8e28c725147ceec4f6a0b9c (patch) | |
tree | 757a2b726111e54e1a40f5bd0b4ac0d7d6c30286 | |
parent | 10bc4537a631514b691348448ae4a240a0d9d9ab (diff) | |
download | jitsi-8d2147e6365c47acb8e28c725147ceec4f6a0b9c.zip jitsi-8d2147e6365c47acb8e28c725147ceec4f6a0b9c.tar.gz jitsi-8d2147e6365c47acb8e28c725147ceec4f6a0b9c.tar.bz2 |
Fixes crashes in the Outlook contact integration related to calling conventions.
12 files changed, 82 insertions, 119 deletions
diff --git a/lib/native/windows-64/jmsoutlookaddrbook.dll b/lib/native/windows-64/jmsoutlookaddrbook.dll Binary files differindex 39c9f36..22c084f 100644 --- a/lib/native/windows-64/jmsoutlookaddrbook.dll +++ b/lib/native/windows-64/jmsoutlookaddrbook.dll diff --git a/lib/native/windows/jmsoutlookaddrbook.dll b/lib/native/windows/jmsoutlookaddrbook.dll Binary files differindex 045e613..b9b0538 100644 --- a/lib/native/windows/jmsoutlookaddrbook.dll +++ b/lib/native/windows/jmsoutlookaddrbook.dll diff --git a/src/native/addrbook/msoutlook/lib/MAPINotification.cxx b/src/native/addrbook/msoutlook/MAPINotification.cxx index 51dc745..229699a 100644 --- a/src/native/addrbook/msoutlook/lib/MAPINotification.cxx +++ b/src/native/addrbook/msoutlook/MAPINotification.cxx @@ -6,17 +6,14 @@ */
#include "MAPINotification.h"
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-
-#include <stdio.h>
-#include <Unknwn.h>
-
+#include "MsOutlookMAPI.h"
+#include "net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService.h"
+#include "net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery.h"
#include <mapidefs.h>
#include <mapiutil.h>
+#include <stdio.h>
+#include <unknwn.h>
-#include "../net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService.h"
-#include "../net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery.h"
/**
* Manages notification for the message data base (used to get the list of
* contact).
@@ -167,12 +164,12 @@ ULONG registerNotifyMessageDataBase( iUnknown,
&adviseSink);
ULONG nbConnection = 0;
- iUnknown->Advise(
- 0,
- NULL,
+ iUnknown->Advise(
+ (ULONG) 0,
+ (LPENTRYID) NULL,
EVENT_MASK,
adviseSink,
- &nbConnection);
+ (ULONG_PTR *) &nbConnection);
return nbConnection;
}
diff --git a/src/native/addrbook/msoutlook/lib/MAPINotification.h b/src/native/addrbook/msoutlook/MAPINotification.h index 2cf4eea..9b1c8d3 100644 --- a/src/native/addrbook/msoutlook/lib/MAPINotification.h +++ b/src/native/addrbook/msoutlook/MAPINotification.h @@ -5,15 +5,15 @@ * See terms of license at gnu.org. */ -#ifndef _mapi_notification_h -#define _mapi_notification_h +#ifndef _NET_JAVA_SIP_COMMUNICATOR_PLUGIN_ADDRBOOK_MSOUTLOOK_MAPINOTIFICATION_H_ +#define _NET_JAVA_SIP_COMMUNICATOR_PLUGIN_ADDRBOOK_MSOUTLOOK_MAPINOTIFICATION_H_ #ifdef __cplusplus extern "C" { #endif +#include "MsOutlookMAPI.h" #include <mapidefs.h> -#include <mapix.h> LONG STDAPICALLTYPE onNotify( LPVOID lpvContext, @@ -27,4 +27,4 @@ ULONG registerNotifyMessageDataBase( } #endif -#endif +#endif /* #ifndef _NET_JAVA_SIP_COMMUNICATOR_PLUGIN_ADDRBOOK_MSOUTLOOK_MAPINOTIFICATION_H_ */ diff --git a/src/native/addrbook/msoutlook/Makefile b/src/native/addrbook/msoutlook/Makefile deleted file mode 100644 index a594e5a..0000000 --- a/src/native/addrbook/msoutlook/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -CC = gcc -O2
-OUTLOOK_MAPI_HEADERS ?= C:/Users/lyub0m1r/Downloads/Outlook2010MAPIHeaders
-TARGET_BASENAME = jmsoutlookaddrbook
-
-ARCH ?= $(shell $(CC) -dumpmachine | sed -e s/x86_64-.*/-64/ -e s/i.86-.*// -e s/mingw32//)
-ifeq "$(ARCH)" "-64"
- JAVA_HOME ?= C:/PROGRA~1/jdk
-else
- JAVA_HOME ?= C:/PROGRA~2/jdk
-endif
-
-CPPFLAGS = \
- -Wall -Wreturn-type \
- -DWINVER=0x0502 -D_WIN32_WINNT=0x0502 \
- -DJNI_IMPLEMENTATION \
- -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/win32 -I$(OUTLOOK_MAPI_HEADERS) -I..
-LDFLAGS = -shared -Wl,--kill-at -Wl,--subsystem,windows
-LIBS = -ladvapi32 -luuid
-TARGET = ../../../../lib/native/windows$(ARCH)/$(TARGET_BASENAME).dll
-
-$(TARGET): \
- ../AddrBookContactQuery.c \
- MsOutlookMAPIHResultException.cxx \
- net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery.cxx \
- net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService.cxx
- $(CC) $(CPPFLAGS) $^ $(LDFLAGS) -o $@ $(LIBS)
- -strip $(TARGET)
diff --git a/src/native/addrbook/msoutlook/MsOutlookMAPI.h b/src/native/addrbook/msoutlook/MsOutlookMAPI.h index 9739835..ecab5b4 100644 --- a/src/native/addrbook/msoutlook/MsOutlookMAPI.h +++ b/src/native/addrbook/msoutlook/MsOutlookMAPI.h @@ -11,9 +11,16 @@ #define WIN32_LEAN_AND_MEAN
#include <windows.h>
+#ifndef __in
+#define __in
+#endif /* #ifndef __in */
#ifndef __in_opt
#define __in_opt
#endif /* #ifndef __in_opt */
+#ifndef __out
+#define __out
+#endif /* #ifndef __out */
+
#if defined(_WINBASE_H) && !defined(_WINBASE_)
#define _tagCY_DEFINED
#define _WINBASE_
diff --git a/src/native/addrbook/msoutlook/MsOutlookMAPIHResultException.h b/src/native/addrbook/msoutlook/MsOutlookMAPIHResultException.h index 11350b5..c0f7742 100644 --- a/src/native/addrbook/msoutlook/MsOutlookMAPIHResultException.h +++ b/src/native/addrbook/msoutlook/MsOutlookMAPIHResultException.h @@ -8,8 +8,8 @@ #ifndef _NET_JAVA_SIP_COMMUNICATOR_PLUGIN_ADDRBOOK_MSOUTLOOK_MSOUTLOOKMAPIHRESULTEXCEPTION_H_
#define _NET_JAVA_SIP_COMMUNICATOR_PLUGIN_ADDRBOOK_MSOUTLOOK_MSOUTLOOKMAPIHRESULTEXCEPTION_H_
-#include <jni.h>
#include "MsOutlookMAPI.h"
+#include <jni.h>
#include <tchar.h>
#ifdef __cplusplus
@@ -23,4 +23,4 @@ void MsOutlookMAPIHResultException_throwNew }
#endif /* #ifdef __cplusplus */
-#endif /* _NET_JAVA_SIP_COMMUNICATOR_PLUGIN_ADDRBOOK_MSOUTLOOK_MSOUTLOOKMAPIHRESULTEXCEPTION_ */
\ No newline at end of file +#endif /* _NET_JAVA_SIP_COMMUNICATOR_PLUGIN_ADDRBOOK_MSOUTLOOK_MSOUTLOOKMAPIHRESULTEXCEPTION_ */
diff --git a/src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery.cxx b/src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery.cxx index 2a49371..e63fd33 100644 --- a/src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery.cxx +++ b/src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery.cxx @@ -7,16 +7,13 @@ #include "net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery.h"
-#include "net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService.h"
-
#include "../AddrBookContactQuery.h"
-#include "MsOutlookMAPI.h"
#include "MsOutlookMAPIHResultException.h"
-#include "lib/MAPINotification.h"
-
+#include "MAPINotification.h"
+#include "net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService.h"
+#include <mapiutil.h>
#include <stdio.h>
#include <string.h>
-#include <mapiutil.h>
#define PR_ATTACHMENT_CONTACTPHOTO PROP_TAG(PT_BOOLEAN, 0x7FFF)
@@ -1527,8 +1524,8 @@ LPUNKNOWN openEntryId(const char* entryId) /**
* Registers a callback function for when the message store table changes.
*/
-ULONG registerNotifyTable(
- LPMAPITABLE iUnknown)
+ULONG
+registerNotifyTable(LPMAPITABLE iUnknown)
{
LPMAPIADVISESINK adviseSink;
MsOutlookAddrBookContact_HrAllocAdviseSink(
@@ -1537,10 +1534,10 @@ ULONG registerNotifyTable( iUnknown,
&adviseSink);
ULONG nbConnection = 0;
- iUnknown->Advise(
+ iUnknown->Advise(
fnevTableModified,
adviseSink,
- &nbConnection);
+ (ULONG_PTR *) &nbConnection);
return nbConnection;
}
diff --git a/src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery.h b/src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery.h index 0699120..3c4786c 100644 --- a/src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery.h +++ b/src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery.h @@ -8,9 +8,10 @@ extern "C" {
#endif
+#include "MsOutlookMAPI.h"
#include <mapidefs.h>
#include <mapix.h>
-#include <Unknwn.h>
+#include <unknwn.h>
/*
* Class: net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery
diff --git a/src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService.cxx b/src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService.cxx index 779361e..4514097 100644 --- a/src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService.cxx +++ b/src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService.cxx @@ -7,15 +7,11 @@ #include "net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService.h"
-#include "net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery.h"
-
#include "../AddrBookContactQuery.h"
-#include "MsOutlookMAPI.h"
#include "MsOutlookMAPIHResultException.h"
-
-#include "lib/MAPINotification.h"
-
-#include <Mapiutil.h>
+#include "MAPINotification.h"
+#include "net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactQuery.h"
+#include <mapiutil.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -141,7 +137,6 @@ void callDeletedCallbackMethod( contactSourceServiceVM->DetachCurrentThread();
}
-
static LPMAPIALLOCATEBUFFER
MsOutlookAddrBookContactSourceService_mapiAllocateBuffer;
static LPMAPIFREEBUFFER MsOutlookAddrBookContactSourceService_mapiFreeBuffer;
@@ -149,18 +144,18 @@ static LPMAPIINITIALIZE MsOutlookAddrBookContactSourceService_mapiInitialize; static LPMAPILOGONEX MsOutlookAddrBookContactSourceService_mapiLogonEx;
static LPMAPIUNINITIALIZE
MsOutlookAddrBookContactSourceService_mapiUninitialize;
-static void (STDAPICALLTYPE *MsOutlookAddrBookContactSourceService_hexFromBin)
- (LPBYTE, int, LPTSTR);
-static void (STDAPICALLTYPE *MsOutlookAddrBookContactSourceService_HrAllocAdviseSink)
- (LPNOTIFCALLBACK, LPVOID, LPMAPIADVISESINK*);
-static WINBOOL (STDAPICALLTYPE *MsOutlookAddrBookContactSourceService_FBinFromHex)
- (LPTSTR, LPBYTE);
-static HRESULT (STDAPICALLTYPE *MsOutlookAddrBookContactSourceService_HrQueryAllRows)
- (LPMAPITABLE, LPSPropTagArray, LPSRestriction, LPSSortOrderSet, LONG,
- LPSRowSet*);
-static void (STDAPICALLTYPE *MsOutlookAddrBookContactSourceService_FreeProws)
- (LPSRowSet);
+typedef void (STDAPICALLTYPE *LPHEXFROMBIN)(LPBYTE, int, LPTSTR);
+typedef HRESULT (STDAPICALLTYPE *LPHRALLOCADVISESINK)(LPNOTIFCALLBACK, LPVOID, LPMAPIADVISESINK FAR *);
+typedef BOOL (STDAPICALLTYPE *LPFBINFROMHEX)(LPTSTR, LPBYTE);
+typedef HRESULT (STDAPICALLTYPE *LPHRQUERYALLROWS)(LPMAPITABLE, LPSPropTagArray, LPSRestriction, LPSSortOrderSet, LONG, LPSRowSet FAR *);
+typedef void (STDAPICALLTYPE *LPFREEPROWS)(LPSRowSet);
+
+static LPHEXFROMBIN MsOutlookAddrBookContactSourceService_hexFromBin;
+static LPHRALLOCADVISESINK MsOutlookAddrBookContactSourceService_HrAllocAdviseSink;
+static LPFBINFROMHEX MsOutlookAddrBookContactSourceService_FBinFromHex;
+static LPHRQUERYALLROWS MsOutlookAddrBookContactSourceService_HrQueryAllRows;
+static LPFREEPROWS MsOutlookAddrBookContactSourceService_FreeProws;
static LPMAPISESSION MsOutlookAddrBookContactSourceService_mapiSession = NULL;
static CRITICAL_SECTION MsOutlookAddrBookContactSourceService_mapiSessionCriticalSection;
@@ -406,7 +401,7 @@ Java_net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContac // If we've determined that we'd like to go on with MAPI, try to load it.
if (HR_SUCCEEDED(hResult))
{
- HMODULE lib = LoadLibrary(_T("mapi32.dll"));
+ HMODULE lib = ::LoadLibrary(_T("mapi32.dll"));
hResult = MAPI_E_NO_SUPPORT;
if (lib)
@@ -435,24 +430,18 @@ Java_net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContac MsOutlookAddrBookContactSourceService_mapiLogonEx
= (LPMAPILOGONEX) GetProcAddress(lib, "MAPILogonEx");
-
MsOutlookAddrBookContactSourceService_hexFromBin
- = (STDAPICALLTYPE void(*)(LPBYTE, int, LPTSTR))
- GetProcAddress(lib, "HexFromBin@12");
+ = (LPHEXFROMBIN) GetProcAddress(lib, "HexFromBin@12");
MsOutlookAddrBookContactSourceService_HrAllocAdviseSink
- = (STDAPICALLTYPE void(*)(LPNOTIFCALLBACK, LPVOID, LPMAPIADVISESINK*))
+ = (LPHRALLOCADVISESINK)
GetProcAddress(lib, "HrAllocAdviseSink@12");
MsOutlookAddrBookContactSourceService_FBinFromHex
- = (STDAPICALLTYPE WINBOOL(*)(LPTSTR, LPBYTE))
- GetProcAddress(lib, "FBinFromHex@8");
+ = (LPFBINFROMHEX) GetProcAddress(lib, "FBinFromHex@8");
MsOutlookAddrBookContactSourceService_HrQueryAllRows
- = (STDAPICALLTYPE HRESULT(*)(LPMAPITABLE, LPSPropTagArray,
- LPSRestriction, LPSSortOrderSet, LONG,
- LPSRowSet*))
+ = (LPHRQUERYALLROWS)
GetProcAddress(lib, "HrQueryAllRows@24");
MsOutlookAddrBookContactSourceService_FreeProws
- = (STDAPICALLTYPE void(*)(LPSRowSet))
- GetProcAddress(lib, "FreeProws@4");
+ = (LPFREEPROWS) GetProcAddress(lib, "FreeProws@4");
InitializeCriticalSection(
&MsOutlookAddrBookContactSourceService_mapiSessionCriticalSection);
@@ -462,14 +451,13 @@ Java_net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContac && MsOutlookAddrBookContactSourceService_mapiLogonEx
&& MsOutlookAddrBookContactSourceService_hexFromBin
- &&
- MsOutlookAddrBookContactSourceService_HrAllocAdviseSink
+ && MsOutlookAddrBookContactSourceService_HrAllocAdviseSink
&& MsOutlookAddrBookContactSourceService_FBinFromHex
- &&
- MsOutlookAddrBookContactSourceService_HrQueryAllRows
- && MsOutlookAddrBookContactSourceService_FreeProws
- )
+ && MsOutlookAddrBookContactSourceService_HrQueryAllRows
+ && MsOutlookAddrBookContactSourceService_FreeProws)
+ {
hResult = S_OK;
+ }
else
{
MsOutlookAddrBookContactSourceService_mapiUninitialize();
@@ -485,12 +473,12 @@ Java_net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContac if (HR_SUCCEEDED(hResult)
&& MsOutlookAddrBookContactSourceService_mapiSession == NULL)
{
- hResult = MsOutlookAddrBook_mapiLogonEx(
- //hResult = MAPILogonEx(
- 0,
- NULL, NULL,
- MAPI_EXTENDED | MAPI_NO_MAIL | MAPI_USE_DEFAULT,
- &MsOutlookAddrBookContactSourceService_mapiSession);
+ hResult
+ = MsOutlookAddrBook_mapiLogonEx(
+ 0,
+ NULL, NULL,
+ MAPI_EXTENDED | MAPI_NO_MAIL | MAPI_USE_DEFAULT,
+ &MsOutlookAddrBookContactSourceService_mapiSession);
openAllMsgStores(
MsOutlookAddrBookContactSourceService_mapiSession);
}
diff --git a/src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService.h b/src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService.h index 00e0474..c93b7fb 100644 --- a/src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService.h +++ b/src/native/addrbook/msoutlook/net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService.h @@ -8,9 +8,10 @@ extern "C" {
#endif
+#include "MsOutlookMAPI.h"
#include <mapidefs.h>
#include <mapix.h>
-#include <Unknwn.h>
+#include <unknwn.h>
/*
* Class: net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContactSourceService
diff --git a/src/native/build.xml b/src/native/build.xml index ce32ee4..9627723 100644 --- a/src/native/build.xml +++ b/src/native/build.xml @@ -22,7 +22,10 @@ </or> </condition> <condition property="arch" value="64"> - <os arch="amd64" /> + <or> + <os arch="amd64" /> + <os arch="x86_64" /> + </or> </condition> <!-- @@ -833,42 +836,38 @@ <echo message="-Dportaudio=/path/to/portaudio and -Dspeex=/path/to/speex" /> </target> - <!-- compile jnwmsoutlookaddrbook library for Windows (32-bit/64-bit) --> + <!-- compile jmsoutlookaddrbook library for Windows --> <target - name="msoutlookaddrbook" - description="Build jmsoutlookaddrbook shared library for Windows" - if="is.running.windows" - depends="init-native"> - <cc name="gcc" + name="msoutlookaddrbook" + description="Build jmsoutlookaddrbook shared library for Windows" + if="is.running.windows" + depends="init-native"> + <fail message="Outlook2010MAPIHeaders not set!" unless="Outlook2010MAPIHeaders" /> + <cc + name="gcc" objdir="${obj}" outfile="${native_install_dir}/jmsoutlookaddrbook" outtype="shared"> - <compilerarg value="-D_JNI_IMPLEMENTATION_" /> <compilerarg value="-D_WIN32_WINNT=0x0502" /> <compilerarg value="-DWINVER=0x0502" /> <compilerarg value="-I${system.JAVA_HOME}/include" /> <compilerarg value="-I${system.JAVA_HOME}/include/win32" /> - <compilerarg value="-O2" /> - <compilerarg value="-Wall" /> - <compilerarg value="-Wreturn-type" /> + <compilerarg value="-I${Outlook2010MAPIHeaders}" /> <compilerarg value="-m32" if="cross_32" /> <compilerarg value="-m64" if="cross_64" /> + <compilerarg value="-O2" /> + <compilerarg value="-Wall" /> <linkerarg value="-ojmsoutlookaddrbook.dll" /> - <linkerarg value="-Wl,--kill-at" /> - <linkerarg value="-Wl,--subsystem,windows" /> - <libset libs="advapi32" /> - <libset libs="uuid" /> <linkerarg value="-m32" if="cross_32" /> <linkerarg value="-m64" if="cross_64" /> + <linkerarg value="-Wl,--kill-at" /> + <linkerarg value="-Wl,--subsystem,windows" /> + <libset libs="advapi32,uuid" /> <fileset dir="${src}/native/addrbook" includes="*.c" /> <fileset dir="${src}/native/addrbook/msoutlook" includes="*.cxx" /> - <fileset dir="${src}/native/addrbook/msoutlook/lib" includes="*.cxx" /> </cc> - - <delete dir="${obj}" failonerror="false" /> - <delete file="${native_install_dir}/history.xml" failonerror="false" /> </target> </project> |