Changeset 989
- Timestamp:
- Mar 2, 2008, 12:34:12 AM (18 years ago)
- Location:
- trunk/dll
- Files:
-
- 1 added
- 14 edited
-
arccnrs.h (modified) (1 diff)
-
assoc.c (modified) (2 diffs)
-
avv.c (modified) (2 diffs)
-
collect.c (modified) (1 diff)
-
command.c (modified) (11 diffs)
-
command.h (added)
-
dircnrs.c (modified) (1 diff)
-
fm3dll.h (modified) (3 diffs)
-
init.c (modified) (2 diffs)
-
mainwnd.c (modified) (2 diffs)
-
mainwnd2.c (modified) (1 diff)
-
misc.c (modified) (3 diffs)
-
pathutil.c (modified) (2 diffs)
-
systemf.c (modified) (5 diffs)
-
treecnr.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/arccnrs.h
r907 r989 34 34 MRESULT EXPENTRY ArcFolderProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); 35 35 MRESULT EXPENTRY ArcObjWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); 36 PSZ BldQuotedFullPathName(PSZ pszFullPathName, PSZ pszPathName, PSZ pszFileName);37 PSZ BldQuotedFileName(PSZ pszQuotedFileName, PSZ pszFileName);38 36 39 37 #endif // ARCCNRS_H -
trunk/dll/assoc.c
r985 r989 275 275 while (info) { 276 276 fprintf(fp, 277 ";\n%0.*s\n%0. 4096s\n%0.*s\n%lu\n%lu\n",277 ";\n%0.*s\n%0.*s\n%0.*s\n%lu\n%lu\n", 278 278 CCHMAXPATH, 279 info->mask, 279 info->mask, 280 MaxComLineStrg, 280 281 info->pszCmdLine, 281 282 CCHMAXPATH, … … 510 511 case UM_UNDO: 511 512 { 512 CHAR s[4096]; 513 514 WinSendDlgItemMsg(hwnd, ASS_LISTBOX, LM_DELETEALL, MPVOID, MPVOID); 515 info = asshead; 516 while (info) { 517 sprintf(s, 518 "%-12s \x1a %-24s %s%s%s", 519 info->mask, 520 info->pszCmdLine, 521 (info->sig && *info->sig) ? 522 "[" : NullStr, 523 (info->sig && *info->sig) ? info->sig : NullStr, 524 (info->sig && *info->sig) ? "]" : NullStr); 525 x = (SHORT) WinSendDlgItemMsg(hwnd, 526 ASS_LISTBOX, 527 LM_INSERTITEM, 528 MPFROM2SHORT(LIT_END, 0), MPFROMP(s)); 529 if (x >= 0) 530 WinSendDlgItemMsg(hwnd, 531 ASS_LISTBOX, 532 LM_SETITEMHANDLE, MPFROMSHORT(x), MPFROMP(info)); 533 info = info->next; 534 } 535 WinSendDlgItemMsg(hwnd, 536 ASS_LISTBOX, 537 LM_SELECTITEM, MPFROMSHORT(0), MPFROMSHORT(TRUE)); 513 PSZ pszDisplayStr; 514 515 pszDisplayStr = xmallocz((CCHMAXPATH * 2) + MaxComLineStrg + 6, 516 pszSrcFile, __LINE__); 517 if (pszDisplayStr) { 518 WinSendDlgItemMsg(hwnd, ASS_LISTBOX, LM_DELETEALL, MPVOID, MPVOID); 519 info = asshead; 520 while (info) { 521 sprintf(pszDisplayStr, 522 "%-12s \x1a %-24s %s%s%s", 523 info->mask, 524 info->pszCmdLine, 525 (info->sig && *info->sig) ? 526 "[" : NullStr, 527 (info->sig && *info->sig) ? info->sig : NullStr, 528 (info->sig && *info->sig) ? "]" : NullStr); 529 x = (SHORT) WinSendDlgItemMsg(hwnd, 530 ASS_LISTBOX, 531 LM_INSERTITEM, 532 MPFROM2SHORT(LIT_END, 0), MPFROMP(pszDisplayStr)); 533 if (x >= 0) 534 WinSendDlgItemMsg(hwnd, 535 ASS_LISTBOX, 536 LM_SETITEMHANDLE, MPFROMSHORT(x), MPFROMP(info)); 537 info = info->next; 538 } 539 WinSendDlgItemMsg(hwnd, 540 ASS_LISTBOX, 541 LM_SELECTITEM, MPFROMSHORT(0), MPFROMSHORT(TRUE)); 542 xfree(pszDisplayStr); 543 } 538 544 } 539 545 return 0; -
trunk/dll/avv.c
r985 r989 95 95 { // fixme for command line limit 96 96 CHAR *szCmdLine; 97 PSZ pszWorkBuf; 97 98 98 99 szCmdLine = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__); 99 if (!szCmdLine) 100 return NULL; //already complained 101 xfree(pszDest); 102 WinQueryDlgItemText(hwnd, id, sizeof(szCmdLine), szCmdLine); 103 if (*szCmdLine){ 104 PSZ pszWorkBuf; 100 if (szCmdLine) { 101 xfree(pszDest); 102 WinQueryDlgItemText(hwnd, id, sizeof(szCmdLine), szCmdLine); 105 103 pszWorkBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__); 106 104 if (pszWorkBuf) { … … 111 109 else 112 110 pszDest = xstrdup(szCmdLine, pszSrcFile, __LINE__); // return the unexamined input on failure 111 xfree(szCmdLine); 113 112 } 114 113 else 115 114 pszDest = NULL; 116 xfree(szCmdLine);117 115 return pszDest; 118 116 } -
trunk/dll/collect.c
r985 r989 74 74 #include "tmrsvcs.h" // ITIMER_DESC 75 75 #include "notebook.h" // CfgDlgProc 76 #include "command.h" // RunCommand 76 77 #include "fm3dll.h" 77 78 -
trunk/dll/command.c
r985 r989 43 43 #include "fm3dll.h" 44 44 #include "pathutil.h" // NormalizeCmdLine 45 #include "command.h" 45 46 46 47 typedef struct … … 308 309 next = info->next; 309 310 xfree(info->title); 310 xfree(info-> cl);311 xfree(info->pszCmdLine); 311 312 xfree(info); 312 313 info = next; … … 319 320 FILE *fp; 320 321 LINKCMDS *info; 321 CHAR cl[1024];322 PSZ pszCmdLine; 322 323 CHAR title[100]; 323 324 CHAR flags[72]; … … 326 327 free_commands(); 327 328 cmdloaded = TRUE; 328 save_dir2(cl); 329 if (cl[strlen(cl) - 1] != '\\') 330 strcat(cl, "\\"); 331 strcat(cl, "COMMANDS.DAT"); 332 fp = _fsopen(cl, "r", SH_DENYWR); 333 if (fp) { 334 while (!feof(fp)) { 335 if (!xfgets_bstripcr(title, sizeof(title), fp, pszSrcFile, __LINE__)) 336 break; 337 title[34] = 0; // fixme to know why chopped this way? 338 bstripcr(title); 339 if (!*title || *title == ';') 340 continue; 341 if (!xfgets(cl, sizeof(cl), fp, pszSrcFile, __LINE__)) 342 break; /* error! */ 343 if (!xfgets(flags, 72, fp, pszSrcFile, __LINE__)) 344 break; /* error! */ 345 cl[1000] = 0; // fixme to know why chopped this way? 346 bstripcr(cl); 347 flags[34] = 0; 348 bstripcr(flags); 349 if (!*cl) 350 continue; 351 info = xmallocz(sizeof(LINKCMDS), pszSrcFile, __LINE__); 352 if (info) { 353 info->cl = xstrdup(cl, pszSrcFile, __LINE__); 354 info->title = xstrdup(title, pszSrcFile, __LINE__); 355 info->flags = atol(flags); 356 if (!info->cl || !info->title) { 357 xfree(info->cl); 358 xfree(info->title); 359 xfree(info); 360 break; 361 } 362 if (!cmdhead) 363 cmdhead = info; 364 else { 365 cmdtail->next = info; 366 info->prev = cmdtail; 367 } 368 cmdtail = info; 369 } 370 } 371 fclose(fp); 329 pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); 330 if (pszCmdLine) { 331 save_dir2(pszCmdLine); 332 if (pszCmdLine[strlen(pszCmdLine) - 1] != '\\') 333 strcat(pszCmdLine, "\\"); 334 strcat(pszCmdLine, "COMMANDS.DAT"); 335 fp = _fsopen(pszCmdLine, "r", SH_DENYWR); 336 if (fp) { 337 while (!feof(fp)) { 338 if (!xfgets_bstripcr(title, sizeof(title), fp, pszSrcFile, __LINE__)) 339 break; 340 title[34] = 0; // fixme to know why chopped this way? 341 bstripcr(title); 342 if (!*title || *title == ';') 343 continue; 344 if (!xfgets(pszCmdLine, MaxComLineStrg, fp, pszSrcFile, __LINE__)) 345 break; /* error! */ 346 if (!xfgets(flags, 72, fp, pszSrcFile, __LINE__)) 347 break; /* error! */ 348 pszCmdLine[MaxComLineStrg - 1] = 0; // fixme to know why chopped this way? 349 bstripcr(pszCmdLine); 350 flags[34] = 0; 351 bstripcr(flags); 352 if (!pszCmdLine) 353 continue; 354 info = xmallocz(sizeof(LINKCMDS), pszSrcFile, __LINE__); 355 if (info) { 356 info->pszCmdLine = xstrdup(pszCmdLine, pszSrcFile, __LINE__); 357 info->title = xstrdup(title, pszSrcFile, __LINE__); 358 info->flags = atol(flags); 359 if (!info->pszCmdLine || !info->title) { 360 xfree(info->pszCmdLine); 361 xfree(info->title); 362 xfree(info); 363 break; 364 } 365 if (!cmdhead) 366 cmdhead = info; 367 else { 368 cmdtail->next = info; 369 info->prev = cmdtail; 370 } 371 cmdtail = info; 372 } 373 } 374 xfree(pszCmdLine); 375 fclose(fp); 376 } 372 377 } 373 378 } … … 392 397 while (info) { 393 398 fprintf(fp, 394 ";\n%0.34s\n%0. 1000s\n%lu\n",395 info->title, info->cl, info->flags);399 ";\n%0.34s\n%0.*s\n%lu\n", 400 info->title, MaxComLineStrg, info->pszCmdLine, info->flags); 396 401 info = info->next; 397 402 } … … 417 422 if (!info) 418 423 return NULL; 419 info-> cl= xstrdup(addme->pszCmdLine, pszSrcFile, __LINE__);424 info->pszCmdLine = xstrdup(addme->pszCmdLine, pszSrcFile, __LINE__); 420 425 info->title = xstrdup(addme->title, pszSrcFile, __LINE__); 421 426 if (addme->flags) 422 427 info->flags = addme->flags; 423 if (!info-> cl|| !info->title) {424 xfree(info-> cl);428 if (!info->pszCmdLine || !info->title) { 429 xfree(info->pszCmdLine); 425 430 xfree(info->title); 426 431 xfree(info); … … 459 464 cmdtail = info->prev; 460 465 } 461 xfree(info-> cl);466 xfree(info->pszCmdLine); 462 467 xfree(info->title); 463 468 xfree(info); … … 525 530 break; 526 531 } 527 WinSetDlgItemText(hwnd, CMD_CL, info-> cl);532 WinSetDlgItemText(hwnd, CMD_CL, info->pszCmdLine); 528 533 if (!(info->flags & 1023)) 529 534 WinCheckButton(hwnd, CMD_DEFAULT, TRUE); … … 548 553 *env = 0; 549 554 size = sizeof(env) - 1; 550 if (PrfQueryProfileData(fmprof, FM3Str, info-> cl, env, &size) &&555 if (PrfQueryProfileData(fmprof, FM3Str, info->pszCmdLine, env, &size) && 551 556 *env) 552 557 WinSetDlgItemText(hwnd, CMD_ENVIRON, env); … … 1020 1025 fakelist[1] = NULL; 1021 1026 ExecOnList(hwnd, 1022 info-> cl,1027 info->pszCmdLine, 1023 1028 flags, NULL, fakelist, GetPString(IDS_EXECCMDTITLETEXT), 1024 1029 pszSrcFile, __LINE__); … … 1027 1032 else 1028 1033 ExecOnList(hwnd, 1029 info-> cl,1034 info->pszCmdLine, 1030 1035 flags, NULL, list, GetPString(IDS_EXECCMDTITLETEXT), 1031 1036 pszSrcFile, __LINE__); -
trunk/dll/dircnrs.c
r981 r989 59 59 #include "strutil.h" // GetPString 60 60 #include "notebook.h" // CfgDlgProc 61 #include "command.h" // RunCommand 61 62 #include "fm3dll.h" 62 63 -
trunk/dll/fm3dll.h
r985 r989 125 125 #include "dircnrs.h" // 05 Jan 08 SHL fixme to be gone when DIRCNRDATA refs gone 126 126 #include "makelist.h" // 05 Jan 08 SHL fixme to be gone when LISTINFO refs gone 127 #include "command.h" // 01 Mar 08 GKY fixme to be gone when LINKCMDS refs gone 127 128 128 129 #ifdef DEFINE_GLOBALS … … 332 333 COLORS; 333 334 334 typedef struct LINKCMDS335 {336 CHAR *cl;337 CHAR *title;338 ULONG flags;339 struct LINKCMDS *next;340 struct LINKCMDS *prev;341 }342 LINKCMDS;343 344 335 typedef struct 345 336 { … … 929 920 HWND StartCollector(HWND hwndParent, INT flags); 930 921 MRESULT EXPENTRY CollectorObjWndProc(HWND hwnd, ULONG msg, MPARAM mp1, 931 MPARAM mp2); 932 933 /* command.c */ 934 VOID RunCommand(HWND hwnd, INT cx); 935 VOID EditCommands(HWND hwnd); 936 CHAR *command_title(INT cx); 937 VOID load_commands(VOID); 922 MPARAM mp2); 938 923 939 924 /* instant.c */ -
trunk/dll/init.c
r985 r989 714 714 } 715 715 else { 716 if (!CheckFileHeader(inipath, "\xff\xff\xff\xff\x14\x00\x00\x00", 0L)) 717 saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING, "Check INI header failed"); 718 fIniExisted = TRUE; 719 if (fs3.attrFile & (FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM)) { 720 fs3.attrFile &= ~(FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM); 721 rc = xDosSetPathInfo(inipath, FIL_STANDARD, &fs3, sizeof(fs3), 0); 722 if (rc) { 723 Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, 724 GetPString(IDS_INIREADONLYTEXT), inipath); 725 } 726 716 if (!CheckFileHeader(inipath, "\xff\xff\xff\xff\x14\x00\x00\x00", 0L)) { 717 saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING, 718 "Check INI header failed will attempt to replace with backup \\ 719 if backup fails or not found will open with new ini"); 720 DosCopy("FM3.INI", "FM3INI.BAD", DCPY_EXISTING); 721 DosCopy("FM3INI.BAK", "FM3.INI", DCPY_EXISTING); 722 if (!CheckFileHeader(inipath, "\xff\xff\xff\xff\x14\x00\x00\x00", 0L)) { 723 DosCopy("FM3.INI", "FM3INI2.BAD", DCPY_EXISTING); 724 fWantFirstTimeInit = TRUE; 725 } 727 726 } 728 } 729 727 if (!fWantFirstTimeInit) { 728 fIniExisted = TRUE; 729 if (fs3.attrFile & (FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM)) { 730 fs3.attrFile &= ~(FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM); 731 rc = xDosSetPathInfo(inipath, FIL_STANDARD, &fs3, sizeof(fs3), 0); 732 if (rc) { 733 Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, 734 GetPString(IDS_INIREADONLYTEXT), inipath); 735 } 736 } 737 } 738 } 730 739 fmprof = PrfOpenProfile((HAB)0, inipath); 731 740 if (!fmprof) { … … 738 747 if (!fmprof) { 739 748 Win_Error(NULLHANDLE, NULLHANDLE, pszSrcFile, __LINE__, 740 "PrfOpenProfile");749 "PrfOpenProfile"); 741 750 return FALSE; 742 751 } -
trunk/dll/mainwnd.c
r985 r989 75 75 #include "comp.h" 76 76 #include "datamin.h" 77 #include " arccnrs.h" // BldQuotedFileName77 #include "pathutil.h" // BldQuotedFileName 78 78 #include "errutil.h" // Dos_Error... 79 79 #include "strutil.h" // GetPString 80 80 #include "notebook.h" // CfgDlgProc CfgMenuInit 81 #include "command.h" // LINKCMDS 81 82 #include "fm3dll.h" 82 83 … … 1536 1537 case UM_RESCAN: 1537 1538 { 1538 CHAR cl[1024]; 1539 1540 *cl = 0; 1541 lbup = TRUE; 1542 if (WinDlgBox(HWND_DESKTOP, 1543 hwnd, 1544 CmdLine2DlgProc, 1545 FM3ModHandle, EXEC2_FRAME, MPFROMP(cl))) { 1546 lstrip(cl); 1547 WinSetWindowText(hwnd, cl); 1548 } 1549 PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID); 1550 PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID); 1539 PSZ pszCmdLine; 1540 1541 pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); 1542 if (pszCmdLine) { 1543 lbup = TRUE; 1544 if (WinDlgBox(HWND_DESKTOP, 1545 hwnd, 1546 CmdLine2DlgProc, 1547 FM3ModHandle, EXEC2_FRAME, MPFROMP(pszCmdLine))) { 1548 lstrip(pszCmdLine); 1549 WinSetWindowText(hwnd, pszCmdLine); 1550 } 1551 PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID); 1552 PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID); 1553 xfree(pszCmdLine); 1554 } 1551 1555 } 1552 1556 return 0; -
trunk/dll/mainwnd2.c
r985 r989 42 42 #include "datamin.h" 43 43 #include "comp.h" // COMPARE 44 #include " arccnrs.h" // BldQuotedFileName44 #include "pathutil.h" // BldQuotedFileName 45 45 #include "errutil.h" // Dos_Error... 46 46 #include "strutil.h" // GetPString 47 47 #include "notebook.h" // CfgDlgProc 48 #include "command.h" // RunCommand 48 49 #include "fm3dll.h" 49 50 -
trunk/dll/misc.c
r985 r989 57 57 #include "fm3dlg.h" 58 58 #include "fm3str.h" 59 #include "pathutil.h" // BldQuotedFileName59 #include "pathutil.h" // BldQuotedFileName 60 60 #include "errutil.h" // Dos_Error... 61 61 #include "strutil.h" // GetPString 62 #include "command.h" // LINKCMDS 62 63 #include "fm3dll.h" 63 64 … … 962 963 { 963 964 EXECARGS ex; 964 CHAR cl[1001], path[CCHMAXPATH], *p; 965 CHAR path[CCHMAXPATH], *p; 966 PSZ pszCmdLine; 965 967 APIRET ret; 966 968 static INT lastflags = 0; … … 980 982 else 981 983 *path = 0; 982 *cl = 0; 983 BldQuotedFileName(cl, filename); 984 memset(&ex, 0, sizeof(ex)); 985 ex.flags = lastflags; 986 ex.commandline = cl; 987 *ex.path = 0; 988 *ex.environment = 0; 989 ret = WinDlgBox(HWND_DESKTOP, hwnd, CmdLineDlgProc, FM3ModHandle, 990 EXEC_FRAME, &ex); 991 if (ret == 1) { 992 lastflags = ex.flags; 993 return runemf2(ex.flags, hwnd, pszSrcFile, __LINE__, path, 994 *ex.environment ? ex.environment : NULL, 995 "%s", cl) != -1; 996 } 997 else if (ret != 0) 998 return -1; 984 pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); 985 if (pszCmdLine) { 986 BldQuotedFileName(pszCmdLine, filename); 987 memset(&ex, 0, sizeof(ex)); 988 ex.flags = lastflags; 989 ex.commandline = pszCmdLine; 990 *ex.path = 0; 991 *ex.environment = 0; 992 ret = WinDlgBox(HWND_DESKTOP, hwnd, CmdLineDlgProc, FM3ModHandle, 993 EXEC_FRAME, &ex); 994 if (ret == 1) { 995 lastflags = ex.flags; 996 return runemf2(ex.flags, hwnd, pszSrcFile, __LINE__, path, 997 *ex.environment ? ex.environment : NULL, 998 "%s", pszCmdLine) != -1; 999 } 1000 else if (ret != 0) 1001 return -1; 1002 xfree(pszCmdLine); 1003 } 999 1004 return 0; 1000 1005 } -
trunk/dll/pathutil.c
r985 r989 208 208 pszCmdLine_); 209 209 if (ret == MBID_YES){ 210 pszNewCmdLine = pszCmdLine_; 210 if (szArgs[0] != ' ') 211 strcat(pszNewCmdLine, " "); 212 strcat(pszNewCmdLine, szArgs); 211 213 } 212 214 else{ … … 306 308 pszCmdLine_); 307 309 if (ret == MBID_YES) { 308 pszWorkBuf = pszCmdLine_; 310 if (szArgs[0] != ' ') 311 strcat(pszNewCmdLine, " "); 312 strcat(pszNewCmdLine, szArgs); 309 313 } 310 314 else { -
trunk/dll/systemf.c
r985 r989 93 93 return -1; 94 94 } 95 commandline = xmalloc(MaxComLineStrg , pszSrcFile, __LINE__);95 commandline = xmalloc(MaxComLineStrg + 1, pszSrcFile, __LINE__); 96 96 if (!commandline) 97 97 return -1; //already complained … … 466 466 case 'R': 467 467 case 'r': 468 if (pp + strlen(list[x]) > commandline + 1250)468 if (pp + strlen(list[x]) > commandline + MaxComLineStrg) 469 469 goto BreakOut; 470 470 if (*(p + 1) == 'r') { … … 482 482 if (*(p + 1) == 'F' && dot) 483 483 *dot = 0; 484 if (pp + strlen(file) > commandline + 1250)484 if (pp + strlen(file) > commandline + MaxComLineStrg) 485 485 goto BreakOut; 486 486 if (needs_quoting(file)) { … … 505 505 case 'A': 506 506 case 'a': 507 if (pp + strlen(list[x]) > commandline + 1250)507 if (pp + strlen(list[x]) > commandline + MaxComLineStrg) 508 508 goto BreakOut; 509 509 if (needs_quoting(list[x]) && !strchr(list[x], '\"')) { … … 534 534 case 'e': 535 535 if (ext) { 536 if (pp + strlen(ext) > commandline + 1250)536 if (pp + strlen(ext) > commandline + MaxComLineStrg) 537 537 goto BreakOut; 538 538 if (needs_quoting(ext)) { -
trunk/dll/treecnr.c
r985 r989 67 67 #include "strutil.h" // GetPString 68 68 #include "notebook.h" // CfgDlgProc 69 #include "command.h" // RunCommand 69 70 #include "fm3dll.h" 70 71
Note:
See TracChangeset
for help on using the changeset viewer.
