From:	CSBVAX::MRGATE!RELAY-INFO-VAX@CRVAX.SRI.COM@SMTP 16-AUG-1988 22:30
To:	ARISIA::EVERHART
Subj:	Changing Process Privileges PERMANENTLY


Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Tue, 16 AUG 88 13:53:55 PDT
Received: from CORNELLC.CCS.CORNELL.EDU by KL.SRI.COM with TCP; Tue, 16 Aug 88 13:34:30 PDT
Received: from Bitway.Rose-Hulman.Edu by CORNELLC.CCS.CORNELL.EDU ; Tue, 16 Aug 88 16:35:30 EDT
Received: from VMS.Rose-Hulman.Edu by Bitway.Rose-Hulman.Edu; Tue, 16 Aug 88
 15:32 EST
Date: Tue, 16 Aug 88 15:18 EST
From: "Robert W. Shew" <MGRRWS%VMS.Rose-Hulman.Edu@CORNELLC.CCS.CORNELL.EDU>
Subject: Changing Process Privileges PERMANENTLY
To: info-vax@kl.sri.com, prindiville@ccrs.cdn
X-VMS-To: IN%"info-vax@kl.sri.com",IN%"prindiville@ccrs.cdn"


For John Edgecombe (and any other interested parties)...


This program works as of VAX/VMS V4.6.


Simply change the privileges in the MOVQ statements to the privileges
you need.


                        .Title Change_Privs
;*****************************************************************************
;                                                                            *
;       This program changes ALL of the privilege masks of the current       *
;       process.  It requires CMKRNL privilege.                              *
;                                                                            *
;       AUTHOR: Robert W. Shew          DATE: July 31, 1987                  *
;                                                                            *
;*****************************************************************************


                .Link     "SYS$SYSTEM:SYS.STB" /SELECTIVE_SEARCH
                .Library  "SYS$LIBRARY:LIB.MLB"

                $PCBDef
                $PHDDef
                $PRVDef


                .Psect  Code, NoWRT, EXE


        .Entry  Change_Privs, ^M<>

        $SetPRV_S       #1, #PRV$M_Cmkrnl              ; Need CMKRNL
        BlBS            R0, 10$                        ; Got it.
        Ret                                            ; Don't have it.

10$:    $CMKRNL_S       Kernel_Routine                 ; Go for the gusto!

        Ret


        .Entry Kernel_Routine,  ^M<>

        MovL            CTL$GL_PCB, R0                 ; Address of PCB
        MovQ            #<PRV$M_SetPrv!PRV$M_Oper!  -  ; Set the privileges
                        PRV$M_Netmbx!PRV$M_TmpMbx>, -  ; in the PCB priv
                        PCB$Q_Priv(R0)                 ; mask

        MovL            PCB$L_PHD(R0), R0              ; Address of PHD
        MovQ            #<PRV$M_SetPrv!PRV$M_Oper!  -  ; Set the privileges
                        PRV$M_Netmbx!PRV$M_TmpMbx>, -  ; in the PHD priv mask
                        PHD$Q_PrivMsk(R0)         ;

        MovQ            #<PRV$M_SetPrv!PRV$M_Oper!  -  ; Set the privs in the
                        PRV$M_Netmbx!PRV$M_TmpMbx>, -  ; PHD authorized priv
                        PHD$Q_AuthPriv(R0)        ;    ; mask

        MovQ            #<PRV$M_SetPrv!PRV$M_Oper!  -  ; Set the privileges
                        PRV$M_Netmbx!PRV$M_TmpMbx>, -  ; in P1 Space
                        CTL$GQ_ProcPRIV

        MovL            #SS$_Normal, R0                ; Signal OK. (If not
                                                       ; OK, you will know it
                                                       ; soon enough.)
        Ret


        .End            Change_Privs



                                              ------------------------------
                                              | Robert W. Shew             |
                                              | VAX System Manager         |
                                              | RHIT Class of '89          |
                                              |                            |
                                              | MGRRWS@VMS.Rose-Hulman.Edu |
                                              ------------------------------


