Changeset 209 for trunk/src/helpers/exeh.c
- Timestamp:
- Aug 19, 2002, 11:23:17 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/helpers/exeh.c
r176 r209 176 176 *@@changed V0.9.16 (2001-12-08) [umoeller]: speed optimizations, changed some return codes 177 177 *@@changed V0.9.16 (2002-01-04) [umoeller]: added fixes for COM, BAT, CMD extensions 178 *@@changed V0.9.21 (2002-08-18) [umoeller]: this was completely broken for files without extensions (os2krnl) 178 179 */ 179 180 … … 193 194 194 195 if (!ppExec) 195 return (ERROR_INVALID_PARAMETER);196 return ERROR_INVALID_PARAMETER; 196 197 197 198 if (!(pExec = (PEXECUTABLE)malloc(sizeof(EXECUTABLE)))) 198 return (ERROR_NOT_ENOUGH_MEMORY);199 return ERROR_NOT_ENOUGH_MEMORY; 199 200 200 201 memset(pExec, 0, sizeof(EXECUTABLE)); … … 202 203 // check some of the default extensions 203 204 // V0.9.16 (2002-01-04) [umoeller] 204 if ( pExt = doshGetExtension(pcszExecutable))205 if (!(pExt = doshGetExtension(pcszExecutable))) 205 206 { 207 // has no extension: then open file! 208 // fixed V0.9.21 (2002-08-18) [umoeller] 209 fOpenFile = TRUE; 210 } 211 else 212 { 213 // has extension: 206 214 if (!stricmp(pExt, "COM")) 207 215 { … … 508 516 /* 509 517 *@@ ParseBldLevel: 510 * called from exehQueryBldLevel to parse 511 * the BLDLEVEL string. 512 * 513 * On entry, caller has copied the string into 514 * pExec->pszDescription. The string is 515 * null-terminated. 516 * 517 * The BLDLEVEL string comes in two flavors. 518 * called from exehQueryBldLevel to parse the BLDLEVEL string. 519 * 520 * On entry, caller has copied the string into pExec->pszDescription. 521 * The string is null-terminated. 522 * 523 * The BLDLEVEL string comes in at least two basic flavors. 518 524 * 519 525 * -- The standard format is: … … 524 530 * need to have them. 525 531 * 526 * -- However, there is an extended version 527 * in that the DESCRIPTION field is split 528 * up even more. The marker for this seems 529 * to be that the description starts out 530 * with "##1##". 532 * -- However, there is an extended version in that the DESCRIPTION field 533 * is split up even more. 534 * 535 * I have seen two subformats for this. 536 * 537 * -- DANIS506.ADD and some IBM programs have a marker that seems 538 * to be that the description starts out with "##1##". 531 539 * 532 540 + ##1## DATETIME BUILDMACHINE:ASD:LANG:CTRY:REVISION:UNKNOWN:FIXPAK@@DESCRIPTION 533 541 * 534 * The problem is that the DATETIME field comes 535 * in several flavors. IBM uses things like 536 * 537 + "Thu Nov 30 15:30:37 2000 BWBLD228" 538 * 539 * while DANIS506.ADD has 540 * 541 + "15.12.2000 18:22:57 Nachtigall" 542 * 543 * Looks like the date/time string is standardized 544 * to have 24 characters then. 542 * The problem is that the DATETIME field comes 543 * in several flavors. IBM uses things like 544 * 545 + "Thu Nov 30 15:30:37 2000 BWBLD228" 546 * 547 * while DANIS506.ADD has 548 * 549 + "15.12.2000 18:22:57 Nachtigall" 550 * 551 * Looks like the date/time string is standardized to have 24 characters then. 552 * 553 * -- IBM TCP/IP executables (try INETD.EXE) have something yet different on. 554 * We now try to parse that format as well, even though bldlevel.exe can't 555 * handle it. (Isn't that utility from IBM too?) 556 * 557 * Here's what I get for inetd.exe: 558 * 559 + ##built 09:16:27 Mon Sep 17 2001 -- On AURORA43;0.1@@ TCP/IP for OS/2: INETD 545 560 * 546 561 *@@added V0.9.12 (2001-05-18) [umoeller] 547 562 *@@changed V0.9.12 (2001-05-19) [umoeller]: added extended BLDLEVEL support 563 *@@changed V0.9.21 (2002-08-18) [umoeller]: added support for IBM TCP/IP format 564 *@@changed V0.9.21 (2002-08-18) [umoeller]: fixed DANIS506 format when an extended field had only one character 548 565 */ 549 566 … … 555 572 556 573 // @#VENDOR:VERSION#@ DESCRIPTION 557 // but skip the first byte, which has the string length558 574 if ( (pStartOfVendor = strstr(pExec->pszDescription, "@#")) 559 575 && (pStartOfInfo = strstr(pStartOfVendor + 2, "#@")) … … 569 585 570 586 // now check if we have extended DESCRIPTION V0.9.12 (2001-05-19) [umoeller] 571 if ( (strlen(pStartOfInfo) > 6) 572 && (!memcmp(pStartOfInfo, "##1##", 5)) 573 ) 587 if (strlen(pStartOfInfo) > 6) 574 588 { 575 // yes: parse that beast 576 const char *p = pStartOfInfo + 5; 577 578 // get build date/time 579 if (strlen(p) > 24) 589 if (!memcmp(pStartOfInfo, "##1##", 5)) 580 590 { 581 // date/time seems to be fixed 24 chars in length 582 if (pExec->pszBuildDateTime = (PSZ)malloc(25)) 583 { 584 memcpy(pExec->pszBuildDateTime, 591 // DANIS506.ADD format: 592 // "##1## 2.7.2002 19:32:34 Nachtigall::::6::@@..." 593 594 // parse that beast 595 PCSZ p = pStartOfInfo + 5; 596 597 // get build date/time 598 if (strlen(p) > 24) 599 { 600 // skip leading and trailing spaces 601 // V0.9.21 (2002-08-18) [umoeller] 602 PCSZ pStartOfDT = p, 603 pEndOfDT = p + 24; 604 // date/time seems to be fixed 24 chars in length 605 606 while (*pStartOfDT == ' ') 607 ++pStartOfDT; 608 609 while ( (*pEndOfDT == ' ') 610 && (pEndOfDT > pStartOfDT) 611 ) 612 --pEndOfDT; 613 614 pExec->pszBuildDateTime = strhSubstr(pStartOfDT, pEndOfDT + 1); 615 616 /* memcpy(pExec->pszBuildDateTime, 585 617 p, 586 618 24); 587 619 pExec->pszBuildDateTime[24] = '\0'; 588 620 */ 621 622 // date/time seems to be fixed 24 chars in length 589 623 p += 24; 590 624 … … 613 647 ul++) 614 648 { 615 BOOL fStop = FALSE;616 const char *pNextColon = strchr(p, ':'),617 *pDoubleAt = strstr(p, "@@");649 BOOL fStop = FALSE; 650 PCSZ pNextColon = strchr(p, ':'), 651 pDoubleAt = strstr(p, "@@"); 618 652 if (!pNextColon) 619 653 { … … 635 669 ) 636 670 { 637 if (pNextColon > p + 1) 671 // if (pNextColon > p + 1) 672 // fixed V0.9.21 (2002-08-18) [umoeller] 673 // this failed on fields like "revision" 674 // which only had one character 675 if (pNextColon > p) 638 676 *(papsz[ul]) = strhSubstr(p, pNextColon); 639 677 } … … 648 686 } 649 687 } 688 689 if (pStartOfInfo = strstr(p, 690 "@@")) 691 pStartOfInfo += 2; 692 } // end if (!memcmp(pStartOfInfo, "##1##", 5)) 693 else if (!memcmp(pStartOfInfo, "##built", 7)) 694 { 695 // IBM TCP/IP format: 696 // V0.9.21 (2002-08-18) [umoeller] 697 698 // ##built 09:16:27 Mon Sep 17 2001 -- On AURORA43;0.1@@ TCP/IP for OS/2: INETD 699 700 PCSZ p = pStartOfInfo + 7, 701 p2, 702 p3; 703 704 if (p3 = strchr(p, ';')) 705 { 706 while (*p == ' ') 707 ++p; 708 709 // ##built 09:16:27 Mon Sep 17 2001 -- On AURORA43;0.1@@ TCP/IP for OS/2: INETD 710 // ^ p ^ p3 711 // ^ p2 712 713 if ( (p2 = strstr(p, " -- On ")) 714 && (p2 < p3) 715 ) 716 { 717 pExec->pszBuildMachine = strhSubstr(p2 + 7, p3); 718 pExec->pszBuildDateTime = strhSubstr(p, p2); 719 } 720 else 721 pExec->pszBuildDateTime = strhSubstr(p, p3); 722 723 p = p3 + 1; 724 } 725 726 if (pStartOfInfo = strstr(p, 727 "@@")) 728 { 729 if (pStartOfInfo > p3) 730 { 731 // p3 points to this "0.1" string; I assume this is 732 // a "revision.fixpak" format since inetver reports 733 // four digits with this revision 734 PCSZ p4; 735 if ( (p4 = strchr(p3, '.')) 736 && (p4 < pStartOfInfo) 737 ) 738 { 739 pExec->pszRevision = strhSubstr(p3 + 1, p4); 740 pExec->pszFixpak = strhSubstr(p4 + 1, pStartOfInfo); 741 } 742 else 743 pExec->pszRevision = strhSubstr(p3 + 1, pStartOfInfo); 744 } 745 746 pStartOfInfo += 2; 747 } 650 748 } 651 652 pStartOfInfo = strstr(p,653 "@@");654 if (pStartOfInfo)655 pStartOfInfo += 2;656 749 } 657 750 … … 666 759 // skip leading spaces in info string 667 760 while (*pStartOfInfo == ' ') 668 pStartOfInfo++; 761 ++pStartOfInfo; 762 669 763 if (*pStartOfInfo) // V0.9.9 (2001-04-04) [umoeller] 670 764 // and copy until end of string … … 2142 2236 static APIRET ExpandIterdata1(char *pabTarget, // out: page data (pagesize as in lx spec) 2143 2237 int cbTarget, // in: sizeof *pabTarget (pagesize as in lx spec) 2144 const char *pabSource, // in: compressed source data in EXEPACK:1 format2238 PCSZ pabSource, // in: compressed source data in EXEPACK:1 format 2145 2239 int cbSource) // in: sizeof *pabSource 2146 2240 { … … 2205 2299 */ 2206 2300 2207 static void memcpyw(char *pch1, const char *pch2, size_t cch)2301 static void memcpyw(char *pch1, PCSZ pch2, size_t cch) 2208 2302 { 2209 2303 /* … … 2239 2333 */ 2240 2334 2241 static void memcpyb(char *pch1, const char *pch2, size_t cch)2335 static void memcpyb(char *pch1, PCSZ pch2, size_t cch) 2242 2336 { 2243 2337 /* … … 2276 2370 static APIRET ExpandIterdata2(char *pachPage, // out: page data (pagesize as in lx spec) 2277 2371 int cchPage, // in: sizeof *pachPage (pagesize as in lx spec) 2278 const char *pachSrcPage, // in: compressed source data in EXEPACK:1 format2372 PCSZ pachSrcPage, // in: compressed source data in EXEPACK:1 format 2279 2373 int cchSrcPage) // in: size of source buf 2280 2374 { … … 3182 3276 } 3183 3277 3278
Note:
See TracChangeset
for help on using the changeset viewer.