diff options
author | Vincent Lucas <chenzo@jitsi.org> | 2013-02-28 14:15:39 +0000 |
---|---|---|
committer | Vincent Lucas <chenzo@jitsi.org> | 2013-02-28 14:15:39 +0000 |
commit | cba9a8bc078398437d14564f5e61a7055c1b8b08 (patch) | |
tree | 30a2e86e07a3559c5ac089c5f3c4b984d6255ede /src/native/addrbook/msoutlook | |
parent | ecd9a66d4198c993bfe7a451aa312fe62047c3a2 (diff) | |
download | jitsi-cba9a8bc078398437d14564f5e61a7055c1b8b08.zip jitsi-cba9a8bc078398437d14564f5e61a7055c1b8b08.tar.gz jitsi-cba9a8bc078398437d14564f5e61a7055c1b8b08.tar.bz2 |
Work in progress to generate jmoutlookaddrbook.dll without linking mapi32.dll.
Diffstat (limited to 'src/native/addrbook/msoutlook')
4 files changed, 149 insertions, 35 deletions
diff --git a/src/native/addrbook/msoutlook/lib/MAPINotification.cxx b/src/native/addrbook/msoutlook/lib/MAPINotification.cxx index 18d8de4..51dc745 100644 --- a/src/native/addrbook/msoutlook/lib/MAPINotification.cxx +++ b/src/native/addrbook/msoutlook/lib/MAPINotification.cxx @@ -79,7 +79,8 @@ LONG STDAPICALLTYPE onNotify( {
char entryIdStr[lpNotifications[i].info.obj.cbEntryID * 2 + 1];
- HexFromBin(
+ MsOutlookAddrBookContact_hexFromBin(
+ //HexFromBin(
(LPBYTE) lpNotifications[i].info.obj.lpEntryID,
lpNotifications[i].info.obj.cbEntryID,
entryIdStr);
@@ -96,13 +97,15 @@ LONG STDAPICALLTYPE onNotify( if(lpvContext != NULL)
{
char entryIdStr[lpNotifications[i].info.obj.cbEntryID * 2 + 1];
- HexFromBin(
+ MsOutlookAddrBookContact_hexFromBin(
+ //HexFromBin(
(LPBYTE) lpNotifications[i].info.obj.lpEntryID,
lpNotifications[i].info.obj.cbEntryID,
entryIdStr);
char parentEntryIdStr[
lpNotifications[i].info.obj.cbParentID * 2 + 1];
- HexFromBin(
+ MsOutlookAddrBookContact_hexFromBin(
+ //HexFromBin(
(LPBYTE) lpNotifications[i].info.obj.lpParentID,
lpNotifications[i].info.obj.cbParentID,
parentEntryIdStr);
@@ -116,7 +119,8 @@ LONG STDAPICALLTYPE onNotify( &wasteBasketProps);
char wasteBasketEntryIdStr[
wasteBasketProps[0].Value.bin.cb * 2 + 1];
- HexFromBin(
+ MsOutlookAddrBookContact_hexFromBin(
+ //HexFromBin(
(LPBYTE) wasteBasketProps[0].Value.bin.lpb,
wasteBasketProps[0].Value.bin.cb,
wasteBasketEntryIdStr);
@@ -157,7 +161,8 @@ ULONG registerNotifyMessageDataBase( LPMDB iUnknown)
{
LPMAPIADVISESINK adviseSink;
- HrAllocAdviseSink(
+ MsOutlookAddrBookContact_HrAllocAdviseSink(
+ //HrAllocAdviseSink(
&onNotify,
iUnknown,
&adviseSink);
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 6b6adb2..2a49371 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 @@ -315,7 +315,8 @@ Java_net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContac {
char entryIdStr[prop->Value.bin.cb * 2 + 1];
- HexFromBin(
+ MsOutlookAddrBookContact_hexFromBin(
+ //HexFromBin(
prop->Value.bin.lpb,
prop->Value.bin.cb,
entryIdStr);
@@ -1255,8 +1256,6 @@ Java_net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContac (baseGroupEntryIdProp + 5) // 0x8085 PidLidEmail1OriginalEntryID
};
ULONG propTag;
- ULONG propCount;
- LPSPropValue propArray;
LPSPropTagArray propTagArray;
MAPIAllocateBuffer(
CbNewSPropTagArray(nbProps),
@@ -1375,7 +1374,8 @@ void openAllMsgStores( if (HR_SUCCEEDED(hResult))
{
LPSRowSet rows;
- hResult = HrQueryAllRows(
+ hResult = MsOutlookAddrBookContact_HrQueryAllRows(
+ //hResult = HrQueryAllRows(
MsOutlookAddrBookContactQuery_msgStoresTable,
NULL,
NULL,
@@ -1443,7 +1443,8 @@ void openAllMsgStores( }
}
}
- FreeProws(rows);
+ MsOutlookAddrBookContact_FreeProws(rows);
+ //FreeProws(rows);
}
}
}
@@ -1497,7 +1498,10 @@ LPUNKNOWN openEntryId(const char* entryId) {
ULONG tmpEntryIdSize = strlen(entryId) / 2;
LPENTRYID tmpEntryId = (LPENTRYID) malloc(tmpEntryIdSize * sizeof(char));
- if(FBinFromHex((LPSTR) entryId, (LPBYTE) tmpEntryId))
+ if(MsOutlookAddrBookContact_FBinFromHex(
+ (LPSTR) entryId,
+ (LPBYTE) tmpEntryId))
+ //if(FBinFromHex((LPSTR) entryId, (LPBYTE) tmpEntryId))
{
LPMAPISESSION mapiSession
= MsOutlookAddrBookContactSourceService_getMapiSession();
@@ -1527,7 +1531,8 @@ ULONG registerNotifyTable( LPMAPITABLE iUnknown)
{
LPMAPIADVISESINK adviseSink;
- HrAllocAdviseSink(
+ MsOutlookAddrBookContact_HrAllocAdviseSink(
+ //HrAllocAdviseSink(
&tableChanged,
iUnknown,
&adviseSink);
@@ -1557,6 +1562,10 @@ LONG STDAPICALLTYPE tableChanged( {
// Frees and recreates all the notification for the table.
freeAllMsgStores();
- openAllMsgStores(MsOutlookAddrBookContactSourceService_getMapiSession());
+ openAllMsgStores(
+ MsOutlookAddrBookContactSourceService_getMapiSession());
}
+
+ // A client must always return a S_OK.
+ return S_OK;
}
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 99d1d52..cc5224a 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 @@ -149,6 +149,18 @@ static LPMAPIINITIALIZE MsOutlookAddrBookContactSourceService_mapiInitialize; static LPMAPILOGONEX MsOutlookAddrBookContactSourceService_mapiLogonEx;
static LPMAPIUNINITIALIZE
MsOutlookAddrBookContactSourceService_mapiUninitialize;
+static void (*MsOutlookAddrBookContactSourceService_hexFromBin)
+ (LPBYTE, int, LPTSTR);
+static void (*MsOutlookAddrBookContactSourceService_HrAllocAdviseSink)
+ (LPNOTIFCALLBACK, LPVOID, LPMAPIADVISESINK*);
+static WINBOOL (*MsOutlookAddrBookContactSourceService_FBinFromHex)
+ (LPTSTR, LPBYTE);
+static HRESULT (*MsOutlookAddrBookContactSourceService_HrQueryAllRows)
+ (LPMAPITABLE, LPSPropTagArray, LPSRestriction, LPSSortOrderSet, LONG,
+ LPSRowSet*);
+static void (*MsOutlookAddrBookContactSourceService_FreeProws)
+ (LPSRowSet);
+
static LPMAPISESSION MsOutlookAddrBookContactSourceService_mapiSession = NULL;
static CRITICAL_SECTION MsOutlookAddrBookContactSourceService_mapiSessionCriticalSection;
@@ -181,9 +193,9 @@ Java_net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContac {
DWORD i = 0;
TCHAR installRootKeyName[
- 255 /* The size limit of key name as documented in MSDN */
- + 20 /* \Outlook\InstallRoot */
- + 1 /* The terminating null character */ ];
+ 255 // The size limit of key name as documented in MSDN
+ + 20 // \Outlook\InstallRoot
+ + 1]; // The terminating null character
while (1)
{
@@ -232,14 +244,12 @@ Java_net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContac {
LPTSTR pathValue;
- /*
- * MSDN says "the string may not have been stored with the
- * proper terminating null characters."
- */
+ // MSDN says "the string may not have been stored with the
+ // proper terminating null characters."
pathValueSize
+= sizeof(TCHAR)
- * (12 /* \Outlook.exe */
- + 1 /* The terminating null character */);
+ * (12 // \Outlook.exe
+ + 1); // The terminating null character
if (pathValueSize <= sizeof(installRootKeyName))
pathValue = installRootKeyName;
@@ -284,19 +294,15 @@ Java_net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContac }
RegCloseKey(regKey);
- /*
- * Make sure that Microsoft Outlook is the default mail client in order
- * to prevent its dialog in the case of it not being the default mail
- * client.
- */
+ // Make sure that Microsoft Outlook is the default mail client in order
+ // to prevent its dialog in the case of it not being the default mail
+ // client.
if (HR_SUCCEEDED(hResult))
{
DWORD defaultValueType;
- /*
- * The buffer installRootKeyName is long enough to receive
- * "Microsoft Outlook" so use it in order to not have to allocate
- * more memory.
- */
+ // The buffer installRootKeyName is long enough to receive
+ // "Microsoft Outlook" so use it in order to not have to allocate
+ // more memory.
LPTSTR defaultValue = (LPTSTR) installRootKeyName;
DWORD defaultValueCapacity = sizeof(installRootKeyName);
jboolean checkHKeyLocalMachine;
@@ -397,7 +403,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 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"));
@@ -429,15 +435,46 @@ Java_net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContac MsOutlookAddrBookContactSourceService_mapiLogonEx
= (LPMAPILOGONEX) GetProcAddress(lib, "MAPILogonEx");
+
+ MsOutlookAddrBookContactSourceService_hexFromBin
+ = (void(*)(LPBYTE, int, LPTSTR))
+ GetProcAddress(lib, "HexFromBin@12");
+ MsOutlookAddrBookContactSourceService_HrAllocAdviseSink
+ = (void(*)(LPNOTIFCALLBACK, LPVOID, LPMAPIADVISESINK*))
+ GetProcAddress(lib, "HrAllocAdviseSink@12");
+ MsOutlookAddrBookContactSourceService_FBinFromHex
+ = (WINBOOL(*)(LPTSTR, LPBYTE))
+ GetProcAddress(lib, "FBinFromHex@8");
+ MsOutlookAddrBookContactSourceService_HrQueryAllRows
+ = (HRESULT(*)(LPMAPITABLE, LPSPropTagArray,
+ LPSRestriction, LPSSortOrderSet, LONG,
+ LPSRowSet*))
+ GetProcAddress(lib, "HrQueryAllRows@24");
+ MsOutlookAddrBookContactSourceService_FreeProws
+ = (void(*)(LPSRowSet))
+ GetProcAddress(lib, "FreeProws@4");
+
InitializeCriticalSection(
&MsOutlookAddrBookContactSourceService_mapiSessionCriticalSection);
if (MsOutlookAddrBookContactSourceService_mapiAllocateBuffer
&& MsOutlookAddrBookContactSourceService_mapiFreeBuffer
- && MsOutlookAddrBookContactSourceService_mapiLogonEx)
+ && MsOutlookAddrBookContactSourceService_mapiLogonEx
+
+ && MsOutlookAddrBookContactSourceService_hexFromBin
+ &&
+ MsOutlookAddrBookContactSourceService_HrAllocAdviseSink
+ && MsOutlookAddrBookContactSourceService_FBinFromHex
+ &&
+ MsOutlookAddrBookContactSourceService_HrQueryAllRows
+ && MsOutlookAddrBookContactSourceService_FreeProws
+ )
hResult = S_OK;
else
+ {
MsOutlookAddrBookContactSourceService_mapiUninitialize();
+ hResult = MAPI_E_NO_SUPPORT;
+ }
}
}
if (HR_FAILED(hResult))
@@ -448,7 +485,8 @@ Java_net_java_sip_communicator_plugin_addrbook_msoutlook_MsOutlookAddrBookContac if (HR_SUCCEEDED(hResult)
&& MsOutlookAddrBookContactSourceService_mapiSession == NULL)
{
- hResult = MAPILogonEx(
+ hResult = MsOutlookAddrBook_mapiLogonEx(
+ //hResult = MAPILogonEx(
0,
NULL, NULL,
MAPI_EXTENDED | MAPI_NO_MAIL | MAPI_USE_DEFAULT,
@@ -574,3 +612,46 @@ LPMAPISESSION MsOutlookAddrBookContactSourceService_getMapiSession() {
return MsOutlookAddrBookContactSourceService_mapiSession;
}
+
+void MsOutlookAddrBookContact_hexFromBin(LPBYTE pb, int cb, LPTSTR sz)
+{
+ return MsOutlookAddrBookContactSourceService_hexFromBin(pb, cb, sz);
+}
+
+void MsOutlookAddrBookContact_HrAllocAdviseSink(
+ LPNOTIFCALLBACK lpfnCallback,
+ LPVOID lpvContext,
+ LPMAPIADVISESINK* lppAdviseSink)
+{
+ MsOutlookAddrBookContactSourceService_HrAllocAdviseSink(
+ lpfnCallback,
+ lpvContext,
+ lppAdviseSink);
+}
+
+WINBOOL MsOutlookAddrBookContact_FBinFromHex(LPTSTR lpsz, LPBYTE lpb)
+{
+ return MsOutlookAddrBookContactSourceService_FBinFromHex(lpsz, lpb);
+}
+
+HRESULT MsOutlookAddrBookContact_HrQueryAllRows(
+ LPMAPITABLE lpTable,
+ LPSPropTagArray lpPropTags,
+ LPSRestriction lpRestriction,
+ LPSSortOrderSet lpSortOrderSet,
+ LONG crowsMax,
+ LPSRowSet* lppRows)
+{
+ return MsOutlookAddrBookContactSourceService_HrQueryAllRows(
+ lpTable,
+ lpPropTags,
+ lpRestriction,
+ lpSortOrderSet,
+ crowsMax,
+ lppRows);
+}
+
+void MsOutlookAddrBookContact_FreeProws(LPSRowSet lpRows)
+{
+ MsOutlookAddrBookContactSourceService_FreeProws(lpRows);
+}
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 088c13d..00e0474 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 @@ -43,6 +43,25 @@ void callDeletedCallbackMethod( LPMAPISESSION MsOutlookAddrBookContactSourceService_getMapiSession();
+void MsOutlookAddrBookContact_hexFromBin(LPBYTE pb, int cb, LPTSTR sz);
+
+void MsOutlookAddrBookContact_HrAllocAdviseSink(
+ LPNOTIFCALLBACK lpfnCallback,
+ LPVOID lpvContext,
+ LPMAPIADVISESINK* lppAdviseSink);
+
+WINBOOL MsOutlookAddrBookContact_FBinFromHex( LPTSTR lpsz, LPBYTE lpb);
+
+HRESULT MsOutlookAddrBookContact_HrQueryAllRows(
+ LPMAPITABLE lpTable,
+ LPSPropTagArray lpPropTags,
+ LPSRestriction lpRestriction,
+ LPSSortOrderSet lpSortOrderSet,
+ LONG crowsMax,
+ LPSRowSet* lppRows);
+
+void MsOutlookAddrBookContact_FreeProws(LPSRowSet lpRows);
+
#ifdef __cplusplus
}
#endif
|