home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / sys / novell / 11824 < prev    next >
Encoding:
Internet Message Format  |  1993-01-23  |  2.4 KB

  1. From: tp923021@jarrah.canberra.edu.au (ben elliston)
  2. Sender: gateway@f262.n620.z3.fidonet.org
  3. Path: sparky!uunet!munnari.oz.au!manuel.anu.edu.au!sserve!f262.n620.z3!gateway
  4. Newsgroups: comp.sys.novell
  5. Subject: Novell API code
  6. Message-ID: <727749029.AA00270@f262.n620.z3.fidonet.org>
  7. Date: Sat, 23 Jan 1993 00:07:00
  8. Lines: 85
  9.  
  10. For those people asking about login info, etc., I dug up some Pascal code (easily modifyable to C or assembler) which will return some useful info:
  11.  
  12. {
  13. Functions:
  14.          NovellLogicalID            Returns logical id (or station number)
  15.          NovellPhysicalID           Returns physical network address
  16.          NovellLogonName            Returns logon name (or ?????)
  17. }
  18.  
  19. unit NovAPI;
  20.  
  21. interface
  22.  
  23. uses dos;
  24.  
  25. function NovellLogicalID : byte;
  26.   inline($B4/$DC/          {MOV AH,DC}
  27.          $CD/$21);         {INT 21}
  28.  
  29. function NovellPhysicalID : word;
  30.   inline($B4/$EE/          {MOV AH,EE}
  31.          $CD/$21);         {INT 21}
  32.  
  33. function NovellLogonName : string;
  34.  
  35. implementation
  36.  
  37. function NovellLogonName : string;
  38.   var
  39.     i             : integer;
  40.     tmp           : string;
  41.     r             : Registers;
  42.     RequestPacket : record
  43.                       PacketLength : word;
  44.                       LogFunction  : byte;
  45.                       Connection   : byte;
  46.                     end;
  47.     ReplyPacket   : record
  48.                       ReturnLength : word;
  49.                       UniqueID     : longint;
  50.                       ReturnType   : word;
  51.                       ObjectName   : array[1..48] of char;
  52.                       LogTime      : array[1..8] of byte;
  53.                     end;
  54.   begin
  55.     RequestPacket.PacketLength:=2;
  56.     RequestPacket.LogFunction:=22;
  57.     RequestPacket.Connection:=NovellLogicalID;
  58.     ReplyPacket.ReturnLength:=64;
  59.     with r do begin
  60.       DS:=seg(RequestPacket);
  61.       SI:=ofs(RequestPacket);
  62.       ES:=seg(ReplyPacket);
  63.       DI:=ofs(ReplyPacket);
  64.       AH:=$E3;
  65.     end;
  66.     MsDOS(r);
  67.     tmp:='?????';
  68.     if r.AL=0 then begin
  69.       i:=1;
  70.       while (ReplyPacket.ObjectName[i]<>#0) and (i<48) do inc(i);
  71.       move(ReplyPacket.ObjectName[1],tmp[1],i);
  72.       tmp[0]:=char(i);
  73.     end;
  74.     NovellLogonName:=tmp;
  75.   end;
  76.  
  77. end.
  78.  
  79. Then a test program which uses this unit ..
  80.  
  81. program NovellTest;
  82.  
  83. uses dos,novapi;
  84.  
  85. begin
  86.   writeln('Network Information');
  87.   writeln('Logical id  = ',NovellLogicalID);
  88.   writeln('Physical id = ',NovellPhysicalID);
  89.   writeln('Login name  = ',NovellLogonName);
  90.  
  91. end.
  92.  
  93. Cheers, Ben
  94.  
  95.