[2/5] shell32: IShellLink::GetPath returns S_FALSE if there's no path.
Vincent Povirk
vincent at codeweavers.com
Mon Sep 25 15:35:20 CDT 2017
Signed-off-by: Vincent Povirk <vincent at codeweavers.com>
---
dlls/shell32/shelllink.c | 12 +++++++++---
dlls/shell32/tests/shelllink.c | 4 ++--
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/dlls/shell32/shelllink.c b/dlls/shell32/shelllink.c
index 3ac6364..81d76d9 100644
--- a/dlls/shell32/shelllink.c
+++ b/dlls/shell32/shelllink.c
@@ -1254,6 +1254,7 @@ static HRESULT WINAPI IShellLinkA_fnGetPath(IShellLinkA *iface, LPSTR pszFile, I
WIN32_FIND_DATAA *pfd, DWORD fFlags)
{
IShellLinkImpl *This = impl_from_IShellLinkA(iface);
+ HRESULT res = S_OK;
TRACE("(%p)->(pfile=%p len=%u find_data=%p flags=%u)(%s)\n",
This, pszFile, cchMaxPath, pfd, fFlags, debugstr_w(This->sPath));
@@ -1263,13 +1264,15 @@ static HRESULT WINAPI IShellLinkA_fnGetPath(IShellLinkA *iface, LPSTR pszFile, I
if (cchMaxPath)
pszFile[0] = 0;
- if (This->sPath)
+ if (This->sPath && This->sPath[0])
WideCharToMultiByte( CP_ACP, 0, This->sPath, -1,
pszFile, cchMaxPath, NULL, NULL);
+ else
+ res = S_FALSE;
if (pfd) FIXME("(%p): WIN32_FIND_DATA is not yet filled.\n", This);
- return S_OK;
+ return res;
}
static HRESULT WINAPI IShellLinkA_fnGetIDList(IShellLinkA *iface, LPITEMIDLIST *ppidl)
@@ -1639,6 +1642,7 @@ static ULONG WINAPI IShellLinkW_fnRelease(IShellLinkW * iface)
static HRESULT WINAPI IShellLinkW_fnGetPath(IShellLinkW * iface, LPWSTR pszFile,INT cchMaxPath, WIN32_FIND_DATAW *pfd, DWORD fFlags)
{
IShellLinkImpl *This = impl_from_IShellLinkW(iface);
+ HRESULT res = S_OK;
TRACE("(%p)->(pfile=%p len=%u find_data=%p flags=%u)(%s)\n",
This, pszFile, cchMaxPath, pfd, fFlags, debugstr_w(This->sPath));
@@ -1650,10 +1654,12 @@ static HRESULT WINAPI IShellLinkW_fnGetPath(IShellLinkW * iface, LPWSTR pszFile,
pszFile[0] = 0;
if (This->sPath)
lstrcpynW( pszFile, This->sPath, cchMaxPath );
+ else
+ res = S_FALSE;
if (pfd) FIXME("(%p): WIN32_FIND_DATA is not yet filled.\n", This);
- return S_OK;
+ return res;
}
static HRESULT WINAPI IShellLinkW_fnGetIDList(IShellLinkW * iface, LPITEMIDLIST * ppidl)
diff --git a/dlls/shell32/tests/shelllink.c b/dlls/shell32/tests/shelllink.c
index ad254c8..ba73e94 100644
--- a/dlls/shell32/tests/shelllink.c
+++ b/dlls/shell32/tests/shelllink.c
@@ -156,7 +156,7 @@ static void test_get_set(void)
/* Test Getting / Setting the path */
strcpy(buffer,"garbage");
r = IShellLinkA_GetPath(sl, buffer, sizeof(buffer), NULL, SLGP_RAWPATH);
- todo_wine ok(r == S_FALSE || broken(r == S_OK) /* NT4/W2K */, "GetPath failed (0x%08x)\n", r);
+ ok(r == S_FALSE || broken(r == S_OK) /* NT4/W2K */, "GetPath failed (0x%08x)\n", r);
ok(*buffer=='\0', "GetPath returned '%s'\n", buffer);
CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
@@ -177,7 +177,7 @@ static void test_get_set(void)
strcpy(buffer,"garbage");
r = IShellLinkA_GetPath(sl, buffer, sizeof(buffer), NULL, SLGP_RAWPATH);
- todo_wine ok(r == S_FALSE, "GetPath failed (0x%08x)\n", r);
+ ok(r == S_FALSE, "GetPath failed (0x%08x)\n", r);
ok(*buffer=='\0', "GetPath returned '%s'\n", buffer);
/* Win98 returns S_FALSE, but WinXP returns S_OK */
--
2.7.4
More information about the wine-patches
mailing list