- Timestamp:
- Jan 13, 2008, 2:18:17 AM (18 years ago)
- Location:
- trunk/dll
- Files:
-
- 12 edited
-
assoc.c (modified) (6 diffs)
-
avv.c (modified) (3 diffs)
-
command.c (modified) (5 diffs)
-
dirsize.c (modified) (3 diffs)
-
fm3dll.h (modified) (1 diff)
-
fm3dll.str (modified) (1 diff)
-
fm3str.h (modified) (1 diff)
-
newview.c (modified) (1 diff)
-
notebook.c (modified) (10 diffs)
-
pathutil.c (modified) (3 diffs)
-
pathutil.h (modified) (1 diff)
-
systemf.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/assoc.c
r918 r920 15 15 19 Apr 07 SHL Sync with AcceptOneDrop GetOneDrop mods 16 16 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat 17 06 Jan 08 GKY Use CheckApp_QuoteAddExe to check program strings on entry17 06 Jan 08 GKY Use NormalizeCmdLine to check program strings on entry 18 18 19 19 **************************************************************************************/ … … 632 632 ASSOC temp; 633 633 CHAR dummy[34]; 634 PSZ psz ;634 PSZ pszWorkBuf; 635 635 replace = FALSE; 636 636 … … 645 645 MPFROMSHORT(0), MPFROMSHORT(TRUE)); 646 646 } 647 psz = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__);647 pszWorkBuf = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__); 648 648 memset(&temp, 0, sizeof(ASSOC)); 649 649 WinQueryDlgItemText(hwnd, ASS_MASK, sizeof(temp.mask), temp.mask); 650 650 WinQueryDlgItemText(hwnd, ASS_CL, sizeof(temp.cl), temp.cl); 651 CheckApp_QuoteAddExe(psz, temp.cl);652 memcpy(temp.cl, psz , strlen(psz) + 1);651 NormalizeCmdLine(pszWorkBuf, temp.cl); 652 memcpy(temp.cl, pszWorkBuf, strlen(pszWorkBuf) + 1); 653 653 WinQueryDlgItemText(hwnd, ASS_SIG, sizeof(temp.sig), temp.sig); 654 654 rstrip(temp.sig); … … 730 730 ASSOC temp; 731 731 CHAR dummy[34]; 732 PSZ psz ;732 PSZ pszWorkBuf; 733 733 replace = FALSE; 734 734 735 psz = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__);735 pszWorkBuf = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__); 736 736 memset(&temp, 0, sizeof(ASSOC)); 737 737 WinQueryDlgItemText(hwnd, ASS_MASK, sizeof(temp.mask), temp.mask); 738 738 WinQueryDlgItemText(hwnd, ASS_CL, sizeof(temp.cl), temp.cl); 739 CheckApp_QuoteAddExe(psz, temp.cl);740 memcpy(temp.cl, psz , strlen(psz) + 1);739 NormalizeCmdLine(pszWorkBuf, temp.cl); 740 memcpy(temp.cl, pszWorkBuf, strlen(pszWorkBuf) + 1); 741 741 WinQueryDlgItemText(hwnd, ASS_SIG, sizeof(temp.sig), temp.sig); 742 742 rstrip(temp.sig); … … 840 840 ASSOC temp; 841 841 CHAR dummy[34]; 842 PSZ psz ;842 PSZ pszWorkBuf; 843 843 replace = TRUE; 844 844 … … 847 847 LM_QUERYSELECTION, 848 848 MPFROMSHORT(LIT_CURSOR), MPVOID); 849 psz = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__);849 pszWorkBuf = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__); 850 850 memset(&temp, 0, sizeof(ASSOC)); 851 851 WinQueryDlgItemText(hwnd, ASS_MASK, sizeof(temp.mask), temp.mask); 852 852 WinQueryDlgItemText(hwnd, ASS_CL, sizeof(temp.cl), temp.cl); 853 CheckApp_QuoteAddExe(psz, temp.cl);854 memcpy(temp.cl, psz , strlen(psz) + 1);853 NormalizeCmdLine(pszWorkBuf, temp.cl); 854 memcpy(temp.cl, pszWorkBuf, strlen(pszWorkBuf) + 1); 855 855 WinQueryDlgItemText(hwnd, ASS_SIG, sizeof(temp.sig), temp.sig); 856 856 rstrip(temp.sig); -
trunk/dll/avv.c
r918 r920 23 23 16 Jun 07 SHL Update for OpenWatcom 24 24 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat 25 06 Jan 08 GKY Use CheckApp_QuoteAddExe to check program strings on entry25 06 Jan 08 GKY Use NormalizeCmdLine to check program strings on entry 26 26 27 27 ***********************************************************************/ … … 40 40 #include "errutil.h" // Runtime_Error 41 41 #include "fm3dll.h" 42 #include "pathutil.h" // NormalizeCmdLine 42 43 43 44 #pragma data_seg(DATA1) … … 92 93 static PSZ free_and_strdup_quoted_from_window(HWND hwnd, USHORT id, PSZ pszDest) 93 94 { // fixme for command line limit 94 CHAR sz [256];95 PSZ psz ;96 97 psz = xmalloc(256, pszSrcFile, __LINE__);95 CHAR szCmdLine[256]; 96 PSZ pszWorkBuf; 97 98 pszWorkBuf = xmalloc(256, pszSrcFile, __LINE__); 98 99 xfree(pszDest); 99 WinQueryDlgItemText(hwnd, id, sizeof(sz ), sz);100 if (*sz ){101 CheckApp_QuoteAddExe(psz, sz);102 pszDest = xstrdup(psz , pszSrcFile, __LINE__);100 WinQueryDlgItemText(hwnd, id, sizeof(szCmdLine), szCmdLine); 101 if (*szCmdLine){ 102 NormalizeCmdLine(pszWorkBuf, szCmdLine); 103 pszDest = xstrdup(pszWorkBuf, pszSrcFile, __LINE__); 103 104 } 104 105 else -
trunk/dll/command.c
r918 r920 21 21 19 Apr 07 SHL Sync with AcceptOneDrop GetOneDrop mods 22 22 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat 23 06 Jan 08 GKY Use CheckApp_QuoteAddExe to check program strings on entry23 06 Jan 08 GKY Use NormalizeCmdLine to check program strings on entry 24 24 25 25 ***********************************************************************/ … … 40 40 #include "strutil.h" // GetPString 41 41 #include "fm3dll.h" 42 42 #include "pathutil.h" // NormalizeCmdLine 43 43 44 44 typedef struct … … 621 621 { 622 622 COMMAND temp; 623 PSZ psz ;623 PSZ pszWorkBuf; 624 624 APIRET ret; 625 625 626 psz = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__);626 pszWorkBuf = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__); 627 627 memset(&temp, 0, sizeof(COMMAND)); 628 628 WinQueryDlgItemText(hwnd, CMD_CL, sizeof(temp.cl), temp.cl); 629 CheckApp_QuoteAddExe(psz, temp.cl);630 memcpy(temp.cl, psz , strlen(psz) + 1);629 NormalizeCmdLine(pszWorkBuf, temp.cl); 630 memcpy(temp.cl, pszWorkBuf, strlen(pszWorkBuf) + 1); 631 631 if (!strchr(temp.cl, '%')){ 632 632 ret = saymsg(MB_YESNO, … … 716 716 { 717 717 COMMAND temp; 718 PSZ psz ;718 PSZ pszWorkBuf; 719 719 APIRET ret; 720 720 721 psz = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__);721 pszWorkBuf = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__); 722 722 memset(&temp, 0, sizeof(COMMAND)); 723 723 WinQueryDlgItemText(hwnd, CMD_CL, sizeof(temp.cl), temp.cl); 724 CheckApp_QuoteAddExe(psz, temp.cl);725 memcpy(temp.cl, psz , strlen(psz) + 1);724 NormalizeCmdLine(pszWorkBuf, temp.cl); 725 memcpy(temp.cl, pszWorkBuf, strlen(pszWorkBuf) + 1); 726 726 if (!strchr(temp.cl, '%')){ 727 727 ret = saymsg(MB_YESNO, … … 816 816 case CMD_REPLACE: 817 817 { //Delete first 818 PSZ psz ;818 PSZ pszWorkBuf; 819 819 COMMAND temp; 820 820 APIRET ret; 821 821 822 psz = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__);822 pszWorkBuf = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__); 823 823 memset(&temp, 0, sizeof(COMMAND)); 824 824 WinQueryDlgItemText(hwnd, CMD_CL, sizeof(temp.cl), temp.cl); 825 CheckApp_QuoteAddExe(psz, temp.cl);826 memcpy(temp.cl, psz , strlen(psz) + 1);825 NormalizeCmdLine(pszWorkBuf, temp.cl); 826 memcpy(temp.cl, pszWorkBuf, strlen(pszWorkBuf) + 1); 827 827 if (fCancelAction){ 828 828 fCancelAction = FALSE; -
trunk/dll/dirsize.c
r907 r920 92 92 CHAR maskstr[CCHMAXPATH]; 93 93 CHAR szBuf[CCHMAXPATH]; 94 CHAR FileSystem[CCHMAXPATH]; 94 95 CHAR *pEndMask; 95 96 register char *p; … … 109 110 *pullTotalBytes = 0; // In case we fail 110 111 112 CheckDrive(toupper(*pszFileName), FileSystem, NULL); 113 /*if (!stricmp(FileSystem, NTFS)) { 114 saymsg(MB_OK, 115 HWND_DESKTOP, 116 NullStr, 117 GetPString(IDS_NTFSDRIVERFAILSTEXT)); 118 return FALSE; 119 } */ 111 120 ulBufBytes = sizeof(FILEFINDBUF4L) * FilesToGet; 112 121 pffbArray = xmalloc(ulBufBytes, pszSrcFile, __LINE__); … … 138 147 * requesting EASIZE. sheesh. 139 148 */ 140 if (( !rc&& (pffbArray->attrFile & FILE_DIRECTORY)) || strlen(pszFileName) < 4) {149 if (((!rc || rc == ERROR_NO_MORE_FILES) && (pffbArray->attrFile & FILE_DIRECTORY)) || strlen(pszFileName) < 4) { 141 150 if (*pchStopFlag) { 142 151 free(pffbArray); -
trunk/dll/fm3dll.h
r918 r920 684 684 HAPP Exec(HWND hwndNotify, BOOL child, char *startdir, char *env, 685 685 PROGTYPE * progt, ULONG fl, char *formatstring, ...); 686 PSZ CheckApp_QuoteAddExe(PSZ pszQuotedCompletePgm, PSZ pszPgm);687 686 #define MAXCOMLINESTRG (4096) /* used to build command line strings */ 688 687 #define RUNTYPE_MASK 0xf -
trunk/dll/fm3dll.str
r919 r920 723 723 Unknown datatype 0x%04x (%u bytes) 724 724 FM/2 Databar 725 Spare 724 725 The NTFS.IFS fails with a NO_MORE_FILES_ERROR on each subdirectory. We have not found a work around as yet. 726 726 Sun 727 727 Mon -
trunk/dll/fm3str.h
r919 r920 717 717 #define IDS_UNKNOWNBYTESTEXT 722 718 718 #define IDS_DATABARTITLETEXT 723 719 #define IDS_ SPARE_724 724 // available719 #define IDS_NTFSDRIVERFAILSTEXT 724 720 720 #define IDS_SUNDAY 725 721 721 #define IDS_MONDAY 726 -
trunk/dll/newview.c
r907 r920 1962 1962 1963 1963 case UM_SETUP2: 1964 /* 1964 /** 1965 1965 * calculate width of client in characters, recalc lines if 1966 1966 * oldwidth != newwidth, set ad->oldwidth for later comparison -
trunk/dll/notebook.c
r919 r920 21 21 21 Aug 07 GKY Make Subject column in dircnr sizable and movable from the rigth to the left pane 22 22 26 Nov 07 GKY Allow a currently nonvalid path in the ext path field with warning 23 06 Jan 08 GKY Use CheckApp_QuoteAddExe to check program strings on entry23 06 Jan 08 GKY Use NormalizeCmdLine to check program strings on entry 24 24 10 Jan 08 SHL Remember last settings page 25 25 10 Jan 08 SHL Rework page select logic … … 194 194 { 195 195 CHAR szCLBuf[MAXCOMLINESTRG], szPathBuf[CCHMAXPATH]; 196 PSZ psz ;197 198 psz = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__);196 PSZ pszWorkBuf; 197 198 pszWorkBuf = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__); 199 199 WinQueryDlgItemText(hwnd, CFGA_VIRUS, MAXCOMLINESTRG, szCLBuf); 200 200 szCLBuf[MAXCOMLINESTRG - 1] = 0; 201 201 if (strcmp(szCLBuf, virus)){ 202 CheckApp_QuoteAddExe(psz, szCLBuf);203 memcpy(virus, psz , strlen(psz) + 1);202 NormalizeCmdLine(pszWorkBuf, szCLBuf); 203 memcpy(virus, pszWorkBuf, strlen(pszWorkBuf) + 1); 204 204 if (!strchr(virus, '%') && strlen(virus) > 3) 205 205 strcat(virus, " %p"); … … 458 458 { 459 459 CHAR szCLBuf[MAXCOMLINESTRG]; 460 PSZ psz ;461 462 psz = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__);460 PSZ pszWorkBuf; 461 462 pszWorkBuf = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__); 463 463 WinQueryDlgItemText(hwnd, CFGV_VIEWER, MAXCOMLINESTRG, szCLBuf); 464 464 szCLBuf[MAXCOMLINESTRG - 1] = 0; 465 465 if (strcmp(szCLBuf, viewer)){ 466 CheckApp_QuoteAddExe(psz, szCLBuf);467 memcpy(viewer, psz , strlen(psz) + 1);466 NormalizeCmdLine(pszWorkBuf, szCLBuf); 467 memcpy(viewer, pszWorkBuf, strlen(pszWorkBuf) + 1); 468 468 if (!strchr(viewer, '%') && strlen(viewer) > 3) 469 469 strcat(viewer, " %a"); … … 472 472 szCLBuf[MAXCOMLINESTRG - 1] = 0; 473 473 if (strcmp(szCLBuf, editor)){ 474 CheckApp_QuoteAddExe(psz, szCLBuf);475 memcpy(editor, psz , strlen(psz) + 1);474 NormalizeCmdLine(pszWorkBuf, szCLBuf); 475 memcpy(editor, pszWorkBuf, strlen(pszWorkBuf) + 1); 476 476 if (!strchr(editor, '%') && strlen(editor) > 3) 477 477 strcat(editor, " %a"); … … 480 480 szCLBuf[MAXCOMLINESTRG - 1] = 0; 481 481 if (strcmp(szCLBuf, binview)){ 482 CheckApp_QuoteAddExe(psz, szCLBuf);483 memcpy(binview, psz , strlen(psz) + 1);482 NormalizeCmdLine(pszWorkBuf, szCLBuf); 483 memcpy(binview, pszWorkBuf, strlen(pszWorkBuf) + 1); 484 484 if (!strchr(binview, '%') && strlen(binview) > 3) 485 485 strcat(binview, " %a"); … … 488 488 szCLBuf[MAXCOMLINESTRG - 1] = 0; 489 489 if (strcmp(szCLBuf, bined)){ 490 CheckApp_QuoteAddExe(psz, szCLBuf);491 memcpy(bined, psz , strlen(psz) + 1);490 NormalizeCmdLine(pszWorkBuf, szCLBuf); 491 memcpy(bined, pszWorkBuf, strlen(pszWorkBuf) + 1); 492 492 if (!strchr(bined, '%') && strlen(bined) > 3) 493 493 strcat(bined, " %a"); … … 652 652 // they contain args. 653 653 CHAR szCLBuf[MAXCOMLINESTRG], szPathBuf[CCHMAXPATH]; 654 PSZ psz ;655 656 psz = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__);654 PSZ pszWorkBuf; 655 656 pszWorkBuf = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__); 657 657 WinQueryDlgItemText(hwnd, CFGH_RUNHTTPWORKDIR, CCHMAXPATH, szPathBuf); 658 658 szPathBuf[CCHMAXPATH - 1] = 0; … … 670 670 szCLBuf[MAXCOMLINESTRG - 1] = 0; 671 671 if (strcmp(szCLBuf, ftprun)){ 672 CheckApp_QuoteAddExe(psz, szCLBuf);673 memcpy(ftprun, psz , strlen(psz) + 1);672 NormalizeCmdLine(pszWorkBuf, szCLBuf); 673 memcpy(ftprun, pszWorkBuf, strlen(pszWorkBuf) + 1); 674 674 } 675 675 WinQueryDlgItemText(hwnd, CFGH_HTTPRUN, MAXCOMLINESTRG, szCLBuf); 676 676 szCLBuf[MAXCOMLINESTRG - 1] = 0; 677 677 if (strcmp(szCLBuf, httprun)){ 678 CheckApp_QuoteAddExe(psz, szCLBuf);679 memcpy(httprun, psz , strlen(psz) + 1);678 NormalizeCmdLine(pszWorkBuf, szCLBuf); 679 memcpy(httprun, pszWorkBuf, strlen(pszWorkBuf) + 1); 680 680 } 681 681 WinQueryDlgItemText(hwnd, CFGH_MAILRUN, MAXCOMLINESTRG, szCLBuf); 682 682 szCLBuf[MAXCOMLINESTRG - 1] = 0; 683 683 if (strcmp(szCLBuf, mailrun)){ 684 CheckApp_QuoteAddExe(psz, szCLBuf);685 memcpy(mailrun, psz , strlen(psz) + 1);684 NormalizeCmdLine(pszWorkBuf, szCLBuf); 685 memcpy(mailrun, pszWorkBuf, strlen(pszWorkBuf) + 1); 686 686 } 687 687 PrfWriteProfileString(fmprof, appname, "HttpRunDir", httprundir); … … 1263 1263 { 1264 1264 CHAR szCLBuf[MAXCOMLINESTRG]; 1265 PSZ psz ;1266 1267 psz = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__);1265 PSZ pszWorkBuf; 1266 1267 pszWorkBuf = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__); 1268 1268 WinQueryDlgItemText(hwnd, CFGC_DIRCOMPARE, MAXCOMLINESTRG, szCLBuf); 1269 1269 szCLBuf[MAXCOMLINESTRG - 1] = 0; 1270 1270 if (strcmp(szCLBuf, dircompare)){ 1271 CheckApp_QuoteAddExe(psz, szCLBuf);1272 memcpy(dircompare, psz , strlen(psz) + 1);1271 NormalizeCmdLine(pszWorkBuf, szCLBuf); 1272 memcpy(dircompare, pszWorkBuf, strlen(pszWorkBuf) + 1); 1273 1273 if (!strchr(dircompare, '%') && strlen(dircompare) > 3) 1274 1274 strcat(dircompare, " %a"); … … 1278 1278 szCLBuf[MAXCOMLINESTRG - 1] = 0; 1279 1279 if (strcmp(szCLBuf, compare)){ 1280 CheckApp_QuoteAddExe(psz, szCLBuf);1281 memcpy(compare, psz , strlen(psz) + 1);1280 NormalizeCmdLine(pszWorkBuf, szCLBuf); 1281 memcpy(compare, pszWorkBuf, strlen(pszWorkBuf) + 1); 1282 1282 if (!strchr(compare, '%') && strlen(compare) > 3) 1283 1283 strcat(compare, " %a"); -
trunk/dll/pathutil.c
r907 r920 10 10 11 11 05 Jan 08 SHL Move from arccnrs.c and comp.c to here 12 06 Jan 08 GKY Add NormalizeCmdLine to check program strings on entry 12 13 13 14 ***********************************************************************/ … … 16 17 17 18 #define INCL_WIN 19 #define INCL_DOS 18 20 #define INCL_LONGLONG 19 21 20 22 #include "pathutil.h" 21 23 #include "fm3dll.h" // needs_quoting 24 #include "fm3str.h" 25 #include "errutil.h" // Dos_Error... 26 #include "strutil.h" // GetPString 22 27 23 28 // #pragma data_seg(DATA1) … … 96 101 } 97 102 103 /** NormalizeCmdLine 104 * Checks a command line for common errors (missing quotes, missing extension, 105 * no space between exe and args etc) 106 * Command line passed as pszCmdLine_ 107 * A pointer to a buffer of the size MAXCOMLINESTRG should be supplied in 108 * pszWorkBuf. This is where the quoted etc as necessary command 109 * line string will be returned. 110 */ 111 112 PCSZ NormalizeCmdLine(PSZ pszWorkBuf, PSZ pszCmdLine_) 113 { 114 char szCmdLine[MAXCOMLINESTRG], szArgs[MAXCOMLINESTRG]; 115 char *offset = '\0', *offsetexe, *offsetcom, *offsetcmd, *offsetbtm, *offsetbat; 116 APIRET ret; 117 ULONG ulAppType; 118 char *pszChar; 119 FILEFINDBUF3 FindBuffer; 120 ULONG ulResultBufLen = sizeof(FILEFINDBUF3); 121 HDIR hdirFindHandle = HDIR_CREATE; 122 ULONG ulFindCount = 1; 123 PSZ pszNewCmdLine = pszWorkBuf; 124 125 bstrip(pszCmdLine_); 126 strcpy(szCmdLine, pszCmdLine_); 127 if (szCmdLine[0] != '\0') { 128 offsetexe = strstr(strlwr(pszCmdLine_), ".exe"); 129 offsetcmd = strstr(strlwr(pszCmdLine_), ".cmd"); 130 offsetcom = strstr(strlwr(pszCmdLine_), ".com"); 131 offsetbtm = strstr(strlwr(pszCmdLine_), ".btm"); 132 offsetbat = strstr(strlwr(pszCmdLine_), ".bat"); 133 if (offsetexe) 134 offset = offsetexe; 135 else { 136 if (offsetcom) 137 offset = offsetcom; 138 else { 139 if (offsetcmd) 140 offset = offsetcmd; 141 else { 142 if (offsetbtm) 143 offset = offsetbtm; 144 else { 145 if (offsetbat) 146 offset = offsetexe; 147 } 148 } 149 } 150 } 151 if (offset) { 152 szCmdLine[offset + 4 - pszCmdLine_] = '\0'; 153 strcpy(szArgs, &pszCmdLine_[offset + 4 - pszCmdLine_]); 154 while (strchr(szCmdLine, '\"')) 155 remove_first_occurence_of_character("\"", szCmdLine); 156 if ((szArgs[0] == '\"' && szArgs[1] == ' ') || 157 !strstr(pszCmdLine_, "\\:")|| 158 strchr(szArgs, '\"') == strrchr(szArgs, '\"')) 159 remove_first_occurence_of_character("\"", szArgs); 160 if (strchr(szArgs, '\"') != strrchr(szArgs, '\"')) 161 saymsg(MB_OK, HWND_DESKTOP, 162 NullStr, 163 GetPString(IDS_QUOTESINARGSTEXT), 164 pszCmdLine_); 165 if (!offsetexe) { 166 ret = DosFindFirst(szCmdLine, &hdirFindHandle, FILE_NORMAL, &FindBuffer, 167 ulResultBufLen, &ulFindCount, FIL_STANDARD); 168 if (ret) { 169 pszChar = szCmdLine; 170 while (pszChar) { 171 if (*pszChar == ' ') { 172 *pszChar = '\0'; 173 strcat(szCmdLine, ".exe"); 174 ret = DosQueryAppType(szCmdLine, &ulAppType); 175 //printf("%d %s\n", ret, szCmdLine); fflush(stdout); 176 if (!ret) { 177 strcpy(szArgs, pszCmdLine_ + strlen(szCmdLine) - 3); 178 break; 179 } 180 } 181 strcpy(szCmdLine, pszCmdLine_); 182 pszChar++; 183 } 184 } 185 } 186 else 187 ret = DosQueryAppType(szCmdLine, &ulAppType); 188 BldQuotedFileName(pszNewCmdLine, szCmdLine); 189 //printf("%d A", ret); fflush(stdout); 190 if (ret) { 191 ret = saymsg(MB_YESNO, 192 HWND_DESKTOP, 193 NullStr, 194 GetPString(IDS_PROGRAMNOTFOUNDTEXT), 195 pszCmdLine_); 196 if (ret == MBID_YES){ 197 pszNewCmdLine = pszCmdLine_; 198 } 199 else{ 200 fCancelAction = TRUE; 201 pszNewCmdLine = pszCmdLine_; 202 } 203 } 204 else{ 205 if (szArgs[0] != ' ') 206 strcat(pszNewCmdLine, " "); 207 strcat(pszNewCmdLine, szArgs); 208 } 209 210 } 211 else if (szCmdLine && (!strchr(szCmdLine, '.') || 212 strrchr(szCmdLine, '.' ) < strrchr(szCmdLine, '\\'))) { 213 if (!strchr(szCmdLine, ' ')) { 214 while (strchr(szCmdLine, '\"')) 215 remove_first_occurence_of_character("\"", szCmdLine); 216 strcat(szCmdLine, ".exe"); 217 ret = DosFindFirst(szCmdLine, &hdirFindHandle, FILE_NORMAL, &FindBuffer, 218 ulResultBufLen, &ulFindCount, FIL_STANDARD); 219 //printf("%d", ret); fflush(stdout); 220 } 221 else { 222 pszChar = szCmdLine; 223 while (pszChar) { 224 while (strchr(szCmdLine, '\"')) 225 remove_first_occurence_of_character("\"", szCmdLine); 226 if (*pszChar == ' ') { 227 *pszChar = '\0'; 228 strcat(szCmdLine, ".exe"); 229 ret = DosQueryAppType(szCmdLine, &ulAppType); 230 //printf("%d %s\n", ret, szCmdLine); fflush(stdout); 231 if (!ret) { 232 break; 233 } 234 } 235 strcpy(szCmdLine, pszCmdLine_); 236 pszChar++; 237 } 238 } 239 if (!ret){ 240 BldQuotedFileName(pszNewCmdLine, szCmdLine); 241 strcpy(szArgs, pszCmdLine_ + strlen(szCmdLine) - 3); 242 if ((szArgs[0] == '\"' && szArgs[1] == ' ') || 243 !strstr(pszCmdLine_, "\\:" ) || 244 strchr(szArgs, '\"') == strrchr(szArgs, '\"')) 245 remove_first_occurence_of_character("\"", szArgs); 246 if (strchr(szArgs, '\"') != strrchr(szArgs, '\"')) 247 saymsg(MB_OK, HWND_DESKTOP, 248 NullStr, 249 GetPString(IDS_QUOTESINARGSTEXT), 250 pszCmdLine_); 251 if (szArgs[0] != ' ') 252 strcat(pszNewCmdLine, " "); 253 strcat(pszNewCmdLine, szArgs); 254 } 255 else { 256 ret = saymsg(MB_OK, 257 HWND_DESKTOP, 258 NullStr, 259 GetPString(IDS_PROGRAMNOTEXE2TEXT), 260 pszCmdLine_); 261 fCancelAction = TRUE; 262 pszNewCmdLine = pszCmdLine_; 263 } 264 } 265 else { 266 pszChar = strrchr(szCmdLine, '.'); 267 while (pszChar && *pszChar !=' ') { 268 pszChar++; 269 } 270 *pszChar = '\0'; 271 strcpy (szArgs, pszCmdLine_ + strlen(szCmdLine)); 272 while (strchr(szCmdLine, '\"')) 273 remove_first_occurence_of_character("\"", szCmdLine); 274 if ((szArgs[0] == '\"' && szArgs[1] == ' ') || 275 !strstr(pszCmdLine_, "\\:")|| 276 strchr(szArgs, '\"') == strrchr(szArgs, '\"')) 277 remove_first_occurence_of_character("\"", szArgs); 278 if (strchr(szArgs, '\"') != strrchr(szArgs, '\"')) 279 saymsg(MB_OK, HWND_DESKTOP, 280 NullStr, 281 GetPString(IDS_QUOTESINARGSTEXT), 282 pszCmdLine_); 283 ret = DosFindFirst(szCmdLine, &hdirFindHandle, FILE_NORMAL, &FindBuffer, 284 ulResultBufLen, &ulFindCount, FIL_STANDARD); 285 286 BldQuotedFileName(pszNewCmdLine, szCmdLine); 287 //printf("%d %s ", ret, szCmdLine); fflush(stdout); 288 if (ret) { 289 ret = saymsg(MB_YESNO, 290 HWND_DESKTOP, 291 NullStr, 292 GetPString(IDS_PROGRAMNOTFOUNDTEXT), 293 pszCmdLine_); 294 if (ret == MBID_YES) { 295 pszWorkBuf = pszCmdLine_; 296 } 297 else { 298 fCancelAction = TRUE; 299 pszWorkBuf = pszCmdLine_; 300 } 301 } 302 ret = saymsg(MB_YESNOCANCEL, 303 HWND_DESKTOP, 304 NullStr, 305 GetPString(IDS_PROGRAMNOTEXE3TEXT), 306 pszCmdLine_, pszNewCmdLine); 307 if (ret == MBID_YES){ 308 if (szArgs[0] != ' ') 309 strcat(pszNewCmdLine, " "); 310 strcat(pszNewCmdLine, szArgs); 311 } 312 if (ret == MBID_CANCEL){ 313 fCancelAction = TRUE; 314 pszNewCmdLine = pszCmdLine_; 315 } 316 } 317 } 318 return pszWorkBuf; 319 } 320 98 321 #pragma alloc_text(PATHUTIL,BldFullPathName) 99 322 #pragma alloc_text(PATHUTIL,BldQuotedFileName) 100 323 #pragma alloc_text(PATHUTIL,BldQuotedFullPathName) 324 #pragma alloc_text(PATHUTIL,NormalizeCmdLine) -
trunk/dll/pathutil.h
r907 r920 25 25 PSZ BldQuotedFullPathName(PSZ pszFullPathName, PSZ pszPathName, PSZ pszFileName); 26 26 PSZ BldQuotedFileName(PSZ pszQuotedFileName, PSZ pszFileName); 27 PCSZ NormalizeCmdLine(PSZ pszWorkBuf, PSZ pszCmdLine_); 27 28 28 29 #endif // PATHUTIL_H -
trunk/dll/systemf.c
r918 r920 20 20 06 Aug 07 GKY Reduce DosSleep times (ticket 148) 21 21 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat 22 06 Jan 08 GKY Add CheckApp_QuoteAddExe to check program strings on entry23 22 24 23 ***********************************************************************/ … … 611 610 char *formatstring,...) 612 611 { 613 /* example:612 /** example: 614 613 615 614 * status = runemf2(SEPARATE | WINDOWED, … … 625 624 */ 626 625 627 /* 626 /** 628 627 * type bitmapped flag -- see FM3DLL.H 629 628 */ … … 1316 1315 } 1317 1316 1318 PSZ CheckApp_QuoteAddExe(PSZ pszQuotedCompletePgm, PSZ pszPgm) 1319 { 1320 char tempcom[MAXCOMLINESTRG], temparg[MAXCOMLINESTRG]; 1321 char *offset = '\0', *offsetexe, *offsetcom, *offsetcmd, *offsetbtm, *offsetbat; 1322 APIRET ret; 1323 ULONG ulAppType; 1324 char *pszChar; 1325 FILEFINDBUF3 FindBuffer; 1326 ULONG ulResultBufLen = sizeof(FILEFINDBUF3); 1327 HDIR hdirFindHandle = HDIR_CREATE; 1328 ULONG ulFindCount = 1; 1329 PSZ pszTempPgm = pszQuotedCompletePgm; 1330 1331 bstrip(pszPgm); 1332 strcpy(tempcom, pszPgm); 1333 if (tempcom[0] != '\0') { 1334 offsetexe = strstr(strlwr(pszPgm), ".exe"); 1335 offsetcmd = strstr(strlwr(pszPgm), ".cmd"); 1336 offsetcom = strstr(strlwr(pszPgm), ".com"); 1337 offsetbtm = strstr(strlwr(pszPgm), ".btm"); 1338 offsetbat = strstr(strlwr(pszPgm), ".bat"); 1339 if (offsetexe) 1340 offset = offsetexe; 1341 else { 1342 if (offsetcom) 1343 offset = offsetcom; 1344 else { 1345 if (offsetcmd) 1346 offset = offsetcmd; 1347 else { 1348 if (offsetbtm) 1349 offset = offsetbtm; 1350 else { 1351 if (offsetbat) 1352 offset = offsetexe; 1353 } 1354 } 1355 } 1356 } 1357 if (offset) { 1358 tempcom[offset + 4 - pszPgm] = '\0'; 1359 strcpy(temparg, &pszPgm[offset + 4 - pszPgm]); 1360 while (strchr(tempcom, '\"')) 1361 remove_first_occurence_of_character("\"", tempcom); 1362 if ((temparg[0] == '\"' && temparg[1] == ' ') || 1363 !strstr(pszPgm, "\\:")|| 1364 strchr(temparg, '\"') == strrchr(temparg, '\"')) 1365 remove_first_occurence_of_character("\"", temparg); 1366 if (strchr(temparg, '\"') != strrchr(temparg, '\"')) 1367 saymsg(MB_OK, HWND_DESKTOP, 1368 NullStr, 1369 GetPString(IDS_QUOTESINARGSTEXT), 1370 pszPgm); 1371 if (!offsetexe) { 1372 ret = DosFindFirst(tempcom, &hdirFindHandle, FILE_NORMAL, &FindBuffer, 1373 ulResultBufLen, &ulFindCount, FIL_STANDARD); 1374 if (ret) { 1375 pszChar = tempcom; 1376 while (pszChar) { 1377 if (*pszChar == ' ') { 1378 *pszChar = '\0'; 1379 strcat(tempcom, ".exe"); 1380 ret = DosQueryAppType(tempcom, &ulAppType); 1381 //printf("%d %s\n", ret, tempcom); fflush(stdout); 1382 if (!ret) { 1383 strcpy(temparg, pszPgm + strlen(tempcom) - 3); 1384 break; 1385 } 1386 } 1387 strcpy(tempcom, pszPgm); 1388 pszChar++; 1389 } 1390 } 1391 } 1392 else 1393 ret = DosQueryAppType(tempcom, &ulAppType); 1394 BldQuotedFileName(pszTempPgm, tempcom); 1395 //printf("%d A", ret); fflush(stdout); 1396 if (ret) { 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); 1414 } 1415 1416 } 1417 else if (tempcom && (!strchr(tempcom, '.') || 1418 strrchr(tempcom, '.' ) < strrchr(tempcom, '\\'))) { 1419 if (!strchr(tempcom, ' ')) { 1420 while (strchr(tempcom, '\"')) 1421 remove_first_occurence_of_character("\"", tempcom); 1422 strcat(tempcom, ".exe"); 1423 ret = DosFindFirst(tempcom, &hdirFindHandle, FILE_NORMAL, &FindBuffer, 1424 ulResultBufLen, &ulFindCount, FIL_STANDARD); 1425 //printf("%d", ret); fflush(stdout); 1426 } 1427 else { 1428 pszChar = tempcom; 1429 while (pszChar) { 1430 while (strchr(tempcom, '\"')) 1431 remove_first_occurence_of_character("\"", tempcom); 1432 if (*pszChar == ' ') { 1433 *pszChar = '\0'; 1434 strcat(tempcom, ".exe"); 1435 ret = DosQueryAppType(tempcom, &ulAppType); 1436 //printf("%d %s\n", ret, tempcom); fflush(stdout); 1437 if (!ret) { 1438 break; 1439 } 1440 } 1441 strcpy(tempcom, pszPgm); 1442 pszChar++; 1443 } 1444 } 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); 1460 } 1461 else { 1462 ret = saymsg(MB_OK, 1463 HWND_DESKTOP, 1464 NullStr, 1465 GetPString(IDS_PROGRAMNOTEXE2TEXT), 1466 pszPgm); 1467 fCancelAction = TRUE; 1468 pszTempPgm = pszPgm; 1469 } 1470 } 1471 else { 1472 pszChar = strrchr(tempcom, '.'); 1473 while (pszChar && *pszChar !=' ') { 1474 pszChar++; 1475 } 1476 *pszChar = '\0'; 1477 strcpy (temparg, pszPgm + strlen(tempcom)); 1478 while (strchr(tempcom, '\"')) 1479 remove_first_occurence_of_character("\"", tempcom); 1480 if ((temparg[0] == '\"' && temparg[1] == ' ') || 1481 !strstr(pszPgm, "\\:")|| 1482 strchr(temparg, '\"') == strrchr(temparg, '\"')) 1483 remove_first_occurence_of_character("\"", temparg); 1484 if (strchr(temparg, '\"') != strrchr(temparg, '\"')) 1485 saymsg(MB_OK, HWND_DESKTOP, 1486 NullStr, 1487 GetPString(IDS_QUOTESINARGSTEXT), 1488 pszPgm); 1489 ret = DosFindFirst(tempcom, &hdirFindHandle, FILE_NORMAL, &FindBuffer, 1490 ulResultBufLen, &ulFindCount, FIL_STANDARD); 1491 1492 BldQuotedFileName(pszTempPgm, tempcom); 1493 //printf("%d %s ", ret, tempcom); fflush(stdout); 1494 if (ret) { 1495 ret = saymsg(MB_YESNO, 1496 HWND_DESKTOP, 1497 NullStr, 1498 GetPString(IDS_PROGRAMNOTFOUNDTEXT), 1499 pszPgm); 1500 if (ret == MBID_YES) { 1501 pszQuotedCompletePgm = pszPgm; 1502 } 1503 else { 1504 fCancelAction = TRUE; 1505 pszQuotedCompletePgm = pszPgm; 1506 } 1507 } 1508 ret = saymsg(MB_YESNOCANCEL, 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 } 1523 } 1524 else 1525 pszTempPgm = pszPgm; 1526 return pszQuotedCompletePgm; 1527 } 1528 1529 #pragma alloc_text(SYSTEMF,ShowSession,ExecOnList,runemf2,CheckApp_QuoteAddExe) 1317 #pragma alloc_text(SYSTEMF,ShowSession,ExecOnList,runemf2)
Note:
See TracChangeset
for help on using the changeset viewer.
