home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / lan / spoolit / getid.inc next >
Text File  |  1987-02-15  |  1KB  |  63 lines

  1.  
  2. type
  3.    ST48 = String[48];
  4.    ST3 = string[3];
  5. Procedure getuser(var u: ST48; var STN : ST3);
  6.  
  7. type
  8.    RegPack1 = record
  9.               AX,BX,CX,DX,BP,SI,DI,DS,ES,Flags : integer;
  10.  
  11.              end;
  12.    RegPack2 = record
  13.               AL,AH,BL,BH,CL,CH,DL,DH          : Byte;
  14.               end;
  15.    reqType = packed array [1..7] of Byte;
  16.    repType = packed array [1..90] of char;
  17. var
  18.    Regs : Regpack1;
  19.    Sregs: RegPack2;
  20.    req_buffer : reqType;
  21.    rep_buffer : reptype;
  22.    s: string[63];
  23.    i,j: integer;
  24. begin
  25.    with Regs do
  26.    begin
  27.       { This Code gets the user's logical connection Number }
  28.  
  29.       Sregs.AH:=$DC;
  30.       MSDOS(Sregs);
  31.       STR(Sregs.AL,STN);
  32.  
  33.       { This code passes the connection number to the call to obtain
  34.         all logged information about a connection                  }
  35.  
  36.       req_buffer[3]:=$16;
  37.       req_buffer[4]:=Sregs.AL;
  38.       req_buffer[1]:=$02;
  39.       req_buffer[2]:=$00;
  40.       AX:=$E300;
  41.       DS:= seg(req_buffer);
  42.       SI:= ofs(req_buffer);
  43.       ES:= seg(rep_buffer);
  44.       DI:= ofs(rep_buffer);
  45.       MSDOS (Regs);
  46. end;
  47. j:=1;
  48. i:=9;
  49.  
  50. { The Object name is in Bytes 9 thru 63 of the reply buffer and is null
  51.   padded     }
  52.  
  53. While (I < 63) and (rep_buffer[i] <>chr($00)) do begin
  54.    u[j]:=rep_buffer[i];
  55.    i:=i+1;
  56.    j:=j+1;
  57. end;
  58. u[0]:=chr(j-1);
  59.  
  60. End; {procedure GetUser}
  61.  
  62.