Autosyncing with Wine

svn path=/trunk/; revision=22819
This commit is contained in:
The Wine Synchronizer 2006-07-04 12:05:13 +00:00
parent 979f9f7d1a
commit 4b35b55e7a
7 changed files with 302 additions and 223 deletions

View file

@ -15,7 +15,7 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>

View file

@ -1,18 +1,23 @@
<module name="mapi32" type="win32dll" baseaddress="${BASEADDRESS_MAPI32}" installbase="system32" installname="mapi32.dll">
<module name="mapi32" type="win32dll" baseaddress="${BASEADDRESS_MAPI32}" installbase="system32" installname="mapi32.dll" allowwarnings="true">
<importlibrary definition="mapi32.spec.def" />
<include base="mapi32">.</include>
<include base="ReactOS">include/reactos/wine</include>
<define name="__USE_W32API" />
<define name="_WIN32_WINNT">0x501</define>
<define name="__REACTOS__" />
<define name="__WINESRC__" />
<library>ntdll</library>
<library>kernel32</library>
<library>shlwapi</library>
<define name="__USE_W32API" />
<define name="_WIN32_IE">0x600</define>
<define name="_WIN32_WINNT">0x501</define>
<define name="WINVER">0x501</define>
<library>wine</library>
<library>shlwapi</library>
<library>shell32</library>
<library>ole32</library>
<library>user32</library>
<library>kernel32</library>
<library>ntdll</library>
<library>uuid</library>
<library>advapi32</library>
<file>mapi32_main.c</file>
<file>imalloc.c</file>
<file>mapi32_main.c</file>
<file>prop.c</file>
<file>sendmail.c</file>
<file>util.c</file>

View file

@ -20,8 +20,8 @@
28 stdcall -private DllCanUnloadNow()
29 stub MAPIOpenFormMgr
30 stub MAPIOpenFormMgr@8
31 stub MAPIOpenLocalFormContainer
32 stub MAPIOpenLocalFormContainer@4
31 stdcall MAPIOpenLocalFormContainer(ptr)
32 stdcall MAPIOpenLocalFormContainer@4(ptr) MAPIOpenLocalFormContainer
33 stdcall ScInitMapiUtil@4(long) ScInitMapiUtil
34 stdcall DeinitMapiUtil@0() DeinitMapiUtil
35 stub ScGenerateMuid@4
@ -186,6 +186,5 @@
251 stub GetOutlookVersion@0
252 stub FixMAPI
253 stub FixMAPI@0
# This entry point is sometimes used to detect if the mapi dll came from Outlook
#254 stub FGetComponentPath
#255 stub FGetComponentPath@20
254 stdcall FGetComponentPath(str str ptr long long)
255 stdcall FGetComponentPath@20(str str ptr long long) FGetComponentPath

View file

