Changeset 1860


Ignore:
Timestamp:
Aug 22, 2015, 4:30:34 AM (10 years ago)
Author:
Steven Levine
Message:

Rework FlesWaitForWorkListEmpty to support wait for parents of path
Add more wrappers for mutex and event semaphores
Clean up some obsolete code

Location:
trunk/dll
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/flesh.c

    r1858 r1860  
    8282static INT tidFleshWorkListThread = -1; // 2015-08-08 SHL
    8383
    84 static CHAR chFleshFocusDrive;  // 2015-08-16 SHL A..Z or 0
    85 
     84static PCSZ pszFleshFocusPath;  // 2015-08-20 SHL
    8685
    8786BOOL fNoFleshDbgMsg;    // 2015-08-09 SHL FIXME to be gone
     
    693692#endif
    694693{
    695   APIRET rc;
    696 
    697694  PFLESHWORKITEM item = xmallocz(sizeof(FLESHWORKITEM), pszSrcFile, __LINE__);
    698695  item->hwndCnr = hwndCnr;
     
    751748#endif
    752749
    753   rc = DosRequestMutexSem(hmtxFleshWork, SEM_INDEFINITE_WAIT);
    754   if (rc)
    755     Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosRequestMutexSem");
     750  xDosRequestMutexSem(hmtxFleshWork, SEM_INDEFINITE_WAIT);
    756751
    757752  // Delete stale requests
     
    761756  List2Append(&FleshWorkList, (PLIST2)item);
    762757
    763   rc = DosReleaseMutexSem(hmtxFleshWork);
    764   if (rc)
    765     Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosReleaseMutexSem");
    766 
    767   rc = DosPostEventSem(hevFleshWorkListChanged);
    768   if (rc && rc != ERROR_ALREADY_POSTED)
    769     Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosPostEventSem");
     758  xDosReleaseMutexSem(hmtxFleshWork);
     759  xDosPostEventSem(hevFleshWorkListChanged);
    770760
    771761  return TRUE;
     
    785775 * Check if pci pathname is parent of child path name
    786776 * @param data is child path name
    787  * @return TRUE if is parent
     777 * @return TRUE if is work item path is parent of given path
    788778 */
    789779
     
    792782  UINT c;
    793783  if (!((PFLESHWORKITEM)item)->pci->pszFileName) {
    794     Runtime_Error(pszSrcFile, __LINE__, "MatchesFocusDrive called with pci %p pszFileName (null) by %s:%u", ((PFLESHWORKITEM)item)->pci);
     784    Runtime_Error(pszSrcFile, __LINE__, "IsParentOfChildPath called with pci %p pszFileName (null) by %s:%u", ((PFLESHWORKITEM)item)->pci);
    795785    return FALSE;
    796786  }
     
    806796
    807797#if 0 // 2015-08-03 SHL FIXME debug
    808 VOID WaitFleshWorkListEmpty(PCSZ pszFileName)
     798VOID WaitFleshWorkListEmpty(PCSZ pszDirName)
    809799#else
    810 VOID WaitFleshWorkListEmptyDbg(PCSZ pszFileName, PCSZ pszSrcFile_, UINT uSrcLineNo_)
     800VOID WaitFleshWorkListEmptyDbg(PCSZ pszDirName, PCSZ pszSrcFile_, UINT uSrcLineNo_)
    811801#endif
    812802{
     
    814804  PFLESHWORKITEM item;
    815805  INT tid = GetTidForThread();
    816   CHAR chSavedFleshFocusDrive = chFleshFocusDrive;
     806  BOOL pathSaved = FALSE;
     807  PCSZ pszSavedFleshFocusPath;
    817808
    818809  if (tid == 1 || tid == tidFleshWorkListThread) {
     
    849840      return;
    850841
    851     // Just wait for dependents if path name given
    852     if (pszFileName) {
    853       rc = DosRequestMutexSem(hmtxFleshWork, SEM_INDEFINITE_WAIT);
    854       if (rc) {
    855         Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosRequestMutexSem");
    856         continue;
     842    // Just wait for dependents to be gone if path name given
     843    if (pszDirName) {
     844      rc = xDosRequestMutexSem(hmtxFleshWork, SEM_INDEFINITE_WAIT);
     845      if (rc)
     846        continue;                       // Maybe should return ???
     847
     848      if (!pathSaved) {
     849        // Give priority to work items for parents of this path
     850        pathSaved = TRUE;
     851        pszSavedFleshFocusPath = pszFleshFocusPath;
     852        pszFleshFocusPath = pszDirName;
    857853      }
    858854
    859       chFleshFocusDrive = *pszFileName;         // Give priority to work on this drive
    860 
    861       item = (PFLESHWORKITEM)List2Search(&FleshWorkList, IsParentOfChildPath, (PVOID)pszFileName);
    862 
    863       rc = DosReleaseMutexSem(hmtxFleshWork);
    864       if (rc)
    865         Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosReleaseMutexSem");
     855      item = (PFLESHWORKITEM)List2Search(&FleshWorkList, IsParentOfChildPath, (PVOID)pszDirName);
     856
     857      xDosReleaseMutexSem(hmtxFleshWork);
    866858
    867859      if (!item)
    868860        break;                          // Dependents gone from work list
    869     }
     861    } // if pszDirName
     862
    870863    DosSleep(250);
    871864  } // while
    872865
    873   chFleshFocusDrive = chSavedFleshFocusDrive;   // In case overridden
     866  if (!pathSaved) {
     867    xDosRequestMutexSem(hmtxFleshWork, SEM_INDEFINITE_WAIT);
     868    pszFleshFocusPath = pszSavedFleshFocusPath;
     869    xDosReleaseMutexSem(hmtxFleshWork);
     870  }
    874871
    875872}
     
    880877 */
    881878
    882 VOID SetFleshFocusDrive(CHAR chDriveLetter) {
    883   chFleshFocusDrive = chDriveLetter;
    884   DbgMsg(pszSrcFile, __LINE__, "SetFleshFocusDrive focus drive set to %c", chFleshFocusDrive); // 2015-08-03 SHL FIXME debug
    885 
    886 }
    887 
    888 /**
    889  * Check pci pathname matches focus drive
    890  * @param data is uppercase drive letter mapped to PVOID
    891  * @return TRUE if drive letter matches
    892  */
    893 
    894 BOOL MatchesFocusDrive(PLIST2 item, PVOID data)
    895 {
    896   if (!((PFLESHWORKITEM)item)->pci->pszFileName) {
    897     Runtime_Error(pszSrcFile, __LINE__, "MatchesFocusDrive called with pci %p pszFileName (null) by %s:%u", ((PFLESHWORKITEM)item)->pci);
    898     return FALSE;
    899   }
    900   return ((PFLESHWORKITEM)item)->pci->pszFileName[0] == (CHAR)data;
     879VOID SetFleshFocusPath(PCSZ pszPath) {
     880  PCSZ pszOld;
     881  PCSZ pszNew = strdup(pszPath);
     882  xDosRequestMutexSem(hmtxFleshWork, SEM_INDEFINITE_WAIT);
     883  pszOld = pszFleshFocusPath;
     884  pszFleshFocusPath = pszNew;
     885  xDosReleaseMutexSem(hmtxFleshWork);
     886  if (pszOld)
     887    xfree((PVOID)pszOld, pszSrcFile, __LINE__);
     888  DbgMsg(pszSrcFile, __LINE__, "SetFleshFocusPath focus path set to %s", pszFleshFocusPath); // 2015-08-03 SHL FIXME debug
     889
    901890}
    902891
     
    909898  HAB thab;
    910899  HMQ hmq = (HMQ)0;
    911   APIRET rc;
    912900
    913901  // 2015-08-07 SHL FIXME to be gone
     
    933921
    934922        // 2015-08-07 SHL FIXME to use SMPSafe...
    935         rc = DosRequestMutexSem(hmtxFleshWork, SEM_INDEFINITE_WAIT);
    936         if (rc)
    937           Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosRequestMutexSem");
     923        xDosRequestMutexSem(hmtxFleshWork, SEM_INDEFINITE_WAIT);
    938924
    939925        // 2015-08-14 SHL
    940926        // Get next work list item and remove from list
    941         // If focus drive known, process items for focus drive first
    942         if (chFleshFocusDrive) {
    943           item = (PFLESHWORKITEM)List2Search(&FleshWorkList, MatchesFocusDrive, (PVOID)chFleshFocusDrive);
    944           if (!item)
    945             chFleshFocusDrive = 0;              // Revert to normal
     927        // If focus path set, process parents of focus path first
     928        if (pszFleshFocusPath) {
     929          item = (PFLESHWORKITEM)List2Search(&FleshWorkList, IsParentOfChildPath, (PVOID)pszFleshFocusPath);
     930          if (!item) {
     931            xfree((PSZ)pszFleshFocusPath, pszSrcFile, __LINE__);
     932            pszFleshFocusPath = NULL;           // Revert to normal
     933          }
    946934          else
    947935            List2Delete(&FleshWorkList, (PLIST2)item);
     
    953941          item = (PFLESHWORKITEM)List2DeleteFirst(&FleshWorkList);
    954942
    955         rc = DosReleaseMutexSem(hmtxFleshWork);
    956         if (rc)
    957           Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosReleaseMutexSem");
     943        xDosReleaseMutexSem(hmtxFleshWork);
    958944
    959945        // Wait for new items to be added to list
     
    962948          if (!fNoFleshDbgMsg)
    963949            DbgMsg(pszSrcFile, __LINE__, "FleshWorkThread work list empty - waiting"); // 2015-08-03 SHL FIXME debug
    964           rc = DosWaitEventSem(hevFleshWorkListChanged, SEM_INDEFINITE_WAIT);
    965           if (rc)
    966             Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosWaitEventSem");
    967           rc = DosResetEventSem(hevFleshWorkListChanged, &ul);
    968           if (rc)
    969             Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosResetEventSem");
     950          xDosWaitEventSem(hevFleshWorkListChanged, SEM_INDEFINITE_WAIT);
     951          xDosResetEventSem(hevFleshWorkListChanged, &ul);
    970952          if (!fNoFleshDbgMsg)
    971953            DbgMsg(pszSrcFile, __LINE__, "FleshWorkThread work hev posted"); // 2015-08-03 SHL FIXME debug
     
    10851067  }
    10861068
    1087   rc = DosCreateEventSem(NULL, &hevFleshWorkListChanged, 0 /* Not shared */, FALSE /* Reset */);
    1088   if (rc) {
    1089     Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
    1090               PCSZ_DOSCREATEEVENTSEM);
    1091     return FALSE;
    1092   }
     1069  rc = xDosCreateEventSem(NULL, &hevFleshWorkListChanged, 0 /* Not shared */, FALSE /* Reset */);
     1070  if (rc)
     1071    return FALSE;                       // Give up
    10931072
    10941073  /* DbgMsg is time consuming
  • trunk/dll/flesh.h

    r1858 r1860  
    2323BOOL IsFleshWorkListEmpty();
    2424
    25 VOID SetFleshFocusDrive(CHAR chDriveLetter);
     25VOID SetFleshFocusPath(PCSZ pszPath);
    2626
    2727#if 0 // 2015-08-03 SHL FIXME debug
    28 VOID WaitFleshWorkListEmpty();
     28VOID WaitFleshWorkListEmpty(PCSZ pszDirName);
    2929#else
    30 #define WaitFleshWorkListEmpty(pszFileName) WaitFleshWorkListEmptyDbg(pszFileName, __FILE__, __LINE__)
    31 VOID WaitFleshWorkListEmptyDbg(PCSZ pszFileName, PCSZ pszSrcFile, UINT uSrcLineNo);
     30#define WaitFleshWorkListEmpty(pszDirName) WaitFleshWorkListEmptyDbg(pszDirName, __FILE__, __LINE__)
     31VOID WaitFleshWorkListEmptyDbg(PCSZ pszDirName, PCSZ pszSrcFile, UINT uSrcLineNo);
    3232#endif
    3333
  • trunk/dll/init.c

    r1859 r1860  
    7878  14 Mar 09 GKY PCSZ strings moved to compile time initialization
    7979  14 Mar 09 GKY Prevent execution of UM_SHOWME while drive scan is occuring replaces check for
    80                 saved drive containers.
     80                saved drive containers.
    8181  06 Jun 09 GKY Add option to show file system type or drive label in tree
    8282  28 Jun 09 GKY Added AddBackslashToPath() to remove repeatative code.
     
    8585  22 Jul 09 GKY Fix failure to restore the notebook setting for saving container states or not
    8686  12 Sep 09 GKY Change protectonly check to check for VKBD being loaded instead of starting
    87                 command.com. Prevents hang (at least until a Dos program is started) on a system
    88                 that has a broken MDOS install.
     87                command.com. Prevents hang (at least until a Dos program is started) on a system
     88                that has a broken MDOS install.
    8989  15 Nov 09 GKY Add more PCSZs
    9090  22 Nov 09 GKY Fix FindSwapperDat so the check for large file support actually occurs if the
    91                 fall back to config.sys is used to find it; use bstripcr to streamline code.
     91                fall back to config.sys is used to find it; use bstripcr to streamline code.
    9292  13 Dec 09 GKY Fixed separate paramenters. Please note that appname should be used in
    93                 profile calls for user settings that work and are setable in more than one
    94                 miniapp; FM3Str should be used for setting only relavent to FM/2 or that
    95                 aren't user settable; realappname should be used for setting applicable to
    96                 one or more miniapp but not to FM/2
     93                profile calls for user settings that work and are setable in more than one
     94                miniapp; FM3Str should be used for setting only relavent to FM/2 or that
     95                aren't user settable; realappname should be used for setting applicable to
     96                one or more miniapp but not to FM/2
    9797  17 JAN 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast CHAR
    98                 CONSTANT * as CHAR *.
     98                CONSTANT * as CHAR *.
    9999  09 MAY 10 JBS Ticket 434: Make fDontSuggestAgain a "global" flag, not a per app flag
    100100  23 Oct 10 GKY Changes to populate and utilize a HELPTABLE for context specific help
    101101  20 Nov 10 GKY Rework scanning code to remove redundant scans, prevent double directory
    102                 entries in the tree container, fix related semaphore performance using
    103                 combination of event and mutex semaphores
     102                entries in the tree container, fix related semaphore performance using
     103                combination of event and mutex semaphores
    104104  20 Nov 10 GKY Check that pTmpDir IsValid and recreate if not found; Fixes hangs caused
    105                 by temp file creation failures.
     105                by temp file creation failures.
    106106  03 Mar 11 SHL Try using FM3INI to create help instance if fm3.hlp not in current directory
    107107  06 Aug 11 GKY Fixed failure to initalize pFM2SaveDirectory if TEMP and TMP were not present
    108                 or invalid
     108                or invalid
    109109  22 Oct 11 GKY Thread notes dialog now reopens on startup if it was open on shutdown.
    110110  08 Jan 12 GKY Add support for changing PresParams in the notify status window
    111111  04 Aug 12 GKY Changes to use Unlock to unlock files if Unlock.exe is in path both from menu/toolbar and as part of
    112                 copy, move and delete operations
     112                copy, move and delete operations
    113113  04 Aug 12 GKY Changes to allow copy and move over readonly files with a warning dialog; also added a warning dialog
    114                 for delete of readonly files
     114                for delete of readonly files
    115115  09 Feb 14 GKY Fix separate parameters. Moved to general page renamed separate settings
    116                 for apps.
     116                for apps.
    117117  09 Feb 14 GKY Modified wipeallf to allow suppression of the readonly warning on delete
    118                 of temporary files
     118                of temporary files
    119119  16 Feb 14 GKY Add "#" command line switch to workaround problem with blank command shell
    120                 started from fm2 after fm2 has been started with stdout and stderr
    121                 redirected to a file.
     120                started from fm2 after fm2 has been started with stdout and stderr
     121                redirected to a file.
    122122  22 Feb 14 GKY Cleanup of readonly check code suppress spurious error on blocked directory
    123                 delete and eliminated the check on additional temp file deletes
     123                delete and eliminated the check on additional temp file deletes
    124124  23 Feb 14 JBS Ticket #515: Corrected a mis-coded call to strtol which was causing the traps
    125                 described in this ticket. (Also changed it to strtoul.)
     125                described in this ticket. (Also changed it to strtoul.)
    126126  01 Mar 14 JBS Ticket #524: Made "searchapath" thread-safe. Function names and signatures were changed.
    127                 So calls to these functions had to be changed.
     127                So calls to these functions had to be changed.
    128128  02 Mar 14 GKY Fixed typo that reversed the function of the saymsg dialog g/bzip check.
    129                 Added option to suppress message regarding missing bzip2.exe
    130                 or gzip.exe on TAR.B/GZ archives.
     129                Added option to suppress message regarding missing bzip2.exe
     130                or gzip.exe on TAR.B/GZ archives.
    131131  30 Aug 14 GKY Add semaphore hmtxFiltering to prevent freeing dcd while filtering. Prevents
    132                 a trap when FM2 is shutdown while directory containers are still populating
     132                a trap when FM2 is shutdown while directory containers are still populating
    133133  02 Aug 15 GKY Serialize local hard drive scanning to reduce drive thrashing continue to scan
    134                 all other drive types in separate threads.
     134                all other drive types in separate threads.
    135135  12 Aug 15 JBS Ticket #522: Ensure no "highmem-unsafe" functions are called directly
    136                 Calls to unsafe Dos... functions have been changed to call the wrapped xDos... functions
     136                Calls to unsafe Dos... functions have been changed to call the wrapped xDos... functions
    137137  19 Aug 15 SHL Delete obsoletes
     138  20 Aug 15 SHL Support PCSZ_DOS...SEM
    138139
    139140***********************************************************************/
     
    336337PCSZ PCSZ_CM_ALLOCRECORD  = "CM_ALLOCRECORD";
    337338PCSZ PCSZ_QUERYCNRINFO    = "CM_QUERYCNRINFO";
    338 PCSZ PCSZ_DOSCREATEMUTEXSEM =  "DosCreateMutexSem";
    339 PCSZ PCSZ_DOSCREATEEVENTSEM =  "DosCreateEventSem";
     339
     340PCSZ PCSZ_DOSCREATEMUTEXSEM = "DosCreateMutexSem";
     341PCSZ PCSZ_DOSREQUESTMUTEXSEM = "DosRequestMutexSem";
     342PCSZ PCSZ_DOSRELEASEMUTEXSEM =  "DosReleaseMutexSem";
     343PCSZ PCSZ_DOSCREATEEVENTSEM = "DosCreateEventSem";
     344PCSZ PCSZ_DOSWAITEVENTSEM = "DosWaitEventSem";
     345PCSZ PCSZ_DOSPOSTEVENTSEM = "DosPostEventSem";
     346PCSZ PCSZ_DOSRESETEVENTSEM = "DosResetEventSem";
     347
    340348PCSZ PCSZ_DOSDUPHANDLE    =  "DosDupHandle";
    341349PCSZ PCSZ_DOSGETINFOBLOCKS = "DosGetInfoBlocks";
     
    812820                        FILE_SYSTEM | FILE_READONLY | FILE_HIDDEN |
    813821                        FILE_ARCHIVED,
    814                         &ffb, sizeof(ffb), &num_matches, FIL_STANDARD)) {
    815         do {
     822                        &ffb, sizeof(ffb), &num_matches, FIL_STANDARD)) {
     823        do {
    816824          strcpy(enddir, ffb.achName);
    817825          p = strrchr(szTempName, '.');
    818826          if (p) {
    819827            p++;
    820             ul = strtoul(p, NULL, 16);
     828            ul = strtoul(p, NULL, 16);
    821829            GetDosPgmName(ul, temp);
    822830            if (!strstr(temp, "FM/2") &&
     
    826834            }
    827835          }
    828         }
    829         while (!DosFindNext(search_handle,
    830                             &ffb, sizeof(ffb), &num_matches));
    831         DosFindClose(search_handle);
     836        }
     837        while (!DosFindNext(search_handle,
     838                            &ffb, sizeof(ffb), &num_matches));
     839        DosFindClose(search_handle);
    832840      }
    833841      if (fs3.attrFile & FILE_DIRECTORY) {
     
    836844        rc = DosCreateDir(szTempName, 0);
    837845        if (!rc)
    838           pTmpDir = xstrdup(szTempName, pszSrcFile, __LINE__);  // if writable
    839         else
    840           pTmpDir = xstrdup(pFM2SaveDirectory, pszSrcFile, __LINE__);
     846          pTmpDir = xstrdup(szTempName, pszSrcFile, __LINE__);  // if writable
     847        else
     848          pTmpDir = xstrdup(pFM2SaveDirectory, pszSrcFile, __LINE__);
    841849      }
    842850    }
     
    925933      CHAR szFullFilename[CCHMAXPATH];
    926934      if (!SearchMultiplePathsForFile(profile, szFullFilename)) {
    927         strcpy(inipath, szFullFilename);
     935        strcpy(inipath, szFullFilename);
    928936      } else {
    929         strcpy(inipath, profile);
     937        strcpy(inipath, profile);
    930938      }
    931939    } //fixme the DosCopies probably fail if the INI isn't in the FM2 directory GKY 06 Aug 11
     
    936944    if (rc) {
    937945      if (rc == ERROR_FILE_NOT_FOUND) {
    938         DosCopy(PCSZ_FM3INIDOTBAK, PCSZ_FM3DOTINI, 0);
     946        DosCopy(PCSZ_FM3INIDOTBAK, PCSZ_FM3DOTINI, 0);
    939947      }
    940948      rc = DosQueryPathInfo(inipath, FIL_STANDARD, &fs3, sizeof(fs3));
    941949      if (rc)
    942         fWantFirstTimeInit = TRUE;
     950        fWantFirstTimeInit = TRUE;
    943951    }
    944952    if (!fWantFirstTimeInit) { //Check the ini file header and restore from backup if corupted
    945953      if (!CheckFileHeader(inipath, "\xff\xff\xff\xff\x14\x00\x00\x00", 0L)) {
    946         saymsg(MB_ENTER,HWND_DESKTOP, GetPString(IDS_DEBUG_STRING),
    947                GetPString(IDS_INIFAILURETEXT));
    948         DosCopy(PCSZ_FM3DOTINI, PCSZ_FM3INIDOTBAD, DCPY_EXISTING);
    949         DosCopy(PCSZ_FM3INIDOTBAK, PCSZ_FM3DOTINI, DCPY_EXISTING);
    950         if (!CheckFileHeader(inipath, "\xff\xff\xff\xff\x14\x00\x00\x00", 0L)) {
    951           DosCopy(PCSZ_FM3DOTINI, PCSZ_FM3INIDOTBAD2, DCPY_EXISTING);
    952           fWantFirstTimeInit = TRUE;
    953         }
     954        saymsg(MB_ENTER,HWND_DESKTOP, GetPString(IDS_DEBUG_STRING),
     955               GetPString(IDS_INIFAILURETEXT));
     956        DosCopy(PCSZ_FM3DOTINI, PCSZ_FM3INIDOTBAD, DCPY_EXISTING);
     957        DosCopy(PCSZ_FM3INIDOTBAK, PCSZ_FM3DOTINI, DCPY_EXISTING);
     958        if (!CheckFileHeader(inipath, "\xff\xff\xff\xff\x14\x00\x00\x00", 0L)) {
     959          DosCopy(PCSZ_FM3DOTINI, PCSZ_FM3INIDOTBAD2, DCPY_EXISTING);
     960          fWantFirstTimeInit = TRUE;
     961        }
    954962      }
    955963    }
     
    959967      fIniExisted = TRUE;
    960968      if (fs3.attrFile & (FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM)) {
    961         fs3.attrFile &= ~(FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM);
    962         rc = xDosSetPathInfo(inipath, FIL_STANDARD, &fs3, sizeof(fs3), 0);
    963         if (rc) {
    964           Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
    965                       GetPString(IDS_INIREADONLYTEXT), inipath);
    966         }
     969        fs3.attrFile &= ~(FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM);
     970        rc = xDosSetPathInfo(inipath, FIL_STANDARD, &fs3, sizeof(fs3), 0);
     971        if (rc) {
     972          Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
     973                      GetPString(IDS_INIREADONLYTEXT), inipath);
     974        }
    967975      }
    968976    }
     
    10101018          hwndHelp = WinCreateHelpInstance(hab, &hini);
    10111019          if (!hwndHelp)
    1012             Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,
    1013                       "WinCreateHelpInstance failed for %s with error 0x%x",
    1014                       hini.pszHelpLibraryName, hini.ulReturnCode);
     1020            Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,
     1021                      "WinCreateHelpInstance failed for %s with error 0x%x",
     1022                      hini.pszHelpLibraryName, hini.ulReturnCode);
    10151023        }
    10161024      }
     
    11741182  if (rc) {
    11751183    Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
    1176               PCSZ_DOSCREATEMUTEXSEM);
     1184              PCSZ_DOSCREATEMUTEXSEM);
    11771185  }
    11781186  rc = DosCreateMutexSem(NULL, &hmtxFM2Delete, 0L, FALSE);
    11791187  if (rc) {
    11801188    Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
    1181               PCSZ_DOSCREATEMUTEXSEM);
     1189              PCSZ_DOSCREATEMUTEXSEM);
    11821190  }
    11831191  rc = DosCreateMutexSem(NULL, &hmtxFiltering, 0L, FALSE);
    11841192  if (rc) {
    11851193    Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
    1186               PCSZ_DOSCREATEMUTEXSEM);
     1194              PCSZ_DOSCREATEMUTEXSEM);
    11871195  }
    11881196
  • trunk/dll/init.h

    r1858 r1860  
    4444                all other drive types in separate threads.
    4545  19 Aug 15 SHL Delete obsoletes
     46  20 Aug 15 SHL Support PCSZ_DOS...SEM
    4647
    4748***********************************************************************/
     
    120121extern PCSZ PCSZ_CM_ALLOCRECORD;
    121122extern PCSZ PCSZ_QUERYCNRINFO;
     123
    122124extern PCSZ PCSZ_DOSCREATEMUTEXSEM;
     125extern PCSZ PCSZ_DOSREQUESTMUTEXSEM;
     126extern PCSZ PCSZ_DOSRELEASEMUTEXSEM;
     127
    123128extern PCSZ PCSZ_DOSCREATEEVENTSEM;
     129extern PCSZ PCSZ_DOSWAITEVENTSEM;
     130extern PCSZ PCSZ_DOSPOSTEVENTSEM;
     131extern PCSZ PCSZ_DOSRESETEVENTSEM;
     132
    124133extern PCSZ PCSZ_DOSDUPHANDLE;
    125134extern PCSZ PCSZ_DOSGETINFOBLOCKS;
  • trunk/dll/treecnr.c

    r1858 r1860  
    101101  12 Jul 15 GKY Fixed trap caused by pci->pszFileName being NullStr
    102102  07 Aug 15 SHL Rework to use AddFleshWorkRequest rather than direct calls to Stubby/Flesh/Unflesh
     103  20 Aug 15 SHL Sync with SetFleshFocusPath mods
    103104
    104105***********************************************************************/
     
    10921093#     endif
    10931094    }
    1094     DosPostEventSem(CompactSem);
     1095    xDosPostEventSem(CompactSem);
    10951096    if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
    10961097      WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
     
    19811982          free(dir);
    19821983        else
    1983           SetFleshFocusDrive(*dir);
     1984          SetFleshFocusPath(dir);
    19841985      }
    19851986    }
  • trunk/dll/wrappers.c

    r1848 r1860  
    66  Wrappers with error checking
    77
    8   Copyright (c) 2006, 2008 Steven H.Levine
     8  Copyright (c) 2006, 2015 Steven H.Levine
    99
    1010  22 Jul 06 SHL Baseline
     
    2828                   "#if 0" block for quick implementation should FM/2 start to use them.
    2929                   Among these. xDosOpenL and xWinUpper still need work. The rest are ready for use.
     30  20 Aug 15 SHL Add xDos...MutexSem and xDos..EventSem wrappers
    3031
    3132***********************************************************************/
     
    6869{
    6970  APIRET        rc;
    70   HFILE         hFileLow = *phFile;
     71  HFILE hFileLow = *phFile;
    7172
    7273  rc = DosDupHandle(hFile, &hFileLow);
     
    324325  return apiret;
    325326}
     327
     328/**
     329 * DosRequestMutexSem wrapper
     330 */
     331
     332APIRET xDosRequestMutexSem(HMTX hmtx, ULONG ulTimeout)
     333{
     334  APIRET apiret = DosRequestMutexSem(hmtx, ulTimeout);
     335
     336  if (apiret && (ulTimeout == SEM_INDEFINITE_WAIT || apiret != ERROR_TIMEOUT)) {
     337    Dos_Error(MB_CANCEL, apiret, HWND_DESKTOP, pszSrcFile, __LINE__,
     338              PCSZ_DOSREQUESTMUTEXSEM);
     339  }
     340  return apiret;
     341}
     342
     343/**
     344 * DosReleaseMutexSem wrapper
     345 */
     346
     347APIRET xDosReleaseMutexSem(HMTX hmtx)
     348{
     349  APIRET apiret = DosReleaseMutexSem(hmtx);
     350
     351  if (apiret) {
     352    Dos_Error(MB_CANCEL, apiret, HWND_DESKTOP, pszSrcFile, __LINE__,
     353              PCSZ_DOSRELEASEMUTEXSEM);
     354  }
     355  return apiret;
     356}
     357
     358/**
     359 * DosCreateEventSem wrapper
     360 */
     361
     362APIRET xDosCreateEventSem (PSZ pszName,PHEV phev, ULONG flAttr, BOOL32 fState)
     363{
     364  APIRET apiret = DosCreateEventSem (pszName,phev, flAttr, fState);
     365  if (apiret) {
     366    Dos_Error(MB_CANCEL, apiret, HWND_DESKTOP, pszSrcFile, __LINE__,
     367              PCSZ_DOSCREATEEVENTSEM);
     368  }
     369  return apiret;
     370}
     371
     372/**
     373 * DosWaitEventSem wrapper
     374 */
     375
     376APIRET xDosWaitEventSem(HEV hev, ULONG ulTimeout)
     377{
     378  APIRET apiret = DosWaitEventSem(hev, ulTimeout);
     379
     380  if (apiret && (ulTimeout == SEM_INDEFINITE_WAIT || apiret != ERROR_TIMEOUT)) {
     381    Dos_Error(MB_CANCEL, apiret, HWND_DESKTOP, pszSrcFile, __LINE__,
     382              PCSZ_DOSWAITEVENTSEM);
     383  }
     384  return apiret;
     385}
     386
     387/**
     388 * DosPostEventSem wrapper
     389 */
     390
     391APIRET xDosPostEventSem(HEV hev)
     392{
     393  APIRET apiret = DosPostEventSem(hev);
     394
     395  if (apiret && apiret != ERROR_ALREADY_POSTED) {
     396    Dos_Error(MB_CANCEL, apiret, HWND_DESKTOP, pszSrcFile, __LINE__,
     397              PCSZ_DOSPOSTEVENTSEM);
     398  }
     399  return apiret;
     400}
     401
     402/**
     403 * DosResetEventSem wrapper
     404 */
     405
     406APIRET xDosResetEventSem(HEV hev, PULONG pulPostCt)
     407{
     408  APIRET apiret = DosResetEventSem(hev, pulPostCt);
     409
     410  if (apiret && apiret != ERROR_ALREADY_RESET) {
     411    Dos_Error(MB_CANCEL, apiret, HWND_DESKTOP, pszSrcFile, __LINE__,
     412              PCSZ_DOSRESETEVENTSEM);
     413  }
     414  return apiret;
     415}
     416
     417/**
     418 * DosFindFirst wrapper
     419 */
    326420
    327421APIRET xDosFindFirst(PSZ pszFileSpec,
     
    731825/*
    732826 * JBS: Wrappers for functions which...
    733  *      - are identified by klibc as "highmem-unsafe"
    734  *      - not yet used by FM/2
     827 *      - are identified by klibc as "highmem-unsafe"
     828 *      - not yet used by FM/2
    735829 */
    736830
  • trunk/dll/wrappers.h

    r1853 r1860  
    1919                   "#if 0" block in wrappers.c for quick implementation should FM/2 start to use them.
    2020                   Among these. xDosOpenL and xWinUpper still need work. The rest are ready for use.
     21  20 Aug 15 SHL Add xDos...MutexSem and xDos..EventSem wrappers
    2122
    2223***********************************************************************/
     
    8182                    ULONG  ulInfoLevel);        // 06 Oct 07 SHL Added
    8283
    83 #ifdef INCL_DOSPROCESS  // // PPIB PTIB
     84#ifdef INCL_DOSPROCESS  // PPIB PTIB
    8485APIRET xDosGetInfoBlocks(PTIB *pptib,
    8586                         PPIB *pppib);  // 2015-08-09 SHL added
     87#endif
     88
     89#ifdef INCL_DOSSEMAPHORES       // HMTX HEV
     90APIRET xDosRequestMutexSem(HMTX hmtx, ULONG ulTimeout);
     91APIRET xDosReleaseMutexSem(HMTX hmtx);
     92APIRET xDosCreateEventSem (PSZ pszName,PHEV phev, ULONG flAttr, BOOL32 fState);
     93APIRET xDosWaitEventSem(HEV hev, ULONG ulTimeout);
     94APIRET xDosPostEventSem(HEV hev);
     95APIRET xDosResetEventSem(HEV hev, PULONG pulPostCt);
    8696#endif
    8797
Note: See TracChangeset for help on using the changeset viewer.