~ubuntu-branches/ubuntu/feisty/fpc/feisty

« back to all changes in this revision

Viewing changes to packages/extra/winunits/jwanb30.pas

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2007-01-27 20:08:50 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070127200850-9mrptaqqjsx9nwa7
Tags: 2.0.4-5
* Fixed Build-Depends.
* Add myself to Uploaders in debian/control.
* Make sure that the sources are really patched before building them.
* Build unit 'libc' on powerpc too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
{******************************************************************************}
2
 
{                                                                              }
3
 
{ Portable Netbios 3.0 API interface Unit for Object Pascal                    }
4
 
{                                                                              }
5
 
{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
6
 
{ Corporation. All Rights Reserved.                                            }
7
 
{                                                                              }
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).               }
11
 
{                                                                              }
12
 
{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
13
 
{ Marcel van Brakel. All Rights Reserved.                                      }
14
 
{                                                                              }
15
 
{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
16
 
{                                                                              }
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              }
19
 
{                                                                              }
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                                      }
24
 
{                                                                              }
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.    }
28
 
{                                                                              }
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.          }
38
 
{                                                                              }
39
 
{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
40
 
{                                                                              }
41
 
{******************************************************************************}
42
 
 
43
 
// $Id: jwanb30.pas,v 1.1 2005/04/04 07:56:10 marco Exp $
44
 
 
45
 
unit JwaNb30;
46
 
 
47
 
{$WEAKPACKAGEUNIT}
48
 
 
49
 
{$HPPEMIT ''}
50
 
{$HPPEMIT '#include "Nb30.h"'}
51
 
{$HPPEMIT ''}
52
 
 
53
 
{$I jediapilib.inc}
54
 
 
55
 
interface
56
 
 
57
 
uses
58
 
  JwaWinType;
59
 
 
60
 
(****************************************************************
61
 
 *                                                              *
62
 
 *              Data structure templates                        *
63
 
 *                                                              *
64
 
 ****************************************************************)
65
 
 
66
 
const
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}
71
 
 
72
 
//
73
 
// Network Control Block
74
 
//
75
 
 
76
 
type
77
 
  PNCB = ^NCB;
78
 
 
79
 
  TNcbPost = procedure(P: PNCB); stdcall;
80
 
 
81
 
  _NCB = record
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
95
 
    {$IFDEF _WIN64}
96
 
    ncb_reserve: array [0..17] of Char; // reserved, used by BIOS
97
 
    {$ELSE}
98
 
    ncb_reserve: array [0..9] of Char;  // reserved, used by BIOS
99
 
    {$ENDIF _WIN64}
100
 
    ncb_event: HANDLE;   // HANDLE to Win32 event which
101
 
                         // will be set to the signalled
102
 
                         // state when an ASYNCH command
103
 
                         // completes
104
 
  end;
105
 
  {$EXTERNALSYM _NCB}
106
 
  NCB = _NCB;
107
 
  {$EXTERNALSYM NCB}
108
 
  TNcb = NCB;
109
 
 
110
 
//
111
 
//  Structure returned to the NCB command NCBASTAT is ADAPTER_STATUS followed
112
 
//  by an array of NAME_BUFFER structures.
113
 
//
114
 
 
115
 
  _ADAPTER_STATUS = record
116
 
    adapter_address: array [0..5] of UCHAR;
117
 
    rev_major: UCHAR;
118
 
    reserved0: UCHAR;
119
 
    adapter_type: UCHAR;
120
 
    rev_minor: UCHAR;
121
 
    duration: WORD;
122
 
    frmr_recv: WORD;
123
 
    frmr_xmit: WORD;
124
 
    iframe_recv_err: WORD;
125
 
    xmit_aborts: WORD;
126
 
    xmit_success: DWORD;
127
 
    recv_success: DWORD;
128
 
    iframe_xmit_err: WORD;
129
 
    recv_buff_unavail: WORD;
130
 
    t1_timeouts: WORD;
131
 
    ti_timeouts: WORD;
132
 
    reserved1: DWORD;
133
 
    free_ncbs: WORD;
134
 
    max_cfg_ncbs: WORD;
