Author: cmihail
Date: Sat Sep  3 14:20:03 2011
New Revision: 53543

URL: http://svn.reactos.org/svn/reactos?rev=53543&view=rev
Log:
[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

Modified:
    branches/shell32_new-bringup/dll/win32/shell32/shelllink.cpp
    branches/shell32_new-bringup/dll/win32/shell32/shlfileop.cpp

Modified: branches/shell32_new-bringup/dll/win32/shell32/shelllink.cpp
URL: 
http://svn.reactos.org/svn/reactos/branches/shell32_new-bringup/dll/win32/shell32/shelllink.cpp?rev=53543&r1=53542&r2=53543&view=diff
==============================================================================
--- branches/shell32_new-bringup/dll/win32/shell32/shelllink.cpp [iso-8859-1] 
(original)
+++ branches/shell32_new-bringup/dll/win32/shell32/shelllink.cpp [iso-8859-1] 
Sat Sep  3 14:20:03 2011
@@ -1153,7 +1153,7 @@
 {
     TRACE("(%p) %d\n",this, iShowCmd);
 
-    iShowCmd = iShowCmd;
+    this->iShowCmd = iShowCmd;
     bDirty = TRUE;
 
     return NOERROR;
@@ -1191,39 +1191,40 @@
     if (sIcoPath)
     {
         WideCharToMultiByte(CP_ACP, 0, sIcoPath, -1, pszIconPath, cchIconPath, 
NULL, NULL);
-       return S_OK;
+           return S_OK;
     }
 
     if (pPidl || sPath)
     {
-       CComPtr<IShellFolder>           pdsk;
-
-       HRESULT hr = SHGetDesktopFolder(&pdsk);
-
-       if (SUCCEEDED(hr))
+           CComPtr<IShellFolder>               pdsk;
+
+           HRESULT hr = SHGetDesktopFolder(&pdsk);
+
+           if (SUCCEEDED(hr))
         {
-           /* first look for an icon using the PIDL (if present) */
-           if (pPidl)
-               hr = SHELL_PidlGeticonLocationA(pdsk, pPidl, pszIconPath, 
cchIconPath, piIcon);
-           else
-               hr = E_FAIL;
-
-           /* if we couldn't find an icon yet, look for it using the file 
system path */
-           if (FAILED(hr) && sPath)
+               /* first look for an icon using the PIDL (if present) */
+               if (pPidl)
+                       hr = SHELL_PidlGeticonLocationA(pdsk, pPidl, 
pszIconPath, cchIconPath, piIcon);
+               else
+                       hr = E_FAIL;
+
+               /* if we couldn't find an icon yet, look for it using the file 
system path */
+               if (FAILED(hr) && sPath)
             {
-               LPITEMIDLIST pidl;
-
-               hr = pdsk->ParseDisplayName(0, NULL, sPath, NULL, &pidl, NULL);
-
-               if (SUCCEEDED(hr)) {
-                   hr = SHELL_PidlGeticonLocationA(pdsk, pidl, pszIconPath, 
cchIconPath, piIcon);
-
-                   SHFree(pidl);
-               }
+                       LPITEMIDLIST pidl;
+
+                       hr = pdsk->ParseDisplayName(0, NULL, sPath, NULL, 
&pidl, NULL);
+
+                       if (SUCCEEDED(hr))
+                {
+                           hr = SHELL_PidlGeticonLocationA(pdsk, pidl, 
pszIconPath, cchIconPath, piIcon);
+
+                           SHFree(pidl);
+                       }
+               }
            }
-       }
-
-       return hr;
+
+           return hr;
     }
     return S_OK;
 }
@@ -1235,7 +1236,8 @@
     HeapFree(GetProcessHeap(), 0, sIcoPath);
     sIcoPath = NULL;
 
