shell32: Shelllink: Make the create_lnk() failure messages unique.

create_lnk() reports all failures from the perspective of the caller.
That means the failure messages must be unique so one can figure out
which one of its ok() calls actually failed.

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Francois Gouget 2022-05-13 19:57:03 +02:00 committed by Alexandre Julliard
parent 68fa3f6736
commit 43363df399
1 changed files with 19 additions and 15 deletions

View File

@ -452,41 +452,45 @@ void create_lnk_(int line, const WCHAR* path, lnk_desc_t* desc)
init_dirty = IPersistFile_IsDirty(pf); /* empty links start off as clean */
r = IPersistFile_Save(pf, NULL, FALSE);
lok(r == S_OK || r == E_INVALIDARG /* before Windows 7 */, "save failed (0x%08lx)\n", r);
lok(r == S_OK || r == E_INVALIDARG /* before Windows 7 */,
"save(NULL, FALSE) failed (0x%08lx)\n", r);
r = IPersistFile_IsDirty(pf);
lok(r == init_dirty, "dirty (0x%08lx)\n", r);
lok(r == init_dirty, "dirty(NULL, FALSE) (0x%08lx)\n", r);
r = IPersistFile_Save(pf, NULL, TRUE);
lok(r == S_OK || r == E_INVALIDARG /* before Windows 7 */, "save failed (0x%08lx)\n", r);
lok(r == S_OK || r == E_INVALIDARG /* before Windows 7 */,
"save(NULL, TRUE) failed (0x%08lx)\n", r);
r = IPersistFile_IsDirty(pf);
lok(r == init_dirty, "dirty (0x%08lx)\n", r);
lok(r == init_dirty, "dirty(NULL, TRUE) (0x%08lx)\n", r);
/* test GetCurFile before ::Save */
str = (LPWSTR)0xdeadbeef;
r = IPersistFile_GetCurFile(pf, &str);
lok(r == S_FALSE, "got 0x%08lx\n", r);
lok(str == NULL, "got %p\n", str);
lok(r == S_FALSE, "GetCurFile:before got 0x%08lx\n", r);
lok(str == NULL, "GetCurFile:before got %p\n", str);
r = IPersistFile_Save(pf, path, TRUE);
lok(r == S_OK, "save failed (0x%08lx)\n", r);
lok(r == S_OK, "save(path, TRUE) failed (0x%08lx)\n", r);
r = IPersistFile_IsDirty(pf);
lok(r == S_FALSE, "dirty (0x%08lx)\n", r);
lok(r == S_FALSE, "dirty(path, TRUE) (0x%08lx)\n", r);
/* test GetCurFile after ::Save */
r = IPersistFile_GetCurFile(pf, &str);
lok(r == S_OK, "got 0x%08lx\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));
lok(r == S_OK, "GetCurFile(path, TRUE) got 0x%08lx\n", r);
lok(str != NULL, "GetCurFile(path, TRUE) Didn't expect NULL\n");
lok(!wcscmp(path, str), "GetCurFile(path, TRUE) 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%08lx)\n", r);
lok(r == S_OK, "save(NULL, TRUE) failed (0x%08lx)\n", r);
/* test GetCurFile after ::Save */
r = IPersistFile_GetCurFile(pf, &str);
lok(r == S_OK, "got 0x%08lx\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));
lok(r == S_OK, "GetCurFile(NULL, TRUE) got 0x%08lx\n", r);
lok(str != NULL, "GetCurFile(NULL, TRUE) Didn't expect NULL\n");
lok(!wcscmp(path, str), "GetCurFile(NULL, TRUE) Expected %s, got %s\n", wine_dbgstr_w(path), wine_dbgstr_w(str));
CoTaskMemFree(str);
IPersistFile_Release(pf);