135
 
    max_ncbs: WORD;
136
 
    xmit_buf_unavail: WORD;
137
 
    max_dgram_size: WORD;
138
 
    pending_sess: WORD;
139
 
    max_cfg_sess: WORD;
140
 
    max_sess: WORD;
141
 
    max_sess_pkt_size: WORD;
142
 
    name_count: WORD;
143
 
  end;
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;
151
 
 
152
 
  _NAME_BUFFER = record
153
 
    name: array [0..NCBNAMSZ - 1] of Char;
154
 
    name_num: UCHAR;
155
 
    name_flags: UCHAR;
156
 
  end;
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;
164
 
 
165
 
//  values for name_flags bits.
166
 
 
167
 
const
168
 
  NAME_FLAGS_MASK = $87;
169
 
  {$EXTERNALSYM NAME_FLAGS_MASK}
170
 
 
171
 
  GROUP_NAME  = $80;
172
 
  {$EXTERNALSYM GROUP_NAME}
173
 
  UNIQUE_NAME = $00;
174
 
  {$EXTERNALSYM UNIQUE_NAME}
175
 
 
176
 
  REGISTERING     = $00;
177
 
  {$EXTERNALSYM REGISTERING}
178
 
  REGISTERED      = $04;
179
 
  {$EXTERNALSYM REGISTERED}
180
 
  DEREGISTERED    = $05;
181
 
  {$EXTERNALSYM DEREGISTERED}
182
 
  DUPLICATE       = $06;
183
 
  {$EXTERNALSYM DUPLICATE}
184
 
  DUPLICATE_DEREG = $07;
185
 
  {$EXTERNALSYM DUPLICATE_DEREG}
186
 
 
187
 
//
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.
192
 
//
193
 
 
194
 
type
195
 
  _SESSION_HEADER = record
196
 
    sess_name: UCHAR;
197
 
    num_sess: UCHAR;
198
 
    rcv_dg_outstanding: UCHAR;
199
 
    rcv_any_outstanding: UCHAR;
200
 
  end;
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;
208
 
 
209
 
  _SESSION_BUFFER = record
210
 
    lsn: UCHAR;
211
 
    state: UCHAR;
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;
216
 
  end;
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;
224
 
 
225
 
//  Values for state
226
 
 
227
 
const
228
 
  LISTEN_OUTSTANDING  = $01;
229
 
  {$EXTERNALSYM LISTEN_OUTSTANDING}
230
 
  CALL_PENDING        = $02;
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}
240
 
 
241
 
//
242
 
//  Structure returned to the NCB command NCBENUM.
243
 
//
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.
246
 
//
247
 
 
248
 
type
249
 
  _LANA_ENUM = record
250
 
    length: UCHAR; // Number of valid entries in lana[]
251
 
    lana: array [0..MAX_LANA] of UCHAR;
252
 
  end;
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;
260
 
 
261
 
//
262
 
//  Structure returned to the NCB command NCBFINDNAME is FIND_NAME_HEADER followed
263
 
//  by an array of FIND_NAME_BUFFER structures.
264
 
//
265
 
 
266
 
type
267
 
  _FIND_NAME_HEADER = record
268
 
    node_count: WORD;
269
 
    reserved: UCHAR;
270
 
    unique_group: UCHAR;
271
 
  end;
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;
279
 
 
280
 
  _FIND_NAME_BUFFER = record
281
 
    length: UCHAR;
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;
287
 
  end;
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;
295
 
 
296
 
//
297
 
//  Structure provided with NCBACTION. The purpose of NCBACTION is to provide
298
 
//  transport specific extensions to netbios.
299
 
//
300
 
 
301
 
  _ACTION_HEADER = record
302
 
    transport_id: ULONG;
303
 
    action_code: USHORT;
304
 
    reserved: USHORT;
305
 
  end;
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;
313
 
 
314
 
//  Values for transport_id
315
 
 
316
 
const
317
 
  ALL_TRANSPORTS = 'M'#0#0#0;
318
 
  {$EXTERNALSYM ALL_TRANSPORTS}
319
 
  MS_NBF         = 'MNBF';
