Article 136918 of comp.os.vms:
Newsgroups: comp.os.vms
Path: nntpd.lkg.dec.com!lead.zk3.dec.com!crl.dec.com!crl.dec.com!bloom-beacon.mit.edu!spool.mu.edu!howland.reston.ans.net!newsfeed.internetmci.com!in2.uu.net!EU.net!peer-news.britain.eu.net!psinntp!psinntp!psinntp!psinntp!voder!nsc!news
From: Tim Hewitt <thewitt@fmis12.nsc.com>
Subject: Re: BECOME.EXE is where?
Content-Type: text/plain; charset=us-ascii
To: 73740.1636@compuserve.com
Message-ID: <30E33F4B.2410@fmis12.nsc.com>
Sender: news@nsc.nsc.com (netnews maintenance)
Nntp-Posting-Host: fmip47.nsc.com
Content-Transfer-Encoding: 7bit
Organization: National Semiconductor, Santa Clara
References: <30D60197.27C5@fmis12.nsc.com> <4bk8cd$cbi@post.tau.ac.il> <73740.1636-2612952014030001@0.0.0.0>
Mime-Version: 1.0
Date: Fri, 29 Dec 1995 01:07:23 GMT
X-Mailer: Mozilla 2.0b4 (Macintosh; I; PPC)
Lines: 86

Chris Olive wrote:
> 
> In article <4bk8cd$cbi@post.tau.ac.il>, rechtman@shani.net (Mike Rechtman)
> wrote:
[clip]
> 
> And as Hunter Goatley posted here once a while back, why not use GLOGIN?
> It works better since you *are* the target user instead of just pretending
> to be!  No hoaking around with the PCB, etc...  Try it.  It's at
> ftp://ftp.wku.edu/vms/fileserv/glogin.zip (or is that
> ../fileserv/vms/glogin.zip?  I always forget...)  I dropped BECOME a long
> time ago due to GLOGIN...

I can't use GLOGIN because what I need to do is to run a program as another 
user, not log in as another user.  We have a database application that runs 
from a series of menus.  The user is in a common captive account. They would 
like to run Mail, VAXNotes and other applications as themselves.  We used this 
little piece of macro code until VMS V6.1, not it causes a system crash. 
Anyone hazard a guess what's wrong?

  .IDENT	/1.0/
.LIBRARY /SYS$LIBRARY:LIB/
$UAFDEF
$UAIDEF
$PCBDEF
$JIBDEF
 
.SUBTITLE MACROS    - SOME NEEDED MACROS
.PAGE

.MACRO ITEM	CODE, LENGTH, ADDRS, RTN
	.WORD LENGTH
	.WORD CODE
	.LONG ADDRS
	.LONG RTN
.ENDM

.SUBTITLE START     - *** M A I N   E N T R Y   P O I N T ***
.PAGE
.PSECT	CODE, EXE, NOWRT
.ENTRY	START, ^M<>

;	GET THE USERNAME OFF THE COMMAND LINE

	PUSHAW	USRDSC
	PUSHAQ	USRDSC
	PUSHAQ	P1DSC
	CALLS	#3, G^CLI$GET_VALUE
	BLBC	R0, 10$				; ? ERROR

;	LOOK THE USER UP IN SYSUAF

	$GETUAI_S	USRNAM=USRDSC, ITMLST=UAILST
	BLBS	R0,	20$			; ? ERROR
10$:	$EXIT_S	R0				; EXIT WITH ERROR
20$:	$CMKRNL_S	CMKRTN
	$EXIT_S	R0

.SUBTITLE CMKRTN    - KERNEL MODE ROUTINE
.PAGE
.ENTRY	CMKRTN, ^M<>

	MOVL	G^CTL$GL_PCB, R0		; GET THE PCB ADDRESS
	MOVL	UIC, PCB$L_UIC(R0)		; GET THE NEW UIC
	MOVL	PCB$L_JIB(R0), R0		; NOW GET THE JIB ADDRESS
	MOVC5	USRDSC+DSC$W_LENGTH, @USRDSC+DSC$A_POINTER, -
		#^A/ /, #^D12, JIB$T_USERNAME(R0); CHANGE THE USERNAME
	MOVL	#SS$_NORMAL, R0			; SET OK RETURN CODE
	RET

.SUBTITLE DATA      - READ / WRITE DATA SECTION
.PAGE
.PSECT	DATA, PAGE, NOEXE, WRT

USRDSC:	.LONG	32				; USERNAME DESCRIPTOR
	.LONG	USRBUF		
USRBUF:	.BLKB	32
P1DSC:	.ASCID	#P1#				; CLI PARAMETER DESCRIPTORS

	; SYS$GETUAI ITEM LIST

UAILST:	ITEM	UAI$_UIC, 4, UIC, 0				 
	ITEM	0, 0, 0, 0

UIC:	.LONG	0				; SPACE FOR UIC INFO
 	.END	START


