[SHELL32] CDrivesFolder: Implement the eject and disconnect menu items. CORE-13841
[reactos.git] / dll / win32 / mapi32 / prop.c
index 5a7e8db..1e323b1 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#include <stdarg.h>
-#define NONAMELESSUNION
-#define NONAMELESSSTRUCT
-#include "windef.h"
-#include "winbase.h"
-#include "winreg.h"
-#include "winerror.h"
-#include "winternl.h"
-#include "objbase.h"
-#include "shlwapi.h"
-#include "wine/list.h"
-#include "wine/debug.h"
-#include "wine/unicode.h"
-#include "mapival.h"
-
-WINE_DEFAULT_DEBUG_CHANNEL(mapi);
+#include "precomp.h"
+
+#include <wine/list.h>
 
 BOOL WINAPI FBadRglpszA(LPSTR*,ULONG);
 
@@ -221,31 +208,39 @@ ULONG WINAPI UlPropSize(LPSPropValue lpProp)
     switch (PROP_TYPE(lpProp->ulPropTag))
     {
     case PT_MV_I2:       ulRet = lpProp->Value.MVi.cValues;
+                         /* fall through */
     case PT_BOOLEAN:
     case PT_I2:          ulRet *= sizeof(USHORT);
                          break;
     case PT_MV_I4:       ulRet = lpProp->Value.MVl.cValues;
+                         /* fall through */
     case PT_ERROR:
     case PT_I4:          ulRet *= sizeof(LONG);
                          break;
     case PT_MV_I8:       ulRet = lpProp->Value.MVli.cValues;
+                         /* fall through */
     case PT_I8:          ulRet *= sizeof(LONG64);
                          break;
     case PT_MV_R4:       ulRet = lpProp->Value.MVflt.cValues;
+                         /* fall through */
     case PT_R4:          ulRet *= sizeof(float);
                          break;
     case PT_MV_APPTIME:
     case PT_MV_R8:       ulRet = lpProp->Value.MVdbl.cValues;
+                         /* fall through */
     case PT_APPTIME:
     case PT_R8:          ulRet *= sizeof(double);
                          break;
     case PT_MV_CURRENCY: ulRet = lpProp->Value.MVcur.cValues;
+                         /* fall through */
     case PT_CURRENCY:    ulRet *= sizeof(CY);
                          break;
     case PT_MV_SYSTIME:  ulRet = lpProp->Value.MVft.cValues;
+                         /* fall through */
     case PT_SYSTIME:     ulRet *= sizeof(FILETIME);
                          break;
     case PT_MV_CLSID:    ulRet = lpProp->Value.MVguid.cValues;
+                         /* fall through */
     case PT_CLSID:       ulRet *= sizeof(GUID);
                          break;
     case PT_MV_STRING8:  ulRet = 0u;
@@ -409,12 +404,12 @@ BOOL WINAPI FPropCompareProp(LPSPropValue lpPropLeft, ULONG ulOp, LPSPropValue l
 
     switch (ulOp)
     {
-    case RELOP_LT: return iCmp <  0 ? TRUE : FALSE;
-    case RELOP_LE: return iCmp <= 0 ? TRUE : FALSE;
-    case RELOP_GT: return iCmp >  0 ? TRUE : FALSE;
-    case RELOP_GE: return iCmp >= 0 ? TRUE : FALSE;
-    case RELOP_EQ: return iCmp == 0 ? TRUE : FALSE;
-    case RELOP_NE: return iCmp != 0 ? TRUE : FALSE;
+    case RELOP_LT: return iCmp <  0;
+    case RELOP_LE: return iCmp <= 0;
+    case RELOP_GT: return iCmp >  0;
+    case RELOP_GE: return iCmp >= 0;
+    case RELOP_EQ: return iCmp == 0;
+    case RELOP_NE: return iCmp != 0;
     }
     return FALSE;
 }
@@ -705,7 +700,8 @@ VOID WINAPI FreeProws(LPSRowSet lpRowSet)
  *  pcBytes [O] If non-NULL, destination for the size of the property array
  *
  * RETURNS
- *  Success: S_OK. If pcBytes is non-NULL, it contains the size of the propery array.
+ *  Success: S_OK. If pcBytes is non-NULL, it contains the size of the
+ *           properties array.
  *  Failure: MAPI_E_INVALID_PARAMETER, if any parameter is invalid or validation
  *           of the property array fails.
  */
@@ -727,44 +723,44 @@ SCODE WINAPI ScCountProps(INT iCount, LPSPropValue lpProps, ULONG *pcBytes)
             lpProps[i].ulPropTag == PROP_ID_INVALID)
             return MAPI_E_INVALID_PARAMETER;
 
