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 >
Wrap
File List
|
1998-05-08
|
7KB
|
204 lines
PAGE 1
04-08-91
12:14:31
Line# Source Line IBM Personal Computer C/2 Version 1.10 (Release 7.5)
1 #include <stdio.h>
2 #include <dos.h>
3
4 #include "ncb.h"
5 #include "dlcptbls.h"
6 #include "dlcconst.h"
7 #include "codetbl.h"
8
9 /**********************************************************************
*******/
10 /*
11 ** TableLookUp This function scans a code table for a specified value,
12 ** and returns a text string which can be used as a message.
13 */
14
15 char *TableLookUp(table, key)
16 struct CodeTable *table;
17 unsigned char key;
18 {
19 while (table->label && table->code!=key) table++;
20 if (table->label) return(table->label);
21 else return(" <unknown> ");
22 }
TableLookUp Local Symbols
Name Class Type Size Offset Register
table . . . . . . . . . . param 0006
key . . . . . . . . . . . param 000a
23
24 /**********************************************************************
/
25 /*
26 ** TRNcmd Execute an NCB or CCB
27 **
28 ** Accepts a pointer to an NCB or CCB and passes it to the
29 ** network interrupt via an INT 5C.
30 **
31 ** Returns the value in the AX register which is the NCB
32 ** or CCB return code.
33 */
34
35 #define TRNINT 0x5C
36
37 TRNcmd(cmdptr)
38 unsigned char *cmdptr;
39 {
40 union REGS inregs, outregs;
41 struct SREGS segregs;
PAGE 2
04-08-91
12:14:31
Line# Source Line IBM Personal Computer C/2 Version 1.10 (Release 7.5)
42
43 segread(&segregs);
44 segregs.es = FP_SEG(cmdptr);
45 inregs.x.bx = FP_OFF(cmdptr);
46
47 return( int86x( TRNINT, &inregs, &outregs, &segregs));
48 }
TRNcmd Local Symbols
Name Class Type Size Offset Register
outregs . . . . . . . . . auto -0024
inregs. . . . . . . . . . auto -0016
segregs . . . . . . . . . auto -0008
cmdptr. . . . . . . . . . param 0006
49
50 /**********************************************************************
/
51 /*
52 ** Installed Determines what INT5C handlers have been installed.
53 **
54 ** Returns 0 if nothing is handling INT5C
55 ** 1 if only the adapter handler is installed
56 ** 2 if NETBIOS is installed
57 */
58
59 Installed(lana)
60 unsigned char lana;
61 {
62 unsigned long *int5cptr;
63 CCB ccb;
64 NCB ncb;
65
66
67 /*------------------------------------------------------------+
68 | Is anything handling interrupt 5C ? |
69 +------------------------------------------------------------*/
70
71 FP_SEG(int5cptr) = 0x0000;
72 FP_OFF(int5cptr) = (0x5C << 2);
73 if (!*int5cptr)
74 return 0; /* nothing to handle int 5C's
*/
75
76 /*------------------------------------------------------------+
77 | That's good. Now see if the adapter handler is installed |
PAGE 3
04-08-91
12:14:31
Line# Source Line IBM Personal Computer C/2 Version 1.10 (Release 7.5)
78 +------------------------------------------------------------*/
79
80 memset( &ccb, 0, sizeof(CCB) );
81 ccb.command = DIR_INTERRUPT;
82 ccb.retcode = 0x42;
83 ccb.adapter = lana;
84 ccb.parm_tab = ccb.pointer = ccb.cmd_cplt = ZEROADDRESS;
85
86 TRNcmd(&ccb);
87
88 if (ccb.retcode == 0x42)
89 return 0; /* AH not present */
90 else
91 while( ccb.retcode == 0xFF ) ; /* spin */
92
93
94 /*------------------------------------------------------------+
95 | Great! Finally, we see if NETBIOS is installed by trying |
96 | to have it execute an invalid command. |
97 +------------------------------------------------------------*/
98
99 memset( &ncb, 0, sizeof(NCB) );
100 ncb.command = 0xFF; /* an invalid command */
101
102 TRNcmd(&ncb);
103
104 if (ncb.retcode == 0x03)
105 return 2; /* NETBIOS is present */
106 else
107 return 1; /* Alas, only the AH is present */
108
109
110 }
Installed Local Symbols
Name Class Type Size Offset Register
int5cptr. . . . . . . . . auto -0054
ccb . . . . . . . . . . . auto -0050
ncb . . . . . . . . . . . auto -0040
lana. . . . . . . . . . . param 0006
PAGE 4
04-08-91
12:14:31
IBM Personal Computer C/2 Version 1.10 (Release 7.5)
Global Symbols
Name Class Type Size Offset
Installed . . . . . . . . global far function *** 0086
TRNcmd. . . . . . . . . . global far function *** 0046
TableLookUp . . . . . . . global far function *** 0000
int86x. . . . . . . . . . extern far function *** ***
memset. . . . . . . . . . extern far function *** ***
segread . . . . . . . . . extern far function *** ***
Code size = 0136 (310)
Data size = 000c (12)
Bss size = 0000 (0)
No errors detected