Date: Tue, 5 Sep 2000 18:04:37 -0400
Reply-To: Richard DeVenezia <radevenz@IX.NETCOM.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Richard DeVenezia <radevenz@IX.NETCOM.COM>
Organization: MindSpring Enterprises
Subject: Re: GetUserName question
Michael:
Part of the problem may be that the arg2 is defined as updateable, and yet
you pass a constant value (the 8) which can not be updated. arg2 should be
a variable that returns the length of the username (including c-style
terminating null character)
try
rc=modulen('GetUserNameA',Name,Len);
V8 is a little more forgiving and actually tells you what is wrong.
--
Richard DeVenezia
SAS Macros and AF Tools - http://pweb.netcom.com/~radevenz
"Michael Bramley-M/PGI" <bramley.m@PG.COM> wrote in message
news:OF75248AFF.B3AB1CE7-ON85256951.006C0003@na.pg.com...
> I am trying to obtain userid/name info from Windows 95/SAS6.12. I pulled
this
> code from SAS-l, but SAS really complains when it is run. Does anyone
have the
> correct hook into the DLL ?
>
>
> TIA,
>
>
> Michael
>
> Code:
> filename sascbtbl 'winapi.txt'; /* create cbtbl table */
> data _null_ ;
> file sascbtbl notitles ;
> length text $40 ;
> input text & ;
> put Text ;
> cards4 ;
> routine GetUserNameA
> minarg=2
> maxarg=2
> stackpop=called
> module=ADVAPI32
> returns=short;
> arg 1 update char format=$cstr200.;
> arg 2 update num format=pib4.;
> ;;;;
> run ;
>
> data _null_; /* get username */
> length name $8;
> name='';
> rc=modulen('GetUserNameA',Name,8);
> put name= ;
> run;
>
> ----------log--if you're interested-------
> 62 filename sascbtbl 'winapi.txt';
>
>
> 63 data _null_ ;
> 64 file sascbtbl notitles ;
> 65 length text $40 ;
> 66 input text & ;
> 67 put Text ;
> 68 cards4 ;
>
> NOTE: The file SASCBTBL is:
> FILENAME=H:\winapi.txt,
> RECFM=V,LRECL=256
>
> NOTE: 8 records were written to the file SASCBTBL.
> The minimum record length was 8.
> The maximum record length was 35.
> NOTE: The DATA statement used 0.11 seconds.
>
>
> 77 ;;;;
> 78 run ;
> 79
> 80 data _null_;
> 81 length name $8;
> 82 name='';
> 83 rc=modulen('GetUserNameA',Name,8);
> 84 put name= ;
> 85 run;
>
> ERROR: Unknown exception (80000602)
> ERROR: A severe error occurred in task DATASTEP for module SASHOST
executing in module SASHOST at
> address 0005271E.
>
> Please contact Technical Support to report this error.
>
>
> ERROR: Generic critical error.
> NOTE: The SAS System stopped processing this step because of errors.
> NOTE: The DATA statement used 2.25 seconds.
|