-            if (PROP_TYPE(lpProps[i].ulPropTag) != PT_OBJECT)
-            {
-                ulPropSize = UlPropSize(&lpProps[i]);
-                if (!ulPropSize)
-                    return MAPI_E_INVALID_PARAMETER;
-            }
+        if (PROP_TYPE(lpProps[i].ulPropTag) != PT_OBJECT)
+        {
+            ulPropSize = UlPropSize(&lpProps[i]);
+            if (!ulPropSize)
+                return MAPI_E_INVALID_PARAMETER;
+        }
 
-            switch (PROP_TYPE(lpProps[i].ulPropTag))
-            {
-            case PT_STRING8:
-            case PT_UNICODE:
-            case PT_CLSID:
-            case PT_BINARY:
-            case PT_MV_I2:
-            case PT_MV_I4:
-            case PT_MV_I8:
-            case PT_MV_R4:
-            case PT_MV_R8:
-            case PT_MV_CURRENCY:
-            case PT_MV_SYSTIME:
-            case PT_MV_APPTIME:
-                ulPropSize += sizeof(SPropValue);
-                break;
-            case PT_MV_CLSID:
-                ulPropSize += lpProps[i].Value.MVszA.cValues * sizeof(char*) + sizeof(SPropValue);
-                break;
-            case PT_MV_STRING8:
-            case PT_MV_UNICODE:
-                ulPropSize += lpProps[i].Value.MVszA.cValues * sizeof(char*) + sizeof(SPropValue);
-                break;
-            case PT_MV_BINARY:
-                ulPropSize += lpProps[i].Value.MVbin.cValues * sizeof(SBinary) + sizeof(SPropValue);
-                break;
-            default:
-                ulPropSize = sizeof(SPropValue);
-                break;
-            }
-            ulBytes += ulPropSize;
+        switch (PROP_TYPE(lpProps[i].ulPropTag))
+        {
+        case PT_STRING8:
+        case PT_UNICODE:
+        case PT_CLSID:
+        case PT_BINARY:
+        case PT_MV_I2:
+        case PT_MV_I4:
+        case PT_MV_I8:
+        case PT_MV_R4:
+        case PT_MV_R8:
+        case PT_MV_CURRENCY:
+        case PT_MV_SYSTIME:
+        case PT_MV_APPTIME:
+            ulPropSize += sizeof(SPropValue);
+            break;
+        case PT_MV_CLSID:
+            ulPropSize += lpProps[i].Value.MVszA.cValues * sizeof(char*) + sizeof(SPropValue);
+            break;
+        case PT_MV_STRING8:
+        case PT_MV_UNICODE:
+            ulPropSize += lpProps[i].Value.MVszA.cValues * sizeof(char*) + sizeof(SPropValue);
+            break;
+        case PT_MV_BINARY:
+            ulPropSize += lpProps[i].Value.MVbin.cValues * sizeof(SBinary) + sizeof(SPropValue);
+            break;
+        default:
+            ulPropSize = sizeof(SPropValue);
+            break;
+        }
+        ulBytes += ulPropSize;
     }
     if (pcBytes)
         *pcBytes = ulBytes;
@@ -1373,14 +1369,19 @@ ULONG WINAPI FBadColumnSet(LPSPropTagArray lpCols)
 
 
 /**************************************************************************
- *  IMAPIProp {MAPI32}
+ *  IPropData {MAPI32}
  *
- * The default Mapi interface for manipulating object properties.
+ * A default Mapi interface to provide manipulation of object properties.
  *
  * DESCRIPTION
- *  This object provides an interface to an objects properties. It is exposed
- *  by several types of Mapi objects in order to simplify the querying and
- *  modification of properties.
+ *  This object provides a default interface suitable in some cases as an
+ *  implementation of the IMAPIProp interface (which has no default
+ *  implementation). In addition to the IMAPIProp() methods inherited, this
+ *  interface allows read/write control over access to the object and its
+ *  individual properties.
+ *
+ *  To obtain the default implementation of this interface from Mapi, call
+ *  CreateIProp().
  *
  * METHODS
  */
@@ -1396,7 +1397,7 @@ typedef struct
  /* The main property data collection structure */
 typedef struct
 {
-    const IPropDataVtbl   *lpVtbl;
+    IPropData        IPropData_iface;
     LONG             lRef;        /* Reference count */
     ALLOCATEBUFFER  *lpAlloc;     /* Memory allocation routine */
     ALLOCATEMORE    *lpMore;      /* Linked memory allocation routine */
@@ -1407,6 +1408,11 @@ typedef struct
     CRITICAL_SECTION cs;          /* Lock for thread safety */
 } IPropDataImpl;
 
