Changeset 918 for trunk/dll/systemf.c
- Timestamp:
- Jan 12, 2008, 9:16:37 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/systemf.c
r917 r918 43 43 static PSZ pszSrcFile = __FILE__; 44 44 45 #define MAXSTRG (4096) /* used to build command line strings */46 47 45 /** 48 46 * Bring session foreground … … 83 81 /* executes the command once for all files in list */ 84 82 85 char path[CCHMAXPATH], commandline[ 2048], modpath[CCHMAXPATH], listfile[CCHMAXPATH],83 char path[CCHMAXPATH], commandline[MAXCOMLINESTRG], modpath[CCHMAXPATH], listfile[CCHMAXPATH], 86 84 *p, *pp, drive, *file, *ext, *dot; 87 85 register int x; … … 676 674 677 675 rc = DosAllocMem((PVOID)&pszPgm, 678 MAX STRG,676 MAXCOMLINESTRG, 679 677 PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE); 680 678 if (rc) { … … 721 719 if (temp) { 722 720 rc = DosAllocMem((PVOID)&pszArgs, 723 MAX STRG * 2,721 MAXCOMLINESTRG * 2, 724 722 PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE); 725 723 if (rc) … … 854 852 if (~type & FULLSCREEN) 855 853 type |= WINDOWED; 856 rc = DosAllocMem((PVOID) & pszArgs, MAX STRG * 2,854 rc = DosAllocMem((PVOID) & pszArgs, MAXCOMLINESTRG * 2, 857 855 PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE); 858 856 if (rc) { … … 1237 1235 ulOptions |= SAF_STARTCHILDAPP; 1238 1236 1239 executable = xmallocz(MAX STRG,pszSrcFile,__LINE__);1237 executable = xmallocz(MAXCOMLINESTRG, pszSrcFile, __LINE__); 1240 1238 if (executable) { 1241 1239 va_start(parguments, formatstring); … … 1244 1242 strip_lead_char(" \t", executable); 1245 1243 if (*executable) { 1246 parameters = xmalloc(MAX STRG,pszSrcFile,__LINE__);1244 parameters = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__); 1247 1245 if (parameters) { 1248 1246 p = executable; … … 1318 1316 } 1319 1317 1320 PSZ CheckApp_QuoteAddExe(PSZ psz Pgm)1318 PSZ CheckApp_QuoteAddExe(PSZ pszQuotedCompletePgm, PSZ pszPgm) 1321 1319 { 1322 // 11 Jan 08 SHL fixme to not return quoted string on stack 1323 // 11 Jan 08 SHL fixme to have javadoc comments 1324 char szTempPgm[2048], tempcom[2048], temparg[2048]; 1320 char tempcom[MAXCOMLINESTRG], temparg[MAXCOMLINESTRG]; 1325 1321 char *offset = '\0', *offsetexe, *offsetcom, *offsetcmd, *offsetbtm, *offsetbat; 1326 1322 APIRET ret; … … 1331 1327 HDIR hdirFindHandle = HDIR_CREATE; 1332 1328 ULONG ulFindCount = 1; 1333 PSZ psz QuotedCompletePgm;1329 PSZ pszTempPgm = pszQuotedCompletePgm; 1334 1330 1335 1331 bstrip(pszPgm); … … 1396 1392 else 1397 1393 ret = DosQueryAppType(tempcom, &ulAppType); 1398 BldQuotedFileName( szTempPgm, tempcom);1394 BldQuotedFileName(pszTempPgm, tempcom); 1399 1395 //printf("%d A", ret); fflush(stdout); 1400 1396 if (ret) { 1401 1402 1403 1404 1405 1406 if (ret == MBID_YES) 1407 pszQuotedCompletePgm = pszPgm;1408 else { 1409 fCancelAction = TRUE; 1410 pszQuotedCompletePgm = pszPgm;1411 } 1412 }1413 else {1414 if (temparg[0] != ' ') 1415 strcat(szTempPgm, " "); 1416 strcat(szTempPgm, temparg);1417 pszQuotedCompletePgm = szTempPgm;1397 ret = saymsg(MB_YESNO, 1398 HWND_DESKTOP, 1399 NullStr, 1400 GetPString(IDS_PROGRAMNOTFOUNDTEXT), 1401 pszPgm); 1402 if (ret == MBID_YES){ 1403 pszTempPgm = pszPgm; 1404 } 1405 else{ 1406 fCancelAction = TRUE; 1407 pszTempPgm = pszPgm; 1408 } 1409 } 1410 else{ 1411 if (temparg[0] != ' ') 1412 strcat(pszTempPgm, " "); 1413 strcat(pszTempPgm, temparg); 1418 1414 } 1419 1415 … … 1447 1443 } 1448 1444 } 1449 if (!ret) { 1450 BldQuotedFileName(szTempPgm, tempcom); 1451 strcpy(temparg, pszPgm + strlen(tempcom) - 3); 1452 if ((temparg[0] == '\"' && temparg[1] == ' ') || 1453 !strstr(pszPgm, "\\:" ) || 1454 strchr(temparg, '\"') == strrchr(temparg, '\"')) 1455 remove_first_occurence_of_character("\"", temparg); 1456 if (strchr(temparg, '\"') != strrchr(temparg, '\"')) 1457 saymsg(MB_OK, HWND_DESKTOP, 1458 NullStr, 1459 GetPString(IDS_QUOTESINARGSTEXT), 1460 pszPgm); 1461 if (temparg[0] != ' ') 1462 strcat(szTempPgm, " "); 1463 strcat(szTempPgm, temparg); 1464 pszQuotedCompletePgm = szTempPgm; 1445 if (!ret){ 1446 BldQuotedFileName(pszTempPgm, tempcom); 1447 strcpy(temparg, pszPgm + strlen(tempcom) - 3); 1448 if ((temparg[0] == '\"' && temparg[1] == ' ') || 1449 !strstr(pszPgm, "\\:" ) || 1450 strchr(temparg, '\"') == strrchr(temparg, '\"')) 1451 remove_first_occurence_of_character("\"", temparg); 1452 if (strchr(temparg, '\"') != strrchr(temparg, '\"')) 1453 saymsg(MB_OK, HWND_DESKTOP, 1454 NullStr, 1455 GetPString(IDS_QUOTESINARGSTEXT), 1456 pszPgm); 1457 if (temparg[0] != ' ') 1458 strcat(pszTempPgm, " "); 1459 strcat(pszTempPgm, temparg); 1465 1460 } 1466 1461 else { 1467 1468 1469 1470 1471 1472 1473 pszQuotedCompletePgm = pszPgm;1462 ret = saymsg(MB_OK, 1463 HWND_DESKTOP, 1464 NullStr, 1465 GetPString(IDS_PROGRAMNOTEXE2TEXT), 1466 pszPgm); 1467 fCancelAction = TRUE; 1468 pszTempPgm = pszPgm; 1474 1469 } 1475 1470 } … … 1495 1490 ulResultBufLen, &ulFindCount, FIL_STANDARD); 1496 1491 1497 BldQuotedFileName( szTempPgm, tempcom);1492 BldQuotedFileName(pszTempPgm, tempcom); 1498 1493 //printf("%d %s ", ret, tempcom); fflush(stdout); 1499 1494 if (ret) { … … 1512 1507 } 1513 1508 ret = saymsg(MB_YESNOCANCEL, 1514 HWND_DESKTOP, 1515 NullStr, 1516 GetPString(IDS_PROGRAMNOTEXE3TEXT), 1517 pszPgm, szTempPgm); 1518 if (ret == MBID_YES) { 1519 if (temparg[0] != ' ') 1520 strcat(szTempPgm, " "); 1521 strcat(szTempPgm, temparg); 1522 pszQuotedCompletePgm = szTempPgm; 1523 } 1524 if (ret == MBID_CANCEL) { 1525 fCancelAction = TRUE; 1526 pszQuotedCompletePgm = pszPgm; 1527 } 1528 else 1529 pszQuotedCompletePgm = pszPgm; 1530 } 1531 return pszQuotedCompletePgm; 1509 HWND_DESKTOP, 1510 NullStr, 1511 GetPString(IDS_PROGRAMNOTEXE3TEXT), 1512 pszPgm, pszTempPgm); 1513 if (ret == MBID_YES){ 1514 if (temparg[0] != ' ') 1515 strcat(pszTempPgm, " "); 1516 strcat(pszTempPgm, temparg); 1517 } 1518 if (ret == MBID_CANCEL){ 1519 fCancelAction = TRUE; 1520 pszTempPgm = pszPgm; 1521 } 1522 } 1532 1523 } 1533 return pszPgm; 1524 else 1525 pszTempPgm = pszPgm; 1526 return pszQuotedCompletePgm; 1534 1527 } 1535 1528
Note:
See TracChangeset
for help on using the changeset viewer.