Changeset 1271
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/arccnrs.c
r1270 r1271 162 162 typedef struct { 163 163 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 166 172 } 167 173 WAITCHILD; … … 173 179 HAB thab; 174 180 CHAR *filename; 181 INT ret; 175 182 176 183 DosError(FERR_DISABLEHARDERR); … … 186 193 if (thab) { 187 194 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 } 193 204 DecrThreadUsage(); 194 205 WinTerminate(thab); 195 206 } 207 xfree(WaitChild->pszDirectory, pszSrcFile, __LINE__); 208 xfree(WaitChild->pszEnvironment, pszSrcFile, __LINE__); 196 209 free(WaitChild); 197 210 } // if WaitChild … … 1560 1573 return 0; 1561 1574 } 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 | 1563 1581 (fArcStuffVisible ? 0 : BACKGROUND), 1564 dcd->hwndClient, pszSrcFile, __LINE__, dcd->workdir, NULL,1582 , pszSrcFile, __LINE__, dcd->workdir, NULL, 1565 1583 "%s %s %s", 1566 1584 dcd->info->exwdirs ? dcd->info->exwdirs : 1567 1585 dcd->info->extract, 1568 1586 BldQuotedFileName(szQuotedArcName, dcd->arcname), 1569 BldQuotedFileName(szQuotedMemberName, s)); 1587 BldQuotedFileName(szQuotedMemberName, s));*/ 1570 1588 if (!dcd->info->exwdirs) { 1571 1589 p = s; … … 1586 1604 p++; 1587 1605 } 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"); 1589 1613 WaitChild->hwndCnr = dcd->hwndCnr; 1590 1614 rc = _beginthread(WaitChildThread, NULL, 65536, WaitChild); -
trunk/dll/systemf.c
r1270 r1271 62 62 63 63 static PSZ pszSrcFile = __FILE__; 64 65 HEV hWaitChildSem;66 64 67 65 //static HAPP Exec(HWND hwndNotify, BOOL child, char *startdir, char *env, … … 694 692 static char szTermQName[30]; 695 693 static HQUEUE hTermQ; 696 //static HEV hTermQSem;694 static HEV hTermQSem; 697 695 698 696 if (pszDirectory && *pszDirectory) { … … 1082 1080 } 1083 1081 else { 1084 rc = DosCreateEventSem(NULL,(PHEV)&h WaitChildSem,0,FALSE);1082 rc = DosCreateEventSem(NULL,(PHEV)&hTermQSem,0,FALSE); 1085 1083 if (rc) { 1086 h WaitChildSem = (HEV)0; // Try to survive1084 hTermQSem = (HEV)0; // Try to survive 1087 1085 DosCloseQueue(hTermQ); 1088 1086 hTermQ = (HQUEUE)0; // Try to survive … … 1093 1091 } 1094 1092 } // if 1st time 1095 useTermQ = hTermQ && h WaitChildSem;1093 useTermQ = hTermQ && hTermQSem; 1096 1094 if (!rc) 1097 1095 DosExitCritSec(); … … 1134 1132 // sdata.PgmInputs, sdata.TermQ, sdata.InheritOpt, 1135 1133 // sdata.SessionType, szTermQName, 1136 // hTermQ, hWaitChildSem); fflush(stdout);1134 // hTermQ, ); fflush(stdout); 1137 1135 ret = DosStartSession(&sdata, &ulSessID, &sessPID); 1138 1136 … … 1181 1179 } 1182 1180 else { 1183 ULONG clPosted;1184 1185 DosResetEventSem(hWaitChildSem, &clPosted);1186 1181 for (ctr = 0;; ctr++) 1187 1182 { 1188 1183 if (ctr < 20) { 1189 1184 rc = DosReadQueue(hTermQ, &rq, &ulLength, (PPVOID)&pTermInfo, 0, 1190 DCWW_NOWAIT, &bPriority, h WaitChildSem);1185 DCWW_NOWAIT, &bPriority, hTermQSem); 1191 1186 if (rc == ERROR_QUE_EMPTY) { 1192 1187 DosSleep(50);//05 Aug 07 GKY 100 … … 1215 1210 1216 1211 if (pTermInfo->usSessID == ulSessID) { 1217 DosPostEventSem(hWaitChildSem); //Posted to WaitChildThread (arccnrs.c)1218 1212 priority_bumped(); 1213 break; // Our session is done 1219 1214 } 1220 1215 -
trunk/dll/systemf.h
r1268 r1271 48 48 EXECARGS; 49 49 50 extern HEV hWaitChildSem;51 52 50 INT ExecOnList(HWND hwnd, CHAR * command, INT flags, CHAR * tpath, 53 51 CHAR ** list, CHAR * prompt, PCSZ pszCallingFile, UINT uiLineNumber);
Note:
See TracChangeset
for help on using the changeset viewer.