From - Mon Mar  1 18:36:30 1999
Path: reader1.news.rcn.net!feed1.news.rcn.net!rcn!newsfeed.enteract.com!newsfeed.berkeley.edu!remarQ73!supernews.com!remarQ.com!remarQ69!SendSpamHere.ORG!SYSTEM
From: system@SendSpamHere.ORG (Brian Schenkenberger, VAXman-)
Newsgroups: comp.os.vms
Subject: Re: IDENT=
Date: Mon, 01 Mar 1999 22:52:10 GMT
Organization: TMESIS Software
Lines: 87
Distribution: world
Message-ID: <009D4794.B1B1D2F5@SendSpamHere.ORG>
References: <7beihf$q2j$1@nnrp1.dejanews.com> <7beu23$gna@usenet.pa.dec.com>
Reply-To: system@SendSpamHere.ORG
NNTP-Posting-Host: 206.136.149.211
X-Trace: 920328557 B7XOCZ/PT95D3CE88C east43.supernews.com
X-Complaints-To: newsabuse@remarq.com
Xref: reader1.news.rcn.net comp.os.vms:223081

In article <7beu23$gna@usenet.pa.dec.com>, hoffman@xdelta.enet.dec.nospam (Hoff Hoffman) writes:
>
>In article <7beihf$q2j$1@nnrp1.dejanews.com>, bobboylan@my-dejanews.com writes:
>:When linking I use the "IDENT=num" to uniquely identify versions of
>:executables. Works great and I can easily see it using the analyze/image
>:command.  What I'm interested in ... is there a way to retrieve this
>:information about the program while it is running?
>
>  Yes, but it requires some undocumented gyrations and the decoding 
>  of the image headers.  Not difficult, but not entirely obvious
>  either.   Usually, opening the file and accessing the headers
>  is the easiest -- you will be interested becoming familiar with
>  the IHIDEF and IHDDEF structures in the image header...  (This is
>  undocumented and unsupported.)

;++
; Copyright © 1993 - 1999  by Brian Schenkenberger and TMESIS.
; ALL RIGHTS RESERVED.
;--

;++
.SBTTL	Determine the target architecture
;--
	.NTYPE	...ON_ALPHA...,R31
	.IIF EQ,<...ON_ALPHA...@-4&^XF>-5, ALPHA=0
	.IIF DF,ALPHA, .DISABLE	FLAGGING

;++
.SBTTL	Macro declarations for architectural conditional compilation
;--
	.MACRO	.ON_AXP	OPERATION	; conditional compilation macro
	.IIF DF,ALPHA,	OPERATION	;    for code specific to Alpha
	.ENDM	.ON_AXP;OPERATION

	.MACRO	.ON_VAX	OPERATION	; conditional compilation macro
	.IIF NDF,ALPHA,	OPERATION	;    for code specific to VAX
	.ENDM	.ON_VAX;OPERATION

;++
; TMESIS$GET_TIME_IDENT	identification
;
; returns:	R0	status, always normal
;
; arguments:	identification
;		OpenVMS usage:	image_identification
;		type:		character-coded text string
;		access:		write only
;		mechanism:	by 32- or 64-bit descriptor-fixed-length 
;				string descriptor (Alpha)
;				by 32-bit descriptor-fixed-length 
;				string descriptor (VAX)
;--
; To Build:
;
; $ MACRO TMESIS$GET_IMAGE_IDENT
;
; To link:  (VAX)
;
; $ LINK ...,TMESIS$GET_IMAGE_IDENT,...,SYS$SYSTEM:SYS.STB,IMGDEF.STB
;
; To link:  (Alpha)
;
; $ LINK/SYSEXE ...,TMESIS$GET_IMAGE_IDENT,...,SYS$LOADABLE_IMAGES:IMGDEF.STB
;--
	.PSECT	__TMESIS_CODE,NOWRT,EXE,5
	.ENTRY	TMESIS$GET_IMAGE_IDENT,^m<R2>

	MOVL	@CTL$GL_IMGHDRBF,R0

.ON_VAX <MOVZWL	IHD$W_IMGIDOFF(R0),R1>
.ON_VAX <ADDL2	R1,R0>
.ON_VAX <MOVQ	@4(AP),R1>
.ON_VAX	<MOVC5	#IHI$S_IMGID,IHI$T_IMGID+1(R0),#0,R1,(R2)>

.ON_AXP <ADDL2	EIHD$L_IMGIDOFF(R0),R0>
.ON_AXP <MOVQ	@4(AP),R1>
.ON_AXP	<MOVC5	#EIHI$S_IMGID,EIHI$T_IMGID+1(R0),#0,R1,(R2)>
	MOVL	#SS$_NORMAL,R0
	RET
	.END

You're free to use this as long as the code remains unchanged and the
copyright notice is maintained and your not a schmuck or the schmuck.

--
VAXman- OpenVMS APE certification number: AAA-0001          VAXman@TMESIS.COM

