[shell32.dll]

- Fix bug related to correct error code returning in delete_files. The value of 1026 was revealed to be returned by windows 2003 server. Score several passed winetests.
- Fix a bug in ShellLink::SetShowCmd and score one more passed winetest

svn path=/branches/shell32_new-bringup/; revision=53543
This commit is contained in:
Claudiu Mihail 2011-09-03 14:20:03 +00:00
parent 833aa3ffef
commit 8af812d602
2 changed files with 66 additions and 44 deletions

View file

@ -1153,7 +1153,7 @@ HRESULT WINAPI ShellLink::SetShowCmd(INT iShowCmd)
{ {
TRACE("(%p) %d\n",this, iShowCmd); TRACE("(%p) %d\n",this, iShowCmd);
iShowCmd = iShowCmd; this->iShowCmd = iShowCmd;
bDirty = TRUE; bDirty = TRUE;
return NOERROR; return NOERROR;
@ -1191,39 +1191,40 @@ HRESULT WINAPI ShellLink::GetIconLocation(LPSTR pszIconPath,INT cchIconPath,INT
if (sIcoPath) if (sIcoPath)
{ {
WideCharToMultiByte(CP_ACP, 0, sIcoPath, -1, pszIconPath, cchIconPath, NULL, NULL); WideCharToMultiByte(CP_ACP, 0, sIcoPath, -1, pszIconPath, cchIconPath, NULL, NULL);
return S_OK; return S_OK;
} }
if (pPidl || sPath) if (pPidl || sPath)
{ {
CComPtr<IShellFolder> pdsk; CComPtr<IShellFolder> pdsk;
HRESULT hr = SHGetDesktopFolder(&pdsk); HRESULT hr = SHGetDesktopFolder(&pdsk);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
/* first look for an icon using the PIDL (if present) */ /* first look for an icon using the PIDL (if present) */
if (pPidl) if (pPidl)
hr = SHELL_PidlGeticonLocationA(pdsk, pPidl, pszIconPath, cchIconPath, piIcon); hr = SHELL_PidlGeticonLocationA(pdsk, pPidl, pszIconPath, cchIconPath, piIcon);
else else
hr = E_FAIL; hr = E_FAIL;
/* if we couldn't find an icon yet, look for it using the file system path */ /* if we couldn't find an icon yet, look for it using the file system path */
if (FAILED(hr) && sPath) if (FAILED(hr) && sPath)
{ {
LPITEMIDLIST pidl; LPITEMIDLIST pidl;
hr = pdsk->ParseDisplayName(0, NULL, sPath, NULL, &pidl, NULL); hr = pdsk->ParseDisplayName(0, NULL, sPath, NULL, &pidl, NULL);
if (SUCCEEDED(hr)) { if (SUCCEEDED(hr))
hr = SHELL_PidlGeticonLocationA(pdsk, pidl, pszIconPath, cchIconPath, piIcon); {
hr = SHELL_PidlGeticonLocationA(pdsk, pidl, pszIconPath, cchIconPath, piIcon);
SHFree(pidl); SHFree(pidl);
} }
}
} }
}
return hr; return hr;
} }
return S_OK; return S_OK;
} }
@ -1235,7 +1236,8 @@ HRESULT WINAPI ShellLink::SetIconLocation(LPCSTR pszIconPath,INT iIcon)
HeapFree(GetProcessHeap(), 0, sIcoPath); HeapFree(GetProcessHeap(), 0, sIcoPath);
sIcoPath = NULL; sIcoPath = NULL;
if ( pszIconPath ) { if ( pszIconPath )
{
sIcoPath = HEAP_strdupAtoW(GetProcessHeap(), 0, pszIconPath); sIcoPath = HEAP_strdupAtoW(GetProcessHeap(), 0, pszIconPath);
if ( !sIcoPath ) if ( !sIcoPath )
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
@ -1254,7 +1256,8 @@ HRESULT WINAPI ShellLink::SetRelativePath(LPCSTR pszPathRel, DWORD dwReserved)
HeapFree(GetProcessHeap(), 0, sPathRel); HeapFree(GetProcessHeap(), 0, sPathRel);
sPathRel = NULL; sPathRel = NULL;
if ( pszPathRel ) { if ( pszPathRel )
{
sPathRel = HEAP_strdupAtoW(GetProcessHeap(), 0, pszPathRel); sPathRel = HEAP_strdupAtoW(GetProcessHeap(), 0, pszPathRel);
bDirty = TRUE; bDirty = TRUE;
} }
@ -1271,32 +1274,38 @@ HRESULT WINAPI ShellLink::Resolve(HWND hwnd, DWORD fFlags)
/*FIXME: use IResolveShellLink interface */ /*FIXME: use IResolveShellLink interface */
if (!sPath && pPidl) { if (!sPath && pPidl)
WCHAR buffer[MAX_PATH]; {
WCHAR buffer[MAX_PATH];
bSuccess = SHGetPathFromIDListW(pPidl, buffer); bSuccess = SHGetPathFromIDListW(pPidl, buffer);
if (bSuccess && *buffer) { if (bSuccess && *buffer)
sPath = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, (wcslen(buffer)+1)*sizeof(WCHAR)); {
if (!sPath) sPath = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, (wcslen(buffer)+1)*sizeof(WCHAR));
return E_OUTOFMEMORY;
if (!sPath)
return E_OUTOFMEMORY;
wcscpy(sPath, buffer); wcscpy(sPath, buffer);
bDirty = TRUE; bDirty = TRUE;
} else }
hr = S_OK; /* don't report an error occurred while just caching information */ else
hr = S_OK; /* don't report an error occurred while just caching information */
} }
if (!sIcoPath && sPath) { if (!sIcoPath && sPath)
sIcoPath = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, (wcslen(sPath)+1)*sizeof(WCHAR)); {
if (!sIcoPath) sIcoPath = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, (wcslen(sPath)+1)*sizeof(WCHAR));
return E_OUTOFMEMORY;
if (!sIcoPath)
return E_OUTOFMEMORY;
wcscpy(sIcoPath, sPath); wcscpy(sIcoPath, sPath);
iIcoNdx = 0; iIcoNdx = 0;
bDirty = TRUE; bDirty = TRUE;
} }
return hr; return hr;
@ -1312,7 +1321,7 @@ HRESULT WINAPI ShellLink::SetPath(LPCSTR pszFile)
return E_INVALIDARG; return E_INVALIDARG;
str = HEAP_strdupAtoW(GetProcessHeap(), 0, pszFile); str = HEAP_strdupAtoW(GetProcessHeap(), 0, pszFile);
if( !str ) if (!str)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
r = SetPath(str); r = SetPath(str);
@ -1331,6 +1340,7 @@ HRESULT WINAPI ShellLink::GetPath(LPWSTR pszFile,INT cchMaxPath, WIN32_FIND_DATA
if (cchMaxPath) if (cchMaxPath)
pszFile[0] = 0; pszFile[0] = 0;
if (sPath) if (sPath)
lstrcpynW( pszFile, sPath, cchMaxPath ); lstrcpynW( pszFile, sPath, cchMaxPath );
@ -1344,7 +1354,7 @@ HRESULT WINAPI ShellLink::GetDescription(LPWSTR pszName,INT cchMaxName)
TRACE("(%p)->(%p len=%u)\n",this, pszName, cchMaxName); TRACE("(%p)->(%p len=%u)\n",this, pszName, cchMaxName);
pszName[0] = 0; pszName[0] = 0;
if( sDescription ) if (sDescription)
lstrcpynW( pszName, sDescription, cchMaxName ); lstrcpynW( pszName, sDescription, cchMaxName );
return S_OK; return S_OK;

View file

@ -24,7 +24,6 @@
//#define NO_SHLWAPI_STREAM //#define NO_SHLWAPI_STREAM
#include <precomp.h> #include <precomp.h>
WINE_DEFAULT_DEBUG_CHANNEL(shell); WINE_DEFAULT_DEBUG_CHANNEL(shell);
#define IsAttrib(x, y) ((INVALID_FILE_ATTRIBUTES != (x)) && ((x) & (y))) #define IsAttrib(x, y) ((INVALID_FILE_ATTRIBUTES != (x)) && ((x) & (y)))
@ -1503,7 +1502,20 @@ static HRESULT delete_files(LPSHFILEOPSTRUCTW lpFileOp, const FILE_LIST *flFrom)
bPathExists = SHELL_DeleteDirectoryW(lpFileOp->hwnd, fileEntry->szFullPath, FALSE); bPathExists = SHELL_DeleteDirectoryW(lpFileOp->hwnd, fileEntry->szFullPath, FALSE);
if (!bPathExists) if (!bPathExists)
return ERROR_FILE_NOT_FOUND; {
DWORD err = GetLastError();
if (ERROR_FILE_NOT_FOUND == err)
{
// This is a windows 2003 server specific value which ahs been removed.
// Later versions of windows return ERROR_FILE_NOT_FOUND.
return 1026;
}
else
{
return err;
}
}
} }
return ERROR_SUCCESS; return ERROR_SUCCESS;