Changeset 1506


Ignore:
Timestamp:
Apr 12, 2010, 12:36:53 AM (15 years ago)
Author:
Gregg Young
Message:

Fixed hang and drive tree rescan failure resulting from event sem not being posted.

Location:
trunk/dll
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/mainwnd.c

    r1498 r1506  
    104104                aren't user settable; realappname should be used for setting applicable to
    105105                one or more miniapp but not to FM/2
    106   17 JAN 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast CHAR CONSTANT * as CHAR *.
     106  17 JAN 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast
     107                CHAR CONSTANT * as CHAR *.
     108  11 Apr 10 GKY Fix drive tree rescan failure and program hang caused by event sem
     109                never being posted
    107110
    108111***********************************************************************/
     
    353356    }
    354357    if (fInitialDriveScan) {
     358      fInitialDriveScan = FALSE;
    355359      DosPostEventSem(hevInitialCnrScanComplete);
    356360      DosCloseEventSem(hevInitialCnrScanComplete);
    357       fInitialDriveScan = FALSE;
    358361    }
    359362    return 0;
     
    30573060  if (*lasttoolbar) {
    30583061    sprintf(szKey, "%sToolbar", szPrefix);
    3059     PrfWriteProfileString(fmprof, (CHAR *) (CHAR *) FM3Str, szKey, lasttoolbar);
     3062    PrfWriteProfileString(fmprof, FM3Str, szKey, lasttoolbar);
    30603063  }
    30613064
    30623065  if (!fIsShutDownState) {
    30633066    sprintf(szKey, "%sTargetDir", szPrefix);
    3064     PrfWriteProfileString(fmprof, (CHAR *) FM3Str, szKey, targetdir);
     3067    PrfWriteProfileString(fmprof, FM3Str, szKey, targetdir);
    30653068    sprintf(szKey, "%sVersion", szPrefix);
    3066     PrfWriteProfileString(fmprof, (CHAR *) FM3Str, szKey, "3.16");
     3069    PrfWriteProfileString(fmprof, FM3Str, szKey, "3.16");
    30673070  }
    30683071
     
    30883091            eos = &szKey[strlen(szKey)];
    30893092            strcpy(eos, "Pos");
    3090             PrfWriteProfileData(fmprof, (CHAR *) FM3Str, szKey, (PVOID) & swp,
     3093            PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & swp,
    30913094                                sizeof(SWP));
    30923095            dcd = WinQueryWindowPtr(WinWindowFromID(hwndC, DIR_CNR), QWL_USER);
    30933096            if (dcd) {
    30943097              strcpy(eos, "Sort");
    3095               PrfWriteProfileData(fmprof, (CHAR *) FM3Str, szKey, (PVOID) & dcd->sortFlags,
     3098              PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->sortFlags,
    30963099                                  sizeof(INT));
    30973100              strcpy(eos, "Filter");
    3098               PrfWriteProfileData(fmprof, (CHAR *) FM3Str, szKey, (PVOID) & dcd->mask,
     3101              PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->mask,
    30993102                                  sizeof(MASK));
    31003103              strcpy(eos, "View");
     
    31153118                  flWindowAttr |= CV_NAME;
    31163119              }
    3117               PrfWriteProfileData(fmprof, (CHAR *) FM3Str, szKey, (PVOID) &flWindowAttr,
     3120              PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) &flWindowAttr,
    31183121                                  sizeof(ULONG));
    31193122              WriteDetailsSwitches(szKeyBase, &dcd->ds, TRUE);
     
    31213124            }
    31223125            strcpy(eos, "Dir");
    3123             PrfWriteProfileString(fmprof, (CHAR *) FM3Str, szKey, szDir);
     3126            PrfWriteProfileString(fmprof, FM3Str, szKey, szDir);
    31243127            numsaves++;
    31253128          }
     
    31313134
    31323135  sprintf(szKey, "%sNumDirsLastTime", szPrefix);
    3133   if (PrfQueryProfileData(fmprof, (CHAR *) FM3Str, szKey, (PVOID) &previous_numsaves, &ulTemp)) {
     3136  if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) &previous_numsaves, &ulTemp)) {
    31343137    ULONG size = 0;
    31353138
    31363139    sprintf(szKey, "%sVersion", szPrefix);
    3137     PrfQueryProfileSize(fmprof, (CHAR *) FM3Str, szKey, &size);
     3140    PrfQueryProfileSize(fmprof, FM3Str, szKey, &size);
    31383141    if (!size && fSaveState) {
    31393142      for (ulTemp = 0; ulTemp < previous_numsaves; ulTemp++)
    31403143        RemoveOldCnrSwitches(szPrefix, ulTemp);
    31413144       sprintf(szKey, "%sVersion", szPrefix);
    3142        PrfWriteProfileString(fmprof, (CHAR *) FM3Str, szKey, "3.16");
     3145       PrfWriteProfileString(fmprof, FM3Str, szKey, "3.16");
    31433146      }
    31443147    for (ulTemp = numsaves; ulTemp < previous_numsaves; ulTemp++) {
     
    31493152  sprintf(szKey, "%sNumDirsLastTime", szPrefix);
    31503153  if (numsaves) {
    3151     PrfWriteProfileData(fmprof, (CHAR *) FM3Str, szKey, (PVOID) &numsaves, sizeof(ULONG));
     3154    PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) &numsaves, sizeof(ULONG));
    31523155    WinQueryWindowPos(WinQueryWindow(hwndClient, QW_PARENT), &swp);
    31533156    sprintf(szKey, "%sMySizeLastTime", szPrefix);
    3154     PrfWriteProfileData(fmprof, (CHAR *) FM3Str, szKey, (PVOID) &swp, sizeof(SWP));
     3157    PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) &swp, sizeof(SWP));
    31553158    if (WinQueryWindowPos(hwndTree, &swp)) {
    31563159      sprintf(szKey, "%sLastTreePos", szPrefix);
    3157       PrfWriteProfileData(fmprof, (CHAR *) FM3Str, szKey, (PVOID) &swp, sizeof(SWP));
     3160      PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) &swp, sizeof(SWP));
    31583161    }
    31593162  }
    31603163  else if (fIsShutDownState) {
    3161     PrfWriteProfileData(fmprof, (CHAR *) FM3Str, szKey, (PVOID) &numsaves, sizeof(ULONG));
     3164    PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) &numsaves, sizeof(ULONG));
    31623165  }
    31633166  return numsaves;
     
    32403243    if (fToolsChanged)
    32413244      save_tools(NULL);
    3242     PrfQueryProfileString(fmprof, (CHAR *) FM3Str, szKey, NULL, lasttoolbar, sizeof(lasttoolbar));
    3243     PrfWriteProfileString(fmprof, (CHAR *) FM3Str, "LastToolbar", lasttoolbar);
     3245    PrfQueryProfileString(fmprof, FM3Str, szKey, NULL, lasttoolbar, sizeof(lasttoolbar));
     3246    PrfWriteProfileString(fmprof, FM3Str, "LastToolbar", lasttoolbar);
    32443247    load_tools(NULL);
    32453248    PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
     
    32473250  sprintf(szKey, "%sTargetDir", szPrefix);
    32483251  {
    3249     PrfQueryProfileString(fmprof, (CHAR *) FM3Str, szKey, NULL, targetdir, sizeof(targetdir));
    3250     PrfWriteProfileString(fmprof, (CHAR *) FM3Str, "TargetDir", targetdir);
     3252    PrfQueryProfileString(fmprof, FM3Str, szKey, NULL, targetdir, sizeof(targetdir));
     3253    PrfWriteProfileString(fmprof, FM3Str, "TargetDir", targetdir);
    32513254    SetTargetDir(NULLHANDLE, TRUE);
    32523255  }
    32533256  size = sizeof(SWP);
    32543257  sprintf(szKey, "%sMySizeLastTime", szPrefix);
    3255   if (!PrfQueryProfileData(fmprof, (CHAR *) FM3Str, szKey, (PVOID) &swpO, &size) ||
     3258  if (!PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) &swpO, &size) ||
    32563259      size != sizeof(SWP) || !swp.cx || !swp.cy)
    32573260  {
     
    32603263  // If restoring internally saved state, forget info
    32613264  if (fDeleteState)
    3262     PrfWriteProfileData(fmprof, (CHAR *) FM3Str, szKey, NULL, 0L);
     3265    PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    32633266  WinQueryWindowPos(WinQueryWindow(hwndClient, QW_PARENT), &swpN);
    32643267  if (swpN.fl & (SWP_MINIMIZE | SWP_HIDE))
     
    32683271  size = sizeof(SWP);
    32693272  sprintf(szKey, "%sLastTreePos", szPrefix);
    3270   if (PrfQueryProfileData(fmprof, (CHAR *) FM3Str, szKey, (PVOID) &swp, &size)) {
     3273  if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) &swp, &size)) {
    32713274    if (fDeleteState)
    3272       PrfWriteProfileData(fmprof, (CHAR *) FM3Str, szKey, NULL, 0L);
     3275      PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    32733276    swp.hwnd = hwndTree;
    32743277    TransformSwp(&swp, xtrans, ytrans);
     
    32993302  sprintf(szKey, "%sNumDirsLastTime", szPrefix);
    33003303  size = sizeof(ULONG);
    3301   if (PrfQueryProfileData(fmprof, (CHAR *) FM3Str, szKey, (PVOID) &numsaves, &size)) {
     3304  if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) &numsaves, &size)) {
    33023305    if (fDeleteState)
    3303       PrfWriteProfileData(fmprof, (CHAR *) FM3Str, szKey, NULL, 0L);
     3306      PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    33043307    for (x = numsaves - 1; x >= 0; x--) {
    33053308      CHAR *eos = szKey;
     
    33113314      strcpy(eos, "Pos");
    33123315      size = sizeof(SWP);
    3313       if (PrfQueryProfileData(fmprof, (CHAR *) FM3Str, szKey, (PVOID) &swp, &size)) {
     3316      if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) &swp, &size)) {
    33143317        strcpy(eos, "Dir"); ;
    33153318        size = sizeof(szDir);
    3316         if (PrfQueryProfileData(fmprof, (CHAR *) FM3Str, szKey, (PVOID) szDir, &size)) {
     3319        if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) szDir, &size)) {
    33173320          // If restoring shutdown state and drive marked no prescan
    33183321          // bypass window restore
     
    33633366                strcpy(eos, "Sort");
    33643367                size = sizeof(INT);
    3365                 if (PrfQueryProfileData(fmprof, (CHAR *) FM3Str,        szKey, (PVOID) &dcd->sortFlags,
     3368                if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) &dcd->sortFlags,
    33663369                                        &size)) {
    33673370                  if (!dcd->sortFlags)
     
    33703373                size = sizeof(MASK);
    33713374                strcpy(eos, "Filter");
    3372                 if (PrfQueryProfileData(fmprof, (CHAR *) FM3Str,        szKey, (PVOID) &dcd->mask, &size)) {
     3375                if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) &dcd->mask, &size)) {
    33733376                  if (*dcd->mask.szMask)
    33743377                    WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
     
    33793382                if (!noview) {
    33803383                  size = sizeof(ULONG);
    3381                   if (PrfQueryProfileData(fmprof, (CHAR *) FM3Str, szKey, (PVOID) &dcd->flWindowAttr,
     3384                  if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) &dcd->flWindowAttr,
    33823385                                          &size)) {
    33833386
     
    47184721            sprintf(szKey, "%s.NumDirsLastTime", szStateName);
    47194722            size = sizeof(ULONG);
    4720             if (!PrfQueryProfileData(fmprof, (CHAR *) FM3Str, szKey, (PVOID) &numsaves, &size)) {
     4723            if (!PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) &numsaves, &size)) {
    47214724              saymsg(MB_ENTER | MB_ICONASTERISK, hwnd,
    47224725                     GetPString(IDS_WARNINGTEXT),
     
    47264729              Runtime_Error(pszSrcFile, __LINE__, NULL);
    47274730            else {
    4728               PrfWriteProfileData(fmprof, (CHAR *) FM3Str, szKey, NULL, 0L);
     4731              PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    47294732              for (x = 0; x < numsaves; x++) {
    47304733                sprintf(szKeyBase, "%s.DirCnr.%lu", szStateName, x);
     
    47324735                size = 0;
    47334736                sprintf(szKey, "%sVersion", szStateName);
    4734                 if (PrfQueryProfileSize(fmprof, (CHAR *) FM3Str, szKey, &size) && size)
     4737                if (PrfQueryProfileSize(fmprof, FM3Str, szKey, &size) && size)
    47354738                  RemoveOldCnrSwitches(szStateName, x);
    47364739              }
     
    50535056    else
    50545057      fComments = TRUE;
    5055     PrfWriteProfileData(fmprof, (CHAR *) FM3Str, "Comments", &fComments, sizeof(BOOL));
     5058    PrfWriteProfileData(fmprof, FM3Str, "Comments", &fComments, sizeof(BOOL));
    50565059    WinSetWindowText((fComments) ? hwndAutoview : hwndAutoMLE, NullStr);
    50575060    goto AutoChange;
     
    51255128      PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME,
    51265129              MPFROMLONG(FCF_MENU), MPVOID);
    5127       PrfWriteProfileData(fmprof, (CHAR *) FM3Str, "MenuInvisible",
     5130      PrfWriteProfileData(fmprof, FM3Str, "MenuInvisible",
    51285131                          &MenuInvisible, sizeof(BOOL));
    51295132    }
     
    53995402            strcpy(lasttoolbar,
    54005403                   quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART - 1]);
    5401             PrfWriteProfileString(fmprof, (CHAR *) FM3Str, "LastToolbar", lasttoolbar);
     5404            PrfWriteProfileString(fmprof, FM3Str, "LastToolbar", lasttoolbar);
    54025405          }
    54035406          PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
     
    57075710
    57085711    size = sizeof(BOOL);
    5709     if (PrfQueryProfileData(fmprof, (CHAR *) FM3Str, "MenuInvisible", &temp, &size) &&
     5712    if (PrfQueryProfileData(fmprof, FM3Str, "MenuInvisible", &temp, &size) &&
    57105713        size && temp)
    57115714      WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_HIDEMENU, 0), MPVOID);
    57125715    size = sizeof(BOOL);
    5713     if (PrfQueryProfileData(fmprof, (CHAR *) FM3Str, "FreeTree", &temp, &size) &&
     5716    if (PrfQueryProfileData(fmprof, FM3Str, "FreeTree", &temp, &size) &&
    57145717        size && temp)
    57155718      WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_FREETREE, 0), MPVOID);
    57165719    size = sizeof(BOOL);
    5717     if (PrfQueryProfileData(fmprof, (CHAR *) FM3Str, "AutoTile", &temp, &size) &&
     5720    if (PrfQueryProfileData(fmprof, FM3Str, "AutoTile", &temp, &size) &&
    57185721        size && !temp)
    57195722      WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_AUTOTILE, 0), MPVOID);
     
    57465749        if (!fSaveState ||
    57475750            !PrfQueryProfileData(fmprof,
    5748                                  (CHAR *) FM3Str,
     5751                                 FM3Str,
    57495752                                 "LastTreePos",
    57505753                                 &swp, &size) || size != sizeof(SWP)) {
     
    57565759          size = sizeof(ratio);
    57575760          if (!PrfQueryProfileData(fmprof,
    5758                                    (CHAR *) FM3Str,
     5761                                   FM3Str,
    57595762                                   "TreeWindowRatio",
    57605763                                   (PVOID) & ratio,
     
    57985801      PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
    57995802      if (fInitialDriveScan) {
     5803        fInitialDriveScan = FALSE;
    58005804        DosPostEventSem(hevInitialCnrScanComplete);
    58015805        DosCloseEventSem(hevInitialCnrScanComplete);
     
    62966300              load_tools(path);
    62976301              PrfWriteProfileString(fmprof,
    6298                                     (CHAR *) FM3Str, "LastToolbar", lasttoolbar);
     6302                                    FM3Str, "LastToolbar", lasttoolbar);
    62996303              PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
    63006304              WinSetWindowText(hwndButtonlist, (CHAR *) GetPString(IDS_TOOLBARTEXT));
     
    63096313              sprintf(szKey, "%s.NumDirsLastTime", path);       // path is state name
    63106314              if (!PrfQueryProfileData(fmprof,
    6311                                        (CHAR *) FM3Str,
     6315                                       FM3Str,
    63126316                                       szKey,
    63136317                                       (PVOID)&numsaves,
  • trunk/dll/mainwnd2.c

    r1498 r1506  
    3939                one or more miniapp but not to FM/2
    4040  17 JAN 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast CHAR CONSTANT * as CHAR *.
     41  11 Apr 10 GKY Fix drive tree rescan failure and program hang caused by event sem
     42                never being posted
    4143
    4244***********************************************************************/
     
    605607    fTileBackwards = (fTileBackwards) ? FALSE : TRUE;
    606608    PrfWriteProfileData(fmprof,
    607                         (CHAR *) FM3Str,
     609                        FM3Str,
    608610                        "TileBackwards",
    609611                        (PVOID) & fTileBackwards, sizeof(BOOL));
     
    887889      pd->hwndDir2 = StartDirCnr(hwnd, s, (HWND) 0, 3);
    888890      if (fInitialDriveScan) {
     891        fInitialDriveScan = FALSE;
    889892        DosPostEventSem(hevInitialCnrScanComplete);
    890893        DosCloseEventSem(hevInitialCnrScanComplete);
    891         fInitialDriveScan = FALSE;
    892894      }
    893895      WinSetFocus(HWND_DESKTOP, pd->hwndCurr);
  • trunk/dll/treecnr.c

    r1498 r1506  
    8080                before scan completes
    8181  22 Nov 09 GKY Add LVM.EXE to partition submenu
    82   17 JAN 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast CHAR CONSTANT * as CHAR *.
     82  17 JAN 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast
     83                CHAR CONSTANT * as CHAR *.
     84  11 Apr 10 GKY Fix drive tree rescan failure and program hang caused by event sem
     85                never being posted
    8386
    8487***********************************************************************/
     
    649652          temptop = fTopDir;
    650653          fTopDir = TRUE;
    651         }
    652     DosWaitEventSem(hevInitialCnrScanComplete, SEM_INDEFINITE_WAIT);
     654        }
     655        if (fInitialDriveScan)
     656          DosWaitEventSem(hevInitialCnrScanComplete, SEM_INDEFINITE_WAIT);
    653657        ShowTreeRec(dcd->hwndCnr, (CHAR *)mp1, fCollapseFirst, TRUE);
    654658        PostMsg(hwndTree, WM_COMMAND, MPFROM2SHORT(IDM_UPDATE, 0), MPVOID);
     
    32723276          WinSetWindowText(WinWindowFromID(hwndFrame, FID_TITLEBAR), "VTree");
    32733277          FixSwitchList(hwndFrame, "VTree");
     3278          fInitialDriveScan = FALSE;
    32743279          DosPostEventSem(hevInitialCnrScanComplete);
    32753280          DosCloseEventSem(hevInitialCnrScanComplete);
    3276           fInitialDriveScan = FALSE;
    32773281        }
    32783282        else {
Note: See TracChangeset for help on using the changeset viewer.