@ -15,7 +15,7 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
@ -74,7 +74,7 @@ HRESULT WINAPI MAPIInitialize(LPVOID init)
return SUCCESS_SUCCESS;
}
ULONG WINAPI MAPILogon(ULONG uiparam, LPSTR profile, LPSTR password,
ULONG WINAPI MAPILogon(ULONG_PTR uiparam, LPSTR profile, LPSTR password,
FLAGS flags, ULONG reserved, LPLHANDLE session)
{
FIXME("(0x%08lx %s %p 0x%08lx 0x%08lx %p) Stub\n", uiparam,
@ -84,7 +84,7 @@ ULONG WINAPI MAPILogon(ULONG uiparam, LPSTR profile, LPSTR password,
return SUCCESS_SUCCESS;
}
ULONG WINAPI MAPILogoff(LHANDLE session, ULONG uiparam, FLAGS flags,
ULONG WINAPI MAPILogoff(LHANDLE session, ULONG_PTR uiparam, FLAGS flags,
ULONG reserved )
{
FIXME("(0x%08lx 0x%08lx 0x%08lx 0x%08lx) Stub\n", session,
@ -100,6 +100,12 @@ HRESULT WINAPI MAPILogonEx(ULONG_PTR uiparam, LPWSTR profile,
return SUCCESS_SUCCESS;
}
HRESULT WINAPI MAPIOpenLocalFormContainer(LPVOID *ppfcnt)
{
FIXME("(%p) Stub\n", ppfcnt);
return E_FAIL;
}
VOID WINAPI MAPIUninitialize(void)
{
FIXME("Stub\n");

View file

@ -15,7 +15,7 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
@ -1404,7 +1404,7 @@ typedef struct
ULONG ulObjAccess; /* Object access level */
ULONG ulNumValues; /* Number of items in values list */
struct list values; /* List of property values */
RTL_CRITICAL_SECTION cs; /* Lock for thread safety */
CRITICAL_SECTION cs; /* Lock for thread safety */
} IPropDataImpl;
/* Internal - Get a property value, assumes lock is held */
@ -1461,13 +1461,13 @@ static IPropDataItem *IMAPIPROP_AddValue(IPropDataImpl *This,
/* Internal - Lock an IPropData object */
static inline void IMAPIPROP_Lock(IPropDataImpl *This)
{
RtlEnterCriticalSection(&This->cs);
EnterCriticalSection(&This->cs);
}
/* Internal - Unlock an IPropData object */
static inline void IMAPIPROP_Unlock(IPropDataImpl *This)
{
RtlLeaveCriticalSection(&This->cs);
LeaveCriticalSection(&This->cs);
}
/* This one seems to be missing from mapidefs.h */
@ -1553,7 +1553,7 @@ static inline ULONG WINAPI IMAPIProp_fnRelease(LPMAPIPROP iface)
This->lpFree(current->value);
This->lpFree(current);
}
RtlDeleteCriticalSection(&This->cs);
DeleteCriticalSection(&This->cs);
This->lpFree(This);
}
return (ULONG)lRef;
@ -2542,7 +2542,7 @@ SCODE WINAPI CreateIProp(LPCIID iid, ALLOCATEBUFFER *lpAlloc,
lpPropData->ulObjAccess = IPROP_READWRITE;
lpPropData->ulNumValues = 0;
list_init(&lpPropData->values);
RtlInitializeCriticalSection(&lpPropData->cs);
InitializeCriticalSection(&lpPropData->cs);
*lppPropData = (LPPROPDATA)lpPropData;
}
return scode;

View file

@ -1,199 +1,199 @@
/*
* MAPISendMail implementation
*
* Copyright 2005 Hans Leidekker
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "wine/port.h"
#include <stdio.h>
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "winnls.h"
#include "objbase.h"
#include "mapi.h"
#include "winreg.h"
#include "shellapi.h"
#include "shlwapi.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(mapi);
/**************************************************************************
* MAPISendMail (MAPI32.211)
*
* Send a mail.
*
* PARAMS
* session [I] Handle to a MAPI session.
* uiparam [I] Parent window handle.
* message [I] Pointer to a MAPIMessage structure.
* flags [I] Flags.
* reserved [I] Reserved, pass 0.
*
* RETURNS
* Success: SUCCESS_SUCCESS
* Failure: MAPI_E_FAILURE
*
* NOTES
* This is a temporary hack.
*/
ULONG WINAPI MAPISendMail( LHANDLE session, ULONG_PTR uiparam,
lpMapiMessage message, FLAGS flags, ULONG reserved )
{
ULONG ret = MAPI_E_FAILURE;
unsigned int i, to_count = 0, cc_count = 0, bcc_count = 0;
unsigned int to_size = 0, cc_size = 0, bcc_size = 0, subj_size, body_size;
char *address = "", *to = NULL, *cc = NULL, *bcc = NULL, *subject, *body;
static const char format[] =
"mailto:\"%s\"?subject=\"%s\"&cc=\"%s\"&bcc=\"%s\"&body=\"%s\"";
char *mailto = NULL, *escape = NULL;
HRESULT res;
DWORD size;
TRACE( "(0x%08lx 0x%08lx %p 0x%08lx 0x%08lx)\n", session, uiparam,
message, flags, reserved );
if (!message) return MAPI_E_FAILURE;
for (i = 0; i < message->nRecipCount; i++)
{
if (!message->lpRecips)
{
WARN("No recipients found\n");
return MAPI_E_FAILURE;
}
address = message->lpRecips[i].lpszAddress;
if (address)
{
switch (message->lpRecips[i].ulRecipClass)
{
case MAPI_ORIG:
TRACE( "From: %s", debugstr_a(address) );
break;
case MAPI_TO:
TRACE( "To: %s", debugstr_a(address) );
to_size += lstrlenA( address ) + 1;
break;
case MAPI_CC:
TRACE( "Cc: %s", debugstr_a(address) );
cc_size += lstrlenA( address ) + 1;
break;
case MAPI_BCC:
TRACE( "Bcc: %s", debugstr_a(address) );
bcc_size += lstrlenA( address ) + 1;
break;
default:
TRACE( "Unknown recipient class: %ld\n",
message->lpRecips[i].ulRecipClass );
}
}
else
FIXME("Name resolution and entry identifiers not supported\n");
}
if (message->nFileCount) FIXME("Ignoring attachments\n");
subject = message->lpszSubject ? message->lpszSubject : "";
body = message->lpszNoteText ? message->lpszNoteText : "";
TRACE( "Subject: %s\n", debugstr_a(subject) );
TRACE( "Body: %s\n", debugstr_a(body) );
subj_size = lstrlenA( subject );
body_size = lstrlenA( body );
ret = MAPI_E_INSUFFICIENT_MEMORY;
if (to_size)
{
to = HeapAlloc( GetProcessHeap(), 0, to_size );
if (!to) goto exit;
}
if (cc_size)
{
cc = HeapAlloc( GetProcessHeap(), 0, cc_size );
if (!cc) goto exit;
}
if (bcc_size)
{
bcc = HeapAlloc( GetProcessHeap(), 0, bcc_size );
if (!bcc) goto exit;
}
if (message->lpOriginator)
TRACE( "From: %s\n", debugstr_a(message->lpOriginator->lpszAddress) );
for (i = 0; i < message->nRecipCount; i++)
{
address = message->lpRecips[i].lpszAddress;
if (address)
{
switch (message->lpRecips[i].ulRecipClass)
{
case MAPI_TO:
if (to_count) lstrcatA( to, "," );
lstrcatA( to, address );
to_count++;
break;
case MAPI_CC:
if (cc_count) lstrcatA( cc, "," );
lstrcatA( cc, address );
cc_count++;
break;
case MAPI_BCC:
if (bcc_count) lstrcatA( bcc, "," );
lstrcatA( bcc, address );
bcc_count++;
break;
}
}
}
ret = MAPI_E_FAILURE;
size = sizeof(format) + to_size + cc_size + bcc_size + subj_size + body_size;
mailto = HeapAlloc( GetProcessHeap(), 0, size );
if (!mailto) goto exit;
sprintf( mailto, format, to ? to : "", subject, cc ? cc : "", bcc ? bcc : "", body );
size = 0;
res = UrlEscapeA( mailto, NULL, &size, URL_ESCAPE_SPACES_ONLY );
if (res != E_POINTER) goto exit;
escape = HeapAlloc( GetProcessHeap(), 0, size );
if (!escape) goto exit;
res = UrlEscapeA( mailto, escape, &size, URL_ESCAPE_SPACES_ONLY );
if (res != S_OK) goto exit;
if ((UINT_PTR)ShellExecuteA( NULL, "open", escape, NULL, NULL, 0 ) > 32)
ret = SUCCESS_SUCCESS;
exit:
HeapFree( GetProcessHeap(), 0, to );
HeapFree( GetProcessHeap(), 0, cc );
HeapFree( GetProcessHeap(), 0, bcc );
HeapFree( GetProcessHeap(), 0, mailto );
HeapFree( GetProcessHeap(), 0, escape );
return ret;
}
/*
* MAPISendMail implementation
*
* Copyright 2005 Hans Leidekker
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include <stdio.h>
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "winnls.h"
#include "objbase.h"
#include "mapi.h"
#include "winreg.h"
#include "shellapi.h"
#include "shlwapi.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(mapi);
/**************************************************************************
* MAPISendMail (MAPI32.211)
*
* Send a mail.
*
* PARAMS
* session [I] Handle to a MAPI session.
* uiparam [I] Parent window handle.
* message [I] Pointer to a MAPIMessage structure.
* flags [I] Flags.
* reserved [I] Reserved, pass 0.
*
* RETURNS
* Success: SUCCESS_SUCCESS
* Failure: MAPI_E_FAILURE
*
* NOTES
* This is a temporary hack.
*/
ULONG WINAPI MAPISendMail( LHANDLE session, ULONG_PTR uiparam,
lpMapiMessage message, FLAGS flags, ULONG reserved )
{
ULONG ret = MAPI_E_FAILURE;
unsigned int i, to_count = 0, cc_count = 0, bcc_count = 0;
unsigned int to_size = 0, cc_size = 0, bcc_size = 0, subj_size, body_size;
char *address = "", *to = NULL, *cc = NULL, *bcc = NULL, *subject, *body;
static const char format[] =
"mailto:\"%s\"?subject=\"%s\"&cc=\"%s\"&bcc=\"%s\"&body=\"%s\"";
char *mailto = NULL, *escape = NULL;
HRESULT res;
DWORD size;
TRACE( "(0x%08lx 0x%08lx %p 0x%08lx 0x%08lx)\n", session, uiparam,
message, flags, reserved );
if (!message) return MAPI_E_FAILURE;
for (i = 0; i < message->nRecipCount; i++)
{
if (!message->lpRecips)
{
WARN("No recipients found\n");
return MAPI_E_FAILURE;
}
address = message->lpRecips[i].lpszAddress;
if (address)
{
switch (message->lpRecips[i].ulRecipClass)
{
case MAPI_ORIG:
TRACE( "From: %s", debugstr_a(address) );
break;
case MAPI_TO:
TRACE( "To: %s", debugstr_a(address) );
to_size += lstrlenA( address ) + 1;
break;
case MAPI_CC:
TRACE( "Cc: %s", debugstr_a(address) );
cc_size += lstrlenA( address ) + 1;
break;
case MAPI_BCC:
TRACE( "Bcc: %s", debugstr_a(address) );
bcc_size += lstrlenA( address ) + 1;
break;
default:
TRACE( "Unknown recipient class: %ld\n",
message->lpRecips[i].ulRecipClass );
}
}
else
FIXME("Name resolution and entry identifiers not supported\n");
}
if (message->nFileCount) FIXME("Ignoring attachments\n");
subject = message->lpszSubject ? message->lpszSubject : "";
body = message->lpszNoteText ? message->lpszNoteText : "";
TRACE( "Subject: %s\n", debugstr_a(subject) );
TRACE( "Body: %s\n", debugstr_a(body) );
subj_size = lstrlenA( subject );
body_size = lstrlenA( body );
ret = MAPI_E_INSUFFICIENT_MEMORY;
if (to_size)
{
to = HeapAlloc( GetProcessHeap(), 0, to_size );
if (!to) goto exit;
}
if (cc_size)
{
cc = HeapAlloc( GetProcessHeap(), 0, cc_size );
if (!cc) goto exit;
}
if (bcc_size)
{
bcc = HeapAlloc( GetProcessHeap(), 0, bcc_size );
if (!bcc) goto exit;
}
if (message->lpOriginator)
TRACE( "From: %s\n", debugstr_a(message->lpOriginator->lpszAddress) );
for (i = 0; i < message->nRecipCount; i++)
{
address = message->lpRecips[i].lpszAddress;
if (address)
{
switch (message->lpRecips[i].ulRecipClass)
{
case MAPI_TO:
if (to_count) lstrcatA( to, "," );
lstrcatA( to, address );
to_count++;
break;
case MAPI_CC:
if (cc_count) lstrcatA( cc, "," );
lstrcatA( cc, address );
cc_count++;
break;
case MAPI_BCC:
if (bcc_count) lstrcatA( bcc, "," );
lstrcatA( bcc, address );
bcc_count++;
break;
}
}
}
ret = MAPI_E_FAILURE;
size = sizeof(format) + to_size + cc_size + bcc_size + subj_size + body_size;
mailto = HeapAlloc( GetProcessHeap(), 0, size );
if (!mailto) goto exit;
sprintf( mailto, format, to ? to : "", subject, cc ? cc : "", bcc ? bcc : "", body );
size = 0;
res = UrlEscapeA( mailto, NULL, &size, URL_ESCAPE_SPACES_ONLY );
if (res != E_POINTER) goto exit;
escape = HeapAlloc( GetProcessHeap(), 0, size );
if (!escape) goto exit;
res = UrlEscapeA( mailto, escape, &size, URL_ESCAPE_SPACES_ONLY );
if (res != S_OK) goto exit;
if ((UINT_PTR)ShellExecuteA( NULL, "open", escape, NULL, NULL, 0 ) > 32)
ret = SUCCESS_SUCCESS;
exit:
HeapFree( GetProcessHeap(), 0, to );
HeapFree( GetProcessHeap(), 0, cc );
HeapFree( GetProcessHeap(), 0, bcc );
HeapFree( GetProcessHeap(), 0, mailto );
HeapFree( GetProcessHeap(), 0, escape );
return ret;
}

View file

@ -15,10 +15,11 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#include <stdio.h>
#define COBJMACROS
#define NONAMELESSUNION
@ -35,6 +36,7 @@
#include "wine/unicode.h"
#include "mapival.h"
#include "xcmc.h"
#include "msi.h"
WINE_DEFAULT_DEBUG_CHANNEL(mapi);
@ -821,3 +823,70 @@ CMC_return_code WINAPI cmc_query_configuration(
FIXME("stub");
return CMC_E_NOT_SUPPORTED;
}
/**************************************************************************
* FGetComponentPath (MAPI32.254)
* FGetComponentPath@20 (MAPI32.255)
*
* Return the installed component path, usually to the private mapi32.dll.
*
* PARAMS
* component [I] Component ID
* qualifier [I] Application LCID
* dll_path [O] returned component path
* dll_path_length [I] component path length
* install [I] install mode
*
* RETURNS
* Success: TRUE.
* Failure: FALSE.
*
* NOTES
* Previously documented in Q229700 "How to locate the correct path
* to the Mapisvc.inf file in Microsoft Outlook".
*/
BOOL WINAPI FGetComponentPath(LPCSTR component, LPCSTR qualifier, LPSTR dll_path,
DWORD dll_path_length, BOOL install)
{
BOOL ret = FALSE;
HMODULE hmsi;
TRACE("%s %s %p %lu %d\n", component, qualifier, dll_path, dll_path_length, install);
dll_path[0] = 0;
hmsi = LoadLibraryA("msi.dll");
if (hmsi)
{
FARPROC pMsiProvideQualifiedComponentA = GetProcAddress(hmsi, "MsiProvideQualifiedComponentA");
if (pMsiProvideQualifiedComponentA)
{
static const char * const fmt[] = { "%d\\NT", "%d\\95", "%d" };
char lcid_ver[20];
UINT i;
for (i = 0; i < sizeof(fmt)/sizeof(fmt[0]); i++)
{
/* FIXME: what's the correct behaviour here? */
if (!qualifier || qualifier == lcid_ver)
{
sprintf(lcid_ver, fmt[i], GetUserDefaultUILanguage());
qualifier = lcid_ver;
}
if (pMsiProvideQualifiedComponentA(component, qualifier,
install ? INSTALLMODE_DEFAULT : INSTALLMODE_EXISTING,
dll_path, &dll_path_length) == ERROR_SUCCESS)
{
ret = TRUE;
break;
}
if (qualifier != lcid_ver) break;
}
}
FreeLibrary(hmsi);
}
return ret;
}