NetBIOS Commands

A NetBIOS application issues commands to an underlying transport driver using the Netbios function. You provide information in the NCB structure. The appropriate transport driver receives the information, performs the command, and reports status by filling in selected NCB members.

When a command is issued synchronously, Netbios does not return until the protocol driver completes the command. Both the ncb_retcode and ncb_cmd_cplt members contain the return value.

When a command is issued asynchronously, Netbios does not return until the protocol driver checks the command syntax, cehcks whether the session is valid, and checks whether there are sufficient available resources. Both the ncb_retcode and ncb_cmd_cplt members contain the return value. The return value is an error code if the command was not successfully queued. A return value of NRC_PENDING indicates that the protocol driver has successfully queued the command. When the protocol driver completes the command, it places the final return value in both the ncb_retcode and ncb_cmd_cplt members. If the ncb_post member specifies a post routine, the protocol driver calls the post routine.

Post routines are called in the context of the calling process. The post routine in a Win32-based application typically posts a message to an appropriate window and then exits. The thread that receives the message uses it as an indication that the asynchronous command has been completed. The system creates an event and a worker thread for each command that uses a post routine. As a result, it is faster to use the ncb_event member instead of a post routine for asynchronous commands.

The NetBIOS commands can be divided into the following categories: