mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 12:19:49 +00:00
SetPath("") should return S_OK.
SetPath("nonexistent_path") should return S_FALSE.
This commit is contained in:
parent
e2f07fb444
commit
084e596a95
2 changed files with 23 additions and 5 deletions
|
@ -1336,11 +1336,16 @@ static HRESULT WINAPI IShellLinkA_fnSetPath(IShellLinkA * iface, LPCSTR pszFile)
|
|||
IShellLinkImpl *This = (IShellLinkImpl *)iface;
|
||||
char buffer[MAX_PATH];
|
||||
LPSTR fname;
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
TRACE("(%p)->(path=%s)\n",This, pszFile);
|
||||
|
||||
if (!GetFullPathNameA(pszFile, MAX_PATH, buffer, &fname))
|
||||
if(*pszFile == '\0')
|
||||
*buffer = '\0';
|
||||
else if (!GetFullPathNameA(pszFile, MAX_PATH, buffer, &fname))
|
||||
return E_FAIL;
|
||||
else if(!PathFileExistsA(buffer))
|
||||
hr = S_FALSE;
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, This->sPath);
|
||||
This->sPath = HEAP_strdupAtoW(GetProcessHeap(), 0, buffer);
|
||||
|
@ -1349,7 +1354,7 @@ static HRESULT WINAPI IShellLinkA_fnSetPath(IShellLinkA * iface, LPCSTR pszFile)
|
|||
|
||||
This->bDirty = TRUE;
|
||||
|
||||
return S_OK;
|
||||
return hr;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
|
@ -1756,11 +1761,16 @@ static HRESULT WINAPI IShellLinkW_fnSetPath(IShellLinkW * iface, LPCWSTR pszFile
|
|||
_ICOM_THIS_From_IShellLinkW(IShellLinkImpl, iface);
|
||||
WCHAR buffer[MAX_PATH];
|
||||
LPWSTR fname;
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
TRACE("(%p)->(path=%s)\n",This, debugstr_w(pszFile));
|
||||
|
||||
if (!GetFullPathNameW(pszFile, MAX_PATH, buffer, &fname))
|
||||
if (*pszFile == '\0')
|
||||
*buffer = '\0';
|
||||
else if (!GetFullPathNameW(pszFile, MAX_PATH, buffer, &fname))
|
||||
return E_FAIL;
|
||||
else if(!PathFileExistsW(buffer))
|
||||
hr = S_FALSE;
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, This->sPath);
|
||||
This->sPath = HeapAlloc( GetProcessHeap(), 0,
|
||||
|
@ -1771,7 +1781,7 @@ static HRESULT WINAPI IShellLinkW_fnSetPath(IShellLinkW * iface, LPCWSTR pszFile
|
|||
lstrcpyW(This->sPath, buffer);
|
||||
This->bDirty = TRUE;
|
||||
|
||||
return S_OK;
|
||||
return hr;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
|
|
|
@ -136,9 +136,17 @@ static void test_get_set()
|
|||
ok(SUCCEEDED(r), "GetPath failed (0x%08lx)\n", r);
|
||||
ok(*buffer=='\0', "GetPath returned '%s'\n", buffer);
|
||||
|
||||
r = IShellLinkA_SetPath(sl, "");
|
||||
ok(r==S_OK, "SetPath failed (0x%08lx)\n", r);
|
||||
|
||||
strcpy(buffer,"garbage");
|
||||
r = IShellLinkA_GetPath(sl, buffer, sizeof(buffer), NULL, SLGP_RAWPATH);
|
||||
ok(SUCCEEDED(r), "GetPath failed (0x%08lx)\n", r);
|
||||
ok(*buffer=='\0', "GetPath returned '%s'\n", buffer);
|
||||
|
||||
str="c:\\nonexistent\\file";
|
||||
r = IShellLinkA_SetPath(sl, str);
|
||||
ok(SUCCEEDED(r), "SetPath failed (0x%08lx)\n", r);
|
||||
ok(r==S_FALSE, "SetPath failed (0x%08lx)\n", r);
|
||||
|
||||
strcpy(buffer,"garbage");
|
||||
r = IShellLinkA_GetPath(sl, buffer, sizeof(buffer), NULL, SLGP_RAWPATH);
|
||||
|
|
Loading…
Reference in a new issue