-    if ( pszIconPath ) {
+    if ( pszIconPath )
+    {
         sIcoPath = HEAP_strdupAtoW(GetProcessHeap(), 0, pszIconPath);
         if ( !sIcoPath )
             return E_OUTOFMEMORY;
@@ -1254,7 +1256,8 @@
     HeapFree(GetProcessHeap(), 0, sPathRel);
     sPathRel = NULL;
 
-    if ( pszPathRel ) {
+    if ( pszPathRel )
+    {
         sPathRel = HEAP_strdupAtoW(GetProcessHeap(), 0, pszPathRel);
         bDirty = TRUE;
     }
@@ -1271,32 +1274,38 @@
 
     /*FIXME: use IResolveShellLink interface */
 
-    if (!sPath && pPidl) {
-       WCHAR buffer[MAX_PATH];
-
-       bSuccess = SHGetPathFromIDListW(pPidl, buffer);
-
-       if (bSuccess && *buffer) {
-           sPath = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, 
(wcslen(buffer)+1)*sizeof(WCHAR));
-           if (!sPath)
-               return E_OUTOFMEMORY;
-
-           wcscpy(sPath, buffer);
+    if (!sPath && pPidl)
+    {
+           WCHAR buffer[MAX_PATH];
+
+           bSuccess = SHGetPathFromIDListW(pPidl, buffer);
+
+           if (bSuccess && *buffer)
+        {
+               sPath = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, 
(wcslen(buffer)+1)*sizeof(WCHAR));
+               
+            if (!sPath)
+                       return E_OUTOFMEMORY;
+
+               wcscpy(sPath, buffer);
+
+               bDirty = TRUE;
+           }
+        else
+               hr = S_OK;    /* don't report an error occurred while just 
caching information */
+    }
+
+    if (!sIcoPath && sPath)
+    {
+           sIcoPath = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, 
(wcslen(sPath)+1)*sizeof(WCHAR));
+           
+        if (!sIcoPath)
+               return E_OUTOFMEMORY;
+
+           wcscpy(sIcoPath, sPath);
+           iIcoNdx = 0;
 
            bDirty = TRUE;
-       } else
-           hr = S_OK;    /* don't report an error occurred while just caching 
information */
-    }
-
-    if (!sIcoPath && sPath) {
-       sIcoPath = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, 
(wcslen(sPath)+1)*sizeof(WCHAR));
-       if (!sIcoPath)
-           return E_OUTOFMEMORY;
-
-       wcscpy(sIcoPath, sPath);
-       iIcoNdx = 0;
-
-       bDirty = TRUE;
     }
 
     return hr;
@@ -1312,7 +1321,7 @@
                return E_INVALIDARG;
 
     str = HEAP_strdupAtoW(GetProcessHeap(), 0, pszFile);
-    if( !str )
+    if (!str)
         return E_OUTOFMEMORY;
 
     r = SetPath(str);
@@ -1331,6 +1340,7 @@
 
     if (cchMaxPath)
         pszFile[0] = 0;
+    
     if (sPath)
         lstrcpynW( pszFile, sPath, cchMaxPath );
 
@@ -1344,7 +1354,7 @@
     TRACE("(%p)->(%p len=%u)\n",this, pszName, cchMaxName);
 
     pszName[0] = 0;
-    if( sDescription )
+    if (sDescription)
         lstrcpynW( pszName, sDescription, cchMaxName );
 
     return S_OK;

Modified: branches/shell32_new-bringup/dll/win32/shell32/shlfileop.cpp
URL: 
http://svn.reactos.org/svn/reactos/branches/shell32_new-bringup/dll/win32/shell32/shlfileop.cpp?rev=53543&r1=53542&r2=53543&view=diff
==============================================================================
--- branches/shell32_new-bringup/dll/win32/shell32/shlfileop.cpp [iso-8859-1] 
(original)
+++ branches/shell32_new-bringup/dll/win32/shell32/shlfileop.cpp [iso-8859-1] 
Sat Sep  3 14:20:03 2011
@@ -23,7 +23,6 @@
 
 //#define NO_SHLWAPI_STREAM
 #include <precomp.h>
-
 
 WINE_DEFAULT_DEBUG_CHANNEL(shell);
 
@@ -1503,7 +1502,20 @@
             bPathExists = SHELL_DeleteDirectoryW(lpFileOp->hwnd, 
fileEntry->szFullPath, FALSE);
 
         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;


Reply via email to