[PATCH v2 0/4] MR7453: ole32: Improvements to property storage saving
-- v2: ole32: Reset output stream when wrting property storage. ole32: Remove end label from PropertyStorage_WriteToStream. https://gitlab.winehq.org/wine/wine/-/merge_requests/7453
From: Piotr Caban <piotr(a)codeweavers.com> --- dlls/ole32/stg_prop.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/ole32/stg_prop.c b/dlls/ole32/stg_prop.c index 5c86de027b1..3d590b69b0d 100644 --- a/dlls/ole32/stg_prop.c +++ b/dlls/ole32/stg_prop.c @@ -2670,6 +2670,7 @@ static HRESULT PropertyStorage_ConstructEmpty(IStream *stm, REFFMTID rfmtid, hr = PropertyStorage_BaseConstruct(stm, rfmtid, grfMode, &ps); if (SUCCEEDED(hr)) { + ps->dirty = TRUE; if (clsid) ps->clsid = *clsid; ps->format = 0; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/7453
From: Piotr Caban <piotr(a)codeweavers.com> --- dlls/ole32/stg_prop.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dlls/ole32/stg_prop.c b/dlls/ole32/stg_prop.c index 3d590b69b0d..70d7635cc72 100644 --- a/dlls/ole32/stg_prop.c +++ b/dlls/ole32/stg_prop.c @@ -2558,6 +2558,8 @@ static HRESULT PropertyStorage_WriteToStream(PropertyStorage_impl *This) hr = IStream_Write(This->stm, &dwTemp, sizeof(dwTemp), &count); end: + if (SUCCEEDED(hr)) + This->dirty = FALSE; return hr; } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/7453
From: Piotr Caban <piotr(a)codeweavers.com> --- dlls/ole32/stg_prop.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/dlls/ole32/stg_prop.c b/dlls/ole32/stg_prop.c index 70d7635cc72..28a240aa2a3 100644 --- a/dlls/ole32/stg_prop.c +++ b/dlls/ole32/stg_prop.c @@ -2499,10 +2499,10 @@ static HRESULT PropertyStorage_WriteToStream(PropertyStorage_impl *This) seek.QuadPart = SECTIONHEADER_OFFSET; hr = IStream_Seek(This->stm, seek, STREAM_SEEK_SET, NULL); if (FAILED(hr)) - goto end; + return hr; hr = IStream_Write(This->stm, §ionHdr, sizeof(sectionHdr), &count); if (FAILED(hr)) - goto end; + return hr; prop = 0; sectionOffset = sizeof(PROPERTYSECTIONHEADER) + @@ -2513,7 +2513,7 @@ static HRESULT PropertyStorage_WriteToStream(PropertyStorage_impl *This) prop++; hr = PropertyStorage_WriteDictionaryToStream(This, §ionOffset); if (FAILED(hr)) - goto end; + return hr; } PropVariantInit(&var); @@ -2523,7 +2523,7 @@ static HRESULT PropertyStorage_WriteToStream(PropertyStorage_impl *This) hr = PropertyStorage_WritePropertyToStream(This, prop++, PID_CODEPAGE, &var, §ionOffset); if (FAILED(hr)) - goto end; + return hr; if (This->locale != LOCALE_SYSTEM_DEFAULT) { @@ -2532,7 +2532,7 @@ static HRESULT PropertyStorage_WriteToStream(PropertyStorage_impl *This) hr = PropertyStorage_WritePropertyToStream(This, prop++, PID_LOCALE, &var, §ionOffset); if (FAILED(hr)) - goto end; + return hr; } if (This->grfFlags & PROPSETFLAG_CASE_SENSITIVE) @@ -2542,22 +2542,20 @@ static HRESULT PropertyStorage_WriteToStream(PropertyStorage_impl *This) hr = PropertyStorage_WritePropertyToStream(This, prop++, PID_BEHAVIOR, &var, §ionOffset); if (FAILED(hr)) - goto end; + return hr; } hr = PropertyStorage_WritePropertiesToStream(This, prop, §ionOffset); if (FAILED(hr)) - goto end; + return hr; /* Now write the byte count of the section */ seek.QuadPart = SECTIONHEADER_OFFSET; hr = IStream_Seek(This->stm, seek, STREAM_SEEK_SET, NULL); if (FAILED(hr)) - goto end; + return hr; StorageUtl_WriteDWord(&dwTemp, 0, sectionOffset); hr = IStream_Write(This->stm, &dwTemp, sizeof(dwTemp), &count); - -end: if (SUCCEEDED(hr)) This->dirty = FALSE; return hr; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/7453
From: Piotr Caban <piotr(a)codeweavers.com> --- dlls/ole32/stg_prop.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dlls/ole32/stg_prop.c b/dlls/ole32/stg_prop.c index 28a240aa2a3..547d1f82335 100644 --- a/dlls/ole32/stg_prop.c +++ b/dlls/ole32/stg_prop.c @@ -2473,6 +2473,7 @@ end: static HRESULT PropertyStorage_WriteToStream(PropertyStorage_impl *This) { + const ULARGE_INTEGER size = { .QuadPart = 0 }; PROPERTYSECTIONHEADER sectionHdr; HRESULT hr; ULONG count; @@ -2480,6 +2481,10 @@ static HRESULT PropertyStorage_WriteToStream(PropertyStorage_impl *This) DWORD numProps, prop, sectionOffset, dwTemp; PROPVARIANT var; + hr = IStream_SetSize(This->stm, size); + if (FAILED(hr)) + return hr; + PropertyStorage_WriteHeadersToStream(This); /* Count properties. Always at least one property, the code page */ -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/7453
On Sat Mar 1 15:05:55 2025 +0000, Piotr Caban wrote:
changed this line in [version 2 of the diff](/wine/wine/-/merge_requests/7453/diffs?diff_id=161302&start_sha=4227e48706bb3b063af820f3c9c5e397cd9b4ee2#472bf6a4b6d517729a57c632642a24879adf48c7_2484_2484) Thanks, I have pushed a new version with this change.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/7453#note_96311
participants (2)
-
Piotr Caban -
Piotr Caban (@piotr)