Changeset 1721


Ignore:
Timestamp:
Feb 16, 2014, 9:16:25 PM (11 years ago)
Author:
Gregg Young
Message:

Fixed move to trashcan to work when the trashcan::drives key hadn't been written to OS2.INI. INI check is now only if fTrashCan is TRUE. Rework readonly check on delete code so it actually works in a logical way and so it works with move to trashcan inabled. Additional improvements to saymsg2. Tickets 506/507

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/worker.c

    r1712 r1721  
    5757  09 Feb 14 GKY Modified wipeallf to allow suppression of the readonly warning on delete
    5858                of temporary files
     59  16 Feb 14 GKY Fixed move to trashcan to work when the trashcan::drives key hadn't been
     60                written to OS2.INI. INI check is now only if fTrashCan is TRUE.
     61  16 Feb 14 GKY Rework readonly check on delete code so it actually works in a logical way
     62                and so it works with move to trashcan inabled.
    5963
    6064***********************************************************************/
     
    230234          CHAR message[(CCHMAXPATH * 2) + 80], wildname[CCHMAXPATH];
    231235          UINT x;
    232           BOOL dontask = FALSE, wildcarding = FALSE, overold =
    233             FALSE, overnew = FALSE, noreadonlywarn = FALSE, usedtarget;
     236          BOOL dontask = FALSE, wildcarding = FALSE, overold = FALSE;
     237          BOOL overnew = FALSE, usedtarget;
     238          BOOL noreadonlywarn = FALSE;
    234239
    235240          WinCancelShutdown(hmq2, TRUE);
     
    879884                    if (rc == ERROR_ACCESS_DENIED || rc == ERROR_SHARING_VIOLATION) {
    880885                      ret = make_deleteable(newname, rc, noreadonlywarn);
     886                      if (ret == SM2_CANCEL)
     887                        break;
     888                      if (ret == SM2_DONTASK)
     889                        noreadonlywarn = TRUE;
     890                      if (ret == SM2_NO)
     891                        continue;
    881892                      rc = docopyf(type, wk->li->list[x], newname);
    882893                    }
     
    15871598              FILESTATUS3 fsa;
    15881599              CHAR prompt[CCHMAXPATH * 3];
    1589               APIRET error = 0;
     1600              APIRET error = 0, rc;
    15901601              HOBJECT hObjectdest, hObjectofObject;
    15911602              BYTE G_abSupportedDrives[24] = {0};
    15921603              ULONG cbSupportedDrives = sizeof(G_abSupportedDrives);
    15931604              BOOL ignorereadonly = FALSE;
     1605              INT retrn = 0;
    15941606
    15951607              for (x = 0; wk->li->list[x]; x++) {
     
    17131725                  DosError(FERR_DISABLEHARDERR);
    17141726                  if (wk->li->type == IDM_DELETE) {
    1715                     hObjectdest = WinQueryObject("<XWP_TRASHCAN>");
    1716                     PrfQueryProfileData(HINI_USER,
    1717                                         "XWorkplace",
    1718                                         "TrashCan::Drives",
    1719                                         G_abSupportedDrives,
    1720                                         &cbSupportedDrives);
    1721                     if (hObjectdest != NULLHANDLE && fTrashCan &&
    1722                         (G_abSupportedDrives ? (G_abSupportedDrives[toupper(*wk->li->list[x]) - 'C'] &
    1723                                                 1):(!(driveflags[toupper(*wk->li->list[x]) - 'A'] &
    1724                                                       (DRIVE_REMOVABLE | DRIVE_IGNORE |
    1725                                                       DRIVE_REMOTE | DRIVE_VIRTUAL |
    1726                                                       DRIVE_NOTWRITEABLE | DRIVE_RAMDISK))))) {
    1727                         hObjectofObject = WinQueryObject(wk->li->list[x]);
    1728                         error = WinMoveObject(hObjectofObject, hObjectdest, 0);
    1729                     }
    1730                     else {
    1731                       error = DosDelete(wk->li->list[x]);
    1732                     }
    1733                   }
    1734                   else {
    1735                     error = DosForceDelete(wk->li->list[x]); ;
    1736                   }
     1727                    if (fTrashCan) {
     1728                        hObjectdest = WinQueryObject("<XWP_TRASHCAN>");
     1729                        rc = PrfQueryProfileData(HINI_USER,
     1730                                            "XWorkplace",
     1731                                            "TrashCan::Drives",
     1732                                            G_abSupportedDrives,
     1733                                            &cbSupportedDrives);
     1734                        if (hObjectdest != NULLHANDLE &&
     1735                            (rc ? (G_abSupportedDrives[toupper(*wk->li->list[x]) - 'C'] & 1)
     1736                             :((driveflags[toupper(*wk->li->list[x]) - 'A'] &
     1737                                DRIVE_LOCALHD )))) {
     1738                          hObjectofObject = WinQueryObject(wk->li->list[x]);
     1739                          retrn = make_deleteable(wk->li->list[x], error, ignorereadonly);
     1740                          if (retrn == SM2_CANCEL)
     1741                            break;
     1742                          if (retrn == SM2_DONTASK)
     1743                            ignorereadonly = TRUE;
     1744                          if (retrn == SM2_NO)
     1745                            continue;
     1746                          error = WinMoveObject(hObjectofObject, hObjectdest, 0);
     1747                        }
     1748                        else
     1749                          error = DosDelete(wk->li->list[x]);
     1750                      }
     1751                      else
     1752                        error = DosDelete(wk->li->list[x]);
     1753                  }
     1754                  else
     1755                    error = DosForceDelete(wk->li->list[x]);
    17371756                  if (error) {
    1738                     INT retrn = 0;
    17391757
    17401758                    DosError(FERR_DISABLEHARDERR);
    17411759                    retrn = make_deleteable(wk->li->list[x], error, ignorereadonly);
    1742                     if (retrn == 2)
     1760                    if (retrn == SM2_CANCEL)
    17431761                      break;
    1744                     if (retrn == 1)
     1762                    if (retrn == SM2_DONTASK)
    17451763                      ignorereadonly = TRUE;
    1746                     if (retrn == 3)
     1764                    if (retrn == SM2_NO)
    17471765                      continue;
    1748                     if (wk->li->type == IDM_DELETE){
    1749                       hObjectdest = WinQueryObject("<XWP_TRASHCAN>");
    1750                       PrfQueryProfileData(HINI_USER,
    1751                                           "XWorkplace",
    1752                                           "TrashCan::Drives",
    1753                                           G_abSupportedDrives,
    1754                                           &cbSupportedDrives);
    1755                       if (hObjectdest != NULLHANDLE && fTrashCan &&
    1756                           (G_abSupportedDrives ? (G_abSupportedDrives[toupper(*wk->li->list[x]) - 'C'] &
    1757                                                   1):(!(driveflags[toupper(*wk->li->list[x]) - 'A'] &
    1758                                                         (DRIVE_REMOVABLE | DRIVE_IGNORE |
    1759                                                         DRIVE_REMOTE | DRIVE_VIRTUAL |
    1760                                                         DRIVE_NOTWRITEABLE | DRIVE_RAMDISK))))) {
    1761                           hObjectofObject = WinQueryObject(wk->li->list[x]);
    1762                           error = WinMoveObject(hObjectofObject, hObjectdest, 0);
    1763                       }
    1764                       else {
    1765                         error = DosDelete(wk->li->list[x]);
    1766                       }
     1766                    if (wk->li->type == IDM_DELETE) {
     1767                      if (fTrashCan) {
     1768                        hObjectdest = WinQueryObject("<XWP_TRASHCAN>");
     1769                        rc = PrfQueryProfileData(HINI_USER,
     1770                                            "XWorkplace",
     1771                                            "TrashCan::Drives",
     1772                                            G_abSupportedDrives,
     1773                                            &cbSupportedDrives);
     1774                        if (hObjectdest != NULLHANDLE &&
     1775                            (rc ? (G_abSupportedDrives[toupper(*wk->li->list[x]) - 'C'] & 1)
     1776                             :((driveflags[toupper(*wk->li->list[x]) - 'A'] &
     1777                                DRIVE_LOCALHD )))) {
     1778                            hObjectofObject = WinQueryObject(wk->li->list[x]);
     1779                            error = WinMoveObject(hObjectofObject, hObjectdest, 0);
     1780                        }
     1781                        else
     1782                          error = DosDelete(wk->li->list[x]);
     1783                      }
     1784                      else
     1785                        error = DosDelete(wk->li->list[x]);
    17671786                    }
    1768                     else {
     1787                    else
    17691788                      error = DosForceDelete(wk->li->list[x]);
    1770                     }
    17711789                  }
    17721790                  DosReleaseMutexSem(hmtxFM2Delete);
    17731791                }
    1774                 if (error) {
     1792                if (error && (error != 5 ||
     1793                              (error == 5 &&
     1794                               (retrn == SM2_YES || retrn == SM2_DONTASK || retrn == 0)))) {
    17751795                  if (LogFileHandle)
    17761796                    fprintf(LogFileHandle,
Note: See TracChangeset for help on using the changeset viewer.