| Title: | -={ H A C K E R S }=- |
| Notice: | Write locked - see NOTED::HACKERS |
| Moderator: | DIEHRD::MORRIS |
| Created: | Thu Feb 20 1986 |
| Last Modified: | Mon Aug 03 1992 |
| Last Successful Update: | Fri Jun 06 1997 |
| Number of topics: | 680 |
| Total number of notes: | 5456 |
Does anyone have a simple way of getting the image version (image
file identification) of the running image? Or does one have to
read the image file?
thanks, /alan
| T.R | Title | User | Personal Name | Date | Lines |
|---|---|---|---|---|---|
| 336.1 | $GETJPI (?) | CLT::MULLEN | Where Alf, the sacred river ran. | Fri Oct 17 1986 14:57 | 8 |
I simple call to $GETJPI with JPI$_IMAGNAME should do
it unless I missed something. Note that is the image
is installed this wont return the version number
otherwise all you save to do is parse the return
string for a ';'.
Dan
| |||||
| 336.2 | IMAGE FILE IDENTIFICATION/VERSION ANYONE | FNYFS::AUNGIER | Rene El Gringo sin casa, Irish Rebel | Mon Oct 20 1986 09:28 | 56 |
Hello Alan,
I have a procedure written in COBOL which will give you a lot
of information about processes. You could have a copy of the
program if you want and make some changes. This is the type
of output it produces.
I wrote this with the attention of having it callable from any
language and easy to use but it is not finished as it is a mid
night project and at the moment I am too busy to continue. It
is my attention for it to be able to return any chosen process
info with a very simple call to it so that it can be used by
any language and if the system service call changes then only
this module would need to be changed and not the programs that
call it.
[1;4mJOB PROCESS INFORMATION OF SMART GROUP[0m
Username is AUNGIER
Process Name is Malvinas
Images running are FNY09$DUB10:[BSG.][AUNGIER.SYSTEM_SERVICE_PROGRAM_EXAMPLES.COB.EXE]SYS$GETJPI.EXE;1
Your terminal Id is LTA84:
Your process Hex Id is
00000202
Your owner process hex Id is
00000202
Your process mode is INTERACTIVE
[1;4mJOB PROCESS INFORMATION OF SMART GROUP[0m
Username is BANCIL
Process Name is BANCIL
Images running are FNY09$DUA0:[SYS0.SYSCOMMON.][SYSEXE]TYPE.EXE
Your terminal Id is LTA88:
Your process Hex Id is
0000020C
Your process mode is INTERACTIVE
[1;4mJOB PROCESS INFORMATION OF SMART GROUP[0m
Username is CAMBRIDGE
Process Name is Audio
Images running are FNY09$DUB10:[BSG.][SMART.DEV.EXE]SMU03E00.EXE;2
Your terminal Id is
Your process Hex Id is
000000AD
000000AD
Your process mode is UNKNOWN
I hope this is of some help. Let me know if you want the source.
Regards
Rene Aungier
(ADG, Ferney-Voltaire)
| |||||
| 336.3 | a good but not simple solution | HAYNES::GUENTHER | Mon Oct 20 1986 11:43 | 7 | |
Thanks all, Douglas Gordan sent me a routine which does what I was
afraid I'd have to - do a getjpi for the image's file name, then
open/read/close the file and get the data out of the appropriate
record in the image. UGH. Progress! Where's .jbver when you need
it?
/alan
| |||||
| 336.4 | There's a copy in P1 | BISQUE::RATCLIFF | John Ratcliff | Mon Oct 20 1986 17:05 | 6 |
Well, if you want the version name of the image you're running (for
another process, that would mean kernel-asts), ctl$gl_imghdrbf in
p1 space holds a longword pointer to p1 info, which looks a good
deal like block 0 of the .EXE file + full file name.
Hope this helps, John
| |||||
| 336.5 | re: .4 | BOEHM::GUENTHER | Tue Oct 21 1986 10:43 | 4 | |
That sounds much better, I will check into it.
/alan
| |||||
| 336.6 | Check the Internals Bible | SKYLAB::FISHER | Burns Fisher 381-1466, ZKO1-1/D42 | Tue Oct 21 1986 13:31 | 7 |
Check out Kenah and Bate, pp 743-744. It looks like
IHD$L_IDENT(image_header) contains a pointer to the image id section.
In the image ID section, you have IHI$T_IMGNAM (image name),
IHI$T_IMGID, IHI$Q_LINKTIME, and IHI$T_LINKID. I presume that IMGID
will give you what you want.
Burns
| |||||
| 336.7 | It's amazing what you can find in the attic! | ERIS::CALLAS | O jour frabbejais! Calleau! Callai! | Wed Oct 22 1986 10:40 | 144 |
Here's a routine that I wrote ages ago (check the date). It's not the
best code in the world, but it has worked on VMS versions 1 through 5
inclusive, needing nothing worse than a re-compile.
The "system programmer notes" referred to in the comments were the
class notes from the original VMS System Programmer course (now called
the VMS Internals course). Kenah & Bate more than supercedes these
notes. "F4V" was what we called the original VAX Fortran compiler.
Jon
.Title JDC_GET_VERSION : Get ident & link time
.Ident /V1.01/
.Sbttl Opening Remarks & Comments
;
;
; Written by J. D. Callas 1-Jun-1979
;
;*******************************************************************************
; Change Log:
;*******************************************************************************
;
;
; The subroutine JDC_GET_VERSION will obtain the ident & link
;time of the program that calls it.The procedure it uses is:
;When VMS starts a program, it actually calls it as a subroutine,
;passing it 6 arguments via the AP. The 3rd argument points to the
;DCL header, which contains (among other things) the ident and link
;time of the image. This subroutine obtains these from the DCL header
;by declaring an initialization procedure which stores the
;whole argument list in a global psect called JDC_IMG_ARGLIST.
;the DCL header is grabbed by GET_VERSION from this block
;of storage & returns the ident & link time to its caller.
;A map of the DCL header can be found in the system programmer notes,
;volume 2. The initialization procedure has the global name JDC_IA_SAVE.
;
; Calling Sequence (F4V):
;
; CALL JDC_GET_VERSION(ident,date)
;
; ident = the address of a CHARACTER*15 descriptor to receive the
; ident of the executable image
;
; date = the address of a CHARACTER*24 descriptor to recive the
; link time of the executable image
;
;
; A sample call is:
;
;
; CHARACTER IDENT*15,DATE*24
; CALL JDC_GET_VERSION(IDENT,DATE)
; TYPE*, IDENT,' ',DATE
;
;Version-3.17 20-JUN-1995 15:34:12.38
;
.page
.sbttl EQUIVALENCE SYMBOLS & ERROR MSGS
.psect $pdata pic,usr,con,rel,lcl,shr,noexe,rd,nowrt
.library /SYS$LIBRARY:LIB/
$ihddef
$ihidef
ident_error_msg:
.ascii /*Ident*Error***/
first_2_args = 4 ;offset from AP to 1st 2 args (via MOVQ)
;We will use:
;ihd$w_imgidoff -- offset from the beginning of the DCL header to
; the word containing the image ident offset
;ihi$t_imgid -- offset from the image header to the ident
;ihi$q_linktime -- offset from the DCLH to the link time
.page
.sbttl Main Subroutine
.psect $code pic,usr,con,rel,lcl,shr,exe,rd,nowrt
jdc_get_version:: ;entry point
.word ^X0FFC ;save R2 => R11
cmpb (AP),#2 ;Are there the right # of args?
blss no_args ;BRif too few, ignore extra
;
;This routine is pure-procedure. The regesters are:
; R0 = temporary, condition flags, & status back to caller
; R1 = temporary
; R2 = "
; R3 = "
; R4 = "
; R5 = "
; R6 = address of the ident descriptor
; R7 = address of the date descriptor
; R8 = Unused
; R9 = Unused
; R10 = address of the DCL header
; R11 = temporary for offsets & addresses into the DCL header
;
movq first_2_args(AP),r6 ;move descriptors in r6 & r7
movl jdc_img_arglist+12,r10 ;get pointer to the DCL header
movc5 #0,(r6),#^A/ /,(r6),@4(r6) ;clear ident string
movzwl ihd$w_imgidoff(r10),r11 ;r11=address of image header
addl r10,r11
movzbl ihi$t_imgid(r11),r2 ;get # of bytes to transfer
movc3 r2,ihi$t_imgid+1(r11),@4(r6) ;transfer the ident back to
;the caller
$asctim_s - ;convert the link date &
timbuf=(r7),timadr=ihi$q_linktime(r11) ;transfer
ret ;return
.page
.sbttl No_args: error handling
no_args:
movl #24,r0 ;load in ss$_insfargs
blbc (ap),10$ ;exit if 0 args
movl 4(AP),r2 ;load in the descriptor for the error msg
movc3 (r2),ident_error_msg,@4(r2) ;load in ident error if 1 arg
10$: ret ;exit
.page
.sbttl JDC_IA_SAVE & JDC_IMG_ARGLIST - initiailization
;
;
; This entry is callaed before the mainprogram executes
; (because of the LIB$INITIALIZE .psect ).
; The arguments to the initial AP are saved in JDC_IMG_ARGLIST for use
; by later users.
;
jdc_ia_save:: .word ^m<> ;enter, we use no regs
movq (ap),jdc_img_arglist ;store the argument list
movq 8(ap),jdc_img_arglist+8
movq 16(ap),jdc_img_arglist+16
movq 24(ap),jdc_img_arglist+24
movl #1,r0 ;return with a success code
ret
.extrn lib$initialize ;force loading of initialization proc
.psect lib$initialize nopic,usr,con,rel, -
gbl,noexe,rd,nowrt,long
.long jdc_ia_save
.psect $local pic,usr,con,rel,lcl,noshr,noexe,rd,wrt
jdc_img_arglist::
.blkl 8
.end
| |||||
| 336.8 | Image info? -- Ask Jon | ANYWAY::GORDON | Hayduke Lives! | Thu Oct 23 1986 09:04 | 11 |
Re: .-1
Hi Jon!
It's interesting to note that the routine I sent to Alan is
based on another of Jon's old programs that I obtained long before
I had ever met Jon, (We have a mutual friend :-) ) and it reads
the image file. Now we know who the resident "expert" on image
idents is...
--Doug
| |||||