320
 
  {$EXTERNALSYM MS_NBF}
321
 
 
322
 
(****************************************************************
323
 
 *                                                              *
324
 
 *              Special values and constants                    *
325
 
 *                                                              *
326
 
 ****************************************************************)
327
 
 
328
 
//
329
 
//      NCB Command codes
330
 
//
331
 
 
332
 
const
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}
385
 
 
386
 
  ASYNCH = $80; // high bit set == asynchronous
387
 
  {$EXTERNALSYM ASYNCH}
388
 
 
389
 
//
390
 
//      NCB Return codes
391
 
//
392
 
 
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}
469
 
 
470
 
  NRC_PENDING = $ff; // asynchronous command is not yet finished
471
 
  {$EXTERNALSYM NRC_PENDING}
472
 
 
473
 
(****************************************************************
474
 
 *                                                              *
475
 
 *              main user entry point for NetBIOS 3.0           *
476
 
 *                                                              *
477
 
 * Usage: result = Netbios( pncb );                             *
478
 
 ****************************************************************)
479
 
 
480
 
function Netbios(pncb: PNCB): UCHAR; stdcall;
481
 
{$EXTERNALSYM Netbios}
482
 
 
483
 
(****************************************************************
484
 
 *                                                              *
485
 
 *              Prefix for callback routines                    *
486
 
 *                                                              *
487
 
 * Usage in a declaration: NCB_POST MyPostRoutine( PNCB pncb ); *
488
 
 ****************************************************************)
489
 
 
490
 
// #define NCB_POST void CALLBACK
491
 
 
492
 
implementation
493
 
 
494
 
{$IFDEF DYNAMIC_LINK}
495
 
 
496
 
var
497
 
  _Netbios: Pointer;
498
 
 
499
 
function Netbios;
500
 
begin
501
 
  GetProcedureAddress(_Netbios, 'netapi32.dll', 'Netbios');
502
 
  asm
503
 
        MOV     ESP, EBP
504
 
        POP     EBP
505
 
        JMP     [_Netbios]
506
 
  end;
507
 
end;
508
 
 
509
 
{$ELSE}
510
 
 
511
 
function Netbios; external 'netapi32.dll' name 'Netbios';
512
 
 
513
 
{$ENDIF DYNAMIC_LINK}
514
 
 
515
 
end.
 
1
{******************************************************************************}
 
2
{                                                                              }
 
3
{ Portable Netbios 3.0 API interface Unit for Object Pascal                    }
 
4
{                                                                              }
 
5
{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
 
6
{ Corporation. All Rights Reserved.                                            }
 
7
{                                                                              }
 
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).               }
 
11
{                                                                              }
 
12
{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
 
13
{ Marcel van Brakel. All Rights Reserved.                                      }
 
14
{                                                                              }
 
15
{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
 
16
{                                                                              }
 
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              }
 
19
{                                                                              }
 
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                                      }
 
24
{                                                                              }
 
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.    }
 
28
{                                                                              }
 
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.          }
 
38
{                                                                              }
 
39
{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
 
40
{                                                                              }
 
41
{******************************************************************************}
 
42
 
 
43
 
 
44
unit JwaNb30;
 
45
 
 
46
{$WEAKPACKAGEUNIT}
 
47
 
 
48
{$HPPEMIT ''}
 
49
{$HPPEMIT '#include "Nb30.h"'}
 
50
{$HPPEMIT ''}
 
51
 
 
52
{$I jediapilib.inc}
 
53
 
 
54
interface
 
55
 
 
56
uses
 
57
  JwaWinType;
 
58
 
 
59
(****************************************************************
 
60
 *                                                              *
 
61
 *              Data structure templates                        *
 
62
 *                                                              *
 
63
 ****************************************************************)
 
64
 
 
65
const
 
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}
 
70
 
 
71
//
 
72
// Network Control Block
 
73
//
 
74
 
 
75
type
 
76
  PNCB = ^NCB;
 
77
 
 
78
  TNcbPost = procedure(P: PNCB); stdcall;
 
79
 
 
80
  _NCB = record
 
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
 
94
    {$IFDEF _WIN64}
 
