home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / lan / who / who.c next >
Text File  |  1987-10-13  |  1KB  |  67 lines

  1. /********************************************************************
  2.     WHO.C
  3.        Alternate menu function for Novell Netware
  4.  
  5.        First code : 10/13/87
  6.  
  7. ********************************************************************/
  8.  
  9. #include <stdio.h>
  10. #include <dos.h>
  11.  
  12. union REGPACK r;
  13.  
  14. struct {
  15.   int    length ;
  16.   char    function;
  17.   char    station ;
  18. } outpacket ;
  19.  
  20. struct {
  21.   int    length ;
  22.   char    uniqueid[4] ;
  23.   int    type ;
  24.   char    objectname[48] ;
  25.   char    logtime[8] ;
  26. } whoami ;
  27.  
  28. struct {
  29.   int    length ;
  30.   char    network[4] ;
  31.   char    host[6] ;
  32.   char    socket[2] ;
  33. } map ;
  34.  
  35. main()
  36. {
  37.   int count,station,physical ;
  38.  
  39.   r.r_ds=_DS ;
  40.   r.r_es=_DS ;
  41.   r.r_ax=(0xdc00) ;
  42.   intr(0x21,&r) ;
  43.   station=(r.r_ax & 0xff) ;
  44.   r.r_ax=(0xee00) ;
  45.   intr(0x21,&r) ;
  46.   physical=r.r_ax ;
  47.   r.r_si=(int)&outpacket ;
  48.   r.r_di=(int)&whoami ;
  49.   r.r_ax= (0xe300) ;
  50.   whoami.length=sizeof(whoami) ;
  51.   outpacket.length=sizeof(outpacket) ;
  52.   outpacket.function=22 ;
  53.   outpacket.station=station ;
  54.   intr(0x21,&r) ;
  55.   r.r_si=(int)&outpacket ;
  56.   r.r_di=(int)&map ;
  57.   r.r_ax=0xe300 ;
  58.   outpacket.length=sizeof(outpacket) ;
  59.   outpacket.function=19 ;
  60.   outpacket.station=station ;
  61.   map.length=sizeof(map) ;
  62.   intr(0x21,&r) ;
  63.   physical=map.host[5] ;
  64.   printf("You are user %s, at station %i, connection %i.\n",
  65.         whoami.objectname,station,physical) ;
  66. }
  67.