16.1.2 The Netbios Function

The Windows Netbios function is provided primarily for applications that were written for the IBM Netbios system and need to be ported to Windows. Applications that do not have this requirement typically use other interfaces, such as mailslots and named pipes, instead of Netbios.

The Windows Netbios function has one parameter: a pointer to a network-control block (NCB) structure. This structure contains information about the network environment and a pointer to a buffer that is used for messages or for further data about the network. When an application requests information about the LAN adapter, this buffer contains an ADAPTER_STATUS structure, followed by as many NAME_BUFFER structures as are required. When an application requests information about a session, the buffer contains a SESSION_HEADER structure, followed by one or more SESSION_BUFFER structures. When an application requests the numbers of the available LAN adapters, the buffer contains a LANA_ENUM structure.

16.1.2.1 Windows NetBios Enhancements

The Windows implementation of the Netbios function includes several enhancements that are not part of the IBM Netbios 3.0 specification:

POST routines can be called from the C language, by using the ncb_post member of the NCB structure.

Each asynchronous NCB can supply an event (in the ncb_event member of the NCB structure) that is set to the signalled state when the NCB completes.

An application can enumerate all available LAN adapters by using the NCBENUM command in the ncb_command member of the NCB structure.

16.1.2.2 Differences Between Windows and IBM Netbios

There are a few other differences between the Windows Netbios implementation and the IBM Netbios 3.0 specification, in addition to the enhancements listed in Section 0.1.2.1, “Windows NetBios Enhancements”:

The number of outstanding NCB commands specified is not policed when the NCBRESET command is issued. NT memory quota limits are used to limit the total resources an application can use.

If a buffer fails to lock into memory, the NRC_BUFLEN return code is generated.

Asynchronous commands on invalid sessions are rejected when they are submitted.

The numbers of the network names (the ncb_num member of the NCB structure) are assigned on a per-process basis.

Requests for the status of the local adapter retrieve only the names that were added (and which are therefore accessible) by the process making the request.

The value 1 for the ncb_lana_num member of the NCB structure is not exclusive when the NCBRESET command is issued. All MS-DOS and 16-bit Windows applications also share access to name number 1.