Changeset 888 for trunk/dll/systemf.c
- Timestamp:
- Dec 22, 2007, 11:02:11 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/systemf.c
r793 r888 71 71 72 72 int ExecOnList(HWND hwnd, char *command, int flags, char *tpath, 73 char **list, char *prompt )73 char **list, char *prompt, PCSZ pszCallingFile, UINT uiLineNumber) 74 74 { 75 75 /* executes the command once for all files in list */ … … 591 591 ex.flags = flags; 592 592 ex.flags &= (~PROMPT); 593 return runemf2(ex.flags, hwnd, p ath,593 return runemf2(ex.flags, hwnd, pszCallingFile, uiLineNumber, path, 594 594 (*ex.environment) ? ex.environment : NULL, 595 595 "%s", commandline); … … 599 599 //== runemf2() run requested app, return -1 if problem starting else return app rc == 600 600 601 int runemf2(int type, HWND hwnd, char *pszDirectory, char *pszEnvironment, 601 int runemf2(int type, HWND hwnd, PCSZ pszCallingFile, UINT uiLineNumber, 602 char *pszDirectory, char *pszEnvironment, 602 603 char *formatstring,...) 603 604 { … … 605 606 606 607 * status = runemf2(SEPARATE | WINDOWED, 607 * hwnd, 608 * hwnd, pszCallingFile, __LINE__, 608 609 * NullStr, 609 610 * NULL, … … 613 614 * 614 615 * use (HWND)0 for hwnd if window handle not handy. 616 * pszCallingFile and __LINE__ are used to determine caller for easier error tracking 615 617 */ 616 618 … … 634 636 BOOL useTermQ = FALSE; 635 637 char szTempdir[CCHMAXPATH]; 638 char szTempPgm[CCHMAXPATH], tempcom[1024], temparg[1024], buf[10] = " &|<>"; 639 char *offset, *offsetexe, *offsetcom, *offsetcmd, *offsetbtm, *offsetbat; 640 UINT offsetquote; 636 641 637 642 typedef struct { … … 675 680 *pszPgm = 0; 676 681 va_start(parguments, 677 682 formatstring); 678 683 vsprintf(pszPgm, 679 684 formatstring, 680 685 parguments); 681 686 va_end(parguments); 682 687 offsetexe = strstr(pszPgm, ".exe"); 688 offsetcmd = strstr(pszPgm, ".cmd"); 689 offsetcom = strstr(pszPgm, ".com"); 690 offsetbtm = strstr(pszPgm, ".btm"); 691 offsetbat = strstr(pszPgm, ".bat"); 692 if (offsetexe) 693 offset = offsetexe; 694 else if (offsetcom) 695 offset = offsetcom; 696 else if (offsetcmd) 697 offset = offsetcmd; 698 else if (offsetbtm) 699 offset = offsetbtm; 700 else if (offsetbat) 701 offset = offsetbat; 702 else 703 offset = NULL; 704 offsetquote = strcspn(pszPgm, buf); 705 if (pszPgm[0] != '\"' && offsetquote < offset - pszPgm && offsetquote != NULL){ 706 strcpy(tempcom, pszPgm); 707 tempcom[offset + 4 - pszPgm] = '\0'; 708 strcpy (temparg, &pszPgm[offset + 4 - pszPgm]); 709 pszDirectory = szTempdir; 710 strcpy(pszDirectory, tempcom); 711 offset = strrchr(pszDirectory, '\\'); 712 pszDirectory[offset +1 - pszDirectory] = '\0'; 713 BldQuotedFileName(szTempPgm, tempcom); 714 strcat(szTempPgm, temparg); 715 memcpy(pszPgm, szTempPgm, 1024); 716 //printf("%s\n %s\n%s %s\n %d %d", 717 // pszPgm, szTempPgm, tempcom, temparg, offset, offsetquote); fflush(stdout); 718 } 683 719 if (pszEnvironment) { 684 720 p = &pszEnvironment[strlen(pszEnvironment)] + 1; … … 789 825 Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__, 790 826 GetPString(IDS_DOSQAPPTYPEFAILEDTEXT), 791 pszPgm );827 pszPgm, pszCallingFile, __LINE__); 792 828 DosFreeMem(pszPgm); 793 829 if (pszArgs) … … 801 837 Runtime_Error(pszSrcFile, __LINE__, 802 838 GetPString(IDS_APPTYPEUNEXPECTEDTEXT), 803 ulAppType, pszPgm );839 ulAppType, pszPgm, pszCallingFile, __LINE__); 804 840 if (pszPgm) 805 841 DosFreeMem(pszPgm); … … 813 849 Runtime_Error(pszSrcFile, __LINE__, 814 850 GetPString(IDS_APPTYPEUNEXPECTEDTEXT), 815 ulAppType, pszPgm );851 ulAppType, pszPgm, pszCallingFile, __LINE__); 816 852 if (pszPgm) 817 853 DosFreeMem(pszPgm); … … 834 870 if (ret) { 835 871 Dos_Error(MB_ENTER,ret,hwnd,pszSrcFile,__LINE__, 836 GetPString(IDS_DOSEXECPGMFAILEDTEXT), pszPgm); 872 GetPString(IDS_DOSEXECPGMFAILEDTEXT), pszPgm, 873 pszCallingFile, __LINE__); 837 874 } 838 875 } … … 903 940 } 904 941 905 / * goddamned OS/2 limit */942 // goddamned OS/2 limit 906 943 907 944 if (strlen(pszPgm) + strlen(pszArgs) > 1024) … … 922 959 *pszDirectory) 923 960 switch_to(szSavedir); 924 if (rc) 961 if (rc){ 925 962 Dos_Error(MB_CANCEL,rc,hwnd,pszSrcFile,__LINE__, 926 963 GetPString(IDS_DOSQAPPTYPEFAILEDTEXT), 927 pszPgm );964 pszPgm, pszCallingFile, __LINE__); 928 965 DosFreeMem(pszPgm); 929 966 if (pszArgs) … … 937 974 Runtime_Error(pszSrcFile, __LINE__, 938 975 GetPString(IDS_APPTYPEUNEXPECTEDTEXT), 939 pszPgm );976 pszPgm, pszCallingFile, __LINE__); 940 977 DosFreeMem(pszPgm); 941 978 if (pszArgs) … … 1106 1143 if (ret && ret != ERROR_SMG_START_IN_BACKGROUND) { 1107 1144 Dos_Error(MB_CANCEL,ret,hwnd,pszSrcFile,__LINE__, 1108 GetPString(IDS_DOSSTARTSESSIONFAILEDTEXT),pszPgm,pszArgs); 1145 GetPString(IDS_DOSSTARTSESSIONFAILEDTEXT),pszPgm,pszArgs, 1146 pszCallingFile, __LINE__); 1109 1147 } 1110 1148 else if (type & WAIT) {
Note:
See TracChangeset
for help on using the changeset viewer.