[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference vaxaxp::vmsnotes

Title:VAX and Alpha VMS
Notice:This is a new VMSnotes, please read note 2.1
Moderator:VAXAXP::BERNARDO
Created:Wed Jan 22 1997
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:703
Total number of notes:3722

490.0. "VAX/VMS file formats" by NNTPD::"[email protected]" (Surya Prasad P.) Fri Apr 18 1997 07:25

I am sorry if this is answered elsewhere. But i need this information
early.
I am working on a new functionality for a command called 'file'
on Digital Unix, which identifies different types of files. For eg.
'file' can identify unix executables, C files, fifo etc.
I would like to know the VAX/VMS executable file format say starting
from version 4.x onwards. i.e i require the magic numbers that
identify the different VAX/VMS executables, objects, libraries etc.
I need to put these entries in /etc/magic which 'file' uses to identify
the file type.
An entry in /etc/magic looks something like:

0       short   0407                    VAX executable (object file)
>8      short   >0                      not stripped
0       long    0410                    VAX pure
>16     long    >0                      not stripped
0       short   0413                    VAX demand paged pure

Thanks in advance,
Surya.
[email protected]

[Posted by WWW Notes gateway]
T.RTitleUserPersonal
Name
DateLines
490.1Pointers To Documentation, Caveats...XDELTA::HOFFMANSteve, OpenVMS EngineeringFri Apr 18 1997 11:3731
    The image header format is not officially documented, though
    a description exists in the Internals and Data Structures
    Manual, and in the source listings, and in the definition
    files.

    Given what I know about this area, you are going to have some
    fun coming up with a consistent definition that works across
    OpenVMS VAX and OpenVMS Alpha, and across multiple versions.

    You'll want to look in $IHDDEF in the sys$share:lib.mlb macro
    library, or in sys$share:lib.req in the bliss library, and see
    if that will give you enough for this tool -- OpenVMS image
    headers have a small fixed portion containing offsets to various
    image header data structures.

        definition   contents of
        module name  data structure
        -----------  --------------
	$IHDDEF      fixed portion of the image header
	$IHADEF      transfer address array
	$IHSDEF      symbol table and debug offsets
	$IHIDEF      image name and ident strings
	$IHVNDEF     system version array
	$IHPDEF      patch information
	$ISDDEF      image section descriptors

    Differentiating based on the image header data structures isn't
    always easy -- there are some historical design limitations in
    this area.

490.2CSC64::BLAYLOCKIf at first you doubt,doubt again.Fri Apr 18 1997 14:4514

This works pretty well (though not perfect):

0       long    <4                      OpenVMS Executable
>4      long    0                       Alpha Architecture
>52     long    1                       Main Image
>52     long    2                       Shareable Image
#
510     short   0xffff                  OpenVMS Executable
>12     short   <12849                  VAX
>14     short   <13617                  Architecture
>17     byte    1                       Main Image
>17     byte    2                       Shareable Image
490.3NNTPD::&quot;[email protected]&quot;Surya Prasad PFri Apr 25 1997 03:425
I made use of your information. Thank you both.

A bunch of thanks,
Surya Prasad
[Posted by WWW Notes gateway]