Article 128391 of comp.os.vms:
Path: nntpd.lkg.dec.com!crl.dec.com!crl.dec.com!bloom-beacon.mit.edu!gatech!howland.reston.ans.net!vixen.cso.uiuc.edu!uwm.edu!homer.alpha.net!mvb.saic.com!info-vax
From: ivax@meng.ucl.ac.uk (Mark Iline - Info-VAX account)
Newsgroups: comp.os.vms
Subject: Re: How do I create a network process
Message-ID: <95090112151356@meng.ucl.ac.uk>
Date: Fri, 1 Sep 1995 12:15:13 GMT
Organization: Info-Vax<==>Comp.Os.Vms Gateway
X-Gateway-Source-Info: Mailing List
Lines: 158

> Does any one know how DECnet creates its network server 
> processes. What parameters does it pass to CREPRC to get it to 
> create the process as another user, or does it use some other 
> underhanded mechanism ?
> 
> I need to be able to create a process as another user with the 
> mode of network ? Has anyone done this before ?

Yes. It's not too strange. Here's an old posting.

Mark


Date: Mon, 19 Jul 1993 18:50:00 GMT
From: system@meng.ucl.ac.uk (Mark Iline)
To: Info-VAX@KL.SRI.COM
Subject: Re: Creating VMS processes

The following, self-contained, Macro-32 code (which should assemble and 
run) provides a demonstration of how to use the $CREPRC system service to 
create Network Processes, as created by DECnet, UCX, etc. to act as servers in
the context of a user login.

This use of $CREPRC is not documented, and presumably not supported. 
However, it is (was) readilly visible in the sources of NETACP.

I have just assembled and run this code (VMS 5.5-2), and it did work, but 
other than that, it's your lookout.


Mark Iline	system@meng.ucl.ac.uk
Dept Mech Eng, University College, London. UK

			Read at your own risk.


======================= cut here ==========================================
; Mark Iline, Dept Mech Eng, University College London, UK
; This code carries no warranty of any kind, express or otherwise.
; Assemble and run at your own risk.

;I don't expect marks for style...  ;-)

	.psect	code,exe,nowrt
	.psect	const,noexe,nowrt
	.psect	data,noexe,wrt

	$prcdef

        .MACRO  errchk ?a
        BLBS	r0,a
        PUSHL	r0
        CALLS	#1,g^lib$signal
a:
        .ENDM	errchk

        .MACRO	print string
        .SAVE_PSECT     LOCAL_BLOCK
	.psect	const
print_temp=.
	.ascid	\string\
        .RESTORE_PSECT
	pushaq	print_temp
	calls	#1,g^lib$put_output
	errchk
        .ENDM	print


        .MACRO	get_string string,prompt
;Allocates storage space for a string, calls lib$get_input to obtain the 
; string & creates a descriptor pointing to the string (string_d).
; eg get_string name,<What is your name ?> will result in a descriptor, name_d,
; pointing to the name input. Several other symbols are created...
        .SAVE_PSECT     LOCAL_BLOCK
	.psect	const
print_temp=.
	.ascid	\prompt\
	.psect	data
string:	.blkb	256
string'_d:	.long	0
		.address	string
string'_buff_d:	.word	256,0
		.address	string
	.restore
	pushaw	string'_d
	pushaq	print_temp
	pushaq	string'_buff_d
	calls	#3,g^lib$get_input
	errchk
        .ENDM	get_string

































	.psect	code

        .ENTRY  net_proc,^M<r2,r3,r4,r5,r6,r7,r8,r9,r10,r11>

	print	< >
print	<This program will create a network process owned by the username >
print	<you specify. This process will execute SYS$SYSTEM:NET_PROC.COM,>
print	<which must be accessible to the username specified.>
	print	< >


	get_string	username,<Enter Username (must be uppercase): >
	get_string	password,-
		<Enter Password (must be uppercase, *will* be echoed): >


;Create an access string of the following form:
; <null><null><byte count of username>username<byte count of password>password
; <null>
; The final <null> is actually the count byte of a blank field.

	clrw	access_string
	movab	access_string+2,r3
	
	movb	username_d,(r3)+
	movc3	username_d,@username_d+4,(r3)
	movb	password_d,(r3)+
	movc3	password_d,@password_d+4,(r3)
	clrb	(r3)+

	movab	access_string,r0
	subl3	r0,r3,r1
	movw	r1,access_string_d


	$creprc_s	input=com_proc_d,-
			output=access_string_d,-
			image=image_d,-
			stsflg=#prc$m_netwrk,-
			pidadr=server_pid,-
			uic=#<^o1@16+^o3>,-
			prcnam=proc_name_d

;Strangely, the UIC of [1,3] is crucial !!!
;If it is omitted, the username of this process is altered (as is SYS$LOGIN),
; and the created process is a subprocess. Weird.

		.psect	data
access_string:	.blkb	256
access_string_d:	.word	0,0
			.address	access_string
server_pid:	.long	0
		.psect	const
com_proc_d:	.ascid	"SYS$SYSTEM:NET_PROC.COM";.com
image_d:	.ascid	"SYS$SYSTEM:DCL"
proc_name_d:	.ascid	"Network Process"
		.psect	code

	errchk
	ret




	.end	net_proc


