From:	MERC::"uunet!WKUVX1.BITNET!MacroMan" 18-JUN-1992 13:03:04.65
To:	MACRO32@WKUVX1.BITNET
CC:	
Subj:	RE: Can I get the creation date/time of the image I am running?

Date sent:  17-JUN-1992 17:26:08

Various people posted their code to read image headers.
However, you might note that the image name stored at
ihi$t_imgnam is the original name of the image at build
time, and not the name of the file.

I.E., when you F$GETJPI(x,"IMAGNAM") on someone, you will
see the FILENAME they ran, not the IMAGENAME that the
image activator sees.

The following snippet shows the difference.  If you do the
following:
        (call it T.MAR)
        $ mac t
        $ link t
        $ ren t.exe t2.exe
        $ run t2
You'll see that it identifies itself as originally T, and now T2.

Good stuff, but my only question is -- what is the magic name for
the offset I hardcoded as ^X14???

Ehud

--
Ehud Gavron        (EG76)
gavron@vesta.sunquest.com
"The world bores you when you're cool."

        .library        "sys$library:lib.mlb"
        .link           "sys$system:sys.stb"/selective_search

        $ihddef
        $ihidef

        .entry  t,^m<>
        movl    g^ctl$gl_imghdrbf,r4            ; Get image header buffer ptr
        movl    (r4),r4                         ; Get image header buffer
        movzwl  ihd$w_imgidoff(r4),r5           ; Get image ID section offset
        addl2   r5,r4                           ; Get pointer to image ID sec
        movzbl  ihi$t_imgnam(r4),r7             ; Length of string
        addl3   #<ihi$t_imgnam+1>,r4,-(sp)      ; Address of string on stack
        movl    r7,-(sp)                        ; Length of string
        pushl   sp                              ; Address of descriptor on stk
        calls   #1,g^lib$put_output             ; Display it...

        movl    g^ctl$gl_imglstptr,r4           ; Image list pointer
        addl3   #^x14,(r4),r4                   ; get file name
        addl3   #1,r4,-(sp)                     ; Store address of string
        movzbl  (r4),-(sp)                      ; Store length...
        pushl   sp                              ; Address of descriptor...
        calls   #1,g^lib$put_output             ; Display it...

        ret
        .end    t
