[PATCH] oleaut32: IFont never had an IPersistStreamInit interface.

Damjan Jovanovic damjan.jov at gmail.com
Sun Nov 1 10:11:24 CST 2020


As Nikolay Sivov incidentally noted in
https://bugs.winehq.org/show_bug.cgi?id=23726#c29
the IPersistStreamInit interface on IFont "is not supported
on anything newer and including XP." It is a E_NOINTERFACE
on 95, 98, Me and NT4 as well. It never existed on any
version of Windows, and we never should have had it either.
It was added in error by commit
d0372b4e6ea420eadcdfcb93f3d0706284adbb69.

Signed-off-by: Damjan Jovanovic <damjan.jov at gmail.com>
---
 dlls/oleaut32/olefont.c       | 91 -----------------------------------
 dlls/oleaut32/tests/olefont.c |  5 ++
 2 files changed, 5 insertions(+), 91 deletions(-)
-------------- next part --------------
diff --git a/dlls/oleaut32/olefont.c b/dlls/oleaut32/olefont.c
index b82ffbf1b54..a08994e65e5 100644
--- a/dlls/oleaut32/olefont.c
+++ b/dlls/oleaut32/olefont.c
@@ -255,7 +255,6 @@ struct OLEFontImpl
   IPersistStream              IPersistStream_iface;
   IConnectionPointContainer   IConnectionPointContainer_iface;
   IPersistPropertyBag         IPersistPropertyBag_iface;
-  IPersistStreamInit          IPersistStreamInit_iface;
   /*
    * Reference count for that instance of the class.
    */
@@ -311,11 +310,6 @@ static inline OLEFontImpl *impl_from_IPersistPropertyBag( IPersistPropertyBag *i
     return CONTAINING_RECORD(iface, OLEFontImpl, IPersistPropertyBag_iface);
 }
 
-static inline OLEFontImpl *impl_from_IPersistStreamInit( IPersistStreamInit *iface )
-{
-    return CONTAINING_RECORD(iface, OLEFontImpl, IPersistStreamInit_iface);
-}
-
 
 /***********************************************************************
  * Prototypes for the implementation functions for the IFont
@@ -491,10 +485,6 @@ static HRESULT WINAPI OLEFontImpl_QueryInterface(
   {
     *ppvObject = &this->IPersistPropertyBag_iface;
   }
-  else if (IsEqualGUID(&IID_IPersistStreamInit, riid))
-  {
-    *ppvObject = &this->IPersistStreamInit_iface;
-  }
 
   if (!*ppvObject)
   {
@@ -2056,86 +2046,6 @@ static const IPersistPropertyBagVtbl OLEFontImpl_IPersistPropertyBag_VTable =
   OLEFontImpl_IPersistPropertyBag_Save
 };
 
-/************************************************************************
- * OLEFontImpl implementation of IPersistStreamInit.
- */
-static HRESULT WINAPI OLEFontImpl_IPersistStreamInit_QueryInterface(
-   IPersistStreamInit *iface, REFIID riid, LPVOID *ppvObj
-) {
-  OLEFontImpl *this = impl_from_IPersistStreamInit(iface);
-  return IFont_QueryInterface(&this->IFont_iface,riid,ppvObj);
-}
-
-static ULONG WINAPI OLEFontImpl_IPersistStreamInit_AddRef(
-   IPersistStreamInit *iface
-) {
-  OLEFontImpl *this = impl_from_IPersistStreamInit(iface);
-  return IFont_AddRef(&this->IFont_iface);
-}
-
-static ULONG WINAPI OLEFontImpl_IPersistStreamInit_Release(
-   IPersistStreamInit *iface
-) {
-  OLEFontImpl *this = impl_from_IPersistStreamInit(iface);
-  return IFont_Release(&this->IFont_iface);
-}
-
-static HRESULT WINAPI OLEFontImpl_IPersistStreamInit_GetClassID(
-   IPersistStreamInit *iface, CLSID *classid
-) {
-  FIXME("(%p,%p), stub!\n", iface, classid);
-  return E_FAIL;
-}
-
-static HRESULT WINAPI OLEFontImpl_IPersistStreamInit_IsDirty(
-   IPersistStreamInit *iface
-) {
-  FIXME("(%p), stub!\n", iface);
-  return E_FAIL;
-}
-
-static HRESULT WINAPI OLEFontImpl_IPersistStreamInit_Load(
-   IPersistStreamInit *iface, LPSTREAM pStm
-) {
-  FIXME("(%p,%p), stub!\n", iface, pStm);
-  return E_FAIL;
-}
-
-static HRESULT WINAPI OLEFontImpl_IPersistStreamInit_Save(
-   IPersistStreamInit *iface, LPSTREAM pStm, BOOL fClearDirty
-) {
-  FIXME("(%p,%p,%d), stub!\n", iface, pStm, fClearDirty);
-  return E_FAIL;
-}
-
-static HRESULT WINAPI OLEFontImpl_IPersistStreamInit_GetSizeMax(
-   IPersistStreamInit *iface, ULARGE_INTEGER *pcbSize
-) {
-  FIXME("(%p,%p), stub!\n", iface, pcbSize);
-  return E_FAIL;
-}
-
-static HRESULT WINAPI OLEFontImpl_IPersistStreamInit_InitNew(
-   IPersistStreamInit *iface
-) {
-  FIXME("(%p), stub!\n", iface);
-  return S_OK;
-}
-
-static const IPersistStreamInitVtbl OLEFontImpl_IPersistStreamInit_VTable = 
-{
-  OLEFontImpl_IPersistStreamInit_QueryInterface,
-  OLEFontImpl_IPersistStreamInit_AddRef,
-  OLEFontImpl_IPersistStreamInit_Release,
-
-  OLEFontImpl_IPersistStreamInit_GetClassID,
-  OLEFontImpl_IPersistStreamInit_IsDirty,
-  OLEFontImpl_IPersistStreamInit_Load,
-  OLEFontImpl_IPersistStreamInit_Save,
-  OLEFontImpl_IPersistStreamInit_GetSizeMax,
-  OLEFontImpl_IPersistStreamInit_InitNew
-};
-
 /************************************************************************
  * OLEFontImpl_Construct
  *
@@ -2159,7 +2069,6 @@ static OLEFontImpl* OLEFontImpl_Construct(const FONTDESC *fontDesc)
   newObject->IPersistStream_iface.lpVtbl = &OLEFontImpl_IPersistStream_VTable;
   newObject->IConnectionPointContainer_iface.lpVtbl = &OLEFontImpl_IConnectionPointContainer_VTable;
   newObject->IPersistPropertyBag_iface.lpVtbl = &OLEFontImpl_IPersistPropertyBag_VTable;
-  newObject->IPersistStreamInit_iface.lpVtbl = &OLEFontImpl_IPersistStreamInit_VTable;
 
   newObject->ref = 1;
 
diff --git a/dlls/oleaut32/tests/olefont.c b/dlls/oleaut32/tests/olefont.c
index 9c8d255af1d..5137d807e78 100644
--- a/dlls/oleaut32/tests/olefont.c
+++ b/dlls/oleaut32/tests/olefont.c
@@ -188,6 +188,7 @@ static void test_QueryInterface(void)
     LPVOID pvObj = NULL;
     HRESULT hr;
     IFont*  font = NULL;
+    IPersistStreamInit *persistStreamInit = NULL;
     LONG ref;
 
     hr = pOleCreateFontIndirect(NULL, &IID_IFont, NULL);
@@ -212,6 +213,10 @@ static void test_QueryInterface(void)
 
     ok(pvObj != NULL,"IFont_QI does return NULL, instead of a ptr\n");
 
+    /* IFont never had IPersistStreamInit */
+    hr = IFont_QueryInterface(font, &IID_IPersistStreamInit, (void**)&persistStreamInit);
+    EXPECT_HR(hr, E_NOINTERFACE);
+
     IFont_Release(font);
     IFont_Release(font);
 }


More information about the wine-devel mailing list