diff --git a/reactos/dll/win32/mapi32/mapi32.rbuild b/reactos/dll/win32/mapi32/mapi32.rbuild index 1c73d3ad8a4..608c72955b7 100644 --- a/reactos/dll/win32/mapi32/mapi32.rbuild +++ b/reactos/dll/win32/mapi32/mapi32.rbuild @@ -15,6 +15,7 @@ wine shlwapi shell32 + advapi32 kernel32 uuid ntdll diff --git a/reactos/dll/win32/mapi32/mapi32.spec b/reactos/dll/win32/mapi32/mapi32.spec index abf79bf124a..04be363d2bc 100644 --- a/reactos/dll/win32/mapi32/mapi32.spec +++ b/reactos/dll/win32/mapi32/mapi32.spec @@ -145,17 +145,17 @@ 205 stub FDecodeID@12 206 stub CchOfEncoding@4 207 stdcall CbOfEncoded@4(ptr) CbOfEncoded -208 stub MAPISendDocuments +208 stdcall MAPISendDocuments(ptr ptr ptr ptr long) 209 stdcall MAPILogon(long ptr ptr long long ptr) 210 stdcall MAPILogoff(long long long long) 211 stdcall MAPISendMail(long long ptr long long) -212 stub MAPISaveMail -213 stub MAPIReadMail -214 stub MAPIFindNext -215 stub MAPIDeleteMail -217 stub MAPIAddress -218 stub MAPIDetails -219 stub MAPIResolveName +212 stdcall MAPISaveMail(ptr ptr ptr long long ptr) +213 stdcall MAPIReadMail(ptr ptr ptr long long ptr) +214 stdcall MAPIFindNext(ptr ptr ptr ptr long long ptr) +215 stdcall MAPIDeleteMail(ptr ptr ptr long long) +217 stdcall MAPIAddress(ptr ptr ptr long ptr long long ptr long ptr ptr) +218 stdcall MAPIDetails(ptr ptr ptr long long) +219 stdcall MAPIResolveName(ptr ptr ptr long long ptr) 220 stub BMAPISendMail 221 stub BMAPISaveMail 222 stub BMAPIReadMail diff --git a/reactos/dll/win32/mapi32/mapi32_main.c b/reactos/dll/win32/mapi32/mapi32_main.c index b9d5888bead..28c2f140d9c 100644 --- a/reactos/dll/win32/mapi32/mapi32_main.c +++ b/reactos/dll/win32/mapi32/mapi32_main.c @@ -1,7 +1,7 @@ /* * MAPI basics * - * Copyright 2001 CodeWeavers Inc. + * Copyright 2001, 2009 CodeWeavers Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -29,6 +29,7 @@ #include "mapiform.h" #include "mapi.h" #include "wine/debug.h" +#include "util.h" WINE_DEFAULT_DEBUG_CHANNEL(mapi); @@ -45,9 +46,11 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad) { case DLL_PROCESS_ATTACH: DisableThreadLibraryCalls(hinstDLL); + load_mapi_providers(); break; case DLL_PROCESS_DETACH: TRACE("DLL_PROCESS_DETACH: %d objects remaining\n", MAPI_ObjectCount); + unload_mapi_providers(); break; } return TRUE; @@ -58,8 +61,17 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad) */ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv) { - *ppv = NULL; + if (mapiFunctions.DllGetClassObject) + { + HRESULT ret = mapiFunctions.DllGetClassObject(rclsid, iid, ppv); + + TRACE("ret: %x\n", ret); + return ret; + } + FIXME("\n\tCLSID:\t%s,\n\tIID:\t%s\n", debugstr_guid(rclsid), debugstr_guid(iid)); + + *ppv = NULL; return CLASS_E_CLASSNOTAVAILABLE; } @@ -80,36 +92,77 @@ HRESULT WINAPI DllCanUnloadNow(void) return MAPI_ObjectCount == 0 ? S_OK : S_FALSE; } +/*********************************************************************** + * MAPIInitialize + * + * Initialises the MAPI library. In our case, we pass through to the + * loaded Extended MAPI provider. + */ HRESULT WINAPI MAPIInitialize(LPVOID init) { - FIXME("(%p) Stub\n", init); - return SUCCESS_SUCCESS; + TRACE("(%p)\n", init); + + if (mapiFunctions.MAPIInitialize) + return mapiFunctions.MAPIInitialize(init); + + return MAPI_E_NOT_INITIALIZED; } +/*********************************************************************** + * MAPILogon + * + * Logs on to a MAPI provider. If available, we pass this through to a + * Simple MAPI provider. Otherwise, we maintain basic functionality + * ourselves. + */ ULONG WINAPI MAPILogon(ULONG_PTR uiparam, LPSTR profile, LPSTR password, FLAGS flags, ULONG reserved, LPLHANDLE session) { - FIXME("(0x%08lx %s %p 0x%08x 0x%08x %p) Stub\n", uiparam, + TRACE("(0x%08lx %s %p 0x%08x 0x%08x %p)\n", uiparam, debugstr_a(profile), password, flags, reserved, session); + if (mapiFunctions.MAPILogon) + return mapiFunctions.MAPILogon(uiparam, profile, password, flags, reserved, session); + if (session) *session = 1; return SUCCESS_SUCCESS; } +/*********************************************************************** + * MAPILogoff + * + * Logs off from a MAPI provider. If available, we pass this through to a + * Simple MAPI provider. Otherwise, we maintain basic functionality + * ourselves. + */ ULONG WINAPI MAPILogoff(LHANDLE session, ULONG_PTR uiparam, FLAGS flags, ULONG reserved ) { - FIXME("(0x%08lx 0x%08lx 0x%08x 0x%08x) Stub\n", session, + TRACE("(0x%08lx 0x%08lx 0x%08x 0x%08x)\n", session, uiparam, flags, reserved); + + if (mapiFunctions.MAPILogoff) + return mapiFunctions.MAPILogoff(session, uiparam, flags, reserved); + return SUCCESS_SUCCESS; } +/*********************************************************************** + * MAPILogonEx + * + * Logs on to a MAPI provider. If available, we pass this through to an + * Extended MAPI provider. Otherwise, we return an error. + */ HRESULT WINAPI MAPILogonEx(ULONG_PTR uiparam, LPWSTR profile, LPWSTR password, ULONG flags, LPMAPISESSION *session) { - FIXME("(0x%08lx %s %p 0x%08x %p) Stub\n", uiparam, + TRACE("(0x%08lx %s %p 0x%08x %p)\n", uiparam, debugstr_w(profile), password, flags, session); - return SUCCESS_SUCCESS; + + if (mapiFunctions.MAPILogonEx) + return mapiFunctions.MAPILogonEx(uiparam, profile, password, flags, session); + + return E_FAIL; } HRESULT WINAPI MAPIOpenLocalFormContainer(LPVOID *ppfcnt) @@ -118,9 +171,20 @@ HRESULT WINAPI MAPIOpenLocalFormContainer(LPVOID *ppfcnt) return E_FAIL; } +/*********************************************************************** + * MAPIUninitialize + * + * Uninitialises the MAPI library. In our case, we pass through to the + * loaded Extended MAPI provider. + * + */ VOID WINAPI MAPIUninitialize(void) { - FIXME("Stub\n"); + TRACE("()\n"); + + /* Try to uninitialise the Extended MAPI library */ + if (mapiFunctions.MAPIUninitialize) + mapiFunctions.MAPIUninitialize(); } HRESULT WINAPI MAPIAdminProfiles(ULONG ulFlags, LPPROFADMIN *lppProfAdmin) @@ -129,3 +193,68 @@ HRESULT WINAPI MAPIAdminProfiles(ULONG ulFlags, LPPROFADMIN *lppProfAdmin) *lppProfAdmin = NULL; return E_FAIL; } + +ULONG WINAPI MAPIAddress(LHANDLE session, ULONG_PTR uiparam, LPSTR caption, + ULONG editfields, LPSTR labels, ULONG nRecips, lpMapiRecipDesc lpRecips, + FLAGS flags, ULONG reserved, LPULONG newRecips, lpMapiRecipDesc * lppNewRecips) +{ + if (mapiFunctions.MAPIAddress) + return mapiFunctions.MAPIAddress(session, uiparam, caption, editfields, labels, + nRecips, lpRecips, flags, reserved, newRecips, lppNewRecips); + + return MAPI_E_NOT_SUPPORTED; +} + +ULONG WINAPI MAPIDeleteMail(LHANDLE session, ULONG_PTR uiparam, LPSTR msg_id, + FLAGS flags, ULONG reserved) +{ + if (mapiFunctions.MAPIDeleteMail) + return mapiFunctions.MAPIDeleteMail(session, uiparam, msg_id, flags, reserved); + + return MAPI_E_NOT_SUPPORTED; +} + +ULONG WINAPI MAPIDetails(LHANDLE session, ULONG_PTR uiparam, lpMapiRecipDesc recip, + FLAGS flags, ULONG reserved) +{ + if (mapiFunctions.MAPIDetails) + return mapiFunctions.MAPIDetails(session, uiparam, recip, flags, reserved); + + return MAPI_E_NOT_SUPPORTED; +} + +ULONG WINAPI MAPIFindNext(LHANDLE session, ULONG_PTR uiparam, LPSTR msg_type, + LPSTR seed_msg_id, FLAGS flags, ULONG reserved, LPSTR msg_id) +{ + if (mapiFunctions.MAPIFindNext) + return mapiFunctions.MAPIFindNext(session, uiparam, msg_type, seed_msg_id, flags, reserved, msg_id); + + return MAPI_E_NOT_SUPPORTED; +} + +ULONG WINAPI MAPIReadMail(LHANDLE session, ULONG_PTR uiparam, LPSTR msg_id, + FLAGS flags, ULONG reserved, lpMapiMessage msg) +{ + if (mapiFunctions.MAPIReadMail) + return mapiFunctions.MAPIReadMail(session, uiparam, msg_id, flags, reserved, msg); + + return MAPI_E_NOT_SUPPORTED; +} + +ULONG WINAPI MAPIResolveName(LHANDLE session, ULONG_PTR uiparam, LPSTR name, + FLAGS flags, ULONG reserved, lpMapiRecipDesc *recip) +{ + if (mapiFunctions.MAPIResolveName) + return mapiFunctions.MAPIResolveName(session, uiparam, name, flags, reserved, recip); + + return MAPI_E_NOT_SUPPORTED; +} + +ULONG WINAPI MAPISaveMail(LHANDLE session, ULONG_PTR uiparam, lpMapiMessage msg, + FLAGS flags, ULONG reserved, LPSTR msg_id) +{ + if (mapiFunctions.MAPISaveMail) + return mapiFunctions.MAPISaveMail(session, uiparam, msg, flags, reserved, msg_id); + + return MAPI_E_NOT_SUPPORTED; +} diff --git a/reactos/dll/win32/mapi32/sendmail.c b/reactos/dll/win32/mapi32/sendmail.c index 7b8de6676d5..13fb4c7b0ef 100644 --- a/reactos/dll/win32/mapi32/sendmail.c +++ b/reactos/dll/win32/mapi32/sendmail.c @@ -2,6 +2,7 @@ * MAPISendMail implementation * * Copyright 2005 Hans Leidekker + * Copyright 2009 Owen Rudge for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -24,18 +25,347 @@ #include #include +#define COBJMACROS + #include "windef.h" #include "winbase.h" #include "winerror.h" #include "objbase.h" +#include "objidl.h" #include "mapi.h" +#include "mapix.h" +#include "mapiutil.h" +#include "mapidefs.h" #include "winreg.h" #include "shellapi.h" #include "shlwapi.h" #include "wine/debug.h" +#include "util.h" WINE_DEFAULT_DEBUG_CHANNEL(mapi); +#define READ_BUF_SIZE 4096 + +/* + Internal function to send a message via Extended MAPI. Wrapper around the Simple + MAPI function MAPISendMail. +*/ +static ULONG sendmail_extended_mapi(LHANDLE mapi_session, ULONG_PTR uiparam, lpMapiMessage message, + FLAGS flags, ULONG reserved) +{ + ULONG tags[] = {1, PR_IPM_DRAFTS_ENTRYID}; + ULONG retval = MAPI_E_FAILURE; + IMAPISession *session = NULL; + IMAPITable* msg_table; + LPSRowSet rows = NULL; + IMsgStore* msg_store; + IMAPIFolder* folder = NULL; + LPENTRYID entry_id; + LPSPropValue props; + ULONG entry_len; + DWORD obj_type; + IMessage* msg; + ULONG values; + HRESULT ret; + + TRACE("Using Extended MAPI wrapper for MAPISendMail\n"); + + /* Attempt to log on via Extended MAPI */ + + ret = MAPILogonEx(0, NULL, NULL, MAPI_EXTENDED | MAPI_USE_DEFAULT | MAPI_NEW_SESSION, &session); + TRACE("MAPILogonEx: %x\n", ret); + + if (ret != S_OK) + { + retval = MAPI_E_LOGIN_FAILURE; + goto cleanup; + } + + /* Open the default message store */ + + if (IMAPISession_GetMsgStoresTable(session, 0, &msg_table) == S_OK) + { + /* We want the default store */ + SizedSPropTagArray(2, columns) = {2, {PR_ENTRYID, PR_DEFAULT_STORE}}; + + /* Set the columns we want */ + if (IMAPITable_SetColumns(msg_table, (LPSPropTagArray) &columns, 0) == S_OK) + { + while (1) + { + if (IMAPITable_QueryRows(msg_table, 1, 0, &rows) != S_OK) + { + MAPIFreeBuffer(rows); + rows = NULL; + } + else if (rows->cRows != 1) + { + FreeProws(rows); + rows = NULL; + } + else + { + /* If it's not the default store, try the next row */ + if (!rows->aRow[0].lpProps[1].Value.b) + { + FreeProws(rows); + continue; + } + } + + break; + } + } + + IMAPITable_Release(msg_table); + } + + /* Did we manage to get the right store? */ + if (!rows) + goto logoff; + + /* Open the message store */ + IMAPISession_OpenMsgStore(session, 0, rows->aRow[0].lpProps[0].Value.bin.cb, + (ENTRYID *) rows->aRow[0].lpProps[0].Value.bin.lpb, NULL, + MDB_NO_DIALOG | MAPI_BEST_ACCESS, &msg_store); + + /* We don't need this any more */ + FreeProws(rows); + + /* First open the inbox, from which the drafts folder can be opened */ + if (IMsgStore_GetReceiveFolder(msg_store, NULL, 0, &entry_len, &entry_id, NULL) == S_OK) + { + IMsgStore_OpenEntry(msg_store, entry_len, entry_id, NULL, 0, &obj_type, (LPUNKNOWN*) &folder); + MAPIFreeBuffer(entry_id); + } + + /* Open the drafts folder, or failing that, try asking the message store for the outbox */ + if ((folder == NULL) || ((ret = IMAPIFolder_GetProps(folder, (LPSPropTagArray) tags, 0, &values, &props)) != S_OK)) + { + TRACE("Unable to open Drafts folder; opening Outbox instead\n"); + tags[1] = PR_IPM_OUTBOX_ENTRYID; + ret = IMsgStore_GetProps(msg_store, (LPSPropTagArray) tags, 0, &values, &props); + } + + if (ret != S_OK) + goto logoff; + + IMsgStore_OpenEntry(msg_store, props[0].Value.bin.cb, (LPENTRYID) props[0].Value.bin.lpb, + NULL, MAPI_MODIFY, &obj_type, (LPUNKNOWN *) &folder); + + /* Create a new message */ + if (IMAPIFolder_CreateMessage(folder, NULL, 0, &msg) == S_OK) + { + ULONG token; + SPropValue p; + + /* Define message properties */ + p.ulPropTag = PR_MESSAGE_FLAGS; + p.Value.l = MSGFLAG_FROMME | MSGFLAG_UNSENT; + + IMessage_SetProps(msg, 1, &p, NULL); + + p.ulPropTag = PR_SENTMAIL_ENTRYID; + p.Value.bin.cb = props[0].Value.bin.cb; + p.Value.bin.lpb = props[0].Value.bin.lpb; + IMessage_SetProps(msg, 1,&p, NULL); + + /* Set message subject */ + if (message->lpszSubject) + { + p.ulPropTag = PR_SUBJECT_A; + p.Value.lpszA = message->lpszSubject; + IMessage_SetProps(msg, 1, &p, NULL); + } + + /* Set message body */ + if (message->lpszNoteText) + { + LPSTREAM stream = NULL; + + if (IMessage_OpenProperty(msg, PR_BODY_A, &IID_IStream, 0, + MAPI_MODIFY | MAPI_CREATE, (LPUNKNOWN*) &stream) == S_OK) + { + IStream_Write(stream, message->lpszNoteText, strlen(message->lpszNoteText)+1, NULL); + IStream_Release(stream); + } + } + + /* Add message attachments */ + if (message->nFileCount > 0) + { + ULONG num_attach = 0; + int i, j; + + for (i = 0; i < message->nFileCount; i++) + { + IAttach* attachment = NULL; + SPropValue prop[4]; + LPCSTR filename; + HANDLE file; + + if (!message->lpFiles[i].lpszPathName) + continue; + + /* Open the attachment for reading */ + file = CreateFileA(message->lpFiles[i].lpszPathName, GENERIC_READ, FILE_SHARE_READ, + NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + + if (file == INVALID_HANDLE_VALUE) + continue; + + /* Check if a display filename has been given; if not, get one ourselves from path name */ + filename = message->lpFiles[i].lpszFileName; + + if (!filename) + { + filename = message->lpFiles[i].lpszPathName; + + for (j = strlen(message->lpFiles[i].lpszPathName)-1; j >= 0; j--) + { + if (message->lpFiles[i].lpszPathName[i] == '\\' || + message->lpFiles[i].lpszPathName[i] == '/') + { + filename = &message->lpFiles[i].lpszPathName[i+1]; + break; + } + } + } + + TRACE("Attachment %d path: '%s'; filename: '%s'\n", i, debugstr_a(message->lpFiles[i].lpszPathName), + debugstr_a(filename)); + + /* Create the attachment */ + if (IMessage_CreateAttach(msg, NULL, 0, &num_attach, &attachment) != S_OK) + { + TRACE("Unable to create attachment\n"); + CloseHandle(file); + continue; + } + + /* Set the attachment properties */ + ZeroMemory(prop, sizeof(prop)); + + prop[0].ulPropTag = PR_ATTACH_METHOD; + prop[0].Value.ul = ATTACH_BY_VALUE; + prop[1].ulPropTag = PR_ATTACH_LONG_FILENAME_A; + prop[1].Value.lpszA = (LPSTR) filename; + prop[2].ulPropTag = PR_ATTACH_FILENAME_A; + prop[2].Value.lpszA = (LPSTR) filename; + prop[3].ulPropTag = PR_RENDERING_POSITION; + prop[3].Value.l = -1; + + if (IAttach_SetProps(attachment, 4, prop, NULL) == S_OK) + { + LPSTREAM stream = NULL; + + if (IAttach_OpenProperty(attachment, PR_ATTACH_DATA_BIN, &IID_IStream, 0, + MAPI_MODIFY | MAPI_CREATE, (LPUNKNOWN*) &stream) == S_OK) + { + BYTE data[READ_BUF_SIZE]; + DWORD size = 0, read, written; + + while (ReadFile(file, data, READ_BUF_SIZE, &read, NULL) && (read != 0)) + { + IStream_Write(stream, data, read, &written); + size += read; + } + + TRACE("%d bytes read, %d bytes written of attachment\n", read, written); + + IStream_Commit(stream, STGC_DEFAULT); + IStream_Release(stream); + + prop[0].ulPropTag = PR_ATTACH_SIZE; + prop[0].Value.ul = size; + IAttach_SetProps(attachment, 1, prop, NULL); + + IAttach_SaveChanges(attachment, KEEP_OPEN_READONLY); + num_attach++; + } + } + + CloseHandle(file); + IAttach_Release(attachment); + } + } + + IMessage_SaveChanges(msg, KEEP_OPEN_READWRITE); + + /* Prepare the message form */ + + if (IMAPISession_PrepareForm(session, NULL, msg, &token) == S_OK) + { + ULONG access = 0, status = 0, flags = 0, pc = 0; + ULONG pT[2] = {1, PR_MSG_STATUS}; + + /* Retrieve message status, flags, access rights and class */ + + if (IMessage_GetProps(msg, (LPSPropTagArray) pT, 0, &pc, &props) == S_OK) + { + status = props->Value.ul; + MAPIFreeBuffer(props); + } + + pT[1] = PR_MESSAGE_FLAGS; + + if (IMessage_GetProps(msg, (LPSPropTagArray) pT, 0, &pc, &props) == S_OK) + { + flags = props->Value.ul; + MAPIFreeBuffer(props); + } + + pT[1] = PR_ACCESS; + + if (IMessage_GetProps(msg, (LPSPropTagArray) pT, 0, &pc, &props) == S_OK) + { + access = props->Value.ul; + MAPIFreeBuffer(props); + } + + pT[1] = PR_MESSAGE_CLASS_A; + + if (IMessage_GetProps(msg, (LPSPropTagArray) pT, 0, &pc, &props) == S_OK) + { + /* Show the message form (edit window) */ + + ret = IMAPISession_ShowForm(session, 0, msg_store, folder, NULL, + token, NULL, 0, status, flags, access, + props->Value.lpszA); + + switch (ret) + { + case S_OK: + retval = SUCCESS_SUCCESS; + break; + + case MAPI_E_USER_CANCEL: + retval = MAPI_E_USER_ABORT; + break; + + default: + TRACE("ShowForm failure: %x\n", ret); + break; + } + } + } + + IMessage_Release(msg); + } + + /* Free up the resources we've used */ + IMAPIFolder_Release(folder); + IMsgStore_Release(msg_store); + +logoff: ; + IMAPISession_Logoff(session, 0, 0, 0); + IMAPISession_Release(session); + +cleanup: ; + MAPIUninitialize(); + return retval; +} + /************************************************************************** * MAPISendMail (MAPI32.211) * @@ -53,7 +383,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(mapi); * Failure: MAPI_E_FAILURE * * NOTES - * This is a temporary hack. + * The fallback procedure is a temporary hack. */ ULONG WINAPI MAPISendMail( LHANDLE session, ULONG_PTR uiparam, lpMapiMessage message, FLAGS flags, ULONG reserved ) @@ -74,6 +404,15 @@ ULONG WINAPI MAPISendMail( LHANDLE session, ULONG_PTR uiparam, TRACE( "(0x%08x 0x%08lx %p 0x%08x 0x%08x)\n", session, uiparam, message, flags, reserved ); + /* Check to see if we have a Simple MAPI provider loaded */ + if (mapiFunctions.MAPISendMail) + return mapiFunctions.MAPISendMail(session, uiparam, message, flags, reserved); + + /* Check if we have an Extended MAPI provider - if so, use our wrapper */ + if (MAPIInitialize(NULL) == S_OK) + return sendmail_extended_mapi(session, uiparam, message, flags, reserved); + + /* Fall back on our own implementation */ if (!message) return MAPI_E_FAILURE; for (i = 0; i < message->nRecipCount; i++) @@ -201,3 +540,12 @@ exit: return ret; } + +ULONG WINAPI MAPISendDocuments(ULONG_PTR uiparam, LPSTR delim, LPSTR paths, + LPSTR filenames, ULONG reserved) +{ + if (mapiFunctions.MAPISendDocuments) + return mapiFunctions.MAPISendDocuments(uiparam, delim, paths, filenames, reserved); + + return MAPI_E_NOT_SUPPORTED; +} diff --git a/reactos/dll/win32/mapi32/util.c b/reactos/dll/win32/mapi32/util.c index b68eceb51ab..fdb8497d677 100644 --- a/reactos/dll/win32/mapi32/util.c +++ b/reactos/dll/win32/mapi32/util.c @@ -2,6 +2,7 @@ * MAPI Utility functions * * Copyright 2004 Jon Griffiths + * Copyright 2009 Owen Rudge for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -37,6 +38,7 @@ #include "mapival.h" #include "xcmc.h" #include "msi.h" +#include "util.h" WINE_DEFAULT_DEBUG_CHANNEL(mapi); @@ -46,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) * @@ -858,8 +862,9 @@ BOOL WINAPI FGetComponentPath(LPCSTR component, LPCSTR qualifier, LPSTR dll_path hmsi = LoadLibraryA("msi.dll"); if (hmsi) { - FARPROC pMsiProvideQualifiedComponentA = GetProcAddress(hmsi, "MsiProvideQualifiedComponentA"); + UINT (WINAPI *pMsiProvideQualifiedComponentA)(LPCSTR, LPCSTR, DWORD, LPSTR, LPDWORD); + pMsiProvideQualifiedComponentA = (void *)GetProcAddress(hmsi, "MsiProvideQualifiedComponentA"); if (pMsiProvideQualifiedComponentA) { static const char * const fmt[] = { "%d\\NT", "%d\\95", "%d" }; @@ -902,3 +907,174 @@ HRESULT WINAPI HrQueryAllRows(LPMAPITABLE lpTable, LPSPropTagArray lpPropTags, *lppRows = NULL; return MAPI_E_CALL_FAILED; } + +static HMODULE mapi_provider; +static HMODULE mapi_ex_provider; + +/************************************************************************** + * load_mapi_provider + * + * Attempts to load a MAPI provider from the specified registry key. + * + * Returns a handle to the loaded module in `mapi_provider' if successful. + */ +static void load_mapi_provider(HKEY hkeyMail, LPCWSTR valueName, HMODULE *mapi_provider) +{ + static const WCHAR mapi32_dll[] = {'m','a','p','i','3','2','.','d','l','l',0 }; + + DWORD dwType, dwLen = 0; + LPWSTR dllPath; + + /* Check if we have a value set for DLLPath */ + if ((RegQueryValueExW(hkeyMail, valueName, NULL, &dwType, NULL, &dwLen) == ERROR_SUCCESS) && + ((dwType == REG_SZ) || (dwType == REG_EXPAND_SZ)) && (dwLen > 0)) + { + dllPath = HeapAlloc(GetProcessHeap(), 0, dwLen); + + if (dllPath) + { + RegQueryValueExW(hkeyMail, valueName, NULL, NULL, (LPBYTE)dllPath, &dwLen); + + /* Check that this value doesn't refer to mapi32.dll (eg, as Outlook does) */ + if (lstrcmpiW(dllPath, mapi32_dll) != 0) + { + if (dwType == REG_EXPAND_SZ) + { + DWORD dwExpandLen; + LPWSTR dllPathExpanded; + + /* Expand the path if necessary */ + dwExpandLen = ExpandEnvironmentStringsW(dllPath, NULL, 0); + dllPathExpanded = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR) * dwExpandLen + 1); + + if (dllPathExpanded) + { + ExpandEnvironmentStringsW(dllPath, dllPathExpanded, dwExpandLen + 1); + + HeapFree(GetProcessHeap(), 0, dllPath); + dllPath = dllPathExpanded; + } + } + + /* Load the DLL */ + TRACE("loading %s\n", debugstr_w(dllPath)); + *mapi_provider = LoadLibraryW(dllPath); + } + + HeapFree(GetProcessHeap(), 0, dllPath); + } + } +} + +/************************************************************************** + * load_mapi_providers + * + * Scans the registry for MAPI providers and attempts to load a Simple and + * Extended MAPI library. + * + * Returns TRUE if at least one library loaded, FALSE otherwise. + */ +void load_mapi_providers(void) +{ + static const WCHAR regkey_mail[] = { + 'S','o','f','t','w','a','r','e','\\','C','l','i','e','n','t','s','\\', + 'M','a','i','l',0 }; + + static const WCHAR regkey_dllpath[] = {'D','L','L','P','a','t','h',0 }; + static const WCHAR regkey_dllpath_ex[] = {'D','L','L','P','a','t','h','E','x',0 }; + static const WCHAR regkey_backslash[] = { '\\', 0 }; + + HKEY hkeyMail; + DWORD dwType, dwLen = 0; + LPWSTR appName = NULL, appKey = NULL; + + TRACE("()\n"); + + /* Open the Mail key */ + if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, regkey_mail, 0, KEY_READ, &hkeyMail) != ERROR_SUCCESS) + return; + + /* Check if we have a default value set, and the length of it */ + if ((RegQueryValueExW(hkeyMail, NULL, NULL, &dwType, NULL, &dwLen) != ERROR_SUCCESS) || + !((dwType == REG_SZ) || (dwType == REG_EXPAND_SZ)) || (dwLen == 0)) + goto cleanUp; + + appName = HeapAlloc(GetProcessHeap(), 0, dwLen); + + if (!appName) + goto cleanUp; + + /* Get the value, and get the path to the app key */ + RegQueryValueExW(hkeyMail, NULL, NULL, NULL, (LPBYTE)appName, &dwLen); + + TRACE("appName: %s\n", debugstr_w(appName)); + + appKey = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR) * (lstrlenW(regkey_mail) + + lstrlenW(regkey_backslash) + lstrlenW(appName))); + + if (!appKey) + goto cleanUp; + + lstrcpyW(appKey, regkey_mail); + lstrcatW(appKey, regkey_backslash); + lstrcatW(appKey, appName); + + RegCloseKey(hkeyMail); + + TRACE("appKey: %s\n", debugstr_w(appKey)); + + /* Open the app's key */ + if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, appKey, 0, KEY_READ, &hkeyMail) != ERROR_SUCCESS) + goto cleanUp; + + /* Try to load the providers */ + 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"); + + mapiFunctions.DllGetClassObject = (void*) GetProcAddress(mapi_ex_provider, "DllGetClassObject"); + } + +cleanUp: + RegCloseKey(hkeyMail); + HeapFree(GetProcessHeap(), 0, appKey); + HeapFree(GetProcessHeap(), 0, appName); +} + +/************************************************************************** + * unload_mapi_providers + * + * Unloads any loaded MAPI libraries. + */ +void unload_mapi_providers(void) +{ + TRACE("()\n"); + + FreeLibrary(mapi_provider); + FreeLibrary(mapi_ex_provider); +} diff --git a/reactos/dll/win32/mapi32/util.h b/reactos/dll/win32/mapi32/util.h new file mode 100644 index 00000000000..98990538ff2 --- /dev/null +++ b/reactos/dll/win32/mapi32/util.h @@ -0,0 +1,52 @@ +/* + * MAPI utility header file + * + * Copyright 2009 Owen Rudge for CodeWeavers + * + * 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 + */ + +#ifndef _MAPI_UTIL_H + +#define _MAPI_UTIL_H + +#include +#include + +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; + + HRESULT (WINAPI *DllGetClassObject)(REFCLSID, REFIID, LPVOID *); +} MAPI_FUNCTIONS; + +extern MAPI_FUNCTIONS mapiFunctions; + +#endif diff --git a/reactos/dll/win32/mapi32/version.rc b/reactos/dll/win32/mapi32/version.rc index 0f955162b37..d3a620bd8fb 100644 --- a/reactos/dll/win32/mapi32/version.rc +++ b/reactos/dll/win32/mapi32/version.rc @@ -18,5 +18,9 @@ #define WINE_FILEDESCRIPTION_STR "Wine Messaging API" #define WINE_FILENAME_STR "mapi32.dll" +#define WINE_FILEVERSION 1,0,0,0 +#define WINE_FILEVERSION_STR "1.0.0.0" +#define WINE_PRODUCTVERSION 1,0,0,0 +#define WINE_PRODUCTVERSION_STR "1.0.0.0" #include "wine/wine_common_ver.rc" diff --git a/reactos/dll/win32/user32/windows/menu.c b/reactos/dll/win32/user32/windows/menu.c index 7b37f9f6ec4..117dbbce470 100644 --- a/reactos/dll/win32/user32/windows/menu.c +++ b/reactos/dll/win32/user32/windows/menu.c @@ -3365,6 +3365,12 @@ MenuTrackMenu(HMENU Menu, UINT Flags, INT x, INT y, Menu, Flags, x, y, Wnd, Rect ? Rect->left : 0, Rect ? Rect->top : 0, Rect ? Rect->right : 0, Rect ? Rect->bottom : 0); + if (!IsMenu(Menu)) + { + SetLastError( ERROR_INVALID_MENU_HANDLE ); + return FALSE; + } + fEndMenu = FALSE; if (! MenuGetRosMenuInfo(&MenuInfo, Menu)) { @@ -3516,17 +3522,12 @@ MenuTrackMenu(HMENU Menu, UINT Flags, INT x, INT y, { MenuSelectItem(Mt.OwnerWnd, &MenuInfo, NO_SELECTED_ITEM, FALSE, 0 ); - } - /* fall through */ - - case VK_UP: - if (MenuGetRosMenuInfo(&MenuInfo, Mt.CurrentMenu)) - { MenuMoveSelection(Mt.OwnerWnd, &MenuInfo, VK_HOME == Msg.wParam ? ITEM_NEXT : ITEM_PREV); } break; + case VK_UP: case VK_DOWN: /* If on menu bar, pull-down the menu */ if (MenuGetRosMenuInfo(&MenuInfo, Mt.CurrentMenu)) { @@ -3682,6 +3683,11 @@ MenuTrackMenu(HMENU Menu, UINT Flags, INT x, INT y, { DestroyWindow(MenuInfo.Wnd); MenuInfo.Wnd = NULL; + + if (!(MenuInfo.Flags & TPM_NONOTIFY)) + SendMessageW( Mt.OwnerWnd, WM_UNINITMENUPOPUP, (WPARAM)Mt.TopMenu, + MAKELPARAM(0, IS_SYSTEM_MENU(&MenuInfo)) ); + } MenuSelectItem(Mt.OwnerWnd, &MenuInfo, NO_SELECTED_ITEM, FALSE, NULL); } @@ -5183,6 +5189,12 @@ TrackPopupMenu( { BOOL ret = FALSE; + if (!IsMenu(Menu)) + { + SetLastError( ERROR_INVALID_MENU_HANDLE ); + return FALSE; + } + MenuInitTracking(Wnd, Menu, TRUE, Flags); /* Send WM_INITMENUPOPUP message only if TPM_NONOTIFY flag is not specified */ diff --git a/reactos/include/psdk/mapidefs.h b/reactos/include/psdk/mapidefs.h index 27444275137..f06c61f63d2 100644 --- a/reactos/include/psdk/mapidefs.h +++ b/reactos/include/psdk/mapidefs.h @@ -1,5 +1,6 @@ /* * Copyright (C) 1998 Justin Bradford + * Copyright (c) 2009 Owen Rudge for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -83,25 +84,19 @@ typedef struct IAddrBook IAddrBook; typedef IAddrBook *LPADRBOOK; typedef struct IABContainer IABContainer; typedef IABContainer *LPABCONT; -typedef struct IAttach IAttach; -typedef IAttach *LPATTACH; +typedef struct IAttach *LPATTACH; typedef struct IDistList IDistList; typedef IDistList *LPDISTLIST; typedef struct IMailUser IMailUser; typedef IMailUser *LPMAILUSER; typedef struct IMAPIAdviseSink *LPMAPIADVISESINK; -typedef struct IMAPIContainer IMAPIContainer; -typedef IMAPIContainer *LPMAPICONTAINER; -typedef struct IMAPIFolder IMAPIFolder; -typedef IMAPIFolder *LPMAPIFOLDER; +typedef struct IMAPIContainer *LPMAPICONTAINER; +typedef struct IMAPIFolder *LPMAPIFOLDER; typedef struct IMAPIProgress IMAPIProgress; typedef IMAPIProgress *LPMAPIPROGRESS; typedef struct IMAPIStatus IMAPIStatus; typedef IMAPIStatus *LPMAPISTATUS; -typedef struct IMessage IMessage; -typedef IMessage *LPMESSAGE; -typedef struct IMsgStore IMsgStore; -typedef IMsgStore *LPMDB; +typedef struct IMessage *LPMESSAGE; typedef struct IProfSect IProfSect; typedef IProfSect *LPPROFSECT; typedef struct IProviderAdmin IProviderAdmin; @@ -156,12 +151,14 @@ typedef struct _MAPIUID /* Flags for various calls */ #define MAPI_MODIFY 0x00000001U /* Object can be modified */ +#define MAPI_CREATE 0x00000002U /* Object can be created */ #define MAPI_ACCESS_MODIFY MAPI_MODIFY /* Want write access */ #define MAPI_ACCESS_READ 0x00000002U /* Want read access */ #define MAPI_ACCESS_DELETE 0x00000004U /* Want delete access */ #define MAPI_ACCESS_CREATE_HIERARCHY 0x00000008U #define MAPI_ACCESS_CREATE_CONTENTS 0x00000010U #define MAPI_ACCESS_CREATE_ASSOCIATED 0x00000020U +#define MAPI_USE_DEFAULT 0x00000040U #define MAPI_UNICODE 0x80000000U /* Strings in this call are Unicode */ #if defined (UNICODE) || defined (__WINESRC__) @@ -170,6 +167,9 @@ typedef struct _MAPIUID #define fMapiUnicode 0U #endif +/* IMAPISession::OpenMessageStore() flags */ +#define MDB_NO_DIALOG 0x00000001 + /* Types of message receivers */ #ifndef MAPI_ORIG #define MAPI_ORIG 0 /* The original author */ @@ -761,6 +761,9 @@ typedef struct _NOTIFICATION typedef LONG (WINAPI NOTIFCALLBACK)(LPVOID,ULONG,LPNOTIFICATION); typedef NOTIFCALLBACK *LPNOTIFCALLBACK; +/* IMAPIContainer::OpenEntry flags */ +#define MAPI_BEST_ACCESS 0x00000010 + /***************************************************************************** * IMAPITable interface * @@ -895,21 +898,263 @@ DECLARE_INTERFACE_(IMAPIProp,IUnknown) #define IMAPIProp_AddRef(p) (p)->lpVtbl->AddRef(p) #define IMAPIProp_Release(p) (p)->lpVtbl->Release(p) /*** IMAPIProp methods ***/ -#define IMAPIProp_GetLastError(p,a,b,c) (p)->lpVtbl->GetLastError(p,a,b,c) -#define IMAPIProp_SaveChanges(p,a) (p)->lpVtbl->SaveChanges(p,a) -#define IMAPIProp_GetProps(p,a,b,c,d) (p)->lpVtbl->GetProps(p,a,b,c,d) -#define IMAPIProp_GetPropList(p,a,b) (p)->lpVtbl->GetPropList(p,a,b) -#define IMAPIProp_OpenProperty(p,a,b,c,d,e) (p)->lpVtbl->OpenProperty(p,a,b,c,d,e) -#define IMAPIProp_SetProps(p,a,b,c) (p)->lpVtbl->SetProps(p,a,b,c) -#define IMAPIProp_DeleteProps(p,a,b) (p)->lpVtbl->DeleteProps(p,a,b) -#define IMAPIProp_CopyTo(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CopyTo(p,a,b,c,d,e,f,g,h,i) -#define IMAPIProp_CopyProps(p,a,b,c,d,e,f,g) (p)->lpVtbl->CopyProps(p,a,b,c,d,e,f,g) -#define IMAPIProp_GetNamesFromIDs(p,a,b,c,d,e) (p)->lpVtbl->GetNamesFromIDs(p,a,b,c,d,e) -#define IMAPIProp_GetIDsFromNames(p,a,b,c,d) (p)->lpVtbl->GetIDsFromNames(p,a,b,c,d) +#define IMAPIProp_GetLastError(p,a,b,c) (p)->lpVtbl->GetLastError(p,a,b,c) +#define IMAPIProp_SaveChanges(p,a) (p)->lpVtbl->SaveChanges(p,a) +#define IMAPIProp_GetProps(p,a,b,c,d) (p)->lpVtbl->GetProps(p,a,b,c,d) +#define IMAPIProp_GetPropList(p,a,b) (p)->lpVtbl->GetPropList(p,a,b) +#define IMAPIProp_OpenProperty(p,a,b,c,d,e) (p)->lpVtbl->OpenProperty(p,a,b,c,d,e) +#define IMAPIProp_SetProps(p,a,b,c) (p)->lpVtbl->SetProps(p,a,b,c) +#define IMAPIProp_DeleteProps(p,a,b) (p)->lpVtbl->DeleteProps(p,a,b) +#define IMAPIProp_CopyTo(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CopyTo(p,a,b,c,d,e,f,g,h,i) +#define IMAPIProp_CopyProps(p,a,b,c,d,e,f,g) (p)->lpVtbl->CopyProps(p,a,b,c,d,e,f,g) +#define IMAPIProp_GetNamesFromIDs(p,a,b,c,d,e) (p)->lpVtbl->GetNamesFromIDs(p,a,b,c,d,e) +#define IMAPIProp_GetIDsFromNames(p,a,b,c,d) (p)->lpVtbl->GetIDsFromNames(p,a,b,c,d) #endif typedef IMAPIProp *LPMAPIPROP; +#define KEEP_OPEN_READONLY (0x00000001U) +#define KEEP_OPEN_READWRITE (0x00000002U) +#define FORCE_SAVE (0x00000004U) + +/***************************************************************************** + * IMsgStore interface + */ +#define INTERFACE IMsgStore +DECLARE_INTERFACE_(IMsgStore,IMAPIProp) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IMAPIProp methods ***/ + STDMETHOD(GetLastError)(THIS_ HRESULT hRes, ULONG ulFlags, LPMAPIERROR *lppErr) PURE; + STDMETHOD(SaveChanges)(THIS_ ULONG ulFlags) PURE; + STDMETHOD(GetProps)(THIS_ LPSPropTagArray lpPropTags, ULONG ulFlags, ULONG *lpValues, LPSPropValue *lppProps) PURE; + STDMETHOD(GetPropList)(THIS_ ULONG ulFlags, LPSPropTagArray *lppPropTagArray) PURE; + STDMETHOD(OpenProperty)(THIS_ ULONG ulPropTag, LPCIID lpIid, ULONG ulOpts, ULONG ulFlags, LPUNKNOWN *lppUnk) PURE; + STDMETHOD(SetProps)(THIS_ ULONG cValues, LPSPropValue lpProps, LPSPropProblemArray *lppProbs) PURE; + STDMETHOD(DeleteProps)(THIS_ LPSPropTagArray lpPropTags, LPSPropProblemArray *lppProbs) PURE; + STDMETHOD(CopyTo)(THIS_ ULONG ciidExclude, LPCIID lpIid, LPSPropTagArray lpProps, ULONG ulParam, + LPMAPIPROGRESS lpProgress, LPCIID lpIface,LPVOID lpDest, ULONG ulFlags, + LPSPropProblemArray *lppProbs) PURE; + STDMETHOD(CopyProps)(THIS_ LPSPropTagArray lpIncludeProps, ULONG ulParam, LPMAPIPROGRESS lpProgress, + LPCIID lpIid, LPVOID lpDestObj, ULONG ulFlags, LPSPropProblemArray *lppProblems) PURE; + STDMETHOD(GetNamesFromIDs)(THIS_ LPSPropTagArray *lppPropTags, LPGUID lpIid, ULONG ulFlags, ULONG *lpCount, + LPMAPINAMEID **lpppNames) PURE; + STDMETHOD(GetIDsFromNames)(THIS_ ULONG cPropNames, LPMAPINAMEID *lppNames, ULONG ulFlags, LPSPropTagArray *lppPropTags) PURE; + /*** IMsgStore methods ***/ + STDMETHOD(Advise)(THIS_ ULONG cbEntryID, LPENTRYID lpEntryID, ULONG ulEventMask, LPMAPIADVISESINK lpAdviseSink, + ULONG * lpulConnection) PURE; + STDMETHOD(Unadvise)(THIS_ ULONG ulConnection) PURE; + STDMETHOD(CompareEntryIDs)(THIS_ ULONG cbEntryID1, LPENTRYID lpEntryID1, ULONG cbEntryID2, LPENTRYID lpEntryID2, + ULONG ulFlags, ULONG * lpulResult) PURE; + STDMETHOD(OpenEntry)(THIS_ ULONG cbEntryID, LPENTRYID lpEntryID, LPCIID lpInterface, ULONG ulFlags, ULONG *lpulObjType, + LPUNKNOWN *lppUnk) PURE; + STDMETHOD(SetReceiveFolder)(THIS_ LPSTR lpszMessageClass, ULONG ulFlags, ULONG cbEntryID, LPENTRYID lpEntryID) PURE; + STDMETHOD(GetReceiveFolder)(THIS_ LPSTR lpszMessageClass, ULONG ulFlags, ULONG * lpcbEntryID, LPENTRYID *lppEntryID, + LPSTR *lppszExplicitClass) PURE; + STDMETHOD(GetReceiveFolderTable)(THIS_ ULONG ulFlags, LPMAPITABLE * lppTable) PURE; + STDMETHOD(StoreLogoff)(THIS_ ULONG * lpulFlags) PURE; + STDMETHOD(AbortSubmit)(THIS_ ULONG cbEntryID, LPENTRYID lpEntryID, ULONG ulFlags) PURE; + STDMETHOD(GetOutgoingQueue)(THIS_ ULONG ulFlags, LPMAPITABLE * lppTable) PURE; + STDMETHOD(SetLockState)(THIS_ LPMESSAGE lpMessage, ULONG ulLockState) PURE; + STDMETHOD(FinishedMsg)(THIS_ ULONG ulFlags, ULONG cbEntryID, LPENTRYID lpEntryID) PURE; + STDMETHOD(NotifyNewMail)(THIS_ LPNOTIFICATION lpNotification) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) + /*** IUnknown methods ***/ +#define IMsgStore_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IMsgStore_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IMsgStore_Release(p) (p)->lpVtbl->Release(p) + /*** IMAPIProp methods ***/ +#define IMsgStore_GetLastError(p,a,b,c) (p)->lpVtbl->GetLastError(p,a,b,c) +#define IMsgStore_SaveChanges(p,a) (p)->lpVtbl->SaveChanges(p,a) +#define IMsgStore_GetProps(p,a,b,c,d) (p)->lpVtbl->GetProps(p,a,b,c,d) +#define IMsgStore_GetPropList(p,a,b) (p)->lpVtbl->GetPropList(p,a,b) +#define IMsgStore_OpenProperty(p,a,b,c,d,e) (p)->lpVtbl->OpenProperty(p,a,b,c,d,e) +#define IMsgStore_SetProps(p,a,b,c) (p)->lpVtbl->SetProps(p,a,b,c) +#define IMsgStore_DeleteProps(p,a,b) (p)->lpVtbl->DeleteProps(p,a,b) +#define IMsgStore_CopyTo(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CopyTo(p,a,b,c,d,e,f,g,h,i) +#define IMsgStore_CopyProps(p,a,b,c,d,e,f,g) (p)->lpVtbl->CopyProps(p,a,b,c,d,e,f,g) +#define IMsgStore_GetNamesFromIDs(p,a,b,c,d,e) (p)->lpVtbl->GetNamesFromIDs(p,a,b,c,d,e) +#define IMsgStore_GetIDsFromNames(p,a,b,c,d) (p)->lpVtbl->GetIDsFromNames(p,a,b,c,d) + /*** IMsgStore methods ***/ +#define IMsgStore_Advise(p,a,b,c,d,e) (p)->lpVtbl->Advise(p,a,b,c,d,e) +#define IMsgStore_Unadvise(p,a) (p)->lpVtbl->Unadvise(p,a) +#define IMsgStore_CompareEntryIDs(p,a,b,c,d,e,f) (p)->lpVtbl->CompareEntryIDs(p,a,b,c,d,e,f) +#define IMsgStore_OpenEntry(p,a,b,c,d,e,f) (p)->lpVtbl->OpenEntry(p,a,b,c,d,e,f) +#define IMsgStore_SetReceiveFolder(p,a,b,c,d) (p)->lpVtbl->SetReceiveFolder(p,a,b,c,d) +#define IMsgStore_GetReceiveFolder(p,a,b,c,d,e) (p)->lpVtbl->GetReceiveFolder(p,a,b,c,d,e) +#define IMsgStore_GetReceiveFolderTable(p,a,b) (p)->lpVtbl->GetReceiveFolderTable(p,a,b) +#define IMsgStore_StoreLogoff(p,a) (p)->lpVtbl->StoreLogoff(p,a) +#define IMsgStore_AbortSubmit(p,a,b,c) (p)->lpVtbl->AbortSubmit(p,a,b,c) +#define IMsgStore_GetOutgoingQueue(p,a,b) (p)->lpVtbl->GetOutgoingQueue(p,a,b) +#define IMsgStore_SetLockState(p,a,b) (p)->lpVtbl->SetLockState(p,a,b) +#define IMsgStore_FinishedMsg(p,a,b,c) (p)->lpVtbl->FinishedMsg(p,a,b,c) +#define IMsgStore_NotifyNewMail(p,a) (p)->lpVtbl->NotifyNewMail(p,a) + +#endif + +typedef IMsgStore *LPMDB; + +/***************************************************************************** + * IMAPIContainer interface + */ +#define INTERFACE IMAPIContainer +DECLARE_INTERFACE_(IMAPIContainer,IMAPIProp) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IMAPIProp methods ***/ + STDMETHOD(GetLastError)(THIS_ HRESULT hRes, ULONG ulFlags, LPMAPIERROR *lppErr) PURE; + STDMETHOD(SaveChanges)(THIS_ ULONG ulFlags) PURE; + STDMETHOD(GetProps)(THIS_ LPSPropTagArray lpPropTags, ULONG ulFlags, ULONG *lpValues, LPSPropValue *lppProps) PURE; + STDMETHOD(GetPropList)(THIS_ ULONG ulFlags, LPSPropTagArray *lppPropTagArray) PURE; + STDMETHOD(OpenProperty)(THIS_ ULONG ulPropTag, LPCIID lpIid, ULONG ulOpts, ULONG ulFlags, LPUNKNOWN *lppUnk) PURE; + STDMETHOD(SetProps)(THIS_ ULONG cValues, LPSPropValue lpProps, LPSPropProblemArray *lppProbs) PURE; + STDMETHOD(DeleteProps)(THIS_ LPSPropTagArray lpPropTags, LPSPropProblemArray *lppProbs) PURE; + STDMETHOD(CopyTo)(THIS_ ULONG ciidExclude, LPCIID lpIid, LPSPropTagArray lpProps, ULONG ulParam, + LPMAPIPROGRESS lpProgress, LPCIID lpIface,LPVOID lpDest, ULONG ulFlags, + LPSPropProblemArray *lppProbs) PURE; + STDMETHOD(CopyProps)(THIS_ LPSPropTagArray lpIncludeProps, ULONG ulParam, LPMAPIPROGRESS lpProgress, + LPCIID lpIid, LPVOID lpDestObj, ULONG ulFlags, LPSPropProblemArray *lppProblems) PURE; + STDMETHOD(GetNamesFromIDs)(THIS_ LPSPropTagArray *lppPropTags, LPGUID lpIid, ULONG ulFlags, ULONG *lpCount, + LPMAPINAMEID **lpppNames) PURE; + STDMETHOD(GetIDsFromNames)(THIS_ ULONG cPropNames, LPMAPINAMEID *lppNames, ULONG ulFlags, LPSPropTagArray *lppPropTags) PURE; + /*** IMAPIContainer methods ***/ + STDMETHOD(GetContentsTable)(THIS_ ULONG ulFlags, LPMAPITABLE * lppTable) PURE; + STDMETHOD(GetHierarchyTable)(THIS_ ULONG ulFlags, LPMAPITABLE * lppTable) PURE; + STDMETHOD(OpenEntry)(THIS_ ULONG cbEntryID, LPENTRYID lpEntryID, LPCIID lpInterface, ULONG ulFlags, + ULONG * lpulObjType, LPUNKNOWN * lppUnk) PURE; + STDMETHOD(SetSearchCriteria)(THIS_ LPSRestriction lpRestriction, LPENTRYLIST lpContainerList, ULONG ulSearchFlags) PURE; + STDMETHOD(GetSearchCriteria)(THIS_ ULONG ulFlags, LPSRestriction * lppRestriction, LPENTRYLIST * lppContainerList, + ULONG * lpulSearchState) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) + /*** IUnknown methods ***/ +#define IMAPIContainer_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IMAPIContainer_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IMAPIContainer_Release(p) (p)->lpVtbl->Release(p) + /*** IMAPIProp methods ***/ +#define IMAPIContainer_GetLastError(p,a,b,c) (p)->lpVtbl->GetLastError(p,a,b,c) +#define IMAPIContainer_SaveChanges(p,a) (p)->lpVtbl->SaveChanges(p,a) +#define IMAPIContainer_GetProps(p,a,b,c,d) (p)->lpVtbl->GetProps(p,a,b,c,d) +#define IMAPIContainer_GetPropList(p,a,b) (p)->lpVtbl->GetPropList(p,a,b) +#define IMAPIContainer_OpenProperty(p,a,b,c,d,e) (p)->lpVtbl->OpenProperty(p,a,b,c,d,e) +#define IMAPIContainer_SetProps(p,a,b,c) (p)->lpVtbl->SetProps(p,a,b,c) +#define IMAPIContainer_DeleteProps(p,a,b) (p)->lpVtbl->DeleteProps(p,a,b) +#define IMAPIContainer_CopyTo(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CopyTo(p,a,b,c,d,e,f,g,h,i) +#define IMAPIContainer_CopyProps(p,a,b,c,d,e,f,g) (p)->lpVtbl->CopyProps(p,a,b,c,d,e,f,g) +#define IMAPIContainer_GetNamesFromIDs(p,a,b,c,d,e) (p)->lpVtbl->GetNamesFromIDs(p,a,b,c,d,e) +#define IMAPIContainer_GetIDsFromNames(p,a,b,c,d) (p)->lpVtbl->GetIDsFromNames(p,a,b,c,d) + /*** IMAPIContainer methods ***/ +#define IMAPIContainer_GetContentsTable(p,a,b) (p)->lpVtbl->GetContentsTable(p,a,b) +#define IMAPIContainer_GetHierarchyTable(p,a,b) (p)->lpVtbl->GetHierarchyTable(p,a,b) +#define IMAPIContainer_OpenEntry(p,a,b,c,d,e,f) (p)->lpVtbl->OpenEntry(p,a,b,c,d,e,f) +#define IMAPIContainer_SetSearchCriteria(p,a,b,c) (p)->lpVtbl->SetSearchCriteria(p,a,b,c) +#define IMAPIContainer_GetSearchCriteria(p,a,b,c,d) (p)->lpVtbl->GetSearchCriteria(p,a,b,c,d) + +#endif + +/***************************************************************************** + * IMAPIFolder interface + */ +#define INTERFACE IMAPIFolder +DECLARE_INTERFACE_(IMAPIFolder,IMAPIContainer) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IMAPIProp methods ***/ + STDMETHOD(GetLastError)(THIS_ HRESULT hRes, ULONG ulFlags, LPMAPIERROR *lppErr) PURE; + STDMETHOD(SaveChanges)(THIS_ ULONG ulFlags) PURE; + STDMETHOD(GetProps)(THIS_ LPSPropTagArray lpPropTags, ULONG ulFlags, ULONG *lpValues, LPSPropValue *lppProps) PURE; + STDMETHOD(GetPropList)(THIS_ ULONG ulFlags, LPSPropTagArray *lppPropTagArray) PURE; + STDMETHOD(OpenProperty)(THIS_ ULONG ulPropTag, LPCIID lpIid, ULONG ulOpts, ULONG ulFlags, LPUNKNOWN *lppUnk) PURE; + STDMETHOD(SetProps)(THIS_ ULONG cValues, LPSPropValue lpProps, LPSPropProblemArray *lppProbs) PURE; + STDMETHOD(DeleteProps)(THIS_ LPSPropTagArray lpPropTags, LPSPropProblemArray *lppProbs) PURE; + STDMETHOD(CopyTo)(THIS_ ULONG ciidExclude, LPCIID lpIid, LPSPropTagArray lpProps, ULONG ulParam, + LPMAPIPROGRESS lpProgress, LPCIID lpIface,LPVOID lpDest, ULONG ulFlags, + LPSPropProblemArray *lppProbs) PURE; + STDMETHOD(CopyProps)(THIS_ LPSPropTagArray lpIncludeProps, ULONG ulParam, LPMAPIPROGRESS lpProgress, + LPCIID lpIid, LPVOID lpDestObj, ULONG ulFlags, LPSPropProblemArray *lppProblems) PURE; + STDMETHOD(GetNamesFromIDs)(THIS_ LPSPropTagArray *lppPropTags, LPGUID lpIid, ULONG ulFlags, ULONG *lpCount, + LPMAPINAMEID **lpppNames) PURE; + STDMETHOD(GetIDsFromNames)(THIS_ ULONG cPropNames, LPMAPINAMEID *lppNames, ULONG ulFlags, LPSPropTagArray *lppPropTags) PURE; + /*** IMAPIContainer methods ***/ + STDMETHOD(GetContentsTable)(THIS_ ULONG ulFlags, LPMAPITABLE * lppTable) PURE; + STDMETHOD(GetHierarchyTable)(THIS_ ULONG ulFlags, LPMAPITABLE * lppTable) PURE; + STDMETHOD(OpenEntry)(THIS_ ULONG cbEntryID, LPENTRYID lpEntryID, LPCIID lpInterface, ULONG ulFlags, + ULONG * lpulObjType, LPUNKNOWN * lppUnk) PURE; + STDMETHOD(SetSearchCriteria)(THIS_ LPSRestriction lpRestriction, LPENTRYLIST lpContainerList, ULONG ulSearchFlags) PURE; + STDMETHOD(GetSearchCriteria)(THIS_ ULONG ulFlags, LPSRestriction * lppRestriction, LPENTRYLIST * lppContainerList, + ULONG * lpulSearchState) PURE; + /*** IMAPIFolder methods ***/ + STDMETHOD(CreateMessage)(THIS_ LPCIID lpInterface, ULONG ulFlags, LPMESSAGE *lppMessage) PURE; + STDMETHOD(CopyMessages)(THIS_ LPENTRYLIST lpMsgList, LPCIID lpInterface, LPVOID lpDestFolder, ULONG ulUIParam, + LPMAPIPROGRESS lpProgress, ULONG ulFlags) PURE; + STDMETHOD(DeleteMessages)(THIS_ LPENTRYLIST lpMsgList, ULONG ulUIParam, LPMAPIPROGRESS lpProgress, ULONG ulFlags) PURE; + STDMETHOD(CreateFolder)(THIS_ ULONG ulFolderType, LPSTR lpszFolderName, LPSTR lpszFolderComment, LPCIID lpInterface, + ULONG ulFlags, LPMAPIFOLDER lppFolder) PURE; + STDMETHOD(CopyFolder)(THIS_ ULONG cbEntryID, LPENTRYID lpEntryID, LPCIID lpInterface, LPVOID lpDestFolder, + LPSTR lpszNewFolderName, ULONG ulUIParam, LPMAPIPROGRESS lpProgress, ULONG ulFlags) PURE; + STDMETHOD(DeleteFolder)(THIS_ ULONG cbEntryID, LPENTRYID lpEntryID, ULONG ulUIParam, LPMAPIPROGRESS lpProgress, + ULONG ulFlags) PURE; + STDMETHOD(SetReadFlags)(THIS_ LPENTRYLIST lpMsgList, ULONG ulUIParam, LPMAPIPROGRESS lpProgress, ULONG ulFlags) PURE; + STDMETHOD(GetMessageStatus)(THIS_ ULONG cbEntryID, LPENTRYID lpEntryID, ULONG ulFlags, ULONG * lpulMessageStatus) PURE; + STDMETHOD(SetMessageStatus)(THIS_ ULONG cbEntryID, LPENTRYID lpEntryID, ULONG ulNewStatus, + ULONG ulNewStatusMask, ULONG * lpulOldStatus) PURE; + STDMETHOD(SaveContentsSort)(THIS_ LPSSortOrderSet lpSortCriteria, ULONG ulFlags) PURE; + STDMETHOD(EmptyFolder) (THIS_ ULONG ulUIParam, LPMAPIPROGRESS lpProgress, ULONG ulFlags) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) + /*** IUnknown methods ***/ +#define IMAPIFolder_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IMAPIFolder_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IMAPIFolder_Release(p) (p)->lpVtbl->Release(p) + /*** IMAPIProp methods ***/ +#define IMAPIFolder_GetLastError(p,a,b,c) (p)->lpVtbl->GetLastError(p,a,b,c) +#define IMAPIFolder_SaveChanges(p,a) (p)->lpVtbl->SaveChanges(p,a) +#define IMAPIFolder_GetProps(p,a,b,c,d) (p)->lpVtbl->GetProps(p,a,b,c,d) +#define IMAPIFolder_GetPropList(p,a,b) (p)->lpVtbl->GetPropList(p,a,b) +#define IMAPIFolder_OpenProperty(p,a,b,c,d,e) (p)->lpVtbl->OpenProperty(p,a,b,c,d,e) +#define IMAPIFolder_SetProps(p,a,b,c) (p)->lpVtbl->SetProps(p,a,b,c) +#define IMAPIFolder_DeleteProps(p,a,b) (p)->lpVtbl->DeleteProps(p,a,b) +#define IMAPIFolder_CopyTo(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CopyTo(p,a,b,c,d,e,f,g,h,i) +#define IMAPIFolder_CopyProps(p,a,b,c,d,e,f,g) (p)->lpVtbl->CopyProps(p,a,b,c,d,e,f,g) +#define IMAPIFolder_GetNamesFromIDs(p,a,b,c,d,e) (p)->lpVtbl->GetNamesFromIDs(p,a,b,c,d,e) +#define IMAPIFolder_GetIDsFromNames(p,a,b,c,d) (p)->lpVtbl->GetIDsFromNames(p,a,b,c,d) + /*** IMAPIContainer methods ***/ +#define IMAPIFolder_GetContentsTable(p,a,b) (p)->lpVtbl->GetContentsTable(p,a,b) +#define IMAPIFolder_GetHierarchyTable(p,a,b) (p)->lpVtbl->GetHierarchyTable(p,a,b) +#define IMAPIFolder_OpenEntry(p,a,b,c,d,e,f) (p)->lpVtbl->OpenEntry(p,a,b,c,d,e,f) +#define IMAPIFolder_SetSearchCriteria(p,a,b,c) (p)->lpVtbl->SetSearchCriteria(p,a,b,c) +#define IMAPIFolder_GetSearchCriteria(p,a,b,c,d) (p)->lpVtbl->GetSearchCriteria(p,a,b,c,d) + /*** IMAPIFolder methods ***/ +#define IMAPIFolder_CreateMessage(p,a,b,c) (p)->lpVtbl->CreateMessage(p,a,b,c) +#define IMAPIFolder_CopyMessages(p,a,b,c,d,e,f) (p)->lpVtbl->CopyMessages(p,a,b,c,d,e,f) +#define IMAPIFolder_DeleteMessages(p,a,b,c,d) (p)->lpVtbl->DeleteMessages(p,a,b,c,d) +#define IMAPIFolder_CreateFolder(p,a,b,c,d,e,f) (p)->lpVtbl->CreateFolder(p,a,b,c,d,e,f) +#define IMAPIFolder_CopyFolder(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CopyFolder(p,a,b,c,d,e,f,g,h) +#define IMAPIFolder_DeleteFolder(p,a,b,c,d,e) (p)->lpVtbl->CreateFolder(p,a,b,c,d,e) +#define IMAPIFolder_SetReadFlags(p,a,b,c,d) (p)->lpVtbl->SetReadFlags(p,a,b,c,d) +#define IMAPIFolder_GetMessageStatus(p,a,b,c,d) (p)->lpVtbl->GetMessageStatus(p,a,b,c,d) +#define IMAPIFolder_SetMessageStatus(p,a,b,c,d,e) (p)->lpVtbl->SetMessageStatus(p,a,b,c,d,e) +#define IMAPIFolder_SaveContentsSort(p,a,b) (p)->lpVtbl->SaveContentsSort(p,a,b) +#define IMAPIFolder_EmptyFolder(p,a,b,c) (p)->lpVtbl->EmptyFolder(p,a,b,c) + +#endif + typedef struct { ULONG cb; @@ -949,4 +1194,133 @@ typedef struct _ADRLIST ADRENTRY aEntries[MAPI_DIM]; } ADRLIST, *LPADRLIST; +/***************************************************************************** + * IMessage interface + */ +#define INTERFACE IMessage +DECLARE_INTERFACE_(IMessage,IMAPIProp) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IMAPIProp methods ***/ + STDMETHOD(GetLastError)(THIS_ HRESULT hRes, ULONG ulFlags, LPMAPIERROR *lppErr) PURE; + STDMETHOD(SaveChanges)(THIS_ ULONG ulFlags) PURE; + STDMETHOD(GetProps)(THIS_ LPSPropTagArray lpPropTags, ULONG ulFlags, ULONG *lpValues, LPSPropValue *lppProps) PURE; + STDMETHOD(GetPropList)(THIS_ ULONG ulFlags, LPSPropTagArray *lppPropTagArray) PURE; + STDMETHOD(OpenProperty)(THIS_ ULONG ulPropTag, LPCIID lpIid, ULONG ulOpts, ULONG ulFlags, LPUNKNOWN *lppUnk) PURE; + STDMETHOD(SetProps)(THIS_ ULONG cValues, LPSPropValue lpProps, LPSPropProblemArray *lppProbs) PURE; + STDMETHOD(DeleteProps)(THIS_ LPSPropTagArray lpPropTags, LPSPropProblemArray *lppProbs) PURE; + STDMETHOD(CopyTo)(THIS_ ULONG ciidExclude, LPCIID lpIid, LPSPropTagArray lpProps, ULONG ulParam, + LPMAPIPROGRESS lpProgress, LPCIID lpIface,LPVOID lpDest, ULONG ulFlags, + LPSPropProblemArray *lppProbs) PURE; + STDMETHOD(CopyProps)(THIS_ LPSPropTagArray lpIncludeProps, ULONG ulParam, LPMAPIPROGRESS lpProgress, + LPCIID lpIid, LPVOID lpDestObj, ULONG ulFlags, LPSPropProblemArray *lppProblems) PURE; + STDMETHOD(GetNamesFromIDs)(THIS_ LPSPropTagArray *lppPropTags, LPGUID lpIid, ULONG ulFlags, ULONG *lpCount, + LPMAPINAMEID **lpppNames) PURE; + STDMETHOD(GetIDsFromNames)(THIS_ ULONG cPropNames, LPMAPINAMEID *lppNames, ULONG ulFlags, LPSPropTagArray *lppPropTags) PURE; + /*** IMessage methods ***/ + STDMETHOD(GetAttachmentTable)(THIS_ ULONG ulFlags, LPMAPITABLE *lppTable) PURE; + STDMETHOD(OpenAttach)(THIS_ ULONG ulAttachmentNum, LPCIID lpInterface, ULONG ulFlags, LPATTACH *lppAttach) PURE; + STDMETHOD(CreateAttach)(THIS_ LPCIID lpInterface, ULONG ulFlags, ULONG *lpulAttachmentNum, LPATTACH *lppAttach) PURE; + STDMETHOD(DeleteAttach)(THIS_ ULONG ulAttachmentNum, ULONG ulUIParam, LPMAPIPROGRESS lpProgress, ULONG ulFlags) PURE; + STDMETHOD(GetRecipientTable)(THIS_ ULONG ulFlags, LPMAPITABLE *lppTable) PURE; + STDMETHOD(ModifyRecipients)(THIS_ ULONG ulFlags, LPADRLIST lpMods) PURE; + STDMETHOD(SubmitMessage)(THIS_ ULONG ulFlags) PURE; + STDMETHOD(SetReadFlag)(THIS_ ULONG ulFlags) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) + /*** IUnknown methods ***/ +#define IMessage_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IMessage_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IMessage_Release(p) (p)->lpVtbl->Release(p) + /*** IMAPIProp methods ***/ +#define IMessage_GetLastError(p,a,b,c) (p)->lpVtbl->GetLastError(p,a,b,c) +#define IMessage_SaveChanges(p,a) (p)->lpVtbl->SaveChanges(p,a) +#define IMessage_GetProps(p,a,b,c,d) (p)->lpVtbl->GetProps(p,a,b,c,d) +#define IMessage_GetPropList(p,a,b) (p)->lpVtbl->GetPropList(p,a,b) +#define IMessage_OpenProperty(p,a,b,c,d,e) (p)->lpVtbl->OpenProperty(p,a,b,c,d,e) +#define IMessage_SetProps(p,a,b,c) (p)->lpVtbl->SetProps(p,a,b,c) +#define IMessage_DeleteProps(p,a,b) (p)->lpVtbl->DeleteProps(p,a,b) +#define IMessage_CopyTo(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CopyTo(p,a,b,c,d,e,f,g,h,i) +#define IMessage_CopyProps(p,a,b,c,d,e,f,g) (p)->lpVtbl->CopyProps(p,a,b,c,d,e,f,g) +#define IMessage_GetNamesFromIDs(p,a,b,c,d,e) (p)->lpVtbl->GetNamesFromIDs(p,a,b,c,d,e) +#define IMessage_GetIDsFromNames(p,a,b,c,d) (p)->lpVtbl->GetIDsFromNames(p,a,b,c,d) + /*** IMessage methods ***/ +#define IMessage_GetAttachmentTable(p,a,b) (p)->lpVtbl->GetAttachmentTable(p,a,b) +#define IMessage_OpenAttach(p,a,b,c,d) (p)->lpVtbl->OpenAttach(p,a,b,c,d) +#define IMessage_CreateAttach(p,a,b,c,d) (p)->lpVtbl->CreateAttach(p,a,b,c,d) +#define IMessage_DeleteAttach(p,a,b,c,d) (p)->lpVtbl->DeleteAttach(p,a,b,c,d) +#define IMessage_GetRecipientTable(p,a,b) (p)->lpVtbl->GetRecipientTable(p,a,b) +#define IMessage_ModifyRecipients(p,a,b) (p)->lpVtbl->ModifyRecipients(p,a,b) +#define IMessage_SubmitMessage(p,a) (p)->lpVtbl->SubmitMessage(p,a) +#define IMessage_SetReadFlag(p,a) (p)->lpVtbl->SetReadFlag(p,a) + +#endif + +/* Message flags (PR_MESSAGE_FLAGS) */ + +#define MSGFLAG_READ 0x00000001U +#define MSGFLAG_UNMODIFIED 0x00000002U +#define MSGFLAG_SUBMIT 0x00000004U +#define MSGFLAG_UNSENT 0x00000008U +#define MSGFLAG_HASATTACH 0x00000010U +#define MSGFLAG_FROMME 0x00000020U + +/***************************************************************************** + * IAttach interface + */ +#define INTERFACE IAttach +DECLARE_INTERFACE_(IAttach,IMAPIProp) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IMAPIProp methods ***/ + STDMETHOD(GetLastError)(THIS_ HRESULT hRes, ULONG ulFlags, LPMAPIERROR *lppErr) PURE; + STDMETHOD(SaveChanges)(THIS_ ULONG ulFlags) PURE; + STDMETHOD(GetProps)(THIS_ LPSPropTagArray lpPropTags, ULONG ulFlags, ULONG *lpValues, LPSPropValue *lppProps) PURE; + STDMETHOD(GetPropList)(THIS_ ULONG ulFlags, LPSPropTagArray *lppPropTagArray) PURE; + STDMETHOD(OpenProperty)(THIS_ ULONG ulPropTag, LPCIID lpIid, ULONG ulOpts, ULONG ulFlags, LPUNKNOWN *lppUnk) PURE; + STDMETHOD(SetProps)(THIS_ ULONG cValues, LPSPropValue lpProps, LPSPropProblemArray *lppProbs) PURE; + STDMETHOD(DeleteProps)(THIS_ LPSPropTagArray lpPropTags, LPSPropProblemArray *lppProbs) PURE; + STDMETHOD(CopyTo)(THIS_ ULONG ciidExclude, LPCIID lpIid, LPSPropTagArray lpProps, ULONG ulParam, + LPMAPIPROGRESS lpProgress, LPCIID lpIface,LPVOID lpDest, ULONG ulFlags, + LPSPropProblemArray *lppProbs) PURE; + STDMETHOD(CopyProps)(THIS_ LPSPropTagArray lpIncludeProps, ULONG ulParam, LPMAPIPROGRESS lpProgress, + LPCIID lpIid, LPVOID lpDestObj, ULONG ulFlags, LPSPropProblemArray *lppProblems) PURE; + STDMETHOD(GetNamesFromIDs)(THIS_ LPSPropTagArray *lppPropTags, LPGUID lpIid, ULONG ulFlags, ULONG *lpCount, + LPMAPINAMEID **lpppNames) PURE; + STDMETHOD(GetIDsFromNames)(THIS_ ULONG cPropNames, LPMAPINAMEID *lppNames, ULONG ulFlags, LPSPropTagArray *lppPropTags) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) + /*** IUnknown methods ***/ +#define IAttach_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IAttach_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IAttach_Release(p) (p)->lpVtbl->Release(p) + /*** IMAPIProp methods ***/ +#define IAttach_GetLastError(p,a,b,c) (p)->lpVtbl->GetLastError(p,a,b,c) +#define IAttach_SaveChanges(p,a) (p)->lpVtbl->SaveChanges(p,a) +#define IAttach_GetProps(p,a,b,c,d) (p)->lpVtbl->GetProps(p,a,b,c,d) +#define IAttach_GetPropList(p,a,b) (p)->lpVtbl->GetPropList(p,a,b) +#define IAttach_OpenProperty(p,a,b,c,d,e) (p)->lpVtbl->OpenProperty(p,a,b,c,d,e) +#define IAttach_SetProps(p,a,b,c) (p)->lpVtbl->SetProps(p,a,b,c) +#define IAttach_DeleteProps(p,a,b) (p)->lpVtbl->DeleteProps(p,a,b) +#define IAttach_CopyTo(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CopyTo(p,a,b,c,d,e,f,g,h,i) +#define IAttach_CopyProps(p,a,b,c,d,e,f,g) (p)->lpVtbl->CopyProps(p,a,b,c,d,e,f,g) +#define IAttach_GetNamesFromIDs(p,a,b,c,d,e) (p)->lpVtbl->GetNamesFromIDs(p,a,b,c,d,e) +#define IAttach_GetIDsFromNames(p,a,b,c,d) (p)->lpVtbl->GetIDsFromNames(p,a,b,c,d) +#endif + +/* Attachment flags */ + +#define NO_ATTACHMENT 0x00000000U +#define ATTACH_BY_VALUE 0x00000001U + #endif /*MAPIDEFS_H*/ diff --git a/reactos/include/psdk/mapitags.h b/reactos/include/psdk/mapitags.h index abeee4845b1..48f4dc133ec 100644 --- a/reactos/include/psdk/mapitags.h +++ b/reactos/include/psdk/mapitags.h @@ -452,6 +452,7 @@ #define PR_AB_PROVIDER_ID PROP_TAG(PT_BINARY,0x3615) #define PR_DEFAULT_VIEW_ENTRYID PROP_TAG(PT_BINARY,0x3616) #define PR_ASSOC_CONTENT_COUNT PROP_TAG(PT_I4,0x3617) +#define PR_IPM_DRAFTS_ENTRYID PROP_TAG(PT_BINARY,0x36D7) #define PR_ATTACHMENT_X400_PARAMETERS PROP_TAG(PT_BINARY,0x3700) #define PR_ATTACH_DATA_OBJ PROP_TAG(PT_OBJECT,0x3701) #define PR_ATTACH_DATA_BIN PROP_TAG(PT_BINARY,0x3701)