Commit 94378704 authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

shell32: IShellLink::GetPath returns S_FALSE if there's no path.

parent a796bcaa
...@@ -1254,6 +1254,7 @@ static HRESULT WINAPI IShellLinkA_fnGetPath(IShellLinkA *iface, LPSTR pszFile, I ...@@ -1254,6 +1254,7 @@ static HRESULT WINAPI IShellLinkA_fnGetPath(IShellLinkA *iface, LPSTR pszFile, I
WIN32_FIND_DATAA *pfd, DWORD fFlags) WIN32_FIND_DATAA *pfd, DWORD fFlags)
{ {
IShellLinkImpl *This = impl_from_IShellLinkA(iface); IShellLinkImpl *This = impl_from_IShellLinkA(iface);
HRESULT res = S_OK;
TRACE("(%p)->(pfile=%p len=%u find_data=%p flags=%u)(%s)\n", TRACE("(%p)->(pfile=%p len=%u find_data=%p flags=%u)(%s)\n",
This, pszFile, cchMaxPath, pfd, fFlags, debugstr_w(This->sPath)); This, pszFile, cchMaxPath, pfd, fFlags, debugstr_w(This->sPath));
...@@ -1263,13 +1264,15 @@ static HRESULT WINAPI IShellLinkA_fnGetPath(IShellLinkA *iface, LPSTR pszFile, I ...@@ -1263,13 +1264,15 @@ static HRESULT WINAPI IShellLinkA_fnGetPath(IShellLinkA *iface, LPSTR pszFile, I
if (cchMaxPath) if (cchMaxPath)
pszFile[0] = 0; pszFile[0] = 0;
if (This->sPath) if (This->sPath && This->sPath[0])
WideCharToMultiByte( CP_ACP, 0, This->sPath, -1, WideCharToMultiByte( CP_ACP, 0, This->sPath, -1,
pszFile, cchMaxPath, NULL, NULL); pszFile, cchMaxPath, NULL, NULL);
else
res = S_FALSE;
if (pfd) FIXME("(%p): WIN32_FIND_DATA is not yet filled.\n", This); 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) static HRESULT WINAPI IShellLinkA_fnGetIDList(IShellLinkA *iface, LPITEMIDLIST *ppidl)
...@@ -1639,6 +1642,7 @@ static ULONG WINAPI IShellLinkW_fnRelease(IShellLinkW * iface) ...@@ -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) static HRESULT WINAPI IShellLinkW_fnGetPath(IShellLinkW * iface, LPWSTR pszFile,INT cchMaxPath, WIN32_FIND_DATAW *pfd, DWORD fFlags)
{ {
IShellLinkImpl *This = impl_from_IShellLinkW(iface); IShellLinkImpl *This = impl_from_IShellLinkW(iface);
HRESULT res = S_OK;
TRACE("(%p)->(pfile=%p len=%u find_data=%p flags=%u)(%s)\n", TRACE("(%p)->(pfile=%p len=%u find_data=%p flags=%u)(%s)\n",
This, pszFile, cchMaxPath, pfd, fFlags, debugstr_w(This->sPath)); This, pszFile, cchMaxPath, pfd, fFlags, debugstr_w(This->sPath));
...@@ -1650,10 +1654,12 @@ static HRESULT WINAPI IShellLinkW_fnGetPath(IShellLinkW * iface, LPWSTR pszFile, ...@@ -1650,10 +1654,12 @@ static HRESULT WINAPI IShellLinkW_fnGetPath(IShellLinkW * iface, LPWSTR pszFile,
pszFile[0] = 0; pszFile[0] = 0;
if (This->sPath) if (This->sPath)
lstrcpynW( pszFile, This->sPath, cchMaxPath ); lstrcpynW( pszFile, This->sPath, cchMaxPath );
else
res = S_FALSE;
if (pfd) FIXME("(%p): WIN32_FIND_DATA is not yet filled.\n", This); 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) static HRESULT WINAPI IShellLinkW_fnGetIDList(IShellLinkW * iface, LPITEMIDLIST * ppidl)
......
...@@ -156,7 +156,7 @@ static void test_get_set(void) ...@@ -156,7 +156,7 @@ static void test_get_set(void)
/* Test Getting / Setting the path */ /* Test Getting / Setting the path */
strcpy(buffer,"garbage"); strcpy(buffer,"garbage");
r = IShellLinkA_GetPath(sl, buffer, sizeof(buffer), NULL, SLGP_RAWPATH); 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); ok(*buffer=='\0', "GetPath returned '%s'\n", buffer);
CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
...@@ -177,7 +177,7 @@ static void test_get_set(void) ...@@ -177,7 +177,7 @@ static void test_get_set(void)
strcpy(buffer,"garbage"); strcpy(buffer,"garbage");
r = IShellLinkA_GetPath(sl, buffer, sizeof(buffer), NULL, SLGP_RAWPATH); 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); ok(*buffer=='\0', "GetPath returned '%s'\n", buffer);
/* Win98 returns S_FALSE, but WinXP returns S_OK */ /* Win98 returns S_FALSE, but WinXP returns S_OK */
......
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