1
{******************************************************************************}
3
{ Portable Netbios 3.0 API interface Unit for Object Pascal }
5
{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft }
6
{ Corporation. All Rights Reserved. }
8
{ The original file is: Nb30.h, released June 2000. The original Pascal }
9
{ code is: JwaN30.pas, released December 2000. The initial developer of the }
10
{ Pascal code is Marcel van Brakel (brakelm att chello dott nl). }
12
{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001 }
13
{ Marcel van Brakel. All Rights Reserved. }
15
{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI) }
17
{ You may retrieve the latest version of this file at the Project JEDI }
18
{ APILIB home page, located at http://jedi-apilib.sourceforge.net }
20
{ The contents of this file are used with permission, subject to the Mozilla }
21
{ Public License Version 1.1 (the "License"); you may not use this file except }
22
{ in compliance with the License. You may obtain a copy of the License at }
23
{ http://www.mozilla.org/MPL/MPL-1.1.html }
25
{ Software distributed under the License is distributed on an "AS IS" basis, }
26
{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
27
{ the specific language governing rights and limitations under the License. }
29
{ Alternatively, the contents of this file may be used under the terms of the }
30
{ GNU Lesser General Public License (the "LGPL License"), in which case the }
31
{ provisions of the LGPL License are applicable instead of those above. }
32
{ If you wish to allow use of your version of this file only under the terms }
33
{ of the LGPL License and not to allow others to use your version of this file }
34
{ under the MPL, indicate your decision by deleting the provisions above and }
35
{ replace them with the notice and other provisions required by the LGPL }
36
{ License. If you do not delete the provisions above, a recipient may use }
37
{ your version of this file under either the MPL or the LGPL License. }
39
{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
41
{******************************************************************************}
43
// $Id: jwanb30.pas,v 1.1 2005/04/04 07:56:10 marco Exp $
50
{$HPPEMIT '#include "Nb30.h"'}
60
(****************************************************************
62
* Data structure templates *
64
****************************************************************)
67
NCBNAMSZ = 16; // absolute length of a net name
68
{$EXTERNALSYM NCBNAMSZ}
69
MAX_LANA = 254; // lana's in range 0 to MAX_LANA inclusive
70
{$EXTERNALSYM MAX_LANA}
73
// Network Control Block
79
TNcbPost = procedure(P: PNCB); stdcall;
82
ncb_command: UCHAR; // command code
83
ncb_retcode: UCHAR; // return code
84
ncb_lsn: UCHAR; // local session number
85
ncb_num: UCHAR; // number of our network name
86
ncb_buffer: PChar; // address of message buffer
87
ncb_length: Word; // size of message buffer
88
ncb_callname: array [0..NCBNAMSZ - 1] of Char; // blank-padded name of remote
89
ncb_name: array [0..NCBNAMSZ - 1] of Char; // our blank-padded netname
90
ncb_rto: UCHAR; // rcv timeout/retry count
91
ncb_sto: UCHAR; // send timeout/sys timeout
92
ncb_post: TNcbPost; // POST routine address
93
ncb_lana_num: UCHAR; // lana (adapter) number
94
ncb_cmd_cplt: UCHAR; // 0xff => commmand pending
96
ncb_reserve: array [0..17] of Char; // reserved, used by BIOS
98
ncb_reserve: array [0..9] of Char; // reserved, used by BIOS
100
ncb_event: HANDLE; // HANDLE to Win32 event which
101
// will be set to the signalled
102
// state when an ASYNCH command
111
// Structure returned to the NCB command NCBASTAT is ADAPTER_STATUS followed
112
// by an array of NAME_BUFFER structures.
115
_ADAPTER_STATUS = record
116
adapter_address: array [0..5] of UCHAR;
124
iframe_recv_err: WORD;
128
iframe_xmit_err: WORD;
129
recv_buff_unavail: WORD;
136
xmit_buf_unavail: WORD;
137
max_dgram_size: WORD;
141
max_sess_pkt_size: WORD;
144
{$EXTERNALSYM _ADAPTER_STATUS}
145
ADAPTER_STATUS = _ADAPTER_STATUS;
146
{$EXTERNALSYM ADAPTER_STATUS}
147
PADAPTER_STATUS = ^ADAPTER_STATUS;
148
{$EXTERNALSYM PADAPTER_STATUS}
149
TAdapterStatus = ADAPTER_STATUS;
150
PAdapterStatus = PADAPTER_STATUS;
152
_NAME_BUFFER = record
153
name: array [0..NCBNAMSZ - 1] of Char;
157
{$EXTERNALSYM _NAME_BUFFER}
158
NAME_BUFFER = _NAME_BUFFER;
159
{$EXTERNALSYM NAME_BUFFER}
160
PNAME_BUFFER = ^NAME_BUFFER;
161
{$EXTERNALSYM PNAME_BUFFER}
162
TNameBuffer = NAME_BUFFER;
163
PNameBuffer = PNAME_BUFFER;
165
// values for name_flags bits.
168
NAME_FLAGS_MASK = $87;
169
{$EXTERNALSYM NAME_FLAGS_MASK}
172
{$EXTERNALSYM GROUP_NAME}
174
{$EXTERNALSYM UNIQUE_NAME}
177
{$EXTERNALSYM REGISTERING}
179
{$EXTERNALSYM REGISTERED}
181
{$EXTERNALSYM DEREGISTERED}
183
{$EXTERNALSYM DUPLICATE}
184
DUPLICATE_DEREG = $07;
185
{$EXTERNALSYM DUPLICATE_DEREG}
188
// Structure returned to the NCB command NCBSSTAT is SESSION_HEADER followed
189
// by an array of SESSION_BUFFER structures. If the NCB_NAME starts with an
190
// asterisk then an array of these structures is returned containing the
191
// status for all names.
195
_SESSION_HEADER = record
198
rcv_dg_outstanding: UCHAR;
199
rcv_any_outstanding: UCHAR;
201
{$EXTERNALSYM _SESSION_HEADER}
202
SESSION_HEADER = _SESSION_HEADER;
203
{$EXTERNALSYM SESSION_HEADER}
204
PSESSION_HEADER = ^SESSION_HEADER;
205
{$EXTERNALSYM PSESSION_HEADER}
206
TSessionHeader = SESSION_HEADER;
207
PSessionHeader = PSESSION_HEADER;
209
_SESSION_BUFFER = record
212
local_name: array [0..NCBNAMSZ - 1] of UCHAR;
213
remote_name: array [0..NCBNAMSZ - 1] of UCHAR;
214
rcvs_outstanding: UCHAR;
215
sends_outstanding: UCHAR;
217
{$EXTERNALSYM _SESSION_BUFFER}
218
SESSION_BUFFER = _SESSION_BUFFER;
219
{$EXTERNALSYM SESSION_BUFFER}
220
PSESSION_BUFFER = ^SESSION_BUFFER;
221
{$EXTERNALSYM PSESSION_BUFFER}
222
TSessionBuffer = SESSION_BUFFER;
223
PSessionBuffer = PSESSION_BUFFER;
228
LISTEN_OUTSTANDING = $01;
229
{$EXTERNALSYM LISTEN_OUTSTANDING}
231
{$EXTERNALSYM CALL_PENDING}
232
SESSION_ESTABLISHED = $03;
233
{$EXTERNALSYM SESSION_ESTABLISHED}
234
HANGUP_PENDING = $04;
235
{$EXTERNALSYM HANGUP_PENDING}
236
HANGUP_COMPLETE = $05;
237
{$EXTERNALSYM HANGUP_COMPLETE}
238
SESSION_ABORTED = $06;
239
{$EXTERNALSYM SESSION_ABORTED}
242
// Structure returned to the NCB command NCBENUM.
244
// On a system containing lana's 0, 2 and 3, a structure with
245
// length =3, lana[0]=0, lana[1]=2 and lana[2]=3 will be returned.
250
length: UCHAR; // Number of valid entries in lana[]
251
lana: array [0..MAX_LANA] of UCHAR;
253
{$EXTERNALSYM _LANA_ENUM}
254
LANA_ENUM = _LANA_ENUM;
255
{$EXTERNALSYM LANA_ENUM}
256
PLANA_ENUM = ^LANA_ENUM;
257
{$EXTERNALSYM PLANA_ENUM}
258
TLanaEnum = LANA_ENUM;
259
PLanaEnum = PLANA_ENUM;
262
// Structure returned to the NCB command NCBFINDNAME is FIND_NAME_HEADER followed
263
// by an array of FIND_NAME_BUFFER structures.
267
_FIND_NAME_HEADER = record
272
{$EXTERNALSYM _FIND_NAME_HEADER}
273
FIND_NAME_HEADER = _FIND_NAME_HEADER;
274
{$EXTERNALSYM FIND_NAME_HEADER}
275
PFIND_NAME_HEADER = ^FIND_NAME_HEADER;
276
{$EXTERNALSYM PFIND_NAME_HEADER}
277
TFindNameHeader = FIND_NAME_HEADER;
278
PFindNameHeader = PFIND_NAME_HEADER;
280
_FIND_NAME_BUFFER = record
282
access_control: UCHAR;
283
frame_control: UCHAR;
284
destination_addr: array [0..5] of UCHAR;
285
source_addr: array [0..5] of UCHAR;
286
routing_info: array [0..17] of UCHAR;
288
{$EXTERNALSYM _FIND_NAME_BUFFER}
289
FIND_NAME_BUFFER = _FIND_NAME_BUFFER;
290
{$EXTERNALSYM FIND_NAME_BUFFER}
291
PFIND_NAME_BUFFER = ^FIND_NAME_BUFFER;
292
{$EXTERNALSYM PFIND_NAME_BUFFER}
293
TFindNameBuffer = FIND_NAME_BUFFER;
294
PFindNameBuffer = PFIND_NAME_BUFFER;
297
// Structure provided with NCBACTION. The purpose of NCBACTION is to provide
298
// transport specific extensions to netbios.
301
_ACTION_HEADER = record
306
{$EXTERNALSYM _ACTION_HEADER}
307
ACTION_HEADER = _ACTION_HEADER;
308
{$EXTERNALSYM ACTION_HEADER}
309
PACTION_HEADER = ^ACTION_HEADER;
310
{$EXTERNALSYM PACTION_HEADER}
311
TActionHeader = ACTION_HEADER;
312
PActionHeader = PACTION_HEADER;
314
// Values for transport_id
317
ALL_TRANSPORTS = 'M'#0#0#0;
318
{$EXTERNALSYM ALL_TRANSPORTS}
320
{$EXTERNALSYM MS_NBF}
322
(****************************************************************
324
* Special values and constants *
326
****************************************************************)
333
NCBCALL = $10; // NCB CALL
334
{$EXTERNALSYM NCBCALL}
335
NCBLISTEN = $11; // NCB LISTEN
336
{$EXTERNALSYM NCBLISTEN}
337
NCBHANGUP = $12; // NCB HANG UP
338
{$EXTERNALSYM NCBHANGUP}
339
NCBSEND = $14; // NCB SEND
340
{$EXTERNALSYM NCBSEND}
341
NCBRECV = $15; // NCB RECEIVE
342
{$EXTERNALSYM NCBRECV}
343
NCBRECVANY = $16; // NCB RECEIVE ANY
344
{$EXTERNALSYM NCBRECVANY}
345
NCBCHAINSEND = $17; // NCB CHAIN SEND
346
{$EXTERNALSYM NCBCHAINSEND}
347
NCBDGSEND = $20; // NCB SEND DATAGRAM
348
{$EXTERNALSYM NCBDGSEND}
349
NCBDGRECV = $21; // NCB RECEIVE DATAGRAM
350
{$EXTERNALSYM NCBDGRECV}
351
NCBDGSENDBC = $22; // NCB SEND BROADCAST DATAGRAM
352
{$EXTERNALSYM NCBDGSENDBC}
353
NCBDGRECVBC = $23; // NCB RECEIVE BROADCAST DATAGRAM
354
{$EXTERNALSYM NCBDGRECVBC}
355
NCBADDNAME = $30; // NCB ADD NAME
356
{$EXTERNALSYM NCBADDNAME}
357
NCBDELNAME = $31; // NCB DELETE NAME
358
{$EXTERNALSYM NCBDELNAME}
359
NCBRESET = $32; // NCB RESET
360
{$EXTERNALSYM NCBRESET}
361
NCBASTAT = $33; // NCB ADAPTER STATUS
362
{$EXTERNALSYM NCBASTAT}
363
NCBSSTAT = $34; // NCB SESSION STATUS
364
{$EXTERNALSYM NCBSSTAT}
365
NCBCANCEL = $35; // NCB CANCEL
366
{$EXTERNALSYM NCBCANCEL}
367
NCBADDGRNAME = $36; // NCB ADD GROUP NAME
368
{$EXTERNALSYM NCBADDGRNAME}
369
NCBENUM = $37; // NCB ENUMERATE LANA NUMBERS
370
{$EXTERNALSYM NCBENUM}
371
NCBUNLINK = $70; // NCB UNLINK
372
{$EXTERNALSYM NCBUNLINK}
373
NCBSENDNA = $71; // NCB SEND NO ACK
374
{$EXTERNALSYM NCBSENDNA}
375
NCBCHAINSENDNA = $72; // NCB CHAIN SEND NO ACK
376
{$EXTERNALSYM NCBCHAINSENDNA}
377
NCBLANSTALERT = $73; // NCB LAN STATUS ALERT
378
{$EXTERNALSYM NCBLANSTALERT}
379
NCBACTION = $77; // NCB ACTION
380
{$EXTERNALSYM NCBACTION}
381
NCBFINDNAME = $78; // NCB FIND NAME
382
{$EXTERNALSYM NCBFINDNAME}
383
NCBTRACE = $79; // NCB TRACE
384
{$EXTERNALSYM NCBTRACE}
386
ASYNCH = $80; // high bit set == asynchronous
387
{$EXTERNALSYM ASYNCH}
393
NRC_GOODRET = $00; // good return also returned when ASYNCH request accepted
394
{$EXTERNALSYM NRC_GOODRET}
395
NRC_BUFLEN = $01; // illegal buffer length
396
{$EXTERNALSYM NRC_BUFLEN}
397
NRC_ILLCMD = $03; // illegal command
398
{$EXTERNALSYM NRC_ILLCMD}
399
NRC_CMDTMO = $05; // command timed out
400
{$EXTERNALSYM NRC_CMDTMO}
401
NRC_INCOMP = $06; // message incomplete, issue another command
402
{$EXTERNALSYM NRC_INCOMP}
403
NRC_BADDR = $07; // illegal buffer address
404
{$EXTERNALSYM NRC_BADDR}
405
NRC_SNUMOUT = $08; // session number out of range
406
{$EXTERNALSYM NRC_SNUMOUT}
407
NRC_NORES = $09; // no resource available
408
{$EXTERNALSYM NRC_NORES}
409
NRC_SCLOSED = $0a; // session closed
410
{$EXTERNALSYM NRC_SCLOSED}
411
NRC_CMDCAN = $0b; // command cancelled
412
{$EXTERNALSYM NRC_CMDCAN}
413
NRC_DUPNAME = $0d; // duplicate name
414
{$EXTERNALSYM NRC_DUPNAME}
415
NRC_NAMTFUL = $0e; // name table full
416
{$EXTERNALSYM NRC_NAMTFUL}
417
NRC_ACTSES = $0f; // no deletions, name has active sessions
418
{$EXTERNALSYM NRC_ACTSES}
419
NRC_LOCTFUL = $11; // local session table full
420
{$EXTERNALSYM NRC_LOCTFUL}
421
NRC_REMTFUL = $12; // remote session table full
422
{$EXTERNALSYM NRC_REMTFUL}
423
NRC_ILLNN = $13; // illegal name number
424
{$EXTERNALSYM NRC_ILLNN}
425
NRC_NOCALL = $14; // no callname
426
{$EXTERNALSYM NRC_NOCALL}
427
NRC_NOWILD = $15; // cannot put * in NCB_NAME
428
{$EXTERNALSYM NRC_NOWILD}
429
NRC_INUSE = $16; // name in use on remote adapter
430
{$EXTERNALSYM NRC_INUSE}
431
NRC_NAMERR = $17; // name deleted
432
{$EXTERNALSYM NRC_NAMERR}
433
NRC_SABORT = $18; // session ended abnormally
434
{$EXTERNALSYM NRC_SABORT}
435
NRC_NAMCONF = $19; // name conflict detected
436
{$EXTERNALSYM NRC_NAMCONF}
437
NRC_IFBUSY = $21; // interface busy, IRET before retrying
438
{$EXTERNALSYM NRC_IFBUSY}
439
NRC_TOOMANY = $22; // too many commands outstanding, retry later
440
{$EXTERNALSYM NRC_TOOMANY}
441
NRC_BRIDGE = $23; // ncb_lana_num field invalid
442
{$EXTERNALSYM NRC_BRIDGE}
443
NRC_CANOCCR = $24; // command completed while cancel occurring
444
{$EXTERNALSYM NRC_CANOCCR}
445
NRC_CANCEL = $26; // command not valid to cancel
446
{$EXTERNALSYM NRC_CANCEL}
447
NRC_DUPENV = $30; // name defined by anther local process
448
{$EXTERNALSYM NRC_DUPENV}
449
NRC_ENVNOTDEF = $34; // environment undefined. RESET required
450
{$EXTERNALSYM NRC_ENVNOTDEF}
451
NRC_OSRESNOTAV = $35; // required OS resources exhausted
452
{$EXTERNALSYM NRC_OSRESNOTAV}
453
NRC_MAXAPPS = $36; // max number of applications exceeded
454
{$EXTERNALSYM NRC_MAXAPPS}
455
NRC_NOSAPS = $37; // no saps available for netbios
456
{$EXTERNALSYM NRC_NOSAPS}
457
NRC_NORESOURCES = $38; // requested resources are not available
458
{$EXTERNALSYM NRC_NORESOURCES}
459
NRC_INVADDRESS = $39; // invalid ncb address or length > segment
460
{$EXTERNALSYM NRC_INVADDRESS}
461
NRC_INVDDID = $3B; // invalid NCB DDID
462
{$EXTERNALSYM NRC_INVDDID}
463
NRC_LOCKFAIL = $3C; // lock of user area failed
464
{$EXTERNALSYM NRC_LOCKFAIL}
465
NRC_OPENERR = $3f; // NETBIOS not loaded
466
{$EXTERNALSYM NRC_OPENERR}
467
NRC_SYSTEM = $40; // system error
468
{$EXTERNALSYM NRC_SYSTEM}
470
NRC_PENDING = $ff; // asynchronous command is not yet finished
471
{$EXTERNALSYM NRC_PENDING}
473
(****************************************************************
475
* main user entry point for NetBIOS 3.0 *
477
* Usage: result = Netbios( pncb ); *
478
****************************************************************)
480
function Netbios(pncb: PNCB): UCHAR; stdcall;
481
{$EXTERNALSYM Netbios}
483
(****************************************************************
485
* Prefix for callback routines *
487
* Usage in a declaration: NCB_POST MyPostRoutine( PNCB pncb ); *
488
****************************************************************)
490
// #define NCB_POST void CALLBACK
494
{$IFDEF DYNAMIC_LINK}
501
GetProcedureAddress(_Netbios, 'netapi32.dll', 'Netbios');
511
function Netbios; external 'netapi32.dll' name 'Netbios';
513
{$ENDIF DYNAMIC_LINK}
1
{******************************************************************************}
3
{ Portable Netbios 3.0 API interface Unit for Object Pascal }
5
{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft }
6
{ Corporation. All Rights Reserved. }
8
{ The original file is: Nb30.h, released June 2000. The original Pascal }
9
{ code is: JwaN30.pas, released December 2000. The initial developer of the }
10
{ Pascal code is Marcel van Brakel (brakelm att chello dott nl). }
12
{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001 }
13
{ Marcel van Brakel. All Rights Reserved. }
15
{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI) }
17
{ You may retrieve the latest version of this file at the Project JEDI }
18
{ APILIB home page, located at http://jedi-apilib.sourceforge.net }
20
{ The contents of this file are used with permission, subject to the Mozilla }
21
{ Public License Version 1.1 (the "License"); you may not use this file except }
22
{ in compliance with the License. You may obtain a copy of the License at }
23
{ http://www.mozilla.org/MPL/MPL-1.1.html }
25
{ Software distributed under the License is distributed on an "AS IS" basis, }
26
{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
27
{ the specific language governing rights and limitations under the License. }
29
{ Alternatively, the contents of this file may be used under the terms of the }
30
{ GNU Lesser General Public License (the "LGPL License"), in which case the }
31
{ provisions of the LGPL License are applicable instead of those above. }
32
{ If you wish to allow use of your version of this file only under the terms }
33
{ of the LGPL License and not to allow others to use your version of this file }
34
{ under the MPL, indicate your decision by deleting the provisions above and }
35
{ replace them with the notice and other provisions required by the LGPL }
36
{ License. If you do not delete the provisions above, a recipient may use }
37
{ your version of this file under either the MPL or the LGPL License. }
39
{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
41
{******************************************************************************}
49
{$HPPEMIT '#include "Nb30.h"'}
59
(****************************************************************
61
* Data structure templates *
63
****************************************************************)
66
NCBNAMSZ = 16; // absolute length of a net name
67
{$EXTERNALSYM NCBNAMSZ}
68
MAX_LANA = 254; // lana's in range 0 to MAX_LANA inclusive
69
{$EXTERNALSYM MAX_LANA}
72
// Network Control Block
78
TNcbPost = procedure(P: PNCB); stdcall;
81
ncb_command: UCHAR; // command code
82
ncb_retcode: UCHAR; // return code
83
ncb_lsn: UCHAR; // local session number
84
ncb_num: UCHAR; // number of our network name
85
ncb_buffer: PChar; // address of message buffer
86
ncb_length: Word; // size of message buffer
87
ncb_callname: array [0..NCBNAMSZ - 1] of Char; // blank-padded name of remote
88
ncb_name: array [0..NCBNAMSZ - 1] of Char; // our blank-padded netname
89
ncb_rto: UCHAR; // rcv timeout/retry count
90
ncb_sto: UCHAR; // send timeout/sys timeout
91
ncb_post: TNcbPost; // POST routine address
92
ncb_lana_num: UCHAR; // lana (adapter) number
93
ncb_cmd_cplt: UCHAR; // 0xff => commmand pending
95
ncb_reserve: array [0..17] of Char; // reserved, used by BIOS
97
ncb_reserve: array [0..9] of Char; // reserved, used by BIOS
99
ncb_event: HANDLE; // HANDLE to Win32 event which
100
// will be set to the signalled
101
// state when an ASYNCH command
110
// Structure returned to the NCB command NCBASTAT is ADAPTER_STATUS followed
111
// by an array of NAME_BUFFER structures.
114
_ADAPTER_STATUS = record
115
adapter_address: array [0..5] of UCHAR;
123
iframe_recv_err: WORD;
127
iframe_xmit_err: WORD;
128
recv_buff_unavail: WORD;
135
xmit_buf_unavail: WORD;
136
max_dgram_size: WORD;
140
max_sess_pkt_size: WORD;
143
{$EXTERNALSYM _ADAPTER_STATUS}
144
ADAPTER_STATUS = _ADAPTER_STATUS;
145
{$EXTERNALSYM ADAPTER_STATUS}
146
PADAPTER_STATUS = ^ADAPTER_STATUS;
147
{$EXTERNALSYM PADAPTER_STATUS}
148
TAdapterStatus = ADAPTER_STATUS;
149
PAdapterStatus = PADAPTER_STATUS;
151
_NAME_BUFFER = record
152
name: array [0..NCBNAMSZ - 1] of Char;
156
{$EXTERNALSYM _NAME_BUFFER}
157
NAME_BUFFER = _NAME_BUFFER;
158
{$EXTERNALSYM NAME_BUFFER}
159
PNAME_BUFFER = ^NAME_BUFFER;
160
{$EXTERNALSYM PNAME_BUFFER}
161
TNameBuffer = NAME_BUFFER;
162
PNameBuffer = PNAME_BUFFER;
164
// values for name_flags bits.
167
NAME_FLAGS_MASK = $87;
168
{$EXTERNALSYM NAME_FLAGS_MASK}
171
{$EXTERNALSYM GROUP_NAME}
173
{$EXTERNALSYM UNIQUE_NAME}
176
{$EXTERNALSYM REGISTERING}
178
{$EXTERNALSYM REGISTERED}
180
{$EXTERNALSYM DEREGISTERED}
182
{$EXTERNALSYM DUPLICATE}
183
DUPLICATE_DEREG = $07;
184
{$EXTERNALSYM DUPLICATE_DEREG}
187
// Structure returned to the NCB command NCBSSTAT is SESSION_HEADER followed
188
// by an array of SESSION_BUFFER structures. If the NCB_NAME starts with an
189
// asterisk then an array of these structures is returned containing the
190
// status for all names.
194
_SESSION_HEADER = record
197
rcv_dg_outstanding: UCHAR;
198
rcv_any_outstanding: UCHAR;
200
{$EXTERNALSYM _SESSION_HEADER}
201
SESSION_HEADER = _SESSION_HEADER;
202
{$EXTERNALSYM SESSION_HEADER}
203
PSESSION_HEADER = ^SESSION_HEADER;
204
{$EXTERNALSYM PSESSION_HEADER}
205
TSessionHeader = SESSION_HEADER;
206
PSessionHeader = PSESSION_HEADER;
208
_SESSION_BUFFER = record
211
local_name: array [0..NCBNAMSZ - 1] of UCHAR;
212
remote_name: array [0..NCBNAMSZ - 1] of UCHAR;
213
rcvs_outstanding: UCHAR;
214
sends_outstanding: UCHAR;
216
{$EXTERNALSYM _SESSION_BUFFER}
217
SESSION_BUFFER = _SESSION_BUFFER;
218
{$EXTERNALSYM SESSION_BUFFER}
219
PSESSION_BUFFER = ^SESSION_BUFFER;
220
{$EXTERNALSYM PSESSION_BUFFER}
221
TSessionBuffer = SESSION_BUFFER;
222
PSessionBuffer = PSESSION_BUFFER;
227
LISTEN_OUTSTANDING = $01;
228
{$EXTERNALSYM LISTEN_OUTSTANDING}
230
{$EXTERNALSYM CALL_PENDING}
231
SESSION_ESTABLISHED = $03;
232
{$EXTERNALSYM SESSION_ESTABLISHED}
233
HANGUP_PENDING = $04;
234
{$EXTERNALSYM HANGUP_PENDING}
235
HANGUP_COMPLETE = $05;
236
{$EXTERNALSYM HANGUP_COMPLETE}
237
SESSION_ABORTED = $06;
238
{$EXTERNALSYM SESSION_ABORTED}
241
// Structure returned to the NCB command NCBENUM.
243
// On a system containing lana's 0, 2 and 3, a structure with
244
// length =3, lana[0]=0, lana[1]=2 and lana[2]=3 will be returned.
249
length: UCHAR; // Number of valid entries in lana[]
250
lana: array [0..MAX_LANA] of UCHAR;
252
{$EXTERNALSYM _LANA_ENUM}
253
LANA_ENUM = _LANA_ENUM;
254
{$EXTERNALSYM LANA_ENUM}
255
PLANA_ENUM = ^LANA_ENUM;
256
{$EXTERNALSYM PLANA_ENUM}
257
TLanaEnum = LANA_ENUM;
258
PLanaEnum = PLANA_ENUM;
261
// Structure returned to the NCB command NCBFINDNAME is FIND_NAME_HEADER followed
262
// by an array of FIND_NAME_BUFFER structures.
266
_FIND_NAME_HEADER = record
271
{$EXTERNALSYM _FIND_NAME_HEADER}
272
FIND_NAME_HEADER = _FIND_NAME_HEADER;
273
{$EXTERNALSYM FIND_NAME_HEADER}
274
PFIND_NAME_HEADER = ^FIND_NAME_HEADER;
275
{$EXTERNALSYM PFIND_NAME_HEADER}
276
TFindNameHeader = FIND_NAME_HEADER;
277
PFindNameHeader = PFIND_NAME_HEADER;
279
_FIND_NAME_BUFFER = record
281
access_control: UCHAR;
282
frame_control: UCHAR;
283
destination_addr: array [0..5] of UCHAR;
284
source_addr: array [0..5] of UCHAR;
285
routing_info: array [0..17] of UCHAR;
287
{$EXTERNALSYM _FIND_NAME_BUFFER}
288
FIND_NAME_BUFFER = _FIND_NAME_BUFFER;
289
{$EXTERNALSYM FIND_NAME_BUFFER}
290
PFIND_NAME_BUFFER = ^FIND_NAME_BUFFER;
291
{$EXTERNALSYM PFIND_NAME_BUFFER}
292
TFindNameBuffer = FIND_NAME_BUFFER;
293
PFindNameBuffer = PFIND_NAME_BUFFER;
296
// Structure provided with NCBACTION. The purpose of NCBACTION is to provide
297
// transport specific extensions to netbios.
300
_ACTION_HEADER = record
305
{$EXTERNALSYM _ACTION_HEADER}
306
ACTION_HEADER = _ACTION_HEADER;
307
{$EXTERNALSYM ACTION_HEADER}
308
PACTION_HEADER = ^ACTION_HEADER;
309
{$EXTERNALSYM PACTION_HEADER}
310
TActionHeader = ACTION_HEADER;
311
PActionHeader = PACTION_HEADER;
313
// Values for transport_id
316
ALL_TRANSPORTS = 'M'#0#0#0;
317
{$EXTERNALSYM ALL_TRANSPORTS}
319
{$EXTERNALSYM MS_NBF}
321
(****************************************************************
323
* Special values and constants *
325
****************************************************************)
332
NCBCALL = $10; // NCB CALL
333
{$EXTERNALSYM NCBCALL}
334
NCBLISTEN = $11; // NCB LISTEN
335
{$EXTERNALSYM NCBLISTEN}
336
NCBHANGUP = $12; // NCB HANG UP
337
{$EXTERNALSYM NCBHANGUP}
338
NCBSEND = $14; // NCB SEND
339
{$EXTERNALSYM NCBSEND}
340
NCBRECV = $15; // NCB RECEIVE
341
{$EXTERNALSYM NCBRECV}
342
NCBRECVANY = $16; // NCB RECEIVE ANY
343
{$EXTERNALSYM NCBRECVANY}
344
NCBCHAINSEND = $17; // NCB CHAIN SEND
345
{$EXTERNALSYM NCBCHAINSEND}
346
NCBDGSEND = $20; // NCB SEND DATAGRAM
347
{$EXTERNALSYM NCBDGSEND}
348
NCBDGRECV = $21; // NCB RECEIVE DATAGRAM
349
{$EXTERNALSYM NCBDGRECV}
350
NCBDGSENDBC = $22; // NCB SEND BROADCAST DATAGRAM
351
{$EXTERNALSYM NCBDGSENDBC}
352
NCBDGRECVBC = $23; // NCB RECEIVE BROADCAST DATAGRAM
353
{$EXTERNALSYM NCBDGRECVBC}
354
NCBADDNAME = $30; // NCB ADD NAME
355
{$EXTERNALSYM NCBADDNAME}
356
NCBDELNAME = $31; // NCB DELETE NAME
357
{$EXTERNALSYM NCBDELNAME}
358
NCBRESET = $32; // NCB RESET
359
{$EXTERNALSYM NCBRESET}
360
NCBASTAT = $33; // NCB ADAPTER STATUS
361
{$EXTERNALSYM NCBASTAT}
362
NCBSSTAT = $34; // NCB SESSION STATUS
363
{$EXTERNALSYM NCBSSTAT}
364
NCBCANCEL = $35; // NCB CANCEL
365
{$EXTERNALSYM NCBCANCEL}
366
NCBADDGRNAME = $36; // NCB ADD GROUP NAME
367
{$EXTERNALSYM NCBADDGRNAME}
368
NCBENUM = $37; // NCB ENUMERATE LANA NUMBERS
369
{$EXTERNALSYM NCBENUM}
370
NCBUNLINK = $70; // NCB UNLINK
371
{$EXTERNALSYM NCBUNLINK}
372
NCBSENDNA = $71; // NCB SEND NO ACK
373
{$EXTERNALSYM NCBSENDNA}
374
NCBCHAINSENDNA = $72; // NCB CHAIN SEND NO ACK
375
{$EXTERNALSYM NCBCHAINSENDNA}
376
NCBLANSTALERT = $73; // NCB LAN STATUS ALERT
377
{$EXTERNALSYM NCBLANSTALERT}
378
NCBACTION = $77; // NCB ACTION
379
{$EXTERNALSYM NCBACTION}
380
NCBFINDNAME = $78; // NCB FIND NAME
381
{$EXTERNALSYM NCBFINDNAME}
382
NCBTRACE = $79; // NCB TRACE
383
{$EXTERNALSYM NCBTRACE}
385
ASYNCH = $80; // high bit set == asynchronous
386
{$EXTERNALSYM ASYNCH}
392
NRC_GOODRET = $00; // good return also returned when ASYNCH request accepted
393
{$EXTERNALSYM NRC_GOODRET}
394
NRC_BUFLEN = $01; // illegal buffer length
395
{$EXTERNALSYM NRC_BUFLEN}
396
NRC_ILLCMD = $03; // illegal command
397
{$EXTERNALSYM NRC_ILLCMD}
398
NRC_CMDTMO = $05; // command timed out
399
{$EXTERNALSYM NRC_CMDTMO}
400
NRC_INCOMP = $06; // message incomplete, issue another command
401
{$EXTERNALSYM NRC_INCOMP}
402
NRC_BADDR = $07; // illegal buffer address
403
{$EXTERNALSYM NRC_BADDR}
404
NRC_SNUMOUT = $08; // session number out of range
405
{$EXTERNALSYM NRC_SNUMOUT}
406
NRC_NORES = $09; // no resource available
407
{$EXTERNALSYM NRC_NORES}
408
NRC_SCLOSED = $0a; // session closed
409
{$EXTERNALSYM NRC_SCLOSED}
410
NRC_CMDCAN = $0b; // command cancelled
411
{$EXTERNALSYM NRC_CMDCAN}
412
NRC_DUPNAME = $0d; // duplicate name
413
{$EXTERNALSYM NRC_DUPNAME}
414
NRC_NAMTFUL = $0e; // name table full
415
{$EXTERNALSYM NRC_NAMTFUL}
416
NRC_ACTSES = $0f; // no deletions, name has active sessions
417
{$EXTERNALSYM NRC_ACTSES}
418
NRC_LOCTFUL = $11; // local session table full
419
{$EXTERNALSYM NRC_LOCTFUL}
420
NRC_REMTFUL = $12; // remote session table full
421
{$EXTERNALSYM NRC_REMTFUL}
422
NRC_ILLNN = $13; // illegal name number
423
{$EXTERNALSYM NRC_ILLNN}
424
NRC_NOCALL = $14; // no callname
425
{$EXTERNALSYM NRC_NOCALL}
426
NRC_NOWILD = $15; // cannot put * in NCB_NAME
427
{$EXTERNALSYM NRC_NOWILD}
428
NRC_INUSE = $16; // name in use on remote adapter
429
{$EXTERNALSYM NRC_INUSE}
430
NRC_NAMERR = $17; // name deleted
431
{$EXTERNALSYM NRC_NAMERR}
432
NRC_SABORT = $18; // session ended abnormally
433
{$EXTERNALSYM NRC_SABORT}
434
NRC_NAMCONF = $19; // name conflict detected
435
{$EXTERNALSYM NRC_NAMCONF}
436
NRC_IFBUSY = $21; // interface busy, IRET before retrying
437
{$EXTERNALSYM NRC_IFBUSY}
438
NRC_TOOMANY = $22; // too many commands outstanding, retry later
439
{$EXTERNALSYM NRC_TOOMANY}
440
NRC_BRIDGE = $23; // ncb_lana_num field invalid
441
{$EXTERNALSYM NRC_BRIDGE}
442
NRC_CANOCCR = $24; // command completed while cancel occurring
443
{$EXTERNALSYM NRC_CANOCCR}
444
NRC_CANCEL = $26; // command not valid to cancel
445
{$EXTERNALSYM NRC_CANCEL}
446
NRC_DUPENV = $30; // name defined by anther local process
447
{$EXTERNALSYM NRC_DUPENV}
448
NRC_ENVNOTDEF = $34; // environment undefined. RESET required
449
{$EXTERNALSYM NRC_ENVNOTDEF}
450
NRC_OSRESNOTAV = $35; // required OS resources exhausted
451
{$EXTERNALSYM NRC_OSRESNOTAV}
452
NRC_MAXAPPS = $36; // max number of applications exceeded
453
{$EXTERNALSYM NRC_MAXAPPS}
454
NRC_NOSAPS = $37; // no saps available for netbios
455
{$EXTERNALSYM NRC_NOSAPS}
456
NRC_NORESOURCES = $38; // requested resources are not available
457
{$EXTERNALSYM NRC_NORESOURCES}
458
NRC_INVADDRESS = $39; // invalid ncb address or length > segment
459
{$EXTERNALSYM NRC_INVADDRESS}
460
NRC_INVDDID = $3B; // invalid NCB DDID
461
{$EXTERNALSYM NRC_INVDDID}
462
NRC_LOCKFAIL = $3C; // lock of user area failed
463
{$EXTERNALSYM NRC_LOCKFAIL}
464
NRC_OPENERR = $3f; // NETBIOS not loaded
465
{$EXTERNALSYM NRC_OPENERR}
466
NRC_SYSTEM = $40; // system error
467
{$EXTERNALSYM NRC_SYSTEM}
469
NRC_PENDING = $ff; // asynchronous command is not yet finished
470
{$EXTERNALSYM NRC_PENDING}
472
(****************************************************************
474
* main user entry point for NetBIOS 3.0 *
476
* Usage: result = Netbios( pncb ); *
477
****************************************************************)
479
function Netbios(pncb: PNCB): UCHAR; stdcall;
480
{$EXTERNALSYM Netbios}
482
(****************************************************************
484
* Prefix for callback routines *
486
* Usage in a declaration: NCB_POST MyPostRoutine( PNCB pncb ); *
487
****************************************************************)
489
// #define NCB_POST void CALLBACK
493
{$IFDEF DYNAMIC_LINK}
500
GetProcedureAddress(_Netbios, 'netapi32.dll', 'Netbios');
510
function Netbios; external 'netapi32.dll' name 'Netbios';
512
{$ENDIF DYNAMIC_LINK}