From: SMTP%"krj@praxa.com.au" 3-NOV-1994 09:07:07.90 To: EVERHART CC: Subj: Re: Any programs that find all images?? From: krj@praxa.com.au X-Newsgroups: comp.os.vms Subject: Re: Any programs that find all images?? Message-Id: <1994Nov3.111245.134222@praxa.com.au> Date: 3 Nov 94 11:12:45 +1100 Organization: Praxa Ltd. Lines: 134 To: Info-VAX@Mvb.Saic.Com X-Gateway-Source-Info: USENET In article , "Thomas J. Mason" writes: > Are there any DECUS or shareware or any programs that find all .EXE's on > all of a systems disks and attempt to identify them? I would even be > interested in hearing about any commercial products. > Jeff Mason -- infs0009@frank.mstu.edu -- Jeff, Following is a short Fortran program I use. Put it in a loop using F$DEVICE("*","DISK") with an inner loop using f$search and Bob's yer uncle. May not work if header is in next block of .exe, but it gets most of them. Cheers, --kj Kelley Johnston {RDB, VMS systems software, Interociter repair } krj@praxa.com.au {77% of all statistics are made up on the spot } {I am opinionated, but never injudiciously so } ----====[cut here]====---- PROGRAM FIND_IMAGE_VERSION !====================================================================== ! FIND_IMAGE_VERSION.FOR -- Determine version of .EXE ! ! Description: ! Determine the version of an image by reading the ! image file header, then set a symbol and report the value. ! ! Parameters: ! P1 -- Image name ! !---------------------------------------------------------------------- ! 28-Oct-1993 K.Johnston Initial release !====================================================================== IMPLICIT INTEGER*4 (A-Z) ! Declare local variables BYTE HDR_BLOCK (512) CHARACTER*512 HDR_BLOCK_STR EQUIVALENCE (HDR_BLOCK(1), HDR_BLOCK_STR(1:1)) INTEGER*2 STR_LOC CHARACTER*80 IMAGE_NAME, VERSION_STRING BYTE STR_LEN BYTE TEST_BYTE CHARACTER*1 TEST_BYTE_S EQUIVALENCE (TEST_BYTE, TEST_BYTE_S(1:1)) INTEGER*2 IMAGE_NAME_LEN PARAMETER (LUN_INPUT = 1) PARAMETER (SRCH_OFFSET = 128) ! Determine image name from CLI line STATUS = LIB$GET_FOREIGN ( 1 IMAGE_NAME 1 ,'Image name: ' 1 ,IMAGE_NAME_LEN 1 ) ! Open the image name as unformatted file and read first block OPEN ( 1 UNIT = LUN_INPUT 1 ,NAME = IMAGE_NAME(1:IMAGE_NAME_LEN) 1 ,STATUS = 'OLD' 1 ,FORM = 'UNFORMATTED' 1 ,ERR = 100 1 ,READONLY 1 ) READ (LUN_INPUT) HDR_BLOCK CLOSE (LUN_INPUT) ! Determine the string delimited by byte count at offset STR_POS = STR_LOC + STR_LOC_OFF VERSION_STRING = HDR_BLOCK_STR (STR_POS : 1 STR_POS + STR_LEN) ! Now scan block from offset, checking for first non-null byte; ! it's the length of the actual version string which follows. DO I = SRCH_OFFSET, SRCH_OFFSET + 16 IF (HDR_BLOCK(I) .NE. 0) THEN STR_LEN = HDR_BLOCK(I) VERSION_STRING(1:STR_LEN) = 1 HDR_BLOCK_STR(I+1:) GOTO 50 ! EXIT DO ENDIF ENDDO 50 CONTINUE ! ...and report it STATUS = LIB$SET_SYMBOL ('IMAGE_VERSION', 1 VERSION_STRING(1:STR_LEN) 1 ) TYPE *, 'Image version = ', VERSION_STRING(1:STR_LEN) 100 CONTINUE !====================================================================== ! End of FIND_IMAGE_VERSION.FOR !====================================================================== END