95
    ncb_reserve: array [0..17] of Char; // reserved, used by BIOS
 
96
    {$ELSE}
 
97
    ncb_reserve: array [0..9] of Char;  // reserved, used by BIOS
 
98
    {$ENDIF _WIN64}
 
99
    ncb_event: HANDLE;   // HANDLE to Win32 event which
 
100
                         // will be set to the signalled
 
101
                         // state when an ASYNCH command
 
102
                         // completes
 
103
  end;
 
104
  {$EXTERNALSYM _NCB}
 
105
  NCB = _NCB;
 
106
  {$EXTERNALSYM NCB}
 
107
  TNcb = NCB;
 
108
 
 
109
//
 
110
//  Structure returned to the NCB command NCBASTAT is ADAPTER_STATUS followed
 
111
//  by an array of NAME_BUFFER structures.
 
112
//
 
113
 
 
114
  _ADAPTER_STATUS = record
 
115
    adapter_address: array [0..5] of UCHAR;
 
116
    rev_major: UCHAR;
 
117
    reserved0: UCHAR;
 
118
    adapter_type: UCHAR;
 
119
    rev_minor: UCHAR;
 
120
    duration: WORD;
 
121
    frmr_recv: WORD;
 
122
    frmr_xmit: WORD;
 
123
    iframe_recv_err: WORD;
 
124
    xmit_aborts: WORD;
 
125
    xmit_success: DWORD;
 
126
    recv_success: DWORD;
 
127
    iframe_xmit_err: WORD;
 
128
    recv_buff_unavail: WORD;
 
129
    t1_timeouts: WORD;
 
130
    ti_timeouts: WORD;
 
131
    reserved1: DWORD;
 
132
    free_ncbs: WORD;
 
133
    max_cfg_ncbs: WORD;
 
134
    max_ncbs: WORD;
 
135
    xmit_buf_unavail: WORD;
 
136
    max_dgram_size: WORD;
 
137
    pending_sess: WORD;
 
138
    max_cfg_sess: WORD;
 
139
    max_sess: WORD;
 
140
    max_sess_pkt_size: WORD;
 
141
    name_count: WORD;
 
142
  end;
 
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;
 
150
 
 
151
  _NAME_BUFFER = record
 
152
    name: array [0..NCBNAMSZ - 1] of Char;
 
153
    name_num: UCHAR;
 
154
    name_flags: UCHAR;
 
155
  end;
 
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;
 
163
 
 
164
//  values for name_flags bits.
 
165
 
 
166
const
 
167
  NAME_FLAGS_MASK = $87;
 
168
  {$EXTERNALSYM NAME_FLAGS_MASK}
 
169
 
 
170
  GROUP_NAME  = $80;
 
171
  {$EXTERNALSYM GROUP_NAME}
 
172
  UNIQUE_NAME = $00;
 
173
  {$EXTERNALSYM UNIQUE_NAME}
 
174
 
 
175
  REGISTERING     = $00;
 
176
  {$EXTERNALSYM REGISTERING}
 
177
  REGISTERED      = $04;
 
178
  {$EXTERNALSYM REGISTERED}
 
179
  DEREGISTERED    = $05;
 
180
  {$EXTERNALSYM DEREGISTERED}
 
181
  DUPLICATE       = $06;
 
182
  {$EXTERNALSYM DUPLICATE}
 
183
  DUPLICATE_DEREG = $07;
 
184
  {$EXTERNALSYM DUPLICATE_DEREG}
 
185
 
 
186
//
 
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.
 
191
//
 
192
 
 
193
type
 
194
  _SESSION_HEADER = record
 
195
    sess_name: UCHAR;
 
196
    num_sess: UCHAR;
 
197
    rcv_dg_outstanding: UCHAR;
 
198
    rcv_any_outstanding: UCHAR;
 
199
  end;
 
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;
 
207
 
 
208
  _SESSION_BUFFER = record
 
209
    lsn: UCHAR;
 
210
    state: UCHAR;
 
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;
 
215
  end;
 
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;
 
223
 
 
224
//  Values for state
 
225
 
 
226
const
 
227
  LISTEN_OUTSTANDING  = $01;
 
