shell32: IShellLink::GetPath returns S_FALSE if there's no path.
Signed-off-by: Vincent Povirk <vincent@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
a796bcaa7f
commit
94378704f8
|
@ -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)
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue