⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vbnetbios.bas

📁 功能强大的API
💻 BAS
📖 第 1 页 / 共 2 页
字号:
Attribute VB_Name = "vbNetBios"
Option Explicit

' This section contains the definitions
' for portable NetBIOS 3.0 support.

Public Const NCBNAMSZ = 16  '  absolute length of a net name
Public Const MAX_LANA = 254  '  lana's in range 0 to MAX_LANA

' NCB Command Codes (NetBios 3.0)

Public Const NCBCALL = &H10         ' Call
Public Const NCBLISTEN = &H11       ' Listen
Public Const NCBHANGUP = &H12       ' HangUp
Public Const NCBSEND = &H14         ' Send
Public Const NCBRECV = &H15         ' Receive
Public Const NCBRECVANY = &H16      ' Receive Any
Public Const NCBCHAINSEND = &H17    ' Chain Send
Public Const NCBDGSEND = &H20       ' Send Datagram
Public Const NCBDGRECV = &H21       ' Receive Datagram
Public Const NCBDGSENDBC = &H22     ' Send Broadcast Datagram
Public Const NCBDGRECVBC = &H23     ' Receive Broadcase Datagram
Public Const NCBADDNAME = &H30      ' Add Name
Public Const NCBDELNAME = &H31      ' Delete Name
Public Const NCBRESET = &H32        ' Reset
Public Const NCBASTAT = &H33        ' Adapter Status
Public Const NCBSSTAT = &H34        ' Session Status
Public Const NCBCANCEL = &H35       ' Cancel
Public Const NCBADDGRNAME = &H36    ' Add Group Name
Public Const NCBENUM = &H37         ' Enumerate Lana Numbers
Public Const NCBUNLINK = &H70       ' Unlink
Public Const NCBSENDNA = &H71       ' Send No Ack
Public Const NCBCHAINSENDNA = &H72  ' Chain Send No Ack
Public Const NCBLANSTALERT = &H73   ' LAN Status Alert
Public Const NCBACTION = &H77       ' Action
Public Const NCBFINDNAME = &H78     ' Find Name
Public Const NCBTRACE = &H79        ' Trace
Public Const ASYNCH = &H80          ' High bit set = Asynchronous

' NCB Return Codes

Public Const NRC_GOODRET = &H0      ' Good return (also returned when
                                    ' ASYNCH request accepted)
Public Const NRC_BUFLEN = &H1       ' Illegal Buffer Length
Public Const NRC_ILLCMD = &H3       ' Illegal Command
Public Const NRC_CMDTMO = &H5       ' Command Timed Out
Public Const NRC_INCOMP = &H6       ' Message Incomplete, Issue Another
                                    ' Command
Public Const NRC_BADDR = &H7        ' Illegal Buffer Address
Public Const NRC_SNUMOUT = &H8      ' Session Number is Out Of Range
Public Const NRC_NORES = &H9        ' No Resource Available
Public Const NRC_SCLOSED = &HA      ' Session Closed
Public Const NRC_CMDCAN = &HB       ' Command Cancelled
Public Const NRC_DUPNAME = &HD      ' Duplicate Name
Public Const NRC_NAMTFUL = &HE      ' Name Table Full
Public Const NRC_ACTSES = &HF       ' No Deletions, Name has Active
                                    ' Sessions
Public Const NRC_LOCTFUL = &H11     ' Local Session Table Full
Public Const NRC_REMTFUL = &H12     ' Remote Session Table Full
Public Const NRC_ILLNN = &H13       ' Illegal Name Number
Public Const NRC_NOCALL = &H14      ' No Call Name
Public Const NRC_NOWILD = &H15      ' Cannot Put in NCB_NAME
Public Const NRC_INUSE = &H16       ' Name in Use on Remote Adapter
Public Const NRC_NAMERR = &H17      ' Name Deleted
Public Const NRC_SABORT = &H18      ' Session Ended Abnormally
Public Const NRC_NAMCONF = &H19     ' Name Conflict Detected
Public Const NRC_IFBUSY = &H21      ' Interface Busy, IRET before
                                    ' Retrying
Public Const NRC_TOOMANY = &H22     ' Too Many Commands outstanding,
                                    ' Retry later
Public Const NRC_BRIDGE = &H23      ' ncb_lana_num field invalid
Public Const NRC_CANOCCR = &H24     ' Command Completed While Cancel
                                    ' Occurring
Public Const NRC_CANCEL = &H26      ' Command Not Valid to Cancel
Public Const NRC_DUPENV = &H30      ' Name Defined By Another Local
                                    ' Process
Public Const NRC_ENVNOTDEF = &H34   ' Envirnment Undefined. RESET
                                    ' Required
Public Const NRC_OSRESNOTAV = &H35  ' Required OS Resources Exhausted
Public Const NRC_MAXAPPS = &H36     ' Max Number of Applications
                                    ' Exceeded
Public Const NRC_NOSAPS = &H37      ' No Saps Available for NetBIOS
Public Const NRC_NORESOURCES = &H38 ' Requested Resources are Not
                                    ' Available
Public Const NRC_INVADDRESS = &H39  ' Invalid NCB Address, or
                                    ' Length > Segment
