home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1993 #2
/
Image.iso
/
clipper
/
snip0693.zip
/
GETNAME.ASM
< prev
next >
Wrap
Assembly Source File
|
1992-09-03
|
3KB
|
99 lines
Here you go. Just assemble this with TASM, and link into your code. The
function USERNAME() will return the logged in name of the user. This will
work both under DOS and OS/2 requestor. ie:
FUNCTION GetName()
winsay("The user's name is :"+username())
return(username())
;------------------------------------------:
; CLIPPER OBJECT file to return the USER :
; of the logged in user :
;------------------------------------------:
public UserName
extrn __retc:far
dgroup group datasg
datasg segment public '_DATA'
RequestBuffer Label Byte
PacketLengthLow db 2 ; request buffer 2 bytes long
PacketLengthHigh db 0
Function db 22 ; sub function to get user inf
ConnectionNumber db ? ; logical connection number
ReplyBuffer Label Byte
ReturnLengthLow db 62 ; Reply is 62 bytes long
ReturnLengthHigh db 0
UniqueID dd ? ; Station's ID #
Typex dw ?
ObjectName db 48 dup ( ? ) ; USERNAME 1-47 characters
LogTime db 8 dup ( ? ) ; Time user logged in
datasg ends
_prog segment 'CODE'
assume CS:_prog,DS:dgroup,ES:dgroup
UserName proc far
push BP ; preserve return address
mov BP,SP
push DS
push ES
push SI
push DI
mov AH,0DCh ; function to get connection #
int 21h
mov ConnectionNumber,AL
mov AH,0E3h ; log request function #
mov DX,seg dgroup:RequestBuffer
mov DS,DX
mov DX,seg dgroup:ReplyBuffer
mov ES,DX
lea SI,RequestBuffer ; DS:SI points to Request Buf
lea DI,ReplyBuffer ; ES:DI points to Reply Buffe
int 21h
; Return the name
pop DI
pop SI
pop ES ; restore registers
pop DS
pop BP
mov AX,seg dgroup:ObjectName
push AX
mov AX,offset dgroup:ObjectName
push AX
call __retc ; call character
add SP,4 ; fix up stack
ret ; far return
UserName endp
_prog ends
end
;For more CLIPPER INFORMATION, write:
;
;Staben Technologies
;811 West 14th Avenue
;Spokane, WA 99204