From: karcher@thuria.waisman.wisc.edu Sent: Monday, January 14, 2002 11:03 PM To: Info-VAX@Mvb.Saic.Com Subject: Re: In an executable, how do I retrieve the version information for a shareable executable that I am linked against? In a previous article, "Malcolm" wrote: -> ->Wonder if any of you guys out there can tell me how to answer this question? -> ->In an X Windows application, I would like to be able to determine the ->current ->version information for SYS$SHARE:DECW$XLIBSHR.EXE, as this will tell me ->what version of Motif is being used. Sure, I could just open up the EXE file ->and read the version information from the file, but is there a better method? There's a macro routine from '87 that does this. I found this in Mark London's "Bulletin" utility in the file ALLMACS_AXP.MAR (I still use Bulletin to read this newgroup): .TITLE READ_HEADER - Read Image Header .IDENT /1-001/ ; This subroutine returns the image identification and link time. ; ; Format: ; ; status.wlc.v = READ_HEADER( ident.wt.ds [,time.wt.ds] ) ; ; Parameters: ; ; ident The image identification text. ; ; time The image link time (text format). ; Date By Comments ; 4/10/87 D.E. Greenwood Originally written by John Miano, 24-June-1986 ; obtained from April 87 DECUS L&T Sig Newsletter .LIBRARY "SYS$LIBRARY:LIB" $DSCDEF $EIHDDEF $EIHIDEF $SSDEF ; Argument pointer offsets $OFFSET 4,POSITIVE, .PSECT READ_HEADER, RD, NOWRT, EXE, LONG .ENTRY READ_HEADER, ^M< R2, R3, R4, R5, R6, R7, R8, R11 > CMPL (AP),#1 ; Make sure that there is at least BGEQ ENOUGH_ARGUMENTS ; one argument to this routine MOVL #SS$_INSFARG, R0 RET ENOUGH_ARGUMENTS: ; Get the identification of the image. MOVL @#CTL$GL_IMGHDRBF, R11 ; R11 - Address of image buffer MOVL (R11), R6 ; R6 - Address of image header MOVL EIHD$L_IMGIDOFF(R6), R7 MOVAB (R6)[R7], R7 ; R7 - Address of ID Block CVTBL EIHI$T_IMGID(R7),R0 ; Length of the ID string MOVL IDENT(AP), R8 MOVC5 R0, (R7), #32, - DSC$W_LENGTH(R8), @DSC$A_POINTER(R8) CMPL (AP), #2 BGEQ RETURN_TIME MOVZBL #1, R0 RET RETURN_TIME: ; Get the time the image was linked and convert it to ASCII $ASCTIM_S - TIMBUF=@TIME(AP), - TIMADR=EIHI$Q_LINKTIME(R7) RET END -- Carl Karcher, Waisman Computing Services, Waisman Center, UW-Madison -- karcher@waisman.wisc.edu