Public Const NRC_INVDDID = &H3B     ' Invalid NCB DDID
Public Const NRC_LOCKFAIL = &H3C    ' Lock of User Area Failed
Public Const NRC_OPENERR = &H3F     ' NetBIOS Not Loaded
Public Const NRC_SYSTEM = &H40      ' System Error
Public Const NRC_PENDING = &HFF     ' Asynchronous Command is Not Yet
                                    ' Fulfilled

' State Values

Public Const LISTEN_OUTSTANDING = &H1
Public Const CALL_PENDING = &H2
Public Const SESSION_ESTABLISHED = &H3
Public Const HANGUP_PENDING = &H4
Public Const HANGUP_COMPLETE = &H5
Public Const SESSION_ABORTED = &H6

' NCB User Defined Types (structures)

Type SESSION_HEADER
    sess_name As Byte
    num_sess As Byte
    rcv_dg_outstanding As Byte
    rcv_any_outstanding As Byte
End Type

' The structure returned to the NCB Command NCBSTAT is SESSION_HEADER
' followed by an array of SESSION_BUFFER structures.  If the NCB_NAME
' starts with an asterisk, then an array of these structures is returned
' containing the status for all names.

Public SESSION_HEADER As SESSION_HEADER
Public PSESSION_HEADER As SESSION_HEADER

Type SESSION_BUFFER
    lsn As Byte
    state As Byte
    local_name As String * NCBNAMSZ
    remote_name As String * NCBNAMSZ
    rcvs_outstanding As Byte
    sends_outstanding As Byte
End Type

' Structure returned to the NCB command NCBFINDNAME is
' FIND_NAME_HEADER, followed by an array of FIND_NAME_BUFFER
' structures.

Public SESSION_BUFFER As SESSION_BUFFER
Public PSESSION_BUFFER As SESSION_BUFFER

Type FIND_NAME_HEADER
    node_count As Long
    reserved As Byte
    unique_group As Byte
End Type

Public FIND_NAME_HEADER As FIND_NAME_HEADER
Public PFIND_NAME_HEADER As FIND_NAME_HEADER

Type FIND_NAME_BUFFER
    length As Byte
    access_control As Byte
    frame_control As Byte
    destination_addr(0 To 5) As Byte
    source_addr(0 To 5) As Byte
    routing_info(0 To 17) As Byte
End Type

Public FIND_NAME_BUFFER As FIND_NAME_BUFFER
Public PFIND_NAME_BUFFER As FIND_NAME_BUFFER

Type ACTION_HEADER
    transport_id As Long    ' ULONG
    action_code As Integer  ' USHORT
    reserved As Integer     ' USHORT
End Type

' Structures provided with NCBACTION.  The purpose of NCBACTION is
' to provide transport specific extensions to NetBIOS.

Public ACTION_HEADER As ACTION_HEADER
Public PACTION_HEADER As ACTION_HEADER

' Values for trasport_id in Type ACTION_HEADER

Public Const ALL_TRANSPORTS = "M\0\0\0"
Public Const MS_NBF = "MNBF"

Type NCB
    ncb_command As Byte                         '  1-byte   UCHAR
    ncb_retcode As Byte                         '  1-byte   UCHAR
    ncb_lsn As Byte                             '  1-byte   UCHAR
    ncb_num As Byte                             '  1-byte   UCHAR
    ncb_buffer As Long                          '  4-bytes  PUCHAR
    ncb_length As Integer                       '  2-bytes  WORD
    ncb_callname As String * NCBNAMSZ           ' 16-bytes
    ncb_name As String * NCBNAMSZ               ' 16-bytes
    ncb_rto As Byte                             '  1-byte
    ncb_sto As Byte                             '  1-byte
    ncb_post As Long                            '  4-bytes
    ncb_lana_num As Byte                        '  1-byte
    ncb_cmd_cplt As Byte                        '  1-byte
    ncb_reserve(0 To 9) As Byte                 ' 10-bytes  Reserved for BIOS, must be 0
    ncb_event As Long                           '  4-bytes
End Type                                        ' 64-bytes

Public NCB As NCB
Public PNCB As NCB

Type ADAPTER_STATUS
    adapter_address(0 To 5) As Byte             '  6-bytes UCHAR Array
    rev_major As Byte                           '  1
    reserved0 As Byte                           '  1
    adapter_type As Byte                        '  1
    rev_minor As Byte                           '  1
    duration As Integer                         '  2
    frmr_recv As Integer                        '  2
    frmr_xmit As Integer                        '  2
    iframe_recv_err As Integer                  '  2
    xmit_aborts As Integer                      '  2
    xmit_success As Long                        '  4
    recv_success As Long                        '  4
    iframe_xmit_err As Integer                  '  2
    recv_buff_unavail As Integer                '  2
    t1_timeouts As Integer                      '  2
    ti_timeouts As Integer                      '  2
    Reserved1 As Long                           '  4
    free_ncbs As Integer                        '  2
    max_cfg_ncbs As Integer                     '  2
    max_ncbs As Integer                         '  2
    xmit_buf_unavail As Integer                 '  2
    max_dgram_size As Integer                   '  2
    pending_sess As Integer                     '  2
    max_cfg_sess As Integer                     '  2
    max_sess As Integer                         '  2
    max_sess_pkt_size As Integer                '  2
    name_count As Integer                       '  2
End Type                                        ' 60-bytes total

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -