.TITLE LIB_SET_USERNAME ; .IDENT /1-001/ ; ; FACILITY: LIB - General procedure library ; ; ABSTRACT: Rewrite current process's Username ; ; ENVIRONMENT: User mode, calls kernel mode routine, requires ; user privilege CMKRNL ; ; AUTHOR: Geoff Fitch ; CREATION DATE: 04-AUG-82 ;-- ;++ ; FUNCTIONAL DESCRIPTION: ; ; This routine is passed the address of a string descriptor ; pointing to the new username, it copies the string buffer ; to a local buffer and calls a kernel mode routine to write ; the new username in control space and the jib. ; ; CALLING SEQUENCE: (from DCL) ; ; ret_status.wlc.v = LIB_SET_USERNAME ( source_str.rt.dx ) ; ; FORMAL PARAMETERS: ; ; SOURCE_STR String containing the new username ; ; IMPLICIT INPUTS: ; ; NONE ; ; IMPLICIT OUTPUTS: ; ; Process control space (CTL$T_USERNAME) ; Job Info Block (JIB$T_USERNAME) ; ; COMPLETION STATUS: ; ; SS$_NORMAL Success ; SS$_NOPRIV You don't have CMKRNL ; something returned from LIB$SCOPY_DXDX ; ; SIDE EFFECTS: ; ; Process Username is changed ;-- .LIBRARY /SYS$LIBRARY:LIB.MLB/ $JIBDEF ; JIB symbols $PCBDEF ; PCB symbols .PSECT _LIB_CODE, PIC,USR,CON,REL,LCL,SHR,EXE,RD,NOWRT .ENTRY LIB_SET_USERNAME, ^M SUBL2 #12,SP ; allocate a local string MOVAL (SP), -(SP) ; and create string descr PUSHL #12 PUSHAQ (SP) ; copy username to local area PUSHAQ @4(AP) CALLS #2, G^LIB$SCOPY_DXDX BLBC R0, 10$ ; return if copy failed ADDL #8, SP ; deallocate descriptor MOVAB (SP), R8 ; save buffer address $CMKRNL_S ROUTIN=WRITEUSER ; call kernel routine 10$: RET .ENTRY WRITEUSER, 0 MOVC3 #12,(R8),CTL$T_USERNAME ; write username in P1 space MOVL CTL$GL_PCB, R0 ; load address of pcb MOVL PCB$L_JIB(R0), R1 ; load address of jib MOVC3 #12, (R8), JIB$T_USERNAME(R1) ; write username into jib MOVL #1,R0 ; return with success RET .END