O .-----------------------------------------------------------------------------. O | Copyright  1992, 1994, 1996 by Brian Schenkenberger.  ALL RIGHTS RESERVED. | O |                                                                             | O | This software is provided "AS IS" and is supplied for informational purpose | O | only.  No warranty is expressed or implied and no liability can be accepted | O | for any actions or circumstances incurred from the use of this software or  | O | from the information contained herein.  The author makes no claim as to the | O | suitablility or fitness of the software or information contain herein for a | O | particular purpose.                                                         | O |                                                                             | O | Permission is hereby granted *ONLY* for the "not-for-profit" redistribution | O | of this software provided that ALL SOURCE and/or OBJECT CODE remains intact | O | and ALL COPYRIGHT NOTICES remain intact from its original distribution.     | O |                                                                             | O |(!) NO TITLE TO AND/OR OWNERSHIP OF THIS SOFTWARE IS HEREBY TRANSFERRED. (!) | O `-----------------------------------------------------------------------------'   . Package name:	SSINT (System Service INTercept)( Version ident:	V1.3%6.233	20-August-1996E Description:	Demonstration of interception of system service routines ; 		on OpenVMS Alpha via a loadable executive image(execlet). , Author's name:  Brian Schenkenberger, VAXman   Package Overview:  ----------------G This package is comprised of a single loadable executive image(execlet) G which demonstrates a method for intercepting a system service's service G routine on OpenVMS Alpha.  For demonstration purposes, this incarnation G of SSINT intercepts two system services SYS$CREPRC and SYS$DELPRC.  For G each invocation of either of the intercepted system services, a message H is output on the system console device to display the PID of the process0 invoking the service and the status of the call.  F This execlet is unique in that, it does not declare its initializationF routines in the normal fashion using the INITIALIZATION_ROUTINE macro.F Normally, an initialization routine would be declared using this macroG which, in turn, builds the table of vectors of initialization routines. F This table is then used by the INI$DOINIT routine in module SYS$DOINITF to call the execlet's initialization routines.  Unfortunately, this isF not an appropriate initialization senario in cases where an execlet isG required to perform some function prior to default functions performed  + as a consequence of the INI$DOINIT routine.    G In this particular execlet, certain initialization functions need to be F performed before the INI$DOINIT routine invokes the INI$SYSTEM_SERVICEH procedure which, in turn, invokes the procedure EXE$CONNECT_SERVICES to / define the replacement system service function.   F To accomplish the requirements discussed above, a local routine calledF SSINT$DOINIT, is established for this execlets transfer address; thus,F causing the execlet loader to invoke IT for the initialization routine) instead of the normal INI$DOINIT routine.   F After this initialization code is invoked, the INI$DOINIT routine mustF be invoked.  Unfortunately, this routine is not defined globally to beF called by another routine.  Therefore, by playing a little "game" withF the ordering of the initialization linkage, a symbol can be defined inF the EXEC$INIT_LINKAGE psect to establish the location of the ProcedureF DeSCriptor (PDSC) of the INI$DOINIT routine.  This is accomplished via the module SSDOINIHACK.MAR.   E The initialization routine in this execlet is used to obtain the PDSC F address of the original service routine for the system service that isF being intercepted.  A change mode system service which changed mode isF defined by a bound procedure value procedure descriptor.  The address E found at PDSC$Q_ENTRY in the system service's procedure descriptor is F the address of the system service transfer vector code.  For a change H mode system service, this vector will contain the following code thread:  , SYS$<SS-name>_C+00: LDL  R1,(SP)		; A03E0000/ SYS$<SS-name>_C+04: BIS  SP,R31,R28		; 47DF041C 8 SYS$<SS-name>_C+08: LDA  R0,#X<chm-code>(R31)	; 201Fxxxx3 SYS$<SS-name>_C+0C: CHMx			; 0000008x (x: 2=E/3=K)    F * Note: The format of the system service transfer vector under OpenVMSA 	Alpha version prior to V6.1 differ from the above and therefore, A 	this execlet will not function without making necessary changes.   F The initialization code looks through the vector to determine the modeE of the system service and the assigned change mode code of the system F service.  After obtaining these values, the address of the change modeD dispatch vector is calculated and the service routine's PDSC addressF is stored for transfer to later in the intercept (replacement) system E service routine.  The dispatch table entry vector format is depicted   below.   +-----+-----+-----+-----+ H | DISP_A_SERVICE_ROUTINE|:CMOD$AR_<mode>_DISPATCH_VECTOR+10(16)*chm-code +-----+-----+-----+-----+  |   DISP_A_ENTRY_POINT  |  +-----+-----+-----+-----+  |   <reserved>    |FLAGS|  +-----+-----+-----+-----+  |      <reserved>       |  +-----+-----+-----+-----+     H The module SSINTLOADER.MAR can be used to dynamically load the execlet. F This execlet could also be loaded during system initialization.  To doG this, define the execlet using the SYSMAN command:  SYS_LOADABLE ADD.   F An execlet must reside in SYS$LOADABLE_IMAGES to load it during systemF bootstrapping.  After adding the execlet using SYSMAN, a DCL procedureD called VMS$SYSTEM_IMAGES.COM located in SYS$UPDATE must be executed.      3 Modification Information:	V1.3%6.233	20-August-1996  ------------------------F This version of SSINT contains new code to support the interception ofE 64 bit system services and system services enhanced to permit passing E of 64 bit addresses.  This version defines the macro: $SETUP_CALLG_64 F for creating a 64 bit argument list which can, subsequently, be passedE to the built-in EVAX_CALLG_64 to invoke the original service routine. G This 64 bit mechanism, available as of OpenVMS Alpha V7.0, may be used  F to intercept any change mode system service even though the service is not 64 bit enhanced.  F This version also changes the way in which the SSINI$DOINIT routine isF invoked as the primary initialization routine.  This version now elim-G inates the ugly "%LINK-W-MULTFR, multiply defined transfer address..."   when linking SSINTERCEPT.EXE.    .END. 