Date: Tue, 5 Sep 2000 15:39:54 -0400
Reply-To: Michael Bramley-M/PGI <bramley.m@PG.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Michael Bramley-M/PGI <bramley.m@PG.COM>
Subject: GetUserName question
Content-type: text/plain; charset=us-ascii
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.