Changeset 1846 for trunk/dll


Ignore:
Timestamp:
Aug 12, 2015, 10:31:54 PM (10 years ago)
Author:
John Small
Message:

Ticket #524: Ensure no "highmem-unsafe" functions are called directly
Calls to unsafe Dos... functions have been changed to call the wrapped xDos... functions.

Location:
trunk/dll
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/arccnrs.c

    r1826 r1846  
    106106  06 Apr 14 GKY Removed all BZ/GZ checks
    107107  28 Jun 14 GKY Fix errors identified with CPPCheck; Fix retry to create workdir code
     108  12 Aug 15 JBS Ticket #524: Ensure no "highmem-unsafe" functions are called directly
     109                Calls to unsafe Dos... functions have been changed to call the wrapped xDos... functions
    108110
    109111***********************************************************************/
     
    591593  CHAR lonename[CCHMAXPATH + 2],
    592594       *nsize, *osize, *fdate, *fname, *p, *pp, *arctemp;
    593   // Change the DosQueryAppType call below to xDosQueryAppType if "s" is no longer in low memory
    594595  CHAR s[CCHMAXPATH * 2];
    595   CHAR TestStr[CCHMAXPATH * 2]; 
     596  CHAR TestStr[CCHMAXPATH * 2];
    596597  BOOL gotstart;
    597598  BOOL gotend;
     
    606607  APIRET rc;
    607608  CHAR *mode;
    608   ULONG cnter = 0; 
     609  ULONG cnter = 0;
    609610
    610611  if (!arcname || !arcinfo)
     
    659660      *p = 0;
    660661    DosError(FERR_DISABLEHARDERR);
    661     if (!DosQueryAppType(s, &apptype) &&
     662    if (!xDosQueryAppType(s, &apptype) &&
    662663        (apptype & FAPPTYP_DOS ||
    663664         apptype & FAPPTYP_WINDOWSREAL ||
     
    701702          }
    702703          else {
    703             rc = 0; 
     704            rc = 0;
    704705            //DbgMsg(pszSrcFile, __LINE__, "Number of tries %i", cnter);
    705706            rc = SearchPathForFile(PCSZ_PATH, s, NULL);
     
    711712                      info->list,
    712713                      BldQuotedFileName(s, arcname));
    713               if (cnter == 1) { 
     714              if (cnter == 1) {
    714715                if (info->test)
    715716                  strcpy(TestStr, info->test);
     
    944945          if (tinfo) {
    945946            DosError(FERR_DISABLEHARDERR);
    946             DosForceDelete(arctemp);
     947            xDosForceDelete(arctemp);
    947948            info = tinfo;
    948949            goto ReTry;
     
    952953          DosBeep(750, 50);             // wake up user
    953954
    954         if (cnter > 0) { 
     955        if (cnter > 0) {
    955956          CHAR Temp[CCHMAXPATH + 2];
    956957
     
    965966          strcpy(ad.listname, arctemp);
    966967          strcpy(ad.arcname, arcname);
    967           if (!notest) { 
     968          if (!notest) {
    968969            strcpy(Temp, info->test);
    969970            info->test = xstrdup(TestStr, pszSrcFile, __LINE__);
     
    980981            info->test = xstrdup(Temp, pszSrcFile, __LINE__);
    981982        }
    982         else 
     983        else
    983984          saymsg(MB_OK, HWND_DESKTOP, GetPString(IDS_ARCMISSINGEXE),
    984985                 GetPString(IDS_ARCMISSINGEXEVERBOSE));
     
    9991000
    10001001    DosError(FERR_DISABLEHARDERR);
    1001     DosForceDelete(arctemp);
     1002    xDosForceDelete(arctemp);
    10021003    xfree(arctemp, pszSrcFile, __LINE__);
    10031004  }
     
    10081009  return numarcfiles;
    10091010} // FillArcCnr
     1011
    10101012MRESULT EXPENTRY ArcTextProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
    10111013{
  • trunk/dll/cmdline.c

    r1750 r1846  
    3030  23 Oct 10 GKY Changes to populate and utilize a HELPTABLE for context specific help
    3131  28 Apr 14 JBS Ticket #522: Ensure use of wrapper functions where needed
     32  12 Aug 15 JBS Ticket #524: Ensure no "highmem-unsafe" functions are called directly
     33                Calls to unsafe Dos... functions have been changed to call the wrapped xDos... functions
    3234
    3335***********************************************************************/
     
    405407    {
    406408      ULONG apptype = 0L;
    407       // Change DosQueryAppType to xDosQueryAppType if "executable"is no longer local
    408409      CHAR executable[CCHMAXPATH], commandline[1001], *p;
    409410
     
    449450        }
    450451      }
    451       if (DosQueryAppType(executable, &apptype) ||
     452      if (xDosQueryAppType(executable, &apptype) ||
    452453          (apptype && !(apptype &
    453454                        (FAPPTYP_NOTWINDOWCOMPAT |
  • trunk/dll/init.c

    r1838 r1846  
    133133  02 Aug 15 GKY Serialize local hard drive scanning to reduce drive thrashing continue to scan
    134134                all other drive types in separate threads.
     135  12 Aug 15 JBS Ticket #524: Ensure no "highmem-unsafe" functions are called directly
     136                Calls to unsafe Dos... functions have been changed to call the wrapped xDos... functions
    135137
    136138***********************************************************************/
     
    653655  }
    654656  BldFullPathName(szTempFile, pTmpDir, PCSZ_FM2PLAYTEMP);
    655   DosForceDelete(szTempFile);
     657  xDosForceDelete(szTempFile);
    656658  if (pTmpDir) {
    657659    wipeallf(TRUE, "%s\\*", pTmpDir);
  • trunk/dll/killproc.c

    r1738 r1846  
    3535  22 Aug 14 JBS Ticket #519: Corrected mis-coded but probably harmless calls to strtol
    3636                and removed unneeded second parameter variables.
     37  12 Aug 15 JBS Ticket #524: Ensure no "highmem-unsafe" functions are called directly
     38                Calls to unsafe Dos... functions have been changed to call the wrapped xDos... functions
    3739
    3840***********************************************************************/
     
    278280  else {
    279281    newstdout = -1;
    280     rc = DosDupHandle(fileno(stdout), &newstdout);
     282    rc = xDosDupHandle(fileno(stdout), &newstdout);
    281283    if (rc)
    282284      Dos_Error(MB_CANCEL, rc, hwnd, __FILE__, __LINE__, PCSZ_DOSDUPHANDLE);
    283285    oldstdout = fileno(stdout);
    284     DosDupHandle(fileno(fp), &oldstdout);
     286    xDosDupHandle(fileno(fp), &oldstdout);
    285287    rc = runemf2(SEPARATE | INVISIBLE | FULLSCREEN | BACKGROUND | WAIT,
    286288                 hwnd, pszSrcFile, __LINE__, NULL, NULL,
    287289                 "%s", "PSTAT.EXE /C");
    288290    oldstdout = fileno(stdout);
    289     DosDupHandle(newstdout, &oldstdout);
     291    xDosDupHandle(newstdout, &oldstdout);
    290292    DosClose(newstdout);
    291293    fclose(fp);
     
    336338Abort:
    337339  BldFullPathName(s, pTmpDir, "$PSTAT#$.#$#");
    338   DosForceDelete(s);
     340  xDosForceDelete(s);
    339341  PostMsg(hwnd, UM_CONTAINER_FILLED, MPVOID, MPVOID);
    340342  WinDestroyMsgQueue(thmq);
  • trunk/dll/printer.c

    r1673 r1846  
    1616  07 Feb 09 GKY Allow user to turn off alert and/or error beeps in settings notebook.
    1717  17 JAN 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast CHAR CONSTANT * as CHAR *.
     18  12 Aug 15 JBS Ticket #524: Ensure no "highmem-unsafe" functions are called directly
     19                Calls to unsafe Dos... functions have been changed to call the wrapped xDos... functions
    1820
    1921***********************************************************************/
     
    9294      return TRUE;
    9395    }
    94     if (!DosQueryHType(fileno(printhandle), &htype, &flagword) &&
     96    if (!xDosQueryHType(fileno(printhandle), &htype, &flagword) &&
    9597        !(htype & 7)) {
    9698      fclose(printhandle);
  • trunk/dll/seeall.c

    r1803 r1846  
    6464  02 May 15 GKY Changes to allow a JAVA executable object to be created using "Real object"
    6565                menu item on a jar file.
     66  12 Aug 15 JBS Ticket #524: Ensure no "highmem-unsafe" functions are called directly
     67                Calls to unsafe Dos... functions have been changed to call the wrapped xDos... functions
    6668
    6769***********************************************************************/
     
    10981100                error = DosDelete(list[x]);
    10991101              else
    1100                 error = DosForceDelete(list[x]);
     1102                error = xDosForceDelete(list[x]);
    11011103              if (error) {
    11021104                DosError(FERR_DISABLEHARDERR);
     
    11111113                  error = DosDelete(list[x]);
    11121114                else
    1113                   error = DosForceDelete(list[x]);
     1115                  error = xDosForceDelete(list[x]);
    11141116              }
    11151117            }
  • trunk/dll/sysinfo.c

    r1673 r1846  
    1919  20 Nov 10 GKY Check that pTmpDir IsValid and recreate if not found; Fixes hangs caused
    2020                by temp file creation failures.
     21  12 Aug 15 JBS Ticket #524: Ensure no "highmem-unsafe" functions are called directly
     22                Calls to unsafe Dos... functions have been changed to call the wrapped xDos... functions
    2123
    2224***********************************************************************/
     
    7476    else {
    7577      newstdout = -1;
    76       if (DosDupHandle(fileno(stdout), &newstdout)) {
     78      if (xDosDupHandle(fileno(stdout), &newstdout)) {
    7779        fclose(fp);
    7880        goto Abort;
    7981      }
    8082      oldstdout = fileno(stdout);
    81       DosDupHandle(fileno(fp), &oldstdout);
     83      xDosDupHandle(fileno(fp), &oldstdout);
    8284      runemf2(SEPARATE | INVISIBLE | FULLSCREEN | BACKGROUND | WAIT,
    8385              hwnd, pszSrcFile, __LINE__,
    8486              NULL, NULL, "%s", szTempFile);
    8587      oldstdout = fileno(stdout);
    86       DosDupHandle(newstdout, &oldstdout);
     88      xDosDupHandle(newstdout, &oldstdout);
    8789      DosClose(newstdout);
    8890      fclose(fp);
     
    120122  }
    121123  if (szTempFile)
    122     DosForceDelete(szTempFile);
     124    xDosForceDelete(szTempFile);
    123125}
    124126
  • trunk/dll/systemf.c

    r1843 r1846  
    4545                and file.
    4646  28 Apr 14 JBS Ticket #522: Ensure use of wrapper functions where needed
     47  12 Aug 15 JBS Ticket #524: Ensure no "highmem-unsafe" functions are called directly
     48                Calls to unsafe Dos... functions have been changed to call the wrapped xDos... functions
    4749
    4850***********************************************************************/
     
    12171219        switch_to(pszDirectory);
    12181220      }
    1219       ret = DosStartSession(&sdata, &ulSessID, &sessPID);
     1221      ret = xDosStartSession(&sdata, &ulSessID, &sessPID);
    12201222
    12211223
  • trunk/dll/undel.c

    r1554 r1846  
    107107    else {
    108108      newstdout = -1;
    109       if (DosDupHandle(fileno(stdout), &newstdout)) {
     109      if (xDosDupHandle(fileno(stdout), &newstdout)) {
    110110        saymsg(MB_CANCEL,
    111111               hwnd,
     
    116116      }
    117117      oldstdout = fileno(stdout);
    118       DosDupHandle(fileno(fp), &oldstdout);
     118      xDosDupHandle(fileno(fp), &oldstdout);
    119119      runemf2(SEPARATE | INVISIBLE | WINDOWED | BACKGROUND | WAIT,
    120120              hwnd, pszSrcFile, __LINE__,
     
    124124              path, (undelinfo->inclsubdirs) ? " /S" : NullStr);
    125125      oldstdout = fileno(stdout);
    126       DosDupHandle(newstdout, &oldstdout);
     126      xDosDupHandle(newstdout, &oldstdout);
    127127      DosClose(newstdout);
    128128      fclose(fp);
     
    176176    ;
    177177  }
    178   DosForceDelete(szTempFile);
     178  xDosForceDelete(szTempFile);
    179179  xfree(undelinfo, pszSrcFile, __LINE__);
    180180  if (thmq) {
     
    428428
    429429          FILE *fp;
    430           CHAR s[CCHMAXPATH + 1];
    431           CHAR *modew = "w";
    432 
    433           DosForceDelete("\\FMUNDEL.CMD");
     430          CHAR s[CCHMAXPATH + 1];
     431          CHAR *modew = "w";
     432
     433          xDosForceDelete("\\FMUNDEL.CMD");
    434434          fp = xfopen("\\FMUNDEL.CMD", modew, pszSrcFile, __LINE__, FALSE);
    435435          if (fp) {
  • trunk/dll/worker.c

    r1834 r1846  
    6868  24 Jun 15 GKY Corrected failure to show error message when locked non-exe/dll file fails
    6969                delete
     70  12 Aug 15 JBS Ticket #524: Ensure no "highmem-unsafe" functions are called directly
     71                Calls to unsafe Dos... functions have been changed to call the wrapped xDos... functions
    7072
    7173***********************************************************************/
     
    18041806                    }
    18051807                    else
    1806                       error = DosForceDelete(wk->li->list[x]);
     1808                      error = xDosForceDelete(wk->li->list[x]);
    18071809                  }
    18081810                  DosReleaseMutexSem(hmtxFM2Delete);
Note: See TracChangeset for help on using the changeset viewer.