Changeset 1491 for trunk/dll/command.c
- Timestamp:
- Dec 28, 2009, 3:20:57 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/command.c
r1488 r1491 33 33 21 Dec 09 GKY Added 20 new hot keys for commands. 34 34 21 Dec 09 GKY Added CheckExecutibleFlags to streamline code in command.c assoc.c & cmdline.c 35 27 Dec 09 GKY Moved Commands to the INI file this makes commands.dat obsolete 36 27 Dec 09 GKY Added QueryCommandSettings to streamline code 35 37 36 38 ***********************************************************************/ … … 80 82 COMMAND; 81 83 84 BOOL QueryCommandSettings(HWND hwnd, COMMAND *temp); 85 VOID save_commands(VOID); 86 82 87 // Data defintions 83 88 #pragma data_seg(DATA1) … … 87 92 static BOOL UsedCommandIDs[300]; 88 93 static BOOL UsedHotKeyIDs[40]; 94 static PSZ pszCommandsList; 95 static ULONG ulSizeCommandsList = 10000; 96 static BOOL fLoadCommandsFromINI = FALSE; 89 97 90 98 #pragma data_seg(GLOBAL2) … … 349 357 info = next; 350 358 } 359 free(pszCommandsList); 351 360 cmdhead = cmdtail = NULL; 352 361 } … … 359 368 CHAR title[100]; 360 369 CHAR flags[34]; 370 //CHAR *p; 361 371 ULONG size; 362 372 363 if (cmdhead) 364 free_commands();365 PrfQueryProfileData(fmprof, FM3Str, " UsedCommandIDs", &UsedCommandIDs,373 374 size = sizeof(BOOL) * 300; 375 PrfQueryProfileData(fmprof, FM3Str, "COMMANDS.UsedCommandIDs", &UsedCommandIDs, 366 376 &size); 367 PrfQueryProfileData(fmprof, FM3Str, "UsedHotKeyIDs", &UsedHotKeyIDs, 368 &size); 369 cmdloaded = TRUE; 370 pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); 371 if (pszCmdLine) { 372 BldFullPathName(pszCmdLine, pFM2SaveDirectory, PCSZ_COMMANDSDAT); 373 fp = _fsopen(pszCmdLine, "r", SH_DENYWR); 374 if (fp) { 375 while (!feof(fp)) { 376 if (!xfgets_bstripcr(title, sizeof(title), fp, pszSrcFile, __LINE__)) 377 break; 378 //title[strlen(title)] = 0; // Match size to entry file max? Not needed as bstripcr does this? GKY 21 Dec 09 379 if (!*title || *title == ';') 380 continue; 381 if (!xfgets_bstripcr(pszCmdLine, MaxComLineStrg, fp, pszSrcFile, __LINE__)) 382 break; /* error! */ 383 if (!xfgets_bstripcr(flags, sizeof(flags), fp, pszSrcFile, __LINE__)) 384 break; 385 //pszCmdLine[strlen(pszCmdLine)] = 0; // fixme to know why chopped this way? Not needed as bstripcr does this? GKY 21 Dec 09 386 flags[34] = 0; 387 if (!pszCmdLine) 388 continue; 389 info = xmallocz(sizeof(LINKCMDS), pszSrcFile, __LINE__); 390 if (info) { 391 # ifdef FORTIFY 392 Fortify_SetOwner(info, 1); 393 Fortify_SetScope(info, 1); 394 # endif 395 info->pszCmdLine = xstrdup(pszCmdLine, pszSrcFile, __LINE__); 396 info->title = xstrdup(title, pszSrcFile, __LINE__); 397 info->flags = atol(flags); 398 if (!info->pszCmdLine || !info->title) { 399 xfree(info->pszCmdLine, pszSrcFile, __LINE__); 400 xfree(info->title, pszSrcFile, __LINE__); 401 free(info); 377 size = sizeof(BOOL) * 40; 378 PrfQueryProfileData(fmprof, FM3Str, "COMMANDS.UsedHotKeyIDs", &UsedHotKeyIDs, 379 &size); size = sizeof(BOOL); 380 PrfQueryProfileData(fmprof, FM3Str, "COMMANDS.LoadCommandsFromINI", 381 &fLoadCommandsFromINI, &size); 382 if (!fLoadCommandsFromINI) { 383 if (cmdhead) 384 free_commands(); 385 cmdloaded = TRUE; 386 pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); 387 pszCommandsList = xmallocz(ulSizeCommandsList, pszSrcFile, __LINE__); 388 if (pszCmdLine) { 389 BldFullPathName(pszCmdLine, pFM2SaveDirectory, PCSZ_COMMANDSDAT); 390 fp = _fsopen(pszCmdLine, "r", SH_DENYWR); 391 if (fp) { 392 while (!feof(fp)) { 393 if (!xfgets_bstripcr(title, sizeof(title), fp, pszSrcFile, __LINE__)) 402 394 break; 395 if (!*title || *title == ';') 396 continue; 397 if (!xfgets_bstripcr(pszCmdLine, MaxComLineStrg, fp, pszSrcFile, __LINE__)) 398 break; /* error! */ 399 if (!xfgets_bstripcr(flags, sizeof(flags), fp, pszSrcFile, __LINE__)) 400 break; 401 flags[34] = 0; 402 if (!pszCmdLine) 403 continue; 404 info = xmallocz(sizeof(LINKCMDS), pszSrcFile, __LINE__); 405 if (info) { 406 # ifdef FORTIFY 407 Fortify_SetOwner(info, 1); 408 Fortify_SetScope(info, 1); 409 # endif 410 info->pszCmdLine = xstrdup(pszCmdLine, pszSrcFile, __LINE__); 411 412 if (pszCommandsList) { 413 strcpy(pszCommandsList + strlen(pszCommandsList), title); 414 strcpy(pszCommandsList + strlen(pszCommandsList), ";"); 415 } 416 info->title = xstrdup(title, pszSrcFile, __LINE__); 417 info->flags = atol(flags); 418 if (!info->pszCmdLine || !info->title) { 419 xfree(info->pszCmdLine, pszSrcFile, __LINE__); 420 xfree(info->title, pszSrcFile, __LINE__); 421 free(info); 422 break; 423 } 424 # ifdef FORTIFY 425 Fortify_SetOwner(info->pszCmdLine, 1); 426 Fortify_SetScope(info->pszCmdLine, 1); 427 Fortify_SetOwner(info->title, 1); 428 Fortify_SetScope(info->title, 1); 429 # endif 430 if (!cmdhead) 431 cmdhead = info; 432 else { 433 cmdtail->next = info; 434 info->prev = cmdtail; 435 } 436 cmdtail = info; 403 437 } 404 # ifdef FORTIFY 405 Fortify_SetOwner(info->pszCmdLine, 1); 406 Fortify_SetScope(info->pszCmdLine, 1); 407 Fortify_SetOwner(info->title, 1); 408 Fortify_SetScope(info->title, 1); 409 # endif 410 if (!cmdhead) 411 cmdhead = info; 412 else { 413 cmdtail->next = info; 414 info->prev = cmdtail; 415 } 416 cmdtail = info; 417 } 418 } 419 free(pszCmdLine); 420 fclose(fp); 421 load_inicommands(); 422 } 423 } 438 } 439 free(pszCmdLine); 440 fclose(fp); 441 if (pszCommandsList) { 442 ulSizeCommandsList = strlen(pszCommandsList) + 1; 443 } 444 } 445 } 446 } 447 load_inicommands(); 424 448 } 425 449 … … 438 462 ULONG HotKeyID = 0; 439 463 CHAR env[1002]; 440 CHAR keyID[120]; 441 CHAR keyHotKeyID[120]; 442 CHAR keyenv[120]; 464 CHAR key[120]; 465 CHAR szTitle[100]; 443 466 ULONG size; 444 445 if (!cmdloaded || !cmdhead) 446 return; 447 info = cmdhead; 448 while (info) { 449 bstripcr(info->title); 450 sprintf(keyID, "COMMAND.%sID", info->title); 451 sprintf(keyHotKeyID, "COMMAND.%sHotKeyID", info->title); 452 sprintf(keyenv, "COMMAND.%senv", info->title); 453 size = sizeof(ULONG); 454 PrfQueryProfileData(fmprof, FM3Str, keyID, &ID, &size); 455 size = sizeof(ULONG); 456 PrfQueryProfileData(fmprof, FM3Str, keyHotKeyID, &HotKeyID, &size); 457 PrfQueryProfileString(fmprof, FM3Str, keyenv, NullStr, env, sizeof(env)); 458 if (ID) { 459 if (env != NullStr) 460 info->env = xstrdup(env, pszSrcFile, __LINE__); 461 info->ID = ID; 462 info->HotKeyID = HotKeyID; 463 } 464 //This updates the old commands.dat file to the new format 465 //assigning the IDs based on file order or on next available ID if 466 //COMMAND.DAT is hand edited. 467 else { 468 for (x = 0; x < 300; x++) { 469 if (!UsedCommandIDs[x]) { 470 ID = info->ID = IDM_COMMANDSTART + x; 471 UsedCommandIDs[x] = TRUE; 472 for (y = 0; y < 40; y++) { 473 if (!UsedHotKeyIDs[y]) { 474 HotKeyID = info->HotKeyID = IDM_COMMANDNUM0 + y; 475 UsedHotKeyIDs[y] = TRUE; 467 CHAR *p, *pp; 468 PSZ pszCmdLine; 469 ULONG flags; 470 471 # ifdef FORTIFY 472 Fortify_EnterScope(); 473 # endif 474 pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); 475 if (pszCmdLine) { 476 if (fLoadCommandsFromINI) { 477 if (cmdhead) 478 free_commands(); 479 cmdloaded = TRUE; 480 size = sizeof(ULONG); 481 PrfQueryProfileData(fmprof, FM3Str, "COMMANDS.SizeSortOrder", 482 &ulSizeCommandsList, &size); 483 pszCommandsList = xmallocz(ulSizeCommandsList, pszSrcFile, __LINE__); 484 if (pszCommandsList) 485 PrfQueryProfileString(fmprof, FM3Str, "COMMANDS.SortOrder", 486 NullStr, pszCommandsList, ulSizeCommandsList); 487 p = pszCommandsList; 488 while (*p == ';') 489 p++; 490 while (*p) { 491 *szTitle = 0; 492 pp = szTitle; 493 while (*p && *p != ';') 494 *pp++ = *p++; 495 *pp = 0; 496 while (*p == ';') 497 p++; 498 if (*szTitle) { 499 bstripcr(szTitle); 500 sprintf(key, "COMMAND.%sID", szTitle); 501 size = sizeof(ULONG); 502 PrfQueryProfileData(fmprof, FM3Str, key, &ID, &size); 503 sprintf(key, "COMMAND.%sHotKeyID", szTitle); 504 size = sizeof(ULONG); 505 PrfQueryProfileData(fmprof, FM3Str, key, &HotKeyID, &size); 506 sprintf(key, "COMMAND.%sflags", szTitle); 507 size = sizeof(ULONG); 508 PrfQueryProfileData(fmprof, FM3Str, key, &flags, &size); 509 sprintf(key, "COMMAND.%senv", szTitle); 510 PrfQueryProfileString(fmprof, FM3Str, key, NullStr, env, sizeof(env)); 511 sprintf(key, "COMMAND.%sCmdLine", szTitle); 512 PrfQueryProfileString(fmprof, FM3Str, key, NullStr, pszCmdLine, MaxComLineStrg); 513 } 514 info = xmallocz(sizeof(LINKCMDS), pszSrcFile, __LINE__); 515 if (info) { 516 # ifdef FORTIFY 517 Fortify_SetOwner(info, 1); 518 Fortify_SetScope(info, 1); 519 # endif 520 info->pszCmdLine = xstrdup(pszCmdLine, pszSrcFile, __LINE__); 521 info->title = xstrdup(szTitle, pszSrcFile, __LINE__); 522 info->flags = flags; 523 if (env != NullStr) 524 info->env = xstrdup(env, pszSrcFile, __LINE__); 525 info->ID = ID; 526 info->HotKeyID = HotKeyID; 527 if (!info->pszCmdLine || !info->title) { 528 xfree(info->pszCmdLine, pszSrcFile, __LINE__); 529 xfree(info->title, pszSrcFile, __LINE__); 530 xfree(info->env, pszSrcFile, __LINE__); 531 free(info); 476 532 break; 477 533 } 534 if (!cmdhead) 535 cmdhead = info; 536 else { 537 cmdtail->next = info; 538 info->prev = cmdtail; 539 } 540 cmdtail = info; 478 541 } 479 break; 480 } 481 if (x == 299) 482 saymsg(MB_OK | MB_ICONEXCLAMATION , HWND_DESKTOP, 483 GetPString(IDS_COMMANDSLIMITTITLETEXT), 484 GetPString(IDS_COMMANDSLIMITREACHEDTEXT )); 485 } 486 PrfQueryProfileString(fmprof, FM3Str, info->pszCmdLine, NullStr, env, sizeof(env)); 487 info->env = env; 488 if (env != NullStr) 489 PrfWriteProfileString(fmprof, FM3Str, info->pszCmdLine, NULL); 490 if (info->env) 491 strcpy(env, info->env); 492 ID = info->ID; 493 HotKeyID = info->HotKeyID; 494 PrfWriteProfileData(fmprof, FM3Str, keyID, &ID, sizeof(INT)); 495 PrfWriteProfileData(fmprof, FM3Str, keyHotKeyID, &HotKeyID, sizeof(INT)); 496 if (env != NullStr) 497 PrfWriteProfileString(fmprof, FM3Str, keyenv, env); 498 PrfWriteProfileData(fmprof, FM3Str, "UsedCommandIDs", &UsedCommandIDs, 499 sizeof(BOOL) * 300); 500 PrfWriteProfileData(fmprof, FM3Str, "UsedHotKeyIDs", &UsedHotKeyIDs, 501 sizeof(BOOL) * 40); 502 } 503 ID = 0; 504 HotKeyID = 0; 505 info = info->next; 542 } 543 } 544 } 545 else { 546 info = cmdhead; 547 while (info) { 548 bstripcr(info->title); 549 sprintf(key, "COMMAND.%sID", info->title); 550 size = sizeof(ULONG); 551 PrfQueryProfileData(fmprof, FM3Str, key, &ID, &size); 552 sprintf(key, "COMMAND.%sHotKeyID", info->title); 553 size = sizeof(ULONG); 554 PrfQueryProfileData(fmprof, FM3Str, key, &HotKeyID, &size); 555 sprintf(key, "COMMAND.%senv", info->title); 556 PrfQueryProfileString(fmprof, FM3Str, key, NullStr, env, sizeof(env)); 557 if (ID != 0) { 558 if (env != NullStr) 559 info->env = xstrdup(env, pszSrcFile, __LINE__); 560 info->ID = ID; 561 info->HotKeyID = HotKeyID; 562 } 563 //This updates the old commands.dat file to the new format 564 //assigning the IDs based on file order or on next available ID if 565 //COMMAND.DAT is hand edited. 566 else { 567 for (x = 0; x < 300; x++) { 568 if (!UsedCommandIDs[x]) { 569 ID = info->ID = IDM_COMMANDSTART + x; 570 UsedCommandIDs[x] = TRUE; 571 for (y = 0; y < 40; y++) { 572 if (!UsedHotKeyIDs[y]) { 573 HotKeyID = info->HotKeyID = IDM_COMMANDNUM0 + y; 574 UsedHotKeyIDs[y] = TRUE; 575 break; 576 } 577 } 578 break; 579 } 580 if (x == 299) 581 saymsg(MB_OK | MB_ICONEXCLAMATION , HWND_DESKTOP, 582 GetPString(IDS_COMMANDSLIMITTITLETEXT), 583 GetPString(IDS_COMMANDSLIMITREACHEDTEXT )); 584 } 585 PrfQueryProfileString(fmprof, FM3Str, info->pszCmdLine, NullStr, env, sizeof(env)); 586 info->env = xstrdup(env, pszSrcFile, __LINE__); 587 } 588 ID = 0; 589 HotKeyID = 0; 590 info = info->next; 591 } 592 fLoadCommandsFromINI = TRUE; 593 save_commands(); 594 } 595 free(pszCmdLine); 506 596 } 507 597 } … … 510 600 { 511 601 LINKCMDS *info; 512 FILE *fp; 513 CHAR s[CCHMAXPATH + 14]; 514 INT x = 0; 515 INT ID = 0; 516 INT HotKeyID = 0; 517 CHAR env[1002]; 518 CHAR keyID[120]; 519 CHAR keyHotKeyID[120]; 520 CHAR keyenv[120]; 521 602 CHAR key[120]; 603 522 604 if (!cmdloaded || !cmdhead) 523 605 return; 606 524 607 info = cmdhead; 525 BldFullPathName(s, pFM2SaveDirectory, PCSZ_COMMANDSDAT); 526 if (CheckDriveSpaceAvail(s, ullDATFileSpaceNeeded, 1) == 2) 527 return; //already gave error msg 528 fp = xfopen(s, "w", pszSrcFile, __LINE__); 529 if (fp) { 608 pszCommandsList[0] = 0; 530 609 while (info) { 531 fprintf(fp, ";\n%0.99s\n%0.*s\n%lu\n", 532 info->title, MaxComLineStrg, info->pszCmdLine, info->flags); 533 534 if (info->env) 535 strcpy(env, info->env); 536 ID = info->ID; 537 HotKeyID = info->HotKeyID; 610 sprintf(key, "COMMAND.%sflags", info->title); 611 PrfWriteProfileData(fmprof, FM3Str, key, &info->flags, sizeof(ULONG)); 612 sprintf(key, "COMMAND.%sCmdLine", info->title); 613 PrfWriteProfileString(fmprof, FM3Str, key, info->pszCmdLine); 538 614 bstripcr(info->title); 539 sprintf(keyID, "COMMAND.%sID", info->title); 540 sprintf(keyHotKeyID, "COMMAND.%sHotKeyID", info->title); 541 sprintf(keyenv, "COMMAND.%senv", info->title); 542 PrfWriteProfileData(fmprof, FM3Str, keyID, &ID, sizeof(INT)); 543 PrfWriteProfileData(fmprof, FM3Str, keyHotKeyID, &HotKeyID, sizeof(INT)); 544 if (env != NullStr) 545 PrfWriteProfileString(fmprof, FM3Str, keyenv, env); 546 x++; 615 sprintf(key, "COMMAND.%sID", info->title); 616 PrfWriteProfileData(fmprof, FM3Str, key, &info->ID, sizeof(INT)); 617 sprintf(key, "COMMAND.%sHotKeyID", info->title); 618 PrfWriteProfileData(fmprof, FM3Str, key, &info->HotKeyID, sizeof(INT)); 619 if (info->env != NullStr) { 620 sprintf(key, "COMMAND.%senv", info->title); 621 PrfWriteProfileString(fmprof, FM3Str, key, info->env); 622 } 623 if ((strlen(pszCommandsList) + strlen(info->title) + 1) > ulSizeCommandsList) 624 pszCommandsList = xrealloc(pszCommandsList, 625 ulSizeCommandsList + strlen(info->title) + 1, 626 pszSrcFile, __LINE__); 627 strcpy(pszCommandsList + strlen(pszCommandsList), info->title); 628 strcpy(pszCommandsList + strlen(pszCommandsList), ";"); 547 629 info = info->next; 548 630 } // while info 549 PrfWriteProfileData(fmprof, FM3Str, " UsedCommandIDs", &UsedCommandIDs,631 PrfWriteProfileData(fmprof, FM3Str, "COMMANDS.UsedCommandIDs", &UsedCommandIDs, 550 632 sizeof(BOOL) * 300); 551 PrfWriteProfileData(fmprof, FM3Str, " UsedHotKeyIDs", &UsedHotKeyIDs,633 PrfWriteProfileData(fmprof, FM3Str, "COMMANDS.UsedHotKeyIDs", &UsedHotKeyIDs, 552 634 sizeof(BOOL) * 40); 553 fclose(fp); 554 } // if (fp) 635 ulSizeCommandsList = strlen(pszCommandsList) + 1; 636 PrfWriteProfileData(fmprof, FM3Str, "COMMANDS.SizeSortOrder", 637 &ulSizeCommandsList, sizeof(ULONG)); 638 PrfWriteProfileString(fmprof, FM3Str, "COMMANDS.SortOrder", pszCommandsList); 639 PrfWriteProfileData(fmprof, FM3Str, "COMMANDS.LoadCommandsFromINI", 640 &fLoadCommandsFromINI, sizeof(BOOL)); 555 641 } 556 642 557 643 //== add_command() Add command to list == 558 644 559 LINKCMDS *add_command(COMMAND *addme )645 LINKCMDS *add_command(COMMAND *addme, BOOL fDontCheckHotKey) 560 646 { 561 647 LINKCMDS *info; 562 648 INT x; 563 649 INT y; 650 APIRET ret; 564 651 565 652 if (!addme || !*addme->pszCmdLine || !*addme->title) 566 653 return NULL; // No data 654 # ifdef FORTIFY 655 Fortify_EnterScope(); 656 # endif 567 657 info = cmdhead; 568 658 while (info) { 569 659 if (!stricmp(info->title, addme->title)) 570 660 return NULL; // Got a dup 571 if (addme->HotKeyID && info->HotKeyID && info->HotKeyID == addme->HotKeyID)572 info->HotKeyID = 0; //avoid assigning hot key to multiple commands573 661 info = info->next; 662 } 663 if (!fDontCheckHotKey && UsedHotKeyIDs[addme->HotKeyID - IDM_COMMANDNUM0]) { 664 info = cmdhead; 665 while (info) { 666 if (info->HotKeyID == addme->HotKeyID) { //avoid assigning hot key to multiple commands 667 ret = saymsg(MB_YESNOCANCEL, HWND_DESKTOP, NullStr, 668 GetPString(IDS_DUPLICATEHOTKEYTEXT)); 669 if (ret == MBID_YES) { 670 info->HotKeyID = 0; 671 UsedHotKeyIDs[addme->HotKeyID - IDM_COMMANDNUM0] = FALSE; 672 break; 673 } 674 else if (ret == MBID_NO) { 675 addme->HotKeyID = 0; 676 break; 677 } 678 else 679 return NULL; 680 } 681 info = info->next; 682 } 574 683 } 575 684 info = xmallocz(sizeof(LINKCMDS), pszSrcFile, __LINE__); … … 579 688 info->title = xstrdup(addme->title, pszSrcFile, __LINE__); 580 689 info->HotKeyID = addme->HotKeyID; 581 if (info->HotKeyID >= IDM_COMMANDNUM0 && info->HotKeyID <= IDM_COMMANDNUM19) 690 info->ID = addme->ID; 691 if (info->HotKeyID >= IDM_COMMANDNUM0 && info->HotKeyID <= IDM_COMMANDNUM39) { 582 692 UsedHotKeyIDs[info->HotKeyID - IDM_COMMANDNUM0] = TRUE; 693 } 583 694 else 584 695 info->HotKeyID = 0; … … 589 700 info->ID = IDM_COMMANDSTART + x; 590 701 UsedCommandIDs[x] = TRUE; 591 for (y = 0; y < 40; y++) { 592 if (!UsedHotKeyIDs[y]) { 593 info->HotKeyID = IDM_COMMANDNUM0 + y; 594 UsedHotKeyIDs[y] = TRUE; 595 break; 702 if (!info->HotKeyID && !fDontCheckHotKey) { 703 for (y = 0; y < 40; y++) { 704 if (!UsedHotKeyIDs[y]) { 705 info->HotKeyID = IDM_COMMANDNUM0 + y; 706 UsedHotKeyIDs[y] = TRUE; 707 break; 596 708 } 597 709 } 710 } 598 711 break; 599 712 } … … 611 724 xfree(info->pszCmdLine, pszSrcFile, __LINE__); 612 725 xfree(info->title, pszSrcFile, __LINE__); 613 xfree(info-> title, pszSrcFile, __LINE__);726 xfree(info->env, pszSrcFile, __LINE__); 614 727 free(info); 615 728 return NULL; … … 622 735 info->prev = cmdtail; 623 736 cmdtail = info; 737 } 738 pszCommandsList = xrealloc(pszCommandsList, ulSizeCommandsList + strlen(info->title) + 1, 739 pszSrcFile, __LINE__); 740 if (pszCommandsList) { 741 strcpy(pszCommandsList + strlen(pszCommandsList), info->title); 742 strcpy(pszCommandsList + strlen(pszCommandsList), ";"); 743 ulSizeCommandsList = ulSizeCommandsList + strlen(info->title) + 1; 744 } 745 else { 746 pszCommandsList = xmallocz(ulSizeCommandsList, pszSrcFile, __LINE__); 747 if (pszCommandsList) 748 PrfQueryProfileString(fmprof, FM3Str, "COMMANDS.SortOrder", 749 NullStr, pszCommandsList, ulSizeCommandsList); 750 return 0; 624 751 } 625 752 return info; … … 659 786 } 660 787 } 788 # ifdef FORTIFY 789 Fortify_LeaveScope(); 790 # endif 661 791 return FALSE; 792 } 793 794 BOOL QueryCommandSettings(HWND hwnd, COMMAND *temp) 795 { 796 PSZ pszWorkBuf; 797 APIRET ret; 798 CHAR env[1002]; 799 INT x; 800 801 pszWorkBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__); 802 if (!pszWorkBuf) { 803 return FALSE; //already complained 804 } 805 WinQueryDlgItemText(hwnd, CMD_CL, MaxComLineStrg, temp->pszCmdLine); 806 NormalizeCmdLine(pszWorkBuf, temp->pszCmdLine); 807 memcpy(temp->pszCmdLine, pszWorkBuf, strlen(pszWorkBuf) + 1); 808 free(pszWorkBuf); 809 if (fCancelAction) { 810 fCancelAction = FALSE; 811 return FALSE; 812 } 813 if (!strchr(temp->pszCmdLine, '%')) { 814 ret = saymsg(MB_YESNO, 815 HWND_DESKTOP, 816 NullStr, 817 GetPString(IDS_TOACTONSELECTEDTEXT)); 818 if (ret == MBID_YES) 819 strcat(temp->pszCmdLine, " %a"); 820 } 821 WinQueryDlgItemText(hwnd, CMD_TITLE, sizeof(temp->title), temp->title); 822 bstripcr(temp->title); 823 temp->flags = CheckExecutibleFlags(hwnd, 3); 824 *env = 0; 825 WinQueryDlgItemText(hwnd, CMD_ENVIRON, 1000, env); 826 bstripcr(env); 827 if (*env) 828 strcpy(temp->env, env); 829 x = (SHORT) WinSendDlgItemMsg(hwnd, CMD_HOTKEY, 830 LM_QUERYSELECTION, 831 MPFROMSHORT(LIT_FIRST), MPVOID); 832 if (x < 40) 833 temp->HotKeyID = x + IDM_COMMANDNUM0; 834 else 835 temp->HotKeyID = 0; 836 DbgMsg(pszSrcFile, __LINE__, "info %i", temp->HotKeyID); 837 return TRUE; 662 838 } 663 839 … … 667 843 LINKCMDS *info; 668 844 845 # ifdef FORTIFY 846 Fortify_EnterScope(); 847 # endif 669 848 switch (msg) { 670 849 case WM_INITDLG: … … 737 916 WinSetDlgItemText(hwnd, CMD_ENVIRON, info->env); 738 917 else 739 WinSetDlgItemText(hwnd, CMD_ENVIRON, NullStr); 740 } 918 WinSetDlgItemText(hwnd, CMD_ENVIRON, NullStr); 919 for (x = 0; x < 40; x++) { 920 CHAR s[CCHMAXPATH + 24]; 921 922 sprintf(s, "%s%s%s", 923 x < IDM_COMMANDNUM20 - IDM_COMMANDNUM0 ? "Ctrl+" : NullStr, 924 x > IDM_COMMANDNUM19 - IDM_COMMANDNUM0 ? "Alt+" : NullStr, 925 (x > IDM_COMMANDNUM9 - IDM_COMMANDNUM0 && 926 x < IDM_COMMANDNUM20 - IDM_COMMANDNUM0) || 927 x > IDM_COMMANDNUM29 - IDM_COMMANDNUM0 ? "Shift+" : NullStr); 928 sprintf(&s[strlen(s)], "%d", (x % 10) + 1 == 10 ? 0 : (x % 10) + 1); 929 sprintf(&s[strlen(s)], " %s", UsedHotKeyIDs[x] ? "(in use)" : NullStr); 930 WinSendMsg(WinWindowFromID(hwnd, CMD_HOTKEY), LM_INSERTITEM, 931 MPFROM2SHORT(LIT_END, 0), MPFROMP(s)); 932 if (x == 39) 933 WinSendMsg(WinWindowFromID(hwnd, CMD_HOTKEY), LM_INSERTITEM, 934 MPFROM2SHORT(LIT_END, 0), MPFROMP("none")); 935 if (info->HotKeyID == x + IDM_COMMANDNUM0) 936 WinSendMsg(WinWindowFromID(hwnd, CMD_HOTKEY), LM_SELECTITEM, 937 MPFROM2SHORT(x, 0), MPFROMLONG(TRUE)); 938 if (x == 39 && info->HotKeyID == 0) 939 WinSendMsg(WinWindowFromID(hwnd, CMD_HOTKEY), LM_SELECTITEM, 940 MPFROM2SHORT(x + 1, 0), MPFROMLONG(TRUE)); 941 } // for 942 } 741 943 break; 742 944 } … … 794 996 case DID_OK: 795 997 { 796 x = (SHORT) WinSendDlgItemMsg(hwnd, 797 CMD_LISTBOX, 798 LM_QUERYSELECTION, MPVOID, MPVOID); 799 if (x == LIT_NONE) 800 x = (SHORT) WinSendDlgItemMsg(hwnd, 801 CMD_LISTBOX, 802 LM_SELECTITEM, 803 MPFROMSHORT(0), MPFROMSHORT(TRUE)); 804 } 805 { 806 COMMAND temp; 807 PSZ pszWorkBuf; 808 APIRET ret; 809 CHAR env[1002]; 810 811 memset(&temp, 0, sizeof(COMMAND)); 812 temp.pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); 813 if (!temp.pszCmdLine) 998 COMMAND *temp; 999 BOOL fDontCheckHotKey = FALSE; 1000 1001 temp = xmallocz(sizeof(COMMAND), pszSrcFile, __LINE__); 1002 if (!temp) 1003 break; //already complained 1004 temp->pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); 1005 if (!temp->pszCmdLine) { 1006 free (temp); 814 1007 break; //already complained 815 pszWorkBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__); 816 if (!pszWorkBuf) { 817 free(temp.pszCmdLine); 818 break; //already complained 819 } 820 WinQueryDlgItemText(hwnd, CMD_CL, MaxComLineStrg, temp.pszCmdLine); 821 NormalizeCmdLine(pszWorkBuf, temp.pszCmdLine); 822 memcpy(temp.pszCmdLine, pszWorkBuf, strlen(pszWorkBuf) + 1); 823 free(pszWorkBuf); 824 if (!strchr(temp.pszCmdLine, '%') && !fCancelAction){ 825 ret = saymsg(MB_YESNO, 826 HWND_DESKTOP, 827 NullStr, 828 GetPString(IDS_TOACTONSELECTEDTEXT)); 829 if (ret == MBID_YES) 830 strcat(temp.pszCmdLine, " %a"); 831 } 832 WinQueryDlgItemText(hwnd, CMD_TITLE, sizeof(temp.title), temp.title); 833 bstripcr(temp.title); 834 temp.flags = CheckExecutibleFlags(hwnd, 3); 835 /*if (WinQueryButtonCheckstate(hwnd, CMD_DEFAULT)) 836 temp.flags = 0; 837 else if (WinQueryButtonCheckstate(hwnd, CMD_FULLSCREEN)) 838 temp.flags = FULLSCREEN; 839 else if (WinQueryButtonCheckstate(hwnd, CMD_MINIMIZED)) 840 temp.flags = MINIMIZED; 841 else if (WinQueryButtonCheckstate(hwnd, CMD_MAXIMIZED)) 842 temp.flags = MAXIMIZED; 843 else if (WinQueryButtonCheckstate(hwnd, CMD_INVISIBLE)) 844 temp.flags = INVISIBLE; 845 if (WinQueryButtonCheckstate(hwnd, CMD_KEEP)) 846 temp.flags |= KEEP; 847 if (WinQueryButtonCheckstate(hwnd, CMD_PROMPT)) 848 temp.flags |= PROMPT; 849 if (WinQueryButtonCheckstate(hwnd, CMD_ONCE)) 850 temp.flags |= ONCE;*/ 851 *env = 0; 852 WinQueryDlgItemText(hwnd, CMD_ENVIRON, 1000, env); 853 bstripcr(env); 854 if (*env) { 855 strcpy(temp.env, env); 856 } 857 if (fCancelAction){ 858 fCancelAction = FALSE; 859 free(temp.pszCmdLine); 1008 } 1009 if (QueryCommandSettings(hwnd, temp)){ 1010 if (temp->HotKeyID == 0) 1011 fDontCheckHotKey = TRUE; 1012 info = add_command(temp, fDontCheckHotKey); 1013 } 1014 else { 1015 free(temp->pszCmdLine); 1016 free(temp); 860 1017 break; 861 1018 } 862 else 863 info = add_command(&temp); 864 if (!info) 865 WinDismissDlg(hwnd, 0); 866 else { 867 x = (SHORT) WinSendDlgItemMsg(hwnd, 868 CMD_LISTBOX, 869 LM_INSERTITEM, 870 MPFROM2SHORT(LIT_END, 0), 871 MPFROMP(temp.title)); 872 if (x >= 0) { 873 WinSendDlgItemMsg(hwnd, 874 CMD_LISTBOX, 875 LM_SETITEMHANDLE, 876 MPFROMSHORT(x), MPFROMP(info)); 877 WinSendDlgItemMsg(hwnd, 878 CMD_LISTBOX, 879 LM_SELECTITEM, 880 MPFROMSHORT(x), MPFROMSHORT(TRUE)); 881 } 882 } 1019 free(temp->pszCmdLine); 1020 free(temp); 883 1021 save_commands(); 884 load_commands(); 885 free(temp.pszCmdLine); 886 } 887 x = (SHORT) WinSendDlgItemMsg(hwnd, 888 CMD_LISTBOX, 889 LM_QUERYSELECTION, 890 MPFROMSHORT(LIT_FIRST), MPVOID); 891 save_commands(); 892 WinDismissDlg(hwnd, 0); 893 break; 1022 WinDismissDlg(hwnd, 0); 1023 break; 1024 } 894 1025 895 1026 case DID_CANCEL: … … 906 1037 case CMD_ADD: 907 1038 { 908 COMMAND temp; 909 PSZ pszWorkBuf; 910 APIRET ret; 911 CHAR env[1002]; 912 913 memset(&temp, 0, sizeof(COMMAND)); 914 temp.pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); 915 if (!temp.pszCmdLine) 1039 COMMAND *temp; 1040 BOOL fDontCheckHotKey = FALSE; 1041 1042 temp = xmallocz(sizeof(COMMAND), pszSrcFile, __LINE__); 1043 if (!temp) 1044 break; //already complained 1045 temp->pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); 1046 if (!temp->pszCmdLine) { 1047 free (temp); 916 1048 break; //already complained 917 pszWorkBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__); 918 if (!pszWorkBuf) { 919 free(temp.pszCmdLine); 920 break; //already complained 921 } 922 WinQueryDlgItemText(hwnd, CMD_CL, MaxComLineStrg, temp.pszCmdLine); 923 NormalizeCmdLine(pszWorkBuf, temp.pszCmdLine); 924 memcpy(temp.pszCmdLine, pszWorkBuf, strlen(pszWorkBuf) + 1); 925 free(pszWorkBuf); 926 if (!strchr(temp.pszCmdLine, '%') && !fCancelAction){ 927 ret = saymsg(MB_YESNO, 928 HWND_DESKTOP, 929 NullStr, 930 GetPString(IDS_TOACTONSELECTEDTEXT)); 931 if (ret == MBID_YES) 932 strcat(temp.pszCmdLine, " %a"); 933 } 934 WinQueryDlgItemText(hwnd, CMD_TITLE, sizeof(temp.title), temp.title); 935 bstripcr(temp.title); 936 temp.flags = CheckExecutibleFlags(hwnd, 3); 937 /*if (WinQueryButtonCheckstate(hwnd, CMD_DEFAULT)) 938 temp.flags = 0; 939 else if (WinQueryButtonCheckstate(hwnd, CMD_FULLSCREEN)) 940 temp.flags = FULLSCREEN; 941 else if (WinQueryButtonCheckstate(hwnd, CMD_MINIMIZED)) 942 temp.flags = MINIMIZED; 943 else if (WinQueryButtonCheckstate(hwnd, CMD_MAXIMIZED)) 944 temp.flags = MAXIMIZED; 945 else if (WinQueryButtonCheckstate(hwnd, CMD_INVISIBLE)) 946 temp.flags = INVISIBLE; 947 if (WinQueryButtonCheckstate(hwnd, CMD_KEEP)) 948 temp.flags |= KEEP; 949 if (WinQueryButtonCheckstate(hwnd, CMD_PROMPT)) 950 temp.flags |= PROMPT; 951 if (WinQueryButtonCheckstate(hwnd, CMD_ONCE)) 952 temp.flags |= ONCE;*/ 953 *env = 0; 954 WinQueryDlgItemText(hwnd, CMD_ENVIRON, 1000, env); 955 bstripcr(env); 956 if (*env) { 957 strcpy(temp.env, env); 958 } 959 if (fCancelAction){ 960 fCancelAction = FALSE; 961 free(temp.pszCmdLine); 1049 } 1050 if (!QueryCommandSettings(hwnd, temp)) { 1051 free(temp->pszCmdLine); 1052 free(temp); 962 1053 break; 963 1054 } 964 else 965 info = add_command(&temp); 966 if (!info) { 967 saymsg(MB_ENTER, hwnd, GetPString(IDS_ERRORTEXT), 968 GetPString(IDS_CANTADDCOMMANDTEXTDUP), temp.title); 969 } 970 else { 971 x = (SHORT) WinSendDlgItemMsg(hwnd, 972 CMD_LISTBOX, 973 LM_INSERTITEM, 974 MPFROM2SHORT(LIT_END, 0), 975 MPFROMP(temp.title)); 976 if (x >= 0) { 977 WinSendDlgItemMsg(hwnd, 978 CMD_LISTBOX, 979 LM_SETITEMHANDLE, 980 MPFROMSHORT(x), MPFROMP(info)); 981 WinSendDlgItemMsg(hwnd, 982 CMD_LISTBOX, 983 LM_SELECTITEM, 984 MPFROMSHORT(x), MPFROMSHORT(TRUE)); 985 save_commands(); 986 } 987 } 988 free(temp.pszCmdLine); 989 } 990 break; 1055 else { 1056 if (temp->HotKeyID == 0) 1057 fDontCheckHotKey = TRUE; 1058 info = add_command(temp, fDontCheckHotKey); 1059 if (!info) { 1060 saymsg(MB_ENTER, hwnd, GetPString(IDS_ERRORTEXT), 1061 GetPString(IDS_CANTADDCOMMANDTEXTDUP), temp->title); 1062 free(temp->pszCmdLine); 1063 free(temp); 1064 break; 1065 } 1066 x = (SHORT) WinSendDlgItemMsg(hwnd, 1067 CMD_LISTBOX, 1068 LM_INSERTITEM, 1069 MPFROM2SHORT(LIT_END, 0), 1070 MPFROMP(temp->title)); 1071 if (x >= 0) { 1072 WinSendDlgItemMsg(hwnd, 1073 CMD_LISTBOX, 1074 LM_SETITEMHANDLE, 1075 MPFROMSHORT(x), MPFROMP(info)); 1076 WinSendDlgItemMsg(hwnd, 1077 CMD_LISTBOX, 1078 LM_SELECTITEM, 1079 MPFROMSHORT(x), MPFROMSHORT(TRUE)); 1080 } 1081 save_commands(); 1082 } 1083 free(temp->pszCmdLine); 1084 free(temp); 1085 break; 1086 } 991 1087 992 1088 case CMD_DELETE: … … 999 1095 WinQueryDlgItemText(hwnd, CMD_TITLE, 100, temp); 1000 1096 bstripcr(temp); 1001 sprintf(keyID, "COMMAND.%sID", temp);1002 sprintf(keyHotKeyID, "COMMAND.%sHotKeyID", temp);1003 sprintf(keyenv, "COMMAND.%senv", temp);1004 PrfWriteProfileData(fmprof, FM3Str, keyID, NULL, NULL);1005 PrfWriteProfileData(fmprof, FM3Str, keyHotKeyID, NULL, NULL);1006 PrfWriteProfileString(fmprof, FM3Str, keyenv, NULL);1007 1097 if (!kill_command(temp)) 1008 1098 Runtime_Error(pszSrcFile, __LINE__, "kill_command"); 1009 else { 1099 else { 1100 sprintf(keyID, "COMMAND.%sID", temp); 1101 sprintf(keyHotKeyID, "COMMAND.%sHotKeyID", temp); 1102 sprintf(keyenv, "COMMAND.%senv", temp); 1103 PrfWriteProfileData(fmprof, FM3Str, keyID, NULL, 0); 1104 PrfWriteProfileData(fmprof, FM3Str, keyHotKeyID, NULL, 0); 1105 PrfWriteProfileString(fmprof, FM3Str, keyenv, NULL); 1010 1106 x = (SHORT) WinSendDlgItemMsg(hwnd, 1011 1107 CMD_LISTBOX, … … 1019 1115 CMD_LISTBOX, 1020 1116 LM_SELECTITEM, 1021 MPFROMSHORT( LIT_NONE), MPFROMSHORT(FALSE));1117 MPFROMSHORT(0), MPFROMSHORT(TRUE)); 1022 1118 } 1023 1119 save_commands(); … … 1027 1123 1028 1124 case CMD_REPLACE: 1029 { //Delete first 1030 PSZ pszWorkBuf; 1031 COMMAND temp; 1032 APIRET ret; 1125 { 1126 COMMAND *temp; 1033 1127 CHAR keyID[120]; 1034 1128 CHAR keyHotKeyID[120]; 1035 1129 CHAR keyenv[120]; 1036 CHAR env[1002];1037 1130 INT ID = 0; 1038 1131 INT HotKeyID = 0; 1039 1132 ULONG size; 1040 1041 pszWorkBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__); 1042 if (!pszWorkBuf) { 1133 BOOL fDontCheckHotKey = FALSE; 1134 1135 // Query the dialog 1136 temp = xmallocz(sizeof(COMMAND), pszSrcFile, __LINE__); 1137 if (!temp) 1138 break; //already complained 1139 temp->pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); 1140 if (!temp->pszCmdLine) { 1141 free (temp); 1043 1142 break; //already complained 1044 1143 } 1045 memset(&temp, 0, sizeof(COMMAND)); 1046 temp.pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); 1047 if (!temp.pszCmdLine) { 1048 free(pszWorkBuf); 1049 break; //already complained 1050 } 1051 WinQueryDlgItemText(hwnd, CMD_CL, MaxComLineStrg, temp.pszCmdLine); 1052 NormalizeCmdLine(pszWorkBuf, temp.pszCmdLine); 1053 memcpy(temp.pszCmdLine, pszWorkBuf, strlen(pszWorkBuf) + 1); 1054 free(pszWorkBuf); 1055 if (fCancelAction){ 1056 fCancelAction = FALSE; 1057 free(temp.pszCmdLine); 1144 if (!QueryCommandSettings(hwnd, temp)) { 1145 free(temp->pszCmdLine); 1146 free(temp); 1058 1147 break; 1059 }1060 if (!strchr(temp.pszCmdLine, '%') && !fCancelAction){1061 ret = saymsg(MB_YESNO,1062 HWND_DESKTOP,1063 NullStr,1064 GetPString(IDS_TOACTONSELECTEDTEXT));1065 if (ret == MBID_YES)1066 strcat(temp.pszCmdLine, " %a");1067 1148 } 1068 1149 //remember item location in the list … … 1071 1152 LM_QUERYSELECTION, 1072 1153 MPFROMSHORT(LIT_CURSOR), MPVOID); 1073 WinQueryDlgItemText(hwnd, CMD_TITLE, sizeof(temp.title), temp.title); 1074 bstripcr(temp.title); 1075 sprintf(keyID, "COMMAND.%sID", temp.title); 1076 sprintf(keyHotKeyID, "COMMAND.%sHotKeyID", temp.title); 1077 sprintf(keyenv, "COMMAND.%senv", temp.title); 1154 //Delete 1155 sprintf(keyID, "COMMAND.%sID", temp->title); 1156 sprintf(keyHotKeyID, "COMMAND.%sHotKeyID", temp->title); 1157 sprintf(keyenv, "COMMAND.%senv", temp->title); 1078 1158 PrfQueryProfileData(fmprof, FM3Str, keyID, &ID, &size); 1079 1159 PrfQueryProfileData(fmprof, FM3Str, keyHotKeyID, &HotKeyID, &size); 1080 PrfQueryProfileString(fmprof, FM3Str, keyenv, NullStr, env, sizeof(env)); 1081 temp.ID = ID; 1082 temp.HotKeyID = HotKeyID; 1083 if (env != NullStr) 1084 strcpy(temp.env, env); 1085 PrfWriteProfileData(fmprof, FM3Str, keyID, NULL, NULL); 1086 PrfWriteProfileData(fmprof, FM3Str, keyHotKeyID, NULL, NULL); 1087 PrfWriteProfileString(fmprof, FM3Str, keyenv, NULL); 1088 if (kill_command(temp.title)){ 1160 temp->ID = ID; 1161 if (temp->HotKeyID == HotKeyID || temp->HotKeyID == 0) 1162 fDontCheckHotKey = TRUE; 1163 if (kill_command(temp->title)) { 1164 PrfWriteProfileData(fmprof, FM3Str, keyID, NULL, 0); 1165 PrfWriteProfileData(fmprof, FM3Str, keyHotKeyID, NULL, 0); 1166 PrfWriteProfileString(fmprof, FM3Str, keyenv, NULL); 1089 1167 x = (SHORT) WinSendDlgItemMsg(hwnd, 1090 1168 CMD_LISTBOX, … … 1101 1179 } 1102 1180 } // then do an add 1103 temp.flags = CheckExecutibleFlags(hwnd, 3); 1104 /*if (WinQueryButtonCheckstate(hwnd, CMD_DEFAULT)) 1105 temp.flags = 0; 1106 else if (WinQueryButtonCheckstate(hwnd, CMD_FULLSCREEN)) 1107 temp.flags = FULLSCREEN; 1108 else if (WinQueryButtonCheckstate(hwnd, CMD_MINIMIZED)) 1109 temp.flags = MINIMIZED; 1110 else if (WinQueryButtonCheckstate(hwnd, CMD_MAXIMIZED)) 1111 temp.flags = MAXIMIZED; 1112 else if (WinQueryButtonCheckstate(hwnd, CMD_INVISIBLE)) 1113 temp.flags = INVISIBLE; 1114 if (WinQueryButtonCheckstate(hwnd, CMD_KEEP)) 1115 temp.flags |= KEEP; 1116 if (WinQueryButtonCheckstate(hwnd, CMD_PROMPT)) 1117 temp.flags |= PROMPT; 1118 if (WinQueryButtonCheckstate(hwnd, CMD_ONCE)) 1119 temp.flags |= ONCE;*/ 1120 *env = 0; 1121 WinQueryDlgItemText(hwnd, CMD_ENVIRON, 1000, env); 1122 bstripcr(env); 1123 if (*env) 1124 strcpy(temp.env, env); 1125 if (!*env && temp.env != NullStr) 1126 strcpy(temp.env, NullStr); 1127 info = add_command(&temp); 1181 info = add_command(temp, fDontCheckHotKey); 1128 1182 if (!info) { 1129 1183 saymsg(MB_ENTER, hwnd, GetPString(IDS_ERRORTEXT), 1130 1184 GetPString(IDS_CANTADDCOMMANDTEXT), 1131 temp.title); 1132 } 1133 1185 temp->title); 1186 } 1134 1187 else { 1135 1188 //put item back in original place … … 1138 1191 LM_INSERTITEM, 1139 1192 MPFROM2SHORT(y, 0), 1140 MPFROMP(temp .title));1193 MPFROMP(temp->title)); 1141 1194 if (x >= 0) { 1142 1195 LINKCMDS *temphead = NULL,*last = NULL, *temptail = NULL; … … 1179 1232 } 1180 1233 cmdhead = temphead; 1181 1234 cmdtail = temptail; 1182 1235 save_commands(); 1183 1236 } 1184 1237 } 1185 free(temp.pszCmdLine); 1238 xfree(temp->pszCmdLine, pszSrcFile, __LINE__); 1239 xfree(temp, pszSrcFile, __LINE__); 1186 1240 } 1187 1241 break; … … 1189 1243 return 0; 1190 1244 } 1245 # ifdef FORTIFY 1246 Fortify_LeaveScope(); 1247 # endif 1191 1248 return WinDefDlgProc(hwnd, msg, mp1, mp2); 1192 1249 }
Note:
See TracChangeset
for help on using the changeset viewer.