Changeset 1271 for trunk/dll/arccnrs.c


Ignore:
Timestamp:
Nov 10, 2008, 4:58:50 AM (17 years ago)
Author:
Gregg Young
Message:

A fix for the ticket 58 hang which runs runemf2 with the WAIT flag in a separate thread. This appears to fix Ticket 58 for all cases. Removed semaphore fix and reverted hTermQSem code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/arccnrs.c

    r1270 r1271  
    162162typedef struct {
    163163
    164   CHAR filename[CCHMAXPATH];
    165   HWND hwndCnr;
     164  CHAR   filename[CCHMAXPATH];   //file passed as MP1 message parameter (file selected)
     165  HWND   hwndCnr;                //hwnd you want the message posted to
     166  HWND   hwndClient;             //hwnd calling this thread; NULL will work
     167  ULONG  RunFlags;               //runemf2 flags see systemf.h
     168  CHAR   *pszDirectory;
     169  CHAR   *pszEnvironment;
     170  CHAR   formatstring[40];       //Usally "%s"
     171  CHAR   CmdLine[1024];    //Use sprintf to format multipart command line into single string
    166172}
    167173WAITCHILD;
     
    173179  HAB thab;
    174180  CHAR *filename;
     181  INT ret;
    175182
    176183  DosError(FERR_DISABLEHARDERR);
     
    186193    if (thab) {
    187194      IncrThreadUsage();
    188       priority_normal();
    189       DosWaitEventSem(hWaitChildSem, SEM_INDEFINITE_WAIT);
    190       priority_bumped();
    191       if (IsFile(WaitChild->filename) == 1)
    192         PostMsg(WaitChild->hwndCnr, UM_ENTER, MPFROMP(filename), MPVOID);
     195      priority_bumped(); //normal();
     196      ret = runemf2(WaitChild->RunFlags, WaitChild->hwndClient, pszSrcFile, __LINE__,
     197                    WaitChild->pszDirectory, WaitChild->pszEnvironment,
     198                    WaitChild->formatstring, WaitChild->CmdLine);
     199      if (ret != -1) {
     200        //priority_bumped();
     201        if (IsFile(WaitChild->filename) == 1)
     202          PostMsg(WaitChild->hwndCnr, UM_ENTER, MPFROMP(filename), MPVOID);
     203      }
    193204      DecrThreadUsage();
    194205      WinTerminate(thab);
    195206    }
     207    xfree(WaitChild->pszDirectory, pszSrcFile, __LINE__);
     208    xfree(WaitChild->pszEnvironment, pszSrcFile, __LINE__);
    196209    free(WaitChild);
    197210  } // if WaitChild
     
    15601573          return 0;
    15611574        }
    1562         runemf2(SEPARATE | ASYNCHRONOUS | WAIT |
     1575        sprintf(WaitChild->CmdLine, "%s %s %s",
     1576                                    dcd->info->exwdirs ? dcd->info->exwdirs :
     1577                                    dcd->info->extract,
     1578                                    BldQuotedFileName(szQuotedArcName, dcd->arcname),
     1579                                    BldQuotedFileName(szQuotedMemberName, s));
     1580        /*runemf2(SEPARATE | ASYNCHRONOUS | WAIT |
    15631581                (fArcStuffVisible ? 0 : BACKGROUND),
    1564                 dcd->hwndClient, pszSrcFile, __LINE__, dcd->workdir, NULL,
     1582                , pszSrcFile, __LINE__, dcd->workdir, NULL,
    15651583                "%s %s %s",
    15661584                dcd->info->exwdirs ? dcd->info->exwdirs :
    15671585                                     dcd->info->extract,
    15681586                BldQuotedFileName(szQuotedArcName, dcd->arcname),
    1569                 BldQuotedFileName(szQuotedMemberName, s));
     1587                BldQuotedFileName(szQuotedMemberName, s));*/
    15701588        if (!dcd->info->exwdirs) {
    15711589          p = s;
     
    15861604          p++;
    15871605        }
    1588         free(s);
     1606        free(s);
     1607        WaitChild->RunFlags = SEPARATE | ASYNCHRONOUS | WAIT |
     1608                              (fArcStuffVisible ? 0 : BACKGROUND);
     1609        WaitChild->hwndClient = dcd->hwndClient;
     1610        WaitChild->pszDirectory = xstrdup(dcd->workdir, pszSrcFile, __LINE__);
     1611        WaitChild->pszEnvironment = NULL;
     1612        strcpy(WaitChild->formatstring, "%s");
    15891613        WaitChild->hwndCnr = dcd->hwndCnr;
    15901614        rc = _beginthread(WaitChildThread, NULL, 65536, WaitChild);
Note: See TracChangeset for help on using the changeset viewer.