Commit eb9f4603 authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

oleaut32: Calculate icon data if the picture is dirty, or there's no icon data.

parent cbfc3560
...@@ -1826,41 +1826,32 @@ static HRESULT WINAPI OLEPictureImpl_Save( ...@@ -1826,41 +1826,32 @@ static HRESULT WINAPI OLEPictureImpl_Save(
unsigned int iDataSize; unsigned int iDataSize;
ULONG dummy; ULONG dummy;
int iSerializeResult = 0; int iSerializeResult = 0;
OLEPictureImpl *This = impl_from_IPersistStream(iface);
OLEPictureImpl *This = impl_from_IPersistStream(iface); TRACE("%p %p %d\n", This, pStm, fClearDirty);
switch (This->desc.picType) { switch (This->desc.picType) {
case PICTYPE_ICON: case PICTYPE_ICON:
if (This->bIsDirty) { if (This->bIsDirty || !This->data) {
if (serializeIcon(This->desc.u.icon.hicon, &pIconData, &iDataSize)) { if (!serializeIcon(This->desc.u.icon.hicon, &pIconData, &iDataSize)) {
if (This->loadtime_magic != 0xdeadbeef) { ERR("(%p,%p,%d), serializeIcon() failed\n", This, pStm, fClearDirty);
DWORD header[2];
header[0] = This->loadtime_magic;
header[1] = iDataSize;
IStream_Write(pStm, header, 2 * sizeof(DWORD), &dummy);
}
IStream_Write(pStm, pIconData, iDataSize, &dummy);
HeapFree(GetProcessHeap(), 0, This->data);
This->data = pIconData;
This->datalen = iDataSize;
hResult = S_OK;
} else {
FIXME("(%p,%p,%d), unable to serializeIcon()!\n",This,pStm,fClearDirty);
hResult = E_FAIL; hResult = E_FAIL;
break;
} }
} else { This->data = pIconData;
if (This->loadtime_magic != 0xdeadbeef) { This->datalen = iDataSize;
DWORD header[2]; }
if (This->loadtime_magic != 0xdeadbeef) {
DWORD header[2];
header[0] = This->loadtime_magic; header[0] = This->loadtime_magic;
header[1] = This->datalen; header[1] = This->datalen;
IStream_Write(pStm, header, 2 * sizeof(DWORD), &dummy); IStream_Write(pStm, header, 2 * sizeof(DWORD), &dummy);
}
IStream_Write(pStm, This->data, This->datalen, &dummy);
hResult = S_OK;
} }
IStream_Write(pStm, This->data, This->datalen, &dummy);
HeapFree(GetProcessHeap(), 0, This->data);
hResult = S_OK;
break; break;
case PICTYPE_BITMAP: case PICTYPE_BITMAP:
if (This->bIsDirty) { if (This->bIsDirty) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment