The Netbios function interprets and executes the specified network control block (NCB).
The Netbios function is provided primarily for applications that were written for the NetBIOS interface and need to be ported to Windows. Applications not requiring compatibility with NetBIOS should use other interfaces, such as mailslots, named pipes, RPC, or distributed COM to accomplish tasks similar to those supported by NetBIOS. These other interfaces are more flexible and portable.
UCHAR Netbios(
PNCB pncb |
// pointer to the network control block |
); |
For synchronous requests, the return value is the return code of the NCB structure. That value is also returned in the ncb_retcode member of the NCB structure.
For asynchronous requests, there are the following possibilities:
If the address specified by the pncb parameter is invalid, the return value is NRC_BADNCB.
If the buffer length specified in the ncb_length member of the NCB structure is incorrect, or if the buffer specified by the ncb_buffer member is protected from write operations, the return value is NRC_BUFLEN.
When an asynchronous network control block finishes and the ncb_post member is nonzero, the routine specified in ncb_post is called with a single parameter of type PNCB. This parameter contains a pointer to the network control block.
The NCB structure also contains a handle of an event (the ncb_event member). The system sets the event to the nonsignaled state when an asynchronous NetBIOS command is accepted, and sets the event to the signaled state when the asynchronous NetBIOS command is completed. Only manual reset events should be used for synchronization. A specified event should not be associated with more than one active asynchronous NetBIOS command.
Using ncb_event to submit asynchronous requests requires fewer system resources than using ncb_post. Also, when ncb_event is nonzero, the pending request is canceled if the thread terminates before the request is processed. This is not true for requests sent by using ncb_post.
Win32s: This function does not support features that conflict with the non-preemptive, shared-memory design of Windows 3.1. Because the system does not implement events, this function ignores the ncb_event member of the NCB structure. Also, the system maintains one system-wide name table rather the a per-process name table.