home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / lansystk.zip / SAMPLE / MPTS / SAMPLDOS / NUL.LST < prev    next >
File List  |  1998-05-08  |  7KB  |  204 lines

  1.  
  2.  
  3.                                                                        PAGE   1
  4.                                                                        04-08-91
  5.                                                                        12:14:31
  6.  
  7.  Line#  Source Line        IBM Personal Computer C/2 Version 1.10 (Release 7.5)
  8.  
  9.       1 #include <stdio.h>
  10.       2 #include <dos.h>
  11.       3 
  12.       4 #include "ncb.h"
  13.       5 #include "dlcptbls.h"
  14.       6 #include "dlcconst.h"
  15.       7 #include "codetbl.h"
  16.       8 
  17.       9 /**********************************************************************
  18.          *******/
  19.      10 /*
  20.      11 **  TableLookUp This function scans a code table for a specified value,
  21.          
  22.      12 **          and returns a text string which can be used as a message.
  23.      13 */
  24.      14 
  25.      15 char *TableLookUp(table, key)
  26.      16 struct CodeTable *table;
  27.      17 unsigned char key;
  28.      18 {
  29.      19     while (table->label && table->code!=key) table++;
  30.      20     if (table->label) return(table->label);
  31.      21     else return(" <unknown> ");
  32.      22 }
  33.  
  34.  
  35. TableLookUp  Local Symbols
  36.  
  37. Name                      Class   Type              Size   Offset  Register
  38.  
  39. table . . . . . . . . . . param                             0006
  40. key . . . . . . . . . . . param                             000a
  41.  
  42.      23 
  43.      24 /**********************************************************************
  44.          /
  45.      25 /*
  46.      26 **  TRNcmd     Execute an NCB or CCB
  47.      27 **
  48.      28 **            Accepts a pointer to an NCB or CCB and passes it to the
  49.      29 **        network interrupt via an INT 5C.
  50.      30 **
  51.      31 **        Returns the value in the AX register which is the NCB
  52.      32 **        or CCB return code.
  53.      33 */
  54.      34 
  55.      35 #define  TRNINT    0x5C
  56.      36 
  57.      37 TRNcmd(cmdptr)
  58.      38 unsigned char *cmdptr;
  59.      39 {
  60.      40     union REGS inregs, outregs;
  61.      41     struct SREGS segregs;
  62.  
  63.  
  64.                                                                        PAGE   2
  65.                                                                        04-08-91
  66.                                                                        12:14:31
  67.  
  68.  Line#  Source Line        IBM Personal Computer C/2 Version 1.10 (Release 7.5)
  69.  
  70.      42     
  71.      43     segread(&segregs);
  72.      44     segregs.es  = FP_SEG(cmdptr);
  73.      45     inregs.x.bx = FP_OFF(cmdptr);
  74.      46     
  75.      47     return( int86x( TRNINT, &inregs, &outregs, &segregs));
  76.      48 }
  77.  
  78.  
  79. TRNcmd  Local Symbols
  80.  
  81. Name                      Class   Type              Size   Offset  Register
  82.  
  83. outregs . . . . . . . . . auto                             -0024 
  84. inregs. . . . . . . . . . auto                             -0016 
  85. segregs . . . . . . . . . auto                             -0008 
  86. cmdptr. . . . . . . . . . param                             0006
  87.  
  88.      49     
  89.      50 /**********************************************************************
  90.          /
  91.      51 /*
  92.      52 ** Installed    Determines what INT5C handlers have been installed.
  93.      53 **
  94.      54 **        Returns 0 if nothing is handling INT5C
  95.      55 **            1 if only the adapter handler is installed
  96.      56 **            2 if NETBIOS is installed
  97.      57 */
  98.      58 
  99.      59 Installed(lana)
  100.      60 unsigned char lana;
  101.      61 {
  102.      62     unsigned long *int5cptr;
  103.      63     CCB ccb;
  104.      64     NCB ncb;
  105.      65     
  106.      66     
  107.      67         /*------------------------------------------------------------+
  108.          
  109.      68         |  Is anything handling interrupt 5C ?                        |
  110.          
  111.      69         +------------------------------------------------------------*/
  112.          
  113.      70     
  114.      71         FP_SEG(int5cptr) = 0x0000;
  115.      72         FP_OFF(int5cptr) = (0x5C << 2);
  116.      73         if (!*int5cptr)
  117.      74                 return 0;               /* nothing to handle int 5C's  
  118.             */
  119.      75 
  120.      76         /*------------------------------------------------------------+
  121.          
  122.      77         |  That's good.  Now see if the adapter handler is installed  |
  123.  
  124.  
  125.                                                                        PAGE   3
  126.                                                                        04-08-91
  127.                                                                        12:14:31
  128.  
  129.  Line#  Source Line        IBM Personal Computer C/2 Version 1.10 (Release 7.5)
  130.  
  131.          
  132.      78         +------------------------------------------------------------*/
  133.          
  134.      79     
  135.      80     memset( &ccb, 0, sizeof(CCB) );
  136.      81         ccb.command  = DIR_INTERRUPT;
  137.      82         ccb.retcode  = 0x42;
  138.      83         ccb.adapter  = lana;
  139.      84         ccb.parm_tab = ccb.pointer = ccb.cmd_cplt = ZEROADDRESS;
  140.      85     
  141.      86     TRNcmd(&ccb);
  142.      87     
  143.      88     if (ccb.retcode == 0x42)
  144.      89         return 0;        /* AH not present */
  145.      90     else
  146.      91         while( ccb.retcode == 0xFF ) ;   /* spin */
  147.      92     
  148.      93 
  149.      94         /*------------------------------------------------------------+
  150.          
  151.      95         |  Great! Finally, we see if NETBIOS is installed by trying   |
  152.          
  153.      96         |  to have it execute an invalid command.              |
  154.      97         +------------------------------------------------------------*/
  155.          
  156.      98     
  157.      99     memset( &ncb, 0, sizeof(NCB) );
  158.     100     ncb.command = 0xFF;        /* an invalid command */
  159.     101         
  160.     102     TRNcmd(&ncb);
  161.     103     
  162.     104     if (ncb.retcode == 0x03)
  163.     105         return 2;        /* NETBIOS is present */
  164.     106     else
  165.     107         return 1;        /* Alas, only the AH is present */
  166.     108                 
  167.     109 
  168.     110 }
  169.  
  170.  
  171. Installed  Local Symbols
  172.  
  173. Name                      Class   Type              Size   Offset  Register
  174.  
  175. int5cptr. . . . . . . . . auto                             -0054 
  176. ccb . . . . . . . . . . . auto                             -0050 
  177. ncb . . . . . . . . . . . auto                             -0040 
  178. lana. . . . . . . . . . . param                             0006
  179.  
  180.  
  181.  
  182.                                                                        PAGE   4
  183.                                                                        04-08-91
  184.                                                                        12:14:31
  185.  
  186.                            IBM Personal Computer C/2 Version 1.10 (Release 7.5)
  187.  
  188. Global Symbols
  189.  
  190. Name                      Class   Type              Size   Offset  
  191.  
  192. Installed . . . . . . . . global  far function       ***    0086
  193. TRNcmd. . . . . . . . . . global  far function       ***    0046
  194. TableLookUp . . . . . . . global  far function       ***    0000
  195. int86x. . . . . . . . . . extern  far function       ***     ***
  196. memset. . . . . . . . . . extern  far function       ***     ***
  197. segread . . . . . . . . . extern  far function       ***     ***
  198.  
  199. Code size = 0136 (310)
  200. Data size = 000c (12)
  201. Bss size  = 0000 (0)
  202.  
  203. No errors detected
  204.