228
  {$EXTERNALSYM LISTEN_OUTSTANDING}
 
229
  CALL_PENDING        = $02;
 
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}
 
239
 
 
240
//
 
241
//  Structure returned to the NCB command NCBENUM.
 
242
//
 
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.
 
245
//
 
246
 
 
247
type
 
248
  _LANA_ENUM = record
 
249
    length: UCHAR; // Number of valid entries in lana[]
 
250
    lana: array [0..MAX_LANA] of UCHAR;
 
251
  end;
 
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;
 
259
 
 
260
//
 
261
//  Structure returned to the NCB command NCBFINDNAME is FIND_NAME_HEADER followed
 
262
//  by an array of FIND_NAME_BUFFER structures.
 
263
//
 
264
 
 
265
type
 
266
  _FIND_NAME_HEADER = record
 
267
    node_count: WORD;
 
268
    reserved: UCHAR;
 
269
    unique_group: UCHAR;
 
270
  end;
 
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;
 
278
 
 
279
  _FIND_NAME_BUFFER = record
 
280
    length: UCHAR;
 
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;
 
286
  end;
 
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;
 
294
 
 
295
//
 
296
//  Structure provided with NCBACTION. The purpose of NCBACTION is to provide
 
297
//  transport specific extensions to netbios.
 
298
//
 
299
 
 
300
  _ACTION_HEADER = record
 
301
    transport_id: ULONG;
 
302
    action_code: USHORT;
 
303
    reserved: USHORT;
 
304
  end;
 
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;
 
312
 
 
313
//  Values for transport_id
 
314
 
 
315
const
 
316
  ALL_TRANSPORTS = 'M'#0#0#0;
 
317
  {$EXTERNALSYM ALL_TRANSPORTS}
 
318
  MS_NBF         = 'MNBF';
 
319
  {$EXTERNALSYM MS_NBF}
 
320
 
 
321
(****************************************************************
 
322
 *                                                              *
 
323
 *              Special values and constants                    *
 
324
 *                                                              *
 
325
 ****************************************************************)
 
326
 
 
327
//
 
328
//      NCB Command codes
 
329
//
 
330
 
 
331
const
 
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}
 
384
 
 
385
  ASYNCH = $80; // high bit set == asynchronous
 
386
  {$EXTERNALSYM ASYNCH}
 
387
 
 
388
//
 
389
//      NCB Return codes
 
390
//
 
391
 
 
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}
 
468
 
 
469
  NRC_PENDING = $ff; // asynchronous command is not yet finished
 
470
  {$EXTERNALSYM NRC_PENDING}
 
471
 
 
472
(****************************************************************
 
473
 *                                                              *
 
474
 *              main user entry point for NetBIOS 3.0           *
 
475
 *                                                              *
 
476
 * Usage: result = Netbios( pncb );                             *
 
477
 ****************************************************************)
 
478
 
 
479
function Netbios(pncb: PNCB): UCHAR; stdcall;
 
480
{$EXTERNALSYM Netbios}
 
481
 
 
482
(****************************************************************
 
483
 *                                                              *
 
484
 *              Prefix for callback routines                    *
 
485
 *                                                              *
 
486
 * Usage in a declaration: NCB_POST MyPostRoutine( PNCB pncb ); *
 
487
 ****************************************************************)
 
488
 
 
489
// #define NCB_POST void CALLBACK
 
490
 
 
491
implementation
 
492
 
 
493
{$IFDEF DYNAMIC_LINK}
 
494
 
 
495
var
 
496
  _Netbios: Pointer;
 
497
 
 
498
function Netbios;
 
499
begin
 
500
  GetProcedureAddress(_Netbios, 'netapi32.dll', 'Netbios');
 
501
  asm
 
502
        MOV     ESP, EBP
 
503
        POP     EBP
 
504
        JMP     [_Netbios]
 
505
  end;
 
506
end;
 
507
 
 
508
{$ELSE}
 
509
 
 
510
function Netbios; external 'netapi32.dll' name 'Netbios';
 
511
 
 
512
{$ENDIF DYNAMIC_LINK}
 
513
 
 
514
end.