Changeset 1686


Ignore:
Timestamp:
Mar 10, 2013, 7:34:34 PM (12 years ago)
Author:
Gregg Young
Message:

GKY Improvrd readonly check on delete to allow cancel and don't ask again options; Added saymsg2 for this purpose; Fixes to snapshot file. cs 1685 contained the COMP.C changes

Location:
trunk/dll
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/comp.c

    r1685 r1686  
    8888  06 Mar 13 SHL ActionCnrThread: need to strdup pszFmtFileSize to avoid aliased pointers
    8989  09 Mar 13 SHL SetButtonEnables: correct enable support for newish buttons
     90  10 Mar 13 GKY Improvrd readonly check on delete to allow cancel and don't ask again options
     91                Added saymsg2 for this purpose
     92  10 Mar 13 GKY Fixes to snapshot file.
    9093
    9194***********************************************************************/
  • trunk/dll/copyf.c

    r1664 r1686  
    3333  04 Aug 12 GKY Changes to allow copy and move over readonly files with a warning dialog; also added a warning dialog for delete of
    3434                readonly files
     35  10 Mar 13 GKY Improvrd readonly check on delete to allow cancel and don't ask again options
    3536
    3637***********************************************************************/
     
    531532          DosError(FERR_DISABLEHARDERR);
    532533          if (DosDeleteDir(dir)) {
    533             make_deleteable(dir, 0);
     534            make_deleteable(dir, -1, TRUE);
    534535            DosDeleteDir(dir);
    535536          }
     
    541542          error = DosForceDelete(dir);
    542543          if (error) {
    543             make_deleteable(dir, error);
     544            make_deleteable(dir, error, FALSE);
    544545            DosForceDelete(dir);
    545546          }
     
    618619            DosError(FERR_DISABLEHARDERR);
    619620            if (DosDeleteDir(oldname)) {
    620               make_deleteable(oldname, 0);
     621              make_deleteable(oldname, -1, TRUE);
    621622              DosDeleteDir(oldname);
    622623            }
     
    675676}
    676677
    677 INT make_deleteable(CHAR * filename, INT error)
     678INT make_deleteable(CHAR * filename, INT error, BOOL Dontcheckreadonly)
    678679{
    679680  APIRET rc;
     
    682683  FILESTATUS3 fsi;
    683684
     685  //DbgMsg(pszSrcFile, __LINE__, "error %i ", error);
     686  DosError(FERR_DISABLEHARDERR);
     687  rc = DosQueryPathInfo(filename, FIL_STANDARD, &fsi, sizeof(fsi));
     688  if (!rc) {
     689    if (fsi.attrFile & 0x00000001) {
     690      if (fWarnReadOnly && !Dontcheckreadonly) {
     691        retrn = saymsg2(NULL, 0,
     692                       HWND_DESKTOP,
     693                       GetPString(IDS_READONLYFILEWARNINGTITLE),
     694                       GetPString(IDS_READONLYFILEWARNING),
     695                       filename);
     696        if (retrn == 3)
     697          ret = 3;
     698        else if (retrn == 4)
     699          ret = 2;
     700        else {
     701          fsi.attrFile = 0;
     702          DosError(FERR_DISABLEHARDERR);
     703          if (!xDosSetPathInfo(filename, FIL_STANDARD, &fsi, sizeof(fsi), 0))
     704            if (retrn == 1)
     705              ret = 0;
     706            else
     707              ret = 1;
     708        }
     709      }
     710      else
     711        fsi.attrFile = 0;
     712        DosError(FERR_DISABLEHARDERR);
     713        if (!xDosSetPathInfo(filename, FIL_STANDARD, &fsi, sizeof(fsi), 0))
     714          ret = 0;
     715    }
     716  }
    684717  if (error ==  ERROR_SHARING_VIOLATION && fUnlock) {
    685718    retrn = saymsg(MB_YESNO | MB_DEFBUTTON2,
     
    694727    }
    695728  }
    696   DosError(FERR_DISABLEHARDERR);
    697   rc = DosQueryPathInfo(filename, FIL_STANDARD, &fsi, sizeof(fsi));
    698   if (!rc) {
    699     if (fsi.attrFile & 0x00000001) {
    700       if (fWarnReadOnly && error != -1) {
    701         retrn = saymsg(MB_YESNO | MB_DEFBUTTON2,
    702                        HWND_DESKTOP,
    703                        GetPString(IDS_READONLYFILEWARNINGTITLE),
    704                        GetPString(IDS_READONLYFILEWARNING),
    705                        filename);
    706         if (retrn == MBID_YES) {
    707           fsi.attrFile = 0;
    708           DosError(FERR_DISABLEHARDERR);
    709           if (!xDosSetPathInfo(filename, FIL_STANDARD, &fsi, sizeof(fsi), 0))
    710             ret = 0;
    711         }
    712         else
    713           ret = 0;
    714       }
    715       else
    716         fsi.attrFile = 0;
    717         DosError(FERR_DISABLEHARDERR);
    718         if (!xDosSetPathInfo(filename, FIL_STANDARD, &fsi, sizeof(fsi), 0))
    719           ret = 0;
    720     }
    721   }
    722729
    723730  return ret;
     
    737744  va_list ap;
    738745  INT rc;
     746  static BOOL ignorereadonly = FALSE;
    739747
    740748  va_start(ap, string);
     
    815823          // remove directory
    816824          if (DosDeleteDir(ss)) {
    817             make_deleteable(ss, 0);     // Try harder
     825            make_deleteable(ss, -1, TRUE);      // Try harder
    818826            DosError(FERR_DISABLEHARDERR);
    819827            DosDeleteDir(ss);
     
    826834        DosError(FERR_DISABLEHARDERR);
    827835        error = DosForceDelete(ss);
    828         if (error) {
    829           make_deleteable(ss, error);
     836        if (error) {
     837          INT retrn = 0;
     838
     839          retrn = make_deleteable(ss, error, ignorereadonly);
     840          if (retrn == 3)
     841            continue;
     842          else if (retrn == 1)
     843            ignorereadonly = TRUE;
    830844          DosError(FERR_DISABLEHARDERR);
    831845          rc = (INT) DosForceDelete(ss);
     
    844858  free(ss);
    845859  free(str);
     860  ignorereadonly = FALSE;
    846861  return 0;
    847862}
     
    930945    DosError(FERR_DISABLEHARDERR);
    931946    if (DosDelete(string)) {
    932       make_deleteable(string, -1);
     947      make_deleteable(string, -1, TRUE);
    933948      DosError(FERR_DISABLEHARDERR);
    934949      return DosDelete(string);
     
    941956    error = DosForceDelete(string);
    942957    if (error) {
    943       make_deleteable(string, error);
     958      make_deleteable(string, error, FALSE);
    944959      DosError(FERR_DISABLEHARDERR);
    945960      return DosForceDelete(string);
  • trunk/dll/copyf.h

    r1664 r1686  
    1515  04 Aug 12 GKY Changes to allow copy and move over readonly files with a warning dialog; also added a warning dialog
    1616                for delete of readonly files
     17  10 Mar 13 GKY Improvrd readonly check on delete to allow cancel and don't ask again options
    1718
    1819***********************************************************************/
     
    2627BOOL WriteLongName(CHAR * filename, CHAR * longname);
    2728APIRET docopyf(INT type, CHAR * oldname, CHAR * newname);
    28 INT make_deleteable(CHAR * filename, INT error);
     29INT make_deleteable(CHAR * filename, INT error, BOOL Dontcheckreadonly);
    2930INT unlinkf(CHAR * string);
    3031INT wipeallf(CHAR * string, ...);
  • trunk/dll/errutil.c

    r1673 r1686  
    3636                works in HIMEM builds
    3737  01 Dec 10 SHL Dos_Error - remap API errors code that with odd oso001*.msg messages
     38  10 Mar 13 GKY Improvrd readonly check on delete to allow cancel and don't ask again options
     39                Added saymsg2 for this purpose
    3840
    3941***********************************************************************/
     
    4244#include <string.h>
    4345#include <stdarg.h>
     46#include <stdlib.h>
    4447
    4548#define INCL_DOS
     
    5457#include "notebook.h"                   // fErrorBeepOff
    5558#include "init.h"                       // Data declares
     59#include "wrappers.h"                   // xmallocz
    5660
    5761#pragma data_seg(DATA1)
     
    348352} // saymsg
    349353
     354APIRET saymsg2(PCSZ pszButtonNames, int DefaultButton, HWND hwnd, PCSZ pszTitle, PCSZ pszFmt, ...)
     355{
     356  ULONG   i;
     357  APIRET  rc;
     358  CHAR szMsg[4096];
     359  va_list va;
     360  MB2INFO *pmbInfo;     
     361  MB2D mb2dBut[4];   
     362  ULONG   ulInfoSize = (sizeof(MB2INFO) + (sizeof(MB2D) * 3));
     363
     364  va_start(va, pszFmt);
     365  szMsg[sizeof(szMsg) - 1] = 0;
     366  vsprintf(szMsg, pszFmt, va);
     367  va_end(va);
     368
     369  if (szMsg[sizeof(szMsg) - 1]) {
     370    fprintf(stderr, "Buffer overflow in saymsg2 - need %u bytes\n", strlen(szMsg) + 1);
     371    fflush(stderr);
     372  }
     373
     374  memset(mb2dBut, 0, sizeof(MB2D) * 4);
     375  //fixme to use GetPString
     376  strcpy(mb2dBut[0].achText, /*pszButtonNames[0] ? &pszButtonNames[0] :*/ GetPString(IDS_MB2DYES));
     377  strcpy(mb2dBut[1].achText, /*pszButtonNames[1] ? &pszButtonNames[1] :*/ GetPString(IDS_MB2DYESDONTASK));
     378  strcpy(mb2dBut[2].achText, /*pszButtonNames[2] ? &pszButtonNames[2] :*/ GetPString(IDS_MB2DNO));
     379  strcpy(mb2dBut[3].achText,/* pszButtonNames[3] ? &pszButtonNames[3] :*/ GetPString(IDS_MB2DCANCELOP));
     380  mb2dBut[0].idButton = 1;
     381  mb2dBut[1].idButton = 2;
     382  mb2dBut[2].idButton = 3;
     383  mb2dBut[3].idButton = 4;
     384  if (DefaultButton)
     385    mb2dBut[DefaultButton - 1].flStyle = BS_DEFAULT;
     386  pmbInfo = xmallocz(ulInfoSize, pszSrcFile, __LINE__);
     387  if (pmbInfo) {
     388    pmbInfo->cb         = ulInfoSize;       
     389    pmbInfo->hIcon      = 0;
     390    pmbInfo->cButtons   = 4;
     391    pmbInfo->flStyle    = MB_MOVEABLE;
     392    pmbInfo->hwndNotify = NULLHANDLE;
     393    for (i = 0; i < 4; i++) {
     394      memcpy( pmbInfo->mb2d+i , mb2dBut+i , sizeof(MB2D));
     395    }
     396    rc = WinMessageBox2(HWND_DESKTOP, hwnd,
     397                        szMsg, pszTitle, 1234,
     398                        pmbInfo);
     399    free(pmbInfo);
     400    return rc;
     401  }
     402  return MBID_ERROR;
     403}
     404
    350405//=== showMsg: display error popup ===
    351406
  • trunk/dll/errutil.h

    r1558 r1686  
    1212  07 Feb 09 GKY Eliminate Win_Error2 by moving function names to PCSZs used in Win_Error
    1313  08 Mar 09 GKY Remove Dos_Error2 (unused) and Runtime_Error2 (no advantage over using Runtime_Error)
     14  10 Mar 13 GKY Improvrd readonly check on delete to allow cancel and don't ask again options
     15                Added saymsg2 for this purpose
    1416
    1517***********************************************************************/
     
    2931VOID Runtime_Error2(PCSZ pszSrcFile, UINT uSrcLineNo, UINT idMsg);
    3032APIRET saymsg(ULONG mb_type, HWND hwnd, PCSZ pszTitle, PCSZ pszFmt, ...);
     33APIRET saymsg2(PCSZ pszButtonNames, int DefaultButton, HWND hwnd, PCSZ pszTitle, PCSZ pszFmt, ...);
    3134VOID Win_Error(HWND hwndErr, HWND hwndOwner,
    3235               PCSZ pszSrcFile, UINT uSrcLineNo, PCSZ pszFmt, ...);
  • trunk/dll/fm3res.rc

    r1682 r1686  
    1010
    1111  08 Feb 03 SHL Enable SYS_FRAME
    12   17 Feb 07 GKY Add Make direcroy to white space directory container menu
     12  17 Feb 07 GKY Add Make directory to white space directory container menu
    1313  17 Feb 07 GKY Additional drive type icons
    1414  15 Jun 07 SHL Update for OpenWatcom
     
    4040  22 Jul 09 GKY Drivebar enhancements add refresh removable, rescan all drives, drive button
    4141                loads drive root directory in directory container or expands drive tree
    42                 and rescans drive in tree container depending on container focus, greyed out
     42                and rescans drive in tree container depending on container focus, grayed out
    4343                inappropriate menu context choices
    4444  12 Sep 09 GKY Add FM3.INI User ini and system ini to submenu for view ini
     
    6262                copy, move and delete operations
    6363  05 Sep 12 SHL Sync collector menu with docs
    64   30 Dec 12 GKY Enhance traget directory drop to give the option of changing the directory or carrying out an
     64  30 Dec 12 GKY Enhance target directory drop to give the option of changing the directory or carrying out an
    6565                operation to the current target; Added an error message for target = None;
    6666  06 Jan 13 GKY Added EA compare option to compare dir Ticket 80
     67  10 Mar 13 GKY Improvrd readonly check on delete to allow cancel and don't ask again options
     68                Added saymsg2 for this purpose
    6769 
    6870***********************************************************************/
     
    33773379    IDS_READONLYFILEWARNING               "The file %s is Read Only! Do you wish continue the requested operation"
    33783380    IDS_READONLYFILEWARNINGTITLE          "Read Only file!"
     3381    IDS_NOTARGETSET                       "A target directory has not been set"
     3382    IDS_LEFTRIGHTOUTOFSYNC                "pcil and pcir out of sync"
     3383    IDS_CONFIRMDELETE                     "Confirm Delete"
     3384    IDS_DOYOUWISHTODELETE                 "Do you wish to delete %s"
     3385    IDS_DROPSETSTARGET                    "Do you wish to use this directory as the new target directory? \nYes sets target\nNo proceeds with drag/drop operation to current target"
     3386    IDS_MB2DYES                           "Yes"               
     3387    IDS_MB2DYESDONTASK                    "Yes don't ask again"
     3388    IDS_MB2DNO                            "No"               
     3389    IDS_MB2DCANCELOP                      "Cancel operation" 
     3390    IDS_SNAPSHOTFILEBADFORMAT             "The snapshot file lists no files or is not formatted correctly"
     3391    IDS_SNAPSHOTFILELOADFAILED            "The snapshot file %s failed to load"
     3392   
    33793393   
    33803394    // Add strings that need to be combined by GetPString here
     
    34073421    IDS_FM2CMDHELPTEXT2                   "\r\rType ""/SAVE"" or ""/NOSAVE"" to save (or not) cmd lines between sessions.\r\r[Up arrow] or [down arrow] or [+] button for listbox of previous command lines, then [Delete] to remove one or [Enter] to reuse.\r\rOr type a command to be executed"
    34083422    IDS_FM2CMDHELPTEXT3                   " (metastrings like %%a available.)\r\rDouble-click entry field to simulate hitting [Enter].\r\rF5 is the accelerator for this mini-command line."
    3409     IDS_DROPSETSTARGET                    "Do you wish to use this directory as the new target directory? \nYes sets target\nNo proceeds with drag/drop operation to current target"
    3410     IDS_NOTARGETSET                       "A target directory has not been set"
    3411     IDS_LEFTRIGHTOUTOFSYNC                "pcil and pcir out of sync"
    34123423  END
    34133424
  • trunk/dll/fm3str.h

    r1682 r1686  
    4848  30 Dec 12 GKY Enhance traget directory drop to give the option of changing the directory or carrying out an
    4949                operation to the current target; Added an error message for target = None;
     50  10 Mar 13 GKY Improvrd readonly check on delete to allow cancel and don't ask again options
     51                Added saymsg2 for this purpose
     52  10 Mar 13 GKY Fixes to snapshot file.
    5053
    5154***********************************************************************/
     
    258261#define IDS_COMPCOPYFAILEDTEXT                                202
    259262#define IDS_EASDIFFERTEXT                                     203
     263#define IDS_SNAPSHOTFILEBADFORMAT                             204
    260264#define IDS_LARGERTEXT                                        205
    261265#define IDS_SMALLERTEXT                                       206
     
    882886#define IDS_PLEASEWAITCOUNTINGTEXT                            859
    883887#define IDS_SPARE_860                                         860
     888#define IDS_CONFIRMDELETE                                     861
     889#define IDS_DOYOUWISHTODELETE                                 862
     890#define IDS_MB2DYES                                           863
     891#define IDS_MB2DYESDONTASK                                    864
     892#define IDS_MB2DNO                                            865
     893#define IDS_MB2DCANCELOP                                      866
    884894
    885895#define IDS_ARCCNRFILTERMENUHELP                              867
     
    10111021#define IDS_CANTFINDDRIVETEXT                                 995
    10121022#define IDS_CANTDRAGROOTDIR                                   996
    1013 //#define IDS_DOSQAPPTYPEFAILEDTEXT   moved to 1017           997
     1023#define IDS_SNAPSHOTFILELOADFAILED                            997
    10141024#define IDS_APPTYPEUNEXPECTEDTEXT                             998
    10151025#define IDS_PATHTODESKTOP                                     999
  • trunk/dll/seeall.c

    r1682 r1686  
    5555  04 Aug 12 GKY Changes to allow copy and move over readonly files with a warning dialog; also added a warning dialog
    5656                for delete of readonly files
     57  10 Mar 13 GKY Improvrd readonly check on delete to allow cancel and don't ask again options
     58                Added saymsg2 for this purpose
    5759
    5860***********************************************************************/
     
    974976          CHAR prompt[CCHMAXPATH * 3];
    975977          APIRET error;
     978          BOOL ignorereadonly = FALSE;
    976979
    977980          for (x = 0; list[x]; x++) {
     
    10821085                DosDeleteDir(list[x]);
    10831086            }
    1084             else {
     1087            else {
     1088              INT retrn = 0;
     1089
    10851090              DosError(FERR_DISABLEHARDERR);
    10861091              if (SHORT1FROMMP(mp1) == IDM_DELETE)
     
    10901095              if (error) {
    10911096                DosError(FERR_DISABLEHARDERR);
    1092                 make_deleteable(list[x], error);
     1097                retrn = make_deleteable(list[x], error, ignorereadonly);
     1098                if (retrn == 2)
     1099                  break;
     1100                if (retrn == 1)
     1101                  ignorereadonly = TRUE;
     1102                if (retrn == 3)
     1103                  continue;
    10931104                if (SHORT1FROMMP(mp1) == IDM_DELETE)
    10941105                  error = DosDelete(list[x]);
  • trunk/dll/worker.c

    r1682 r1686  
    5353  04 Aug 12 GKY Changes to allow copy and move over readonly files with a warning dialog; also added a warning dialog
    5454                for delete of readonly files
     55  10 Mar 13 GKY Improvrd readonly check on delete to allow cancel and don't ask again options
     56                Added saymsg2 for this purpose
    5557
    5658***********************************************************************/
     
    874876                    rc = docopyf(type, wk->li->list[x], newname);
    875877                    if (rc == ERROR_ACCESS_DENIED || rc == ERROR_SHARING_VIOLATION) {
    876                       if (rc == ERROR_ACCESS_DENIED && noreadonlywarn)
    877                         rc = -1;
    878                       ret = make_deleteable(newname, rc);
     878                      ret = make_deleteable(newname, rc, noreadonlywarn);
    879879                      rc = docopyf(type, wk->li->list[x], newname);
    880880                    }
    881                     if (!ret && (rc == ERROR_ACCESS_DENIED || (rc == ERROR_SHARING_VIOLATION && fUnlock)))
     881                    if (rc == ERROR_ACCESS_DENIED || (rc == ERROR_SHARING_VIOLATION && fUnlock))
    882882                      rc = NO_ERROR;
    883883                    if (fResetVerify) {
     
    15881588              HOBJECT hObjectdest, hObjectofObject;
    15891589              BYTE G_abSupportedDrives[24] = {0};
    1590               ULONG cbSupportedDrives = sizeof(G_abSupportedDrives);
     1590              ULONG cbSupportedDrives = sizeof(G_abSupportedDrives);
     1591              BOOL ignorereadonly = FALSE;
    15911592
    15921593              for (x = 0; wk->li->list[x]; x++) {
     
    17321733                    error = DosForceDelete(wk->li->list[x]); ;
    17331734                  }
    1734                   if (error) {
     1735                  if (error) {
     1736                    INT retrn = 0;
     1737
    17351738                    DosError(FERR_DISABLEHARDERR);
    1736                     make_deleteable(wk->li->list[x], error);
     1739                    retrn = make_deleteable(wk->li->list[x], error, ignorereadonly);
     1740                    if (retrn == 2)
     1741                      break;
     1742                    if (retrn == 1)
     1743                      ignorereadonly = TRUE;
     1744                    if (retrn == 3)
     1745                      continue;
    17371746                    if (wk->li->type == IDM_DELETE){
    17381747                      hObjectdest = WinQueryObject("<XWP_TRASHCAN>");
     
    17911800                            UM_UPDATERECORD,
    17921801                            MPFROMP(wk->li->list[x]), MPVOID);
    1793                 }
     1802                } ;
    17941803              } // for
    17951804            }
Note: See TracChangeset for help on using the changeset viewer.