NetBiosOpen or NetBios32Open
NetBiosOpen or NetBios32Open
The NetBiosOpen API opens a handle to a particular network device driver.
Restrictions
A call to this API must be issued locally. This API can be called only from
an OS/2 workstation.
Before an application can open a device driver, the LAN Server redirector
software must be running.
A device driver's handle cannot be inherited by child processes. Only the
process creating a device driver can pass the handle to another function.
Syntax
#include <netcons.h>
#include <ncb.h>
#include <netbios.h>
NetBiosOpen(devname, reserved,
openopt, handle); /* 16 bit */
NetBios32Open(devname, reserved,
openopt, handle); /* 32 bit */
Parameters
devname
(unsigned char LSFAR *) points to
an ASCIIZ string containing the name of the network, such as net1.
reserved
(unsigned
char LSFAR *) is a reserved null pointer.
openopt
(16-bit unsigned short or 32-bit unsigned long)
is defined in NETBIOS.H and specifies the access mode, which controls whether
the opening process has exclusive or restricted access for the device driver,
as follows: ┌──────────────┬───────┬───────────────────────────────────────────────────────┐
│ ACCESS MODE │ VALUE │ MEANING │
├──────────────┼───────┼───────────────────────────────────────────────────────┤
│ NB_REGULAR │ 1 │ Any number of processes can open the device driver.
│
│ │ │ Does not allow reset or use of permanent names in any │
│ │ │ NCB, nor does it receive broadcast datagrams or any- │
│ │ │ to-any NCBs. │
├──────────────┼───────┼───────────────────────────────────────────────────────┤
│ NB_PRIVILEGED│ 2 │ Only one process can open the device driver. Other
│
│ │ │ processes can open the driver if they use regular │
│ │ │ mode. Does not allow reset or receive any-to-any │
│ │ │ NCBs. NetBiosOpen fails if any other process has the │
│ │ │ device driver open in privileged or exclusive mode. │
├──────────────┼───────┼───────────────────────────────────────────────────────┤
│ NB_EXCLUSIVE │ 3 │ Only one process can open the device driver. Any
NCB │
│ │ │ operation is allowed. NetBiosOpen fails if any other │
│ │ │ process has an open handle to the device driver. │
└──────────────┴───────┴───────────────────────────────────────────────────────┘
handle
(16-bit
unsigned short LSFAR * or 32-bit unsigned long LSFAR *) points to the device
driver's returned handle.
Return Codes
The following table lists the return codes most significant to this API.
(See API Return Codes for a complete
list of return codes.) ┌─────────────────────────────┬───────┬────────────────────────────────────────┐│SYMBOLICCONSTANT
│VALUE│MEANING │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ NERR_Success │ 0 │ No errors were encountered. │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ ERROR_FILE_NOT_FOUND │ 2 │ The file was not found. │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ ERROR_ACCESS_DENIED │ 5 │ Administrator privilege is required. │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ ERROR_INVALID_PARAMETER │ 87 │ At least one parameter value is not
│
│ │ │ valid. │
└─────────────────────────────┴───────┴────────────────────────────────────────┘
[Back: NetBiosGetInfo or NetBios32GetInfo]
[Next: NetBiosSubmit or NetBios32Submit]