Module: wine
Branch: master
Commit: 8c5b08d81c91f01809a52a66d498fb50e55d3bee
URL:
https://gitlab.winehq.org/wine/wine/-/commit/8c5b08d81c91f01809a52a66d498fb…
Author: Daniel Lehman <dlehman25(a)gmail.com>
Date: Mon Feb 26 22:09:16 2024 -0800
oleaut32: Implement GetSizeMax for empty picture.
---
dlls/oleaut32/olepicture.c | 57 ++++++++++++++++++++++++++++++++++++----
dlls/oleaut32/tests/olepicture.c | 3 ---
2 files changed, 52 insertions(+), 8 deletions(-)
diff --git a/dlls/oleaut32/olepicture.c b/dlls/oleaut32/olepicture.c
index 36de9c355f3..6e0db65a101 100644
--- a/dlls/oleaut32/olepicture.c
+++ b/dlls/oleaut32/olepicture.c
@@ -1836,12 +1836,59 @@ static HRESULT WINAPI OLEPictureImpl_Save(
return hResult;
}
-static HRESULT WINAPI OLEPictureImpl_GetSizeMax(
- IPersistStream* iface,ULARGE_INTEGER*pcbSize)
+static HRESULT WINAPI OLEPictureImpl_GetSizeMax(IPersistStream *iface, ULARGE_INTEGER
*size)
{
- OLEPictureImpl *This = impl_from_IPersistStream(iface);
- FIXME("(%p,%p),stub!\n",This,pcbSize);
- return E_NOTIMPL;
+ HRESULT hr = E_NOTIMPL;
+ OLEPictureImpl *This = impl_from_IPersistStream(iface);
+ unsigned int datasize = This->datalen;
+
+ FIXME("(%p,%p), partial stub!\n", This, size);
+
+ if (!size)
+ return E_INVALIDARG;
+
+ switch (This->desc.picType) {
+ case PICTYPE_NONE:
+ hr = S_OK;
+ break;
+ case PICTYPE_ICON:
+ FIXME("(%p), PICTYPE_ICON not implemented!\n",This);
+ break;
+ case PICTYPE_BITMAP:
+ if (This->bIsDirty || !This->data) {
+ switch (This->keepOrigFormat ? This->loadtime_format :
BITMAP_FORMAT_BMP) {
+ case BITMAP_FORMAT_BMP:
+ FIXME("(%p), PICTYPE_BITMAP (format BMP) not
implemented!\n",This);
+ break;
+ case BITMAP_FORMAT_JPEG:
+ FIXME("(%p), PICTYPE_BITMAP (format JPEG) not
implemented!\n",This);
+ break;
+ case BITMAP_FORMAT_GIF:
+ FIXME("(%p), PICTYPE_BITMAP (format GIF) not
implemented!\n",This);
+ break;
+ case BITMAP_FORMAT_PNG:
+ FIXME("(%p), PICTYPE_BITMAP (format PNG) not
implemented!\n",This);
+ break;
+ default:
+ FIXME("(%p), PICTYPE_BITMAP (format UNKNOWN, using BMP?) not
implemented!\n",This);
+ break;
+ }
+ }
+ break;
+ case PICTYPE_METAFILE:
+ FIXME("(%p), PICTYPE_METAFILE not implemented!\n",This);
+ break;
+ case PICTYPE_ENHMETAFILE:
+ FIXME("(%p), PICTYPE_ENHMETAFILE not implemented!\n",This);
+ break;
+ default:
+ FIXME("(%p), [unknown type] not implemented!\n",This);
+ break;
+ }
+
+ size->HighPart = 0;
+ size->LowPart = datasize + 8;
+ return hr;
}
diff --git a/dlls/oleaut32/tests/olepicture.c b/dlls/oleaut32/tests/olepicture.c
index e340eacf272..a269491fd3f 100644
--- a/dlls/oleaut32/tests/olepicture.c
+++ b/dlls/oleaut32/tests/olepicture.c
@@ -1413,13 +1413,10 @@ static void test_load_save_empty_picture(void)
maxsize.QuadPart = 0;
hr = IPersistStream_GetSizeMax(src_stream, &maxsize);
- todo_wine
ok(hr == S_OK, "GetSizeMax error %#lx\n", hr);
- todo_wine
ok(maxsize.QuadPart == 8, "expected 8, got %s\n",
wine_dbgstr_longlong(maxsize.QuadPart));
hr = IPersistStream_GetSizeMax(src_stream, NULL);
- todo_wine
ole_expect(hr, E_INVALIDARG);
hr = IPersistStream_Save(src_stream, dst_stream, TRUE);