; ; Name: SETUSER.MAR ; ; Type: Integer*4 Function (MACRO) ; ; Author: M. R. London ; ; Date: Jan 26, 1983 ; ; Purpose: To set the Username of the current process (which turns out ; to be the process running this program.) ; ; Usage: ; status = SETUSER(username) ; ; status - $CMKRNL status return. 0 if arguments wrong. ; username - Character string containing username ; ; NOTES: ; Must link with SS:SYS.STB ; .Title SETUSER Set uic .IDENT /830531/ ; ; Libraries: ; .LIBRARY /SYS$LIBRARY:LIB.MLB/ ; ; Global variables: ; $PCBDEF $JIBDEF ; ; local variables: ; .PSECT SETUSER_DATA,NOEXE NEWUSE: .BLKB 12 ; Contains new username OLDUSE: .BLKB 12 ; Contains old username ; ; Executable: ; .PSECT SETUSER_CODE,EXE,NOWRT ; Executable code .ENTRY SETUSER,^M CLRL R0 ; 0 is error code MOVZBL (AP),R8 ; Get number of arguments CMPL R8,#1 ; Correct number of arguments BLSS 5$ ; If not, return MOVZBL @4(AP),R6 ; Get size of string MOVL 4(AP),R7 ; Get address of descriptor MOVL 4(R7),R7 ; Get address of string MOVC5 R6,(R7),#32,#12,NEWUSE ; Get new username string CMPL R8,#2 ; Old username given? BLSS 2$ ; No MOVZBL @8(AP),R6 ; Get size of string MOVL 8(AP),R7 ; Get address of descriptor MOVL 4(R7),R7 ; Get address of string MOVC5 R6,(R7),#32,#12,OLDUSE ; Get old username string $CMKRNL_S ROUTIN=20$ ; Must run in kernel mode TSTL R0 ; If old username is checks with BEQL 2$ ; present process name, change MOVL #2,R0 ; to new username, else flag RET ; error and return 2$: $CMKRNL_S ROUTIN=10$ ; Must run in kernel mode 5$: RET 10$: .WORD ^M<> ; Entry mask MOVL SCH$GL_CURPCB,R7 ; Address of current process MOVL PCB$L_JIB(R7),R7 ; Address of Job Info Block ; NOTE: MOVC destroys r0-r5 MOVC3 #12,NEWUSE,JIB$T_USERNAME(R7) ; change username JIB MOVC3 #12,NEWUSE,CTL$T_USERNAME ; change username in P1 MOVZWL #SS$_NORMAL,R0 ; Normal ending RET 20$: .WORD ^M<> ; Entry mask MOVL SCH$GL_CURPCB,R7 ; Address of current process MOVL PCB$L_JIB(R7),R7 ; Address of Job Info Block ; NOTE: MOVC destroys r0-r5 CMPC R6,OLDUSE,JIB$T_USERNAME(R7) ; change username JIB RET .END