[HECnet] ALLIN1 MAIL <-> VMSMAIL <-> Internet mail...

Peter Lothberg roll at Stupi.SE
Sun Feb 24 15:07:48 PST 2013


I got tired of the licence management... Anyone to update it to mordern versions?

.title liza - disable or enable license checking in VMS.
;
; Author: Me.
; Date   : Late night.
; Year   : Happy New.
; City   : A big place with many houses.
;
; This utility disables or enables license checking on the running system by
; patching the routine EXE$GRANT_LICENSE in system space. The patch
; applied simply moves SS$_NORMAL to R0 and then returns. If license
; checking is to enabled, the original contents is restored (CHMK #^X5B).
; NOTE! there seems to have been a change between 5.2 and 5.3, in 5.3
; the service number seems to be 5B for grant_license, and 5C for
; release_license. Under 5.2 however, release_license have 5B, wonder what
; grant_license have?
;
; 22-JUN-1992 Under V 5.5, exe$grant_license have number ^X64 !!
;
; When this is run, all system integrated products (SIP's) can be
; used immedeately. Layered products have to be installed first,
; but will then run properly.
;
; Abstract:
;
; Nothing special. We create a double mapping to the physical memory
; that contains the routine (since the original mapping is write-protected!).
; We give our mapping U:W - protection, then it's only to copy our patch
; there.
;
; Privileges needed to run: all
;
;
; Assemble:
;
;     $MAC LIZA
;
; Link:
;
;     $LINK LIZA,SYS$SYSTEM:SYS.STB/SELEC
;
$psldef
$prtdef
syspag: .blkl 1
              .blkl 1
syspfn: .blkl 1
retadr: .blkl 1
              .blkl 1
sysver: .long sys$k_version
              cr=13
              lf=10
vermsg1:
              .ascid <cr><lf>/System version mismatch - was not linked under this version of VMS
./
vermsg2:
              .ascid <cr><lf>/                                                 Please relink:/<cr><lf><lf>
vermsg3:
              .ascid " $LINK LIZA,SYS$SYSTEM:SYS.STB/SELECTIVE"<cr><lf><lf>
dismsg: .ascid /%LMC-S-DISB, License checking successfully disabled./
enamsg: .ascid /%LMC-F-ENAB, License checking fatally enabled./
chkena: .ascid /%LMC-I-ENAB, License checking is currently enabled/
chkdis: .ascid /%LMC-I-DISB, License checking is currently disabled/
alr_ena:
              .ascid /%LMC-I-ENAB, License checking is already enabled/
alr_dis:
              .ascid /%LMC-I-DISB, License checking is already disabled/
disflg: .blkb 1
chkflg: .blkb 1
enaqual:
              .ascid /ENABLE/
chkqual:
              .ascid /CHECK/
silqual:
              .ascid /SILENT/
silflg: .blkb 1
.entry liza ^m<>
;
; Check current system version against the one we were linked under.
;
              cmpl g^sys$gl_version,sysver
              beql 5$
              brw vermismatch
5$:
              movb #0,silflg                                                   ; assume nosilent
              pushaq silqual
              calls #1,g^cli$present
              blbc r0,6$                                                           ; nosilent ok
              movb #1,silflg                                                   ; should be silent
6$:
              movb #1,disflg                                                   ; assume disable operation
              pushaq enaqual
              calls #1,g^cli$present                                   ; is enable qualifier present?
              blbc r0,7$                                                           ; nope
              movb #0,disflg                                                   ; wants to enable
7$:
              movb #0,chkflg                                                   ; assume not only check
              pushaq chkqual
              calls #1,g^cli$present
              blbc r0,9$
              brw check_only
9$:
              cmpc3     #dis_license_pat_len,-                   ; check if checking is disabled
                              exe$grant_license+2,-
                              dis_license_pat
              beql is_disabled
;
; License checking is enabled. What to do?
;
              tstb disflg
              bneq do_it
              tstb silflg
              bneq 10$
              pushaq alr_ena
              calls #1,g^lib$put_output
10$:
              ret

is_disabled:
              tstb disflg
              beql do_it
              tstb silflg
              bneq 10$
              pushaq alr_dis
              calls #1,g^lib$put_output
10$:
              ret
do_it:
              movl #exe$grant_license,syspag
              movl #exe$grant_license,syspag+4
              addl2 #2,syspag                                 ; entry point is 2 bytes
              addl2 #2,syspag+4
              movl @syspag,r0                                 ; fault the page into phys mem
              pushal syspfn
              pushal syspag
              calls #2,getpfn                                 ; get pfn for page
              blbs r0,10$
              brw faulterr
10$:
              $crmpsc_s             inadr=syspag,-
                                              retadr=retadr,-
                                              acmode=#psl$c_user,-
                                              flags=#sec$m_expreg!sec$m_pfnmap!sec$m_wrt,-
                                              vbn=syspfn
              blbs r0,20$
              brw maperr
20$:
              bicl3 #^xFFFFFE00,syspag,r6
              addl2 r6,retadr+4
              tstb disflg                         ;disable ?
              beql 30$                               ; nope, enable
              movc3 #dis_license_pat_len,dis_license_pat, at retadr+4
              tstb silflg
              bneq 50$
              pushaq dismsg
              brb 40$
30$:
              movc3 #ena_license_pat_len,ena_license_pat, at retadr+4
              tstb silflg
              bneq 50$
              pushaq enamsg
40$:
              calls #1,g^lib$put_output
50$:
              $deltva_s inadr=@retadr+4
              ret
dis_license_pat:
              movzwl #ss$_normal,r0
              ret
dis_license_pat_len=.-dis_license_pat
ena_license_pat:
              chmk #^X5B
              ret
ena_license_pat_len=.-ena_license_pat
faulterr:
maperr:
              ret

check_only:
              cmpc3     #dis_license_pat_len,-                   ; check if checking is disabled
                              exe$grant_license+2,-
                              dis_license_pat
              beql 10$
; is enabled
              pushaq chkena
              calls #1,g^lib$put_output
              ret

10$:       ; is disabled
              pushaq chkdis
              calls #1,g^lib$put_output
              ret

vermismatch:
;
;Tell loser s/he better relink. It was linked under another version of VMS
; than the currently running one!
;
              pushaq vermsg1
              calls #1,g^lib$put_output
              pushaq vermsg2
              calls #1,g^lib$put_output
              pushaq vermsg3
              calls #1,g^lib$put_output
              ret
.subtitle getpfn - return PFN for a given virtual address
;
; inputs - 4(ap) virtual address for which PFN is sought
;outputs - 8(ap) PFN for the page containing 4(ap)
;
; Currently handles only addresses in system virtual space. Other
; addresses returns ebbob.
;
.library /sys$share:lib/
              pfn_notinphys=^x00000200
$phddef
.entry getpfn ^m<r2,r3,r4,r5,r6>
              movl @4(ap),r6
              cmpl r6,#^x80000000                         ; system or process mapping ?
              blssu process_address
              brw s_address
;----------------------------------------------------------------------
process_address:
              cmpl r6,#^x40000000                         ; p0 or p1 map ?
              blssu p0_address
              brb p1_address
p0_address:
p1_address:
              movzwl #ss$_badparam,r0
              ret
;----------------------------------------------------------------------
s_address:
              cmpl r6,#^xc0000000
              blssu sys_or_gbl
              brb io_address
sys_or_gbl:                                                         ; ok we have an address with either
                                                                              ; system PTE or global PTE (or invalid)
              movl g^mmg$gl_sptbase,r4
              movl g^mmg$gl_gpte,r5
              subl3 r4,r5,r3                                   ; get size of system page-table
              divl2 #4,r3                                         ; in longwords -> # of pages in sys
              mull3 r3,#512,r2                               ; # of bytes in system space
              addl2 #^x80000000,r2                       ; hi address of system space
              cmpl r6,r2
              blssu system_address
global_address:
              movzwl #ss$_badparam,r0
              ret
system_address:
              subl2 #^x80000000,r6
              ashl #-9,r6,r6                                   ; calculate VPN as byte offset
              ashl #2,r6,r6
              addl3 r4,r6,ptaddr
              $cmkrnl_s fetch_pte
              blbc r0,slut
              bitl #^x80000000,pte
              beql notinphys
              extzv #0,#21,pte, at 8(ap)
              brb slut
notinphys:
              movzwl #pfn_notinphys,r0
slut:
              ret
io_address:
              movzwl #ss$_badparam,r0
              ret
.psect kernel_code,page
ptaddr: .blkl 1
pte:       .blkl 1
              .entry fetch_pte ^m<>
              moval anti_crash,(fp)
              movl @ptaddr,pte
              movl #ss$_normal,r0
              ret
              .entry anti_crash ^m<r2>
              movl 4(ap),r2
              $exit_s 4(r2)
              ret

.end liza



More information about the Hecnet-list mailing list