+static inline IPropDataImpl *impl_from_IPropData(IPropData *iface)
+{
+    return CONTAINING_RECORD(iface, IPropDataImpl, IPropData_iface);
+}
+
 /* Internal - Get a property value, assumes lock is held */
 static IPropDataItem *IMAPIPROP_GetValue(IPropDataImpl *This, ULONG ulPropTag)
 {
@@ -1415,7 +1421,7 @@ static IPropDataItem *IMAPIPROP_GetValue(IPropDataImpl *This, ULONG ulPropTag)
     LIST_FOR_EACH(cursor, &This->values)
     {
         LPIPropDataItem current = LIST_ENTRY(cursor, IPropDataItem, entry);
-        /* Note that propery types don't have to match, just Id's */
+        /* Note that property types don't have to match, just Id's */
         if (PROP_ID(current->value->ulPropTag) == PROP_ID(ulPropTag))
             return current;
     }
@@ -1475,19 +1481,14 @@ static inline void IMAPIPROP_Unlock(IPropDataImpl *This)
     (offsetof(SPropProblemArray,aProblem)+(c)*sizeof(SPropProblem))
 
 /**************************************************************************
- *  IMAPIProp_QueryInterface {MAPI32}
+ *  IPropData_QueryInterface {MAPI32}
  *
  * Inherited method from the IUnknown Interface.
  * See IUnknown_QueryInterface.
- *
- * NOTES
- * This object exposes the following interfaces:
- * - IUnknown() : The default interface for all COM-Objects.
- * - IMAPIProp() : The default Mapi interface for manipulating object properties.
  */
-static inline HRESULT IMAPIProp_fnQueryInterface(LPMAPIPROP iface, REFIID riid, LPVOID *ppvObj)
+static HRESULT WINAPI IPropData_fnQueryInterface(LPPROPDATA iface, REFIID riid, LPVOID *ppvObj)
 {
-    IPropDataImpl *This = (IPropDataImpl*)iface;
+    IPropDataImpl *This = impl_from_IPropData(iface);
 
     TRACE("(%p,%s,%p)\n", This, debugstr_guid(riid), ppvObj);
 
@@ -1500,7 +1501,7 @@ static inline HRESULT IMAPIProp_fnQueryInterface(LPMAPIPROP iface, REFIID riid,
        IsEqualIID(riid, &IID_IMAPIProp) ||
        IsEqualIID(riid, &IID_IMAPIPropData))
     {
-        *ppvObj = This;
+        *ppvObj = &This->IPropData_iface;
         IPropData_AddRef(iface);
         TRACE("returning %p\n", *ppvObj);
         return S_OK;
@@ -1511,14 +1512,14 @@ static inline HRESULT IMAPIProp_fnQueryInterface(LPMAPIPROP iface, REFIID riid,
 }
 
 /**************************************************************************
- *  IMAPIProp_AddRef {MAPI32}
+ *  IPropData_AddRef {MAPI32}
  *
  * Inherited method from the IUnknown Interface.
  * See IUnknown_AddRef.
  */
-static inline ULONG IMAPIProp_fnAddRef(LPMAPIPROP iface)
+static ULONG WINAPI IPropData_fnAddRef(LPPROPDATA iface)
 {
-    IPropDataImpl *This = (IPropDataImpl*)iface;
+    IPropDataImpl *This = impl_from_IPropData(iface);
 
     TRACE("(%p)->(count before=%u)\n", This, This->lRef);
 
@@ -1526,14 +1527,14 @@ static inline ULONG IMAPIProp_fnAddRef(LPMAPIPROP iface)
 }
 
 /**************************************************************************
- *  IMAPIProp_Release {MAPI32}
+ *  IPropData_Release {MAPI32}
  *
  * Inherited method from the IUnknown Interface.
  * See IUnknown_Release.
  */
-static inline ULONG IMAPIProp_fnRelease(LPMAPIPROP iface)
+static ULONG WINAPI IPropData_fnRelease(LPPROPDATA iface)
 {
-    IPropDataImpl *This = (IPropDataImpl*)iface;
+    IPropDataImpl *This = impl_from_IPropData(iface);
     LONG lRef;
 
     TRACE("(%p)->(count before=%u)\n", This, This->lRef);
@@ -1560,7 +1561,7 @@ static inline ULONG IMAPIProp_fnRelease(LPMAPIPROP iface)
 }
 
 /**************************************************************************
- *  IMAPIProp_GetLastError {MAPI32}
+ *  IPropData_GetLastError {MAPI32}
  *
  * Get information about the last error that occurred in an IMAPIProp object.
  *
@@ -1581,9 +1582,8 @@ static inline ULONG IMAPIProp_fnRelease(LPMAPIPROP iface)
  *  - It is possible for this function to succeed and set *lppError to NULL,
  *  if there is no further information to report about hRes.
  */
-static inline HRESULT
-IMAPIProp_fnGetLastError(LPMAPIPROP iface, HRESULT hRes,
-                         ULONG ulFlags, LPMAPIERROR *lppError)
+static HRESULT WINAPI IPropData_fnGetLastError(LPPROPDATA iface, HRESULT hRes, ULONG ulFlags,
+                                               LPMAPIERROR *lppError)
 {
     TRACE("(%p,0x%08X,0x%08X,%p)\n", iface, hRes, ulFlags, lppError);
 
@@ -1595,7 +1595,7 @@ IMAPIProp_fnGetLastError(LPMAPIPROP iface, HRESULT hRes,
 }
 
 /**************************************************************************
- *  IMAPIProp_SaveChanges {MAPI32}
+ *  IPropData_SaveChanges {MAPI32}
  *
  * Update any changes made to a transactional IMAPIProp object.
  *
@@ -1607,8 +1607,7 @@ IMAPIProp_fnGetLastError(LPMAPIPROP iface, HRESULT hRes,
  *  Success: S_OK. Any outstanding changes are committed to the object.
  *  Failure: An HRESULT error code describing the error.
  */
-static inline HRESULT
-IMAPIProp_fnSaveChanges(LPMAPIPROP iface, ULONG ulFlags)
+static HRESULT WINAPI IPropData_fnSaveChanges(LPPROPDATA iface, ULONG ulFlags)
 {
     TRACE("(%p,0x%08X)\n", iface, ulFlags);
 
@@ -1618,13 +1617,13 @@ IMAPIProp_fnSaveChanges(LPMAPIPROP iface, ULONG ulFlags)
 }
 
 /**************************************************************************
- *  IMAPIProp_GetProps {MAPI32}
+ *  IPropData_GetProps {MAPI32}
  *
  * Get property values from an IMAPIProp object.
  *
  * PARAMS
  *  iface    [I] IMAPIProp object to get the property values from
- *  lpTags   [I] Property tage of property values to be retrieved
+ *  lpTags   [I] Property tags of property values to be retrieved
  *  ulFlags  [I] Return 0=Ascii MAPI_UNICODE=Unicode strings for
  *                 unspecified types
  *  lpCount  [O] Destination for number of properties returned
@@ -1641,13 +1640,12 @@ IMAPIProp_fnSaveChanges(LPMAPIPROP iface, ULONG ulFlags)
  *    retrieved from iface are present in lppProps with their type
  *    changed to PT_ERROR and Id unchanged.
  */
-static inline HRESULT
-IMAPIProp_fnGetProps(LPMAPIPROP iface, LPSPropTagArray lpTags,
-                     ULONG ulFlags, ULONG *lpCount, LPSPropValue *lppProps)
+static HRESULT WINAPI IPropData_fnGetProps(LPPROPDATA iface, LPSPropTagArray lpTags, ULONG ulFlags,
+                                           ULONG *lpCount, LPSPropValue *lppProps)
 {
+    IPropDataImpl *This = impl_from_IPropData(iface);
     ULONG i;
     HRESULT hRet = S_OK;
-    IPropDataImpl *This = (IPropDataImpl*)iface;
 
     TRACE("(%p,%p,0x%08x,%p,%p) stub\n", iface, lpTags, ulFlags,
           lpCount, lppProps);
@@ -1708,11 +1706,10 @@ IMAPIProp_fnGetProps(LPMAPIPROP iface, LPSPropTagArray lpTags,
  *           MAPI_E_BAD_CHARWIDTH, if Ascii or Unicode strings are requested
  *           and that type of string is not supported.
  */
-static inline HRESULT
-IMAPIProp_fnGetPropList(LPMAPIPROP iface, ULONG ulFlags,
-                        LPSPropTagArray *lppTags)
+static HRESULT WINAPI IPropData_fnGetPropList(LPPROPDATA iface, ULONG ulFlags,
+                                              LPSPropTagArray *lppTags)
 {
-    IPropDataImpl *This = (IPropDataImpl*)iface;
+    IPropDataImpl *This = impl_from_IPropData(iface);
     ULONG i;
     HRESULT hRet;
 
@@ -1748,16 +1745,15 @@ IMAPIProp_fnGetPropList(LPMAPIPROP iface, ULONG ulFlags,
 }
 
 /**************************************************************************
- *  IMAPIProp_OpenProperty {MAPI32}
+ *  IPropData_OpenProperty {MAPI32}
  *
  * Not documented at this time.
  *
  * RETURNS
  *  An HRESULT success/failure code.
  */
-static inline HRESULT
-IMAPIProp_fnOpenProperty(LPMAPIPROP iface, ULONG ulPropTag, LPCIID iid,
-                         ULONG ulOpts, ULONG ulFlags, LPUNKNOWN *lpUnk)
+static HRESULT WINAPI IPropData_fnOpenProperty(LPPROPDATA iface, ULONG ulPropTag, LPCIID iid,
+                                               ULONG ulOpts, ULONG ulFlags, LPUNKNOWN *lpUnk)
 {
     FIXME("(%p,%u,%s,%u,0x%08x,%p) stub\n", iface, ulPropTag,
           debugstr_guid(iid), ulOpts, ulFlags, lpUnk);
@@ -1766,7 +1762,7 @@ IMAPIProp_fnOpenProperty(LPMAPIPROP iface, ULONG ulPropTag, LPCIID iid,
 
 
 /**************************************************************************
- *  IMAPIProp_SetProps {MAPI32}
+ *  IPropData_SetProps {MAPI32}
  *
  * Add or edit the property values in an IMAPIProp object.
  *
@@ -1781,11 +1777,10 @@ IMAPIProp_fnOpenProperty(LPMAPIPROP iface, ULONG ulPropTag, LPCIID iid,
  *           exist, or changed to the values in lpProps if they do
  *  Failure: An HRESULT error code describing the error
  */
-static inline HRESULT
-IMAPIProp_fnSetProps(LPMAPIPROP iface, ULONG ulValues,
-                     LPSPropValue lpProps, LPSPropProblemArray *lppProbs)
+static HRESULT WINAPI IPropData_fnSetProps(LPPROPDATA iface, ULONG ulValues, LPSPropValue lpProps,
+                                           LPSPropProblemArray *lppProbs)
 {
-    IPropDataImpl *This = (IPropDataImpl*)iface;
+    IPropDataImpl *This = impl_from_IPropData(iface);
     HRESULT hRet = S_OK;
     ULONG i;
 
@@ -1845,7 +1840,7 @@ IMAPIProp_fnSetProps(LPMAPIPROP iface, ULONG ulValues,
 }
 
 /**************************************************************************
- *  IMAPIProp_DeleteProps {MAPI32}
+ *  IPropData_DeleteProps {MAPI32}
  *
  * Delete one or more property values from an IMAPIProp object.
  *
@@ -1860,7 +1855,7 @@ IMAPIProp_fnSetProps(LPMAPIPROP iface, ULONG ulValues,
  *           errors that occurred.
  *  Failure: MAPI_E_INVALID_PARAMETER, if any parameter is invalid.
  *           E_ACCESSDENIED, if this object was created using CreateIProp() and
- *           a subsequent call to IPropData_SetObjAcess() was made specifying
+ *           a subsequent call to IPropData_SetObjAccess() was made specifying
  *           IPROP_READONLY as the access type.
  *
  * NOTES
@@ -1868,11 +1863,10 @@ IMAPIProp_fnSetProps(LPMAPIPROP iface, ULONG ulValues,
  *    in lpTags but not in iface.
  *  - lppProbs should be deleted with MAPIFreeBuffer() if returned.
  */
-static inline HRESULT
-IMAPIProp_fnDeleteProps(LPMAPIPROP iface, LPSPropTagArray lpTags,
-                        LPSPropProblemArray *lppProbs)
+static HRESULT WINAPI IPropData_fnDeleteProps(LPPROPDATA iface, LPSPropTagArray lpTags,
+                                              LPSPropProblemArray *lppProbs)
 {
-    IPropDataImpl *This = (IPropDataImpl*)iface;
+    IPropDataImpl *This = impl_from_IPropData(iface);
     ULONG i, numProbs = 0;
     HRESULT hRet = S_OK;
 
@@ -1945,18 +1939,18 @@ IMAPIProp_fnDeleteProps(LPMAPIPROP iface, LPSPropTagArray lpTags,
 
 
 /**************************************************************************
- *  IMAPIProp_CopyTo {MAPI32}
+ *  IPropData_CopyTo {MAPI32}
  *
  * Not documented at this time.
  *
  * RETURNS
  *  An HRESULT success/failure code.
  */
-static inline HRESULT
-IMAPIProp_fnCopyTo(LPMAPIPROP iface, ULONG niids, LPCIID lpiidExcl,
-                   LPSPropTagArray lpPropsExcl, ULONG ulParam,
-                   LPMAPIPROGRESS lpIProgress, LPCIID lpIfaceIid, LPVOID lpDstObj,
-                   ULONG ulFlags, LPSPropProblemArray *lppProbs)
+static HRESULT WINAPI IPropData_fnCopyTo(LPPROPDATA iface, ULONG niids, LPCIID lpiidExcl,
+                                         LPSPropTagArray lpPropsExcl, ULONG ulParam,
+                                         LPMAPIPROGRESS lpIProgress, LPCIID lpIfaceIid,
+                                         LPVOID lpDstObj, ULONG ulFlags,
+                                         LPSPropProblemArray *lppProbs)
 {
     FIXME("(%p,%u,%p,%p,%x,%p,%s,%p,0x%08X,%p) stub\n", iface, niids,
           lpiidExcl, lpPropsExcl, ulParam, lpIProgress,
@@ -1965,18 +1959,17 @@ IMAPIProp_fnCopyTo(LPMAPIPROP iface, ULONG niids, LPCIID lpiidExcl,
 }
 
 /**************************************************************************
- *  IMAPIProp_CopyProps {MAPI32}
+ *  IPropData_CopyProps {MAPI32}
  *
  * Not documented at this time.
  *
  * RETURNS
  *  An HRESULT success/failure code.
  */
-static inline HRESULT
-IMAPIProp_fnCopyProps(LPMAPIPROP iface, LPSPropTagArray lpInclProps,
-                      ULONG ulParam, LPMAPIPROGRESS lpIProgress, LPCIID lpIface,
-                      LPVOID lpDstObj, ULONG ulFlags,
-                      LPSPropProblemArray *lppProbs)
+static HRESULT WINAPI IPropData_fnCopyProps(LPPROPDATA iface, LPSPropTagArray lpInclProps,
+                                            ULONG ulParam, LPMAPIPROGRESS lpIProgress,
+                                            LPCIID lpIface, LPVOID lpDstObj, ULONG ulFlags,
+                                            LPSPropProblemArray *lppProbs)
 {
     FIXME("(%p,%p,%x,%p,%s,%p,0x%08X,%p) stub\n", iface, lpInclProps,
           ulParam, lpIProgress, debugstr_guid(lpIface), lpDstObj, ulFlags,
@@ -1985,7 +1978,7 @@ IMAPIProp_fnCopyProps(LPMAPIPROP iface, LPSPropTagArray lpInclProps,
 }
 
 /**************************************************************************
- *  IMAPIProp_GetNamesFromIDs {MAPI32}
+ *  IPropData_GetNamesFromIDs {MAPI32}
  *
  * Get the names of properties from their identifiers.
  *
@@ -2007,10 +2000,9 @@ IMAPIProp_fnCopyProps(LPMAPIPROP iface, LPSPropTagArray lpInclProps,
  *           MAPI_W_ERRORS_RETURNED if not all properties were retrieved
  *           successfully.
  */
-static inline HRESULT
-IMAPIProp_fnGetNamesFromIDs(LPMAPIPROP iface, LPSPropTagArray *lppPropTags,
-                            LPGUID iid, ULONG ulFlags, ULONG *lpCount,
-                            LPMAPINAMEID **lpppNames)
+static HRESULT WINAPI IPropData_fnGetNamesFromIDs(LPPROPDATA iface, LPSPropTagArray *lppPropTags,
+                                                  LPGUID iid, ULONG ulFlags, ULONG *lpCount,
+                                                  LPMAPINAMEID **lpppNames)
 {
     FIXME("(%p,%p,%s,0x%08X,%p,%p) stub\n", iface, lppPropTags,
           debugstr_guid(iid), ulFlags, lpCount, lpppNames);
@@ -2018,7 +2010,7 @@ IMAPIProp_fnGetNamesFromIDs(LPMAPIPROP iface, LPSPropTagArray *lppPropTags,
 }
 
 /**************************************************************************
- *  IMAPIProp_GetIDsFromNames {MAPI32}
+ *  IPropData_GetIDsFromNames {MAPI32}
  *
  * Get property identifiers associated with one or more named properties.
  *
@@ -2038,224 +2030,15 @@ IMAPIProp_fnGetNamesFromIDs(LPMAPIPROP iface, LPSPropTagArray *lppPropTags,
  *           MAPI_W_ERRORS_RETURNED if not all properties were retrieved
  *           successfully.
  */
-static inline HRESULT
-IMAPIProp_fnGetIDsFromNames(LPMAPIPROP iface, ULONG ulNames,
-                            LPMAPINAMEID *lppNames, ULONG ulFlags,
-                            LPSPropTagArray *lppPropTags)
+static HRESULT WINAPI IPropData_fnGetIDsFromNames(LPPROPDATA iface, ULONG ulNames,
+                                                  LPMAPINAMEID *lppNames, ULONG ulFlags,
+                                                  LPSPropTagArray *lppPropTags)
 {
     FIXME("(%p,%d,%p,0x%08X,%p) stub\n",
           iface, ulNames, lppNames, ulFlags, lppPropTags);
     return MAPI_E_NO_SUPPORT;
 }
 
-/**************************************************************************
- *  IPropData {MAPI32}
- *
- * A default Mapi interface to provide manipulation of object properties.
- *
- * DESCRIPTION
- *  This object provides a default interface suitable in some cases as an
- *  implementation of the IMAPIProp interface (which has no default
- *  implementation). In addition to the IMAPIProp() methods inherited, this
- *  interface allows read/write control over access to the object and its
- *  individual properties.
- *
- *  To obtain the default implementation of this interface from Mapi, call
- *  CreateIProp().
- *
- * METHODS
- */
-
-/**************************************************************************
- *  IPropData_QueryInterface {MAPI32}
- *
- * Inherited method from the IMAPIProp Interface.
- * See IMAPIProp_QueryInterface.
- */
-static HRESULT WINAPI
-IPropData_fnQueryInterface(LPPROPDATA iface, REFIID riid, LPVOID *ppvObj)
-{
-    return IMAPIProp_fnQueryInterface((LPMAPIPROP)iface, riid, ppvObj);
-}
-
-/**************************************************************************
- *  IPropData_AddRef {MAPI32}
- *
- * Inherited method from the IMAPIProp Interface.
- * See IMAPIProp_AddRef.
- */
-static ULONG WINAPI
-IPropData_fnAddRef(LPPROPDATA iface)
-{
-    return IMAPIProp_fnAddRef((LPMAPIPROP)iface);
-}
-
-/**************************************************************************
- *  IPropData_Release {MAPI32}
- *
- * Inherited method from the IMAPIProp Interface.
- * See IMAPIProp_Release.
- */
-static ULONG WINAPI
-IPropData_fnRelease(LPPROPDATA iface)
-{
-    return IMAPIProp_fnRelease((LPMAPIPROP)iface);
-}
-
-/**************************************************************************
- *  IPropData_GetLastError {MAPI32}
- *
- * Inherited method from the IMAPIProp Interface.
- * See IMAPIProp_GetLastError.
- */
-static HRESULT WINAPI
-IPropData_fnGetLastError(LPPROPDATA iface, HRESULT hRes, ULONG ulFlags,
-                         LPMAPIERROR *lppError)
-{
-    return IMAPIProp_fnGetLastError((LPMAPIPROP)iface, hRes, ulFlags, lppError);
-}
-
-/**************************************************************************
- *  IPropData_SaveChanges {MAPI32}
- *
- * Inherited method from the IMAPIProp Interface.
- * See IMAPIProp_SaveChanges.
- */
-static HRESULT WINAPI
-IPropData_fnSaveChanges(LPPROPDATA iface, ULONG ulFlags)
-{
-    return IMAPIProp_fnSaveChanges((LPMAPIPROP)iface, ulFlags);
-}
-
-/**************************************************************************
- *  IPropData_GetProps {MAPI32}
- *
- * Inherited method from the IMAPIProp Interface.
- * See IMAPIProp_GetProps.
- */
-static HRESULT WINAPI
-IPropData_fnGetProps(LPPROPDATA iface, LPSPropTagArray lpPropTags,
-                     ULONG ulFlags, ULONG *lpCount, LPSPropValue *lppProps)
-{
-    return IMAPIProp_fnGetProps((LPMAPIPROP)iface, lpPropTags, ulFlags,
-                                lpCount, lppProps);
-}
-
-/**************************************************************************
- *  IPropData_GetPropList {MAPI32}
- *
- * Inherited method from the IMAPIProp Interface.
- * See IMAPIProp_GetPropList.
- */
-static HRESULT WINAPI
-IPropData_fnGetPropList(LPPROPDATA iface, ULONG ulFlags,
-                                              LPSPropTagArray *lppPropTags)
-{
-    return IMAPIProp_fnGetPropList((LPMAPIPROP)iface, ulFlags, lppPropTags);
-}
-
-/**************************************************************************
- *  IPropData_OpenProperty {MAPI32}
- *
- * Inherited method from the IMAPIProp Interface.
- * See IMAPIProp_OpenProperty.
- */
-static HRESULT WINAPI
-IPropData_fnOpenProperty(LPPROPDATA iface, ULONG ulPropTag, LPCIID iid,
-                         ULONG ulOpts, ULONG ulFlags, LPUNKNOWN *lpUnk)
-{
-    return IMAPIProp_fnOpenProperty((LPMAPIPROP)iface, ulPropTag, iid,
-                                    ulOpts, ulFlags, lpUnk);
-}
-
-/**************************************************************************
- *  IPropData_SetProps {MAPI32}
- *
- * Inherited method from the IMAPIProp Interface.
- * See IMAPIProp_SetProps.
- */
-static HRESULT WINAPI
-IPropData_fnSetProps(LPPROPDATA iface, ULONG cValues, LPSPropValue lpProps,
-                     LPSPropProblemArray *lppProbs)
-{
-    return IMAPIProp_fnSetProps((LPMAPIPROP)iface, cValues, lpProps, lppProbs);
-}
-
-/**************************************************************************
- *  IPropData_DeleteProps {MAPI32}
- *
- * Inherited method from the IMAPIProp Interface.
- * See IMAPIProp_DeleteProps.
- */
-static HRESULT WINAPI
-IPropData_fnDeleteProps(LPPROPDATA iface, LPSPropTagArray lpPropTags,
-                        LPSPropProblemArray *lppProbs)
-{
-    return IMAPIProp_fnDeleteProps((LPMAPIPROP)iface, lpPropTags, lppProbs);
-}
-
-/**************************************************************************
- *  IPropData_CopyTo {MAPI32}
- *
- * Inherited method from the IMAPIProp Interface.
- * See IMAPIProp_CopyTo.
- */
-static HRESULT WINAPI
-IPropData_fnCopyTo(LPPROPDATA iface, ULONG ciidExclude, LPCIID lpIid,
-                   LPSPropTagArray lpProps, ULONG ulParam,
-                   LPMAPIPROGRESS lpProgress, LPCIID lpIface, LPVOID lpDst,
-                   ULONG ulFlags, LPSPropProblemArray *lppProbs)
-{
-    return IMAPIProp_fnCopyTo((LPMAPIPROP)iface, ciidExclude, lpIid, lpProps,
-                              ulParam, lpProgress, lpIface, lpDst,
-                              ulFlags, lppProbs);
-}
-
-/**************************************************************************
- *  IPropData_CopyProps {MAPI32}
- *
- * Inherited method from the IMAPIProp Interface.
- * See IMAPIProp_CopyProps.
- */
-static HRESULT WINAPI
-IPropData_fnCopyProps(LPPROPDATA iface, LPSPropTagArray lpProps,
-                      ULONG ulParam, LPMAPIPROGRESS lpProgress, LPCIID lpIface,
-                      LPVOID lpDst, ULONG ulFlags, LPSPropProblemArray *lppProbs)
-{
-    return IMAPIProp_fnCopyProps((LPMAPIPROP)iface, lpProps, ulParam,
-                                 lpProgress, lpIface, lpDst, ulFlags, lppProbs);
-}
-
-/**************************************************************************
- *  IPropData_GetNamesFromIDs {MAPI32}
- *
- * Inherited method from the IMAPIProp Interface.
- * See IMAPIProp_GetNamesFromIDs.
- */
-static HRESULT WINAPI
-IPropData_fnGetNamesFromIDs(LPPROPDATA iface, LPSPropTagArray *lppPropTags,
-                            LPGUID iid, ULONG ulFlags, ULONG *lpCount,
-                            LPMAPINAMEID **lpppNames)
-{
-    return IMAPIProp_fnGetNamesFromIDs((LPMAPIPROP)iface, lppPropTags, iid,
-                                       ulFlags, lpCount, lpppNames);
-}
-
-/**************************************************************************
- *  IPropData_GetIDsFromNames {MAPI32}
- *
- * Inherited method from the IMAPIProp Interface.
- * See IMAPIProp_GetIDsFromNames.
- */
-static HRESULT WINAPI
-IPropData_fnGetIDsFromNames(LPPROPDATA iface, ULONG ulNames,
-                            LPMAPINAMEID *lppNames, ULONG ulFlags,
-                            LPSPropTagArray *lppPropTags)
-{
-    return IMAPIProp_fnGetIDsFromNames((LPMAPIPROP)iface, ulNames, lppNames,
-                                       ulFlags, lppPropTags);
-}
-
 /**************************************************************************
  *  IPropData_HrSetObjAccess {MAPI32}
  *
@@ -2273,7 +2056,7 @@ IPropData_fnGetIDsFromNames(LPPROPDATA iface, ULONG ulNames,
 static HRESULT WINAPI
 IPropData_fnHrSetObjAccess(LPPROPDATA iface, ULONG ulAccess)
 {
-    IPropDataImpl *This = (IPropDataImpl*)iface;
+    IPropDataImpl *This = impl_from_IPropData(iface);
 
     TRACE("(%p,%x)\n", iface, ulAccess);
 
@@ -2327,8 +2110,7 @@ static HRESULT WINAPI
 IPropData_fnHrSetPropAccess(LPPROPDATA iface, LPSPropTagArray lpTags,
                             ULONG *lpAccess)
 {
-    IPropDataImpl *This = (IPropDataImpl*)iface;
-
+    IPropDataImpl *This = impl_from_IPropData(iface);
     ULONG i;
 
     TRACE("(%p,%p,%p)\n", iface, lpTags, lpAccess);
@@ -2379,7 +2161,7 @@ static HRESULT WINAPI
 IPropData_fnHrGetPropAccess(LPPROPDATA iface, LPSPropTagArray *lppTags,
                             ULONG **lppAccess)
 {
-    IPropDataImpl *This = (IPropDataImpl*)iface;
+    IPropDataImpl *This = impl_from_IPropData(iface);
     LPVOID lpMem;
     HRESULT hRet;
     ULONG i;
@@ -2534,7 +2316,7 @@ SCODE WINAPI CreateIProp(LPCIID iid, ALLOCATEBUFFER *lpAlloc,
 
     if (SUCCEEDED(scode))
     {
-        lpPropData->lpVtbl = &IPropDataImpl_vtbl;
+        lpPropData->IPropData_iface.lpVtbl = &IPropDataImpl_vtbl;
         lpPropData->lRef = 1;
         lpPropData->lpAlloc = lpAlloc;
         lpPropData->lpMore = lpMore;
@@ -2544,7 +2326,7 @@ SCODE WINAPI CreateIProp(LPCIID iid, ALLOCATEBUFFER *lpAlloc,
         list_init(&lpPropData->values);
         InitializeCriticalSection(&lpPropData->cs);
         lpPropData->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": IPropDataImpl.cs");
-        *lppPropData = (LPPROPDATA)lpPropData;
+        *lppPropData = &lpPropData->IPropData_iface;
     }
     return scode;
 }