[PATCH v2] shell32: IPersistFile::Save(NULL) should use previously stored file name.
Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru> --- dlls/shell32/shelllink.c | 16 ++++++++++++---- dlls/shell32/tests/shelllink.c | 16 ++++++++++++++++ 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/dlls/shell32/shelllink.c b/dlls/shell32/shelllink.c index 46d9bc994ff..69d610f2503 100644 --- a/dlls/shell32/shelllink.c +++ b/dlls/shell32/shelllink.c @@ -367,7 +367,12 @@ static HRESULT WINAPI IPersistFile_fnSave(IPersistFile* iface, LPCOLESTR pszFile TRACE("(%p)->(%s)\n",This,debugstr_w(pszFileName)); if (!pszFileName) - return E_FAIL; + { + if (!This->filepath) return S_OK; + + pszFileName = This->filepath; + fRemember = FALSE; + } r = SHCreateStreamOnFileW( pszFileName, STGM_READWRITE | STGM_CREATE | STGM_SHARE_EXCLUSIVE, &stm ); if( SUCCEEDED( r ) ) @@ -379,9 +384,12 @@ static HRESULT WINAPI IPersistFile_fnSave(IPersistFile* iface, LPCOLESTR pszFile { StartLinkProcessor( pszFileName ); - /* update file path */ - heap_free(This->filepath); - This->filepath = strdupW(pszFileName); + if (fRemember) + { + /* update file path */ + heap_free(This->filepath); + This->filepath = strdupW(pszFileName); + } This->bDirty = FALSE; } diff --git a/dlls/shell32/tests/shelllink.c b/dlls/shell32/tests/shelllink.c index 20c48814f1d..60271ace2ce 100644 --- a/dlls/shell32/tests/shelllink.c +++ b/dlls/shell32/tests/shelllink.c @@ -451,6 +451,12 @@ void create_lnk_(int line, const WCHAR* path, lnk_desc_t* desc) IPersistFile_GetCurFile(pf, NULL); } + r = IPersistFile_Save(pf, NULL, FALSE); + lok(r == S_OK, "save failed (0x%08x)\n", r); + + r = IPersistFile_Save(pf, NULL, TRUE); + lok(r == S_OK, "save failed (0x%08x)\n", r); + /* test GetCurFile before ::Save */ str = (LPWSTR)0xdeadbeef; r = IPersistFile_GetCurFile(pf, &str); @@ -467,6 +473,16 @@ void create_lnk_(int line, const WCHAR* path, lnk_desc_t* desc) lok(!wcscmp(path, str), "Expected %s, got %s\n", wine_dbgstr_w(path), wine_dbgstr_w(str)); CoTaskMemFree(str); + r = IPersistFile_Save(pf, NULL, TRUE); + lok(r == S_OK, "save failed (0x%08x)\n", r); + + /* test GetCurFile after ::Save */ + r = IPersistFile_GetCurFile(pf, &str); + lok(r == S_OK, "got 0x%08x\n", r); + lok(str != NULL, "Didn't expect NULL\n"); + lok(!wcscmp(path, str), "Expected %s, got %s\n", wine_dbgstr_w(path), wine_dbgstr_w(str)); + CoTaskMemFree(str); + IPersistFile_Release(pf); } -- 2.29.2
Hi, While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=84988 Your paranoid android. === w2008s64 (32 bit report) === shell32: shelllink.c:623: Test failed: save failed (0x80070057) shelllink.c:623: Test failed: save failed (0x80070057) shelllink.c:643: Test failed: save failed (0x80070057) shelllink.c:643: Test failed: save failed (0x80070057) shelllink.c:667: Test failed: save failed (0x80070057) shelllink.c:667: Test failed: save failed (0x80070057) shelllink.c:684: Test failed: save failed (0x80070057) shelllink.c:684: Test failed: save failed (0x80070057) shelllink.c:698: Test failed: save failed (0x80070057) shelllink.c:698: Test failed: save failed (0x80070057) shelllink.c:714: Test failed: save failed (0x80070057) shelllink.c:714: Test failed: save failed (0x80070057) shelllink.c:745: Test failed: save failed (0x80070057) shelllink.c:745: Test failed: save failed (0x80070057) shelllink.c:765: Test failed: save failed (0x80070057) shelllink.c:765: Test failed: save failed (0x80070057) shelllink.c:795: Test failed: save failed (0x80070057) shelllink.c:795: Test failed: save failed (0x80070057) === wvistau64 (64 bit report) === shell32: shelllink.c:623: Test failed: save failed (0x80070057) shelllink.c:623: Test failed: save failed (0x80070057) shelllink.c:643: Test failed: save failed (0x80070057) shelllink.c:643: Test failed: save failed (0x80070057) shelllink.c:667: Test failed: save failed (0x80070057) shelllink.c:667: Test failed: save failed (0x80070057) shelllink.c:684: Test failed: save failed (0x80070057) shelllink.c:684: Test failed: save failed (0x80070057) shelllink.c:698: Test failed: save failed (0x80070057) shelllink.c:698: Test failed: save failed (0x80070057) shelllink.c:714: Test failed: save failed (0x80070057) shelllink.c:714: Test failed: save failed (0x80070057) shelllink.c:745: Test failed: save failed (0x80070057) shelllink.c:745: Test failed: save failed (0x80070057) shelllink.c:765: Test failed: save failed (0x80070057) shelllink.c:765: Test failed: save failed (0x80070057) shelllink.c:795: Test failed: save failed (0x80070057) shelllink.c:795: Test failed: save failed (0x80070057) === w2008s64 (64 bit report) === shell32: shelllink.c:623: Test failed: save failed (0x80070057) shelllink.c:623: Test failed: save failed (0x80070057) shelllink.c:643: Test failed: save failed (0x80070057) shelllink.c:643: Test failed: save failed (0x80070057) shelllink.c:667: Test failed: save failed (0x80070057) shelllink.c:667: Test failed: save failed (0x80070057) shelllink.c:684: Test failed: save failed (0x80070057) shelllink.c:684: Test failed: save failed (0x80070057) shelllink.c:698: Test failed: save failed (0x80070057) shelllink.c:698: Test failed: save failed (0x80070057) shelllink.c:714: Test failed: save failed (0x80070057) shelllink.c:714: Test failed: save failed (0x80070057) shelllink.c:745: Test failed: save failed (0x80070057) shelllink.c:745: Test failed: save failed (0x80070057) shelllink.c:765: Test failed: save failed (0x80070057) shelllink.c:765: Test failed: save failed (0x80070057) shelllink.c:795: Test failed: save failed (0x80070057) shelllink.c:795: Test failed: save failed (0x80070057)
participants (2)
-
Dmitry Timoshkov -
Marvin