mov dx, seg NetworkName
mov ds, dx
mov dx, offset NetworkName ;ds:dx points to buffer for network name
mov ax, 5E00h ;Get Machine Name
int 21h
jc error_handler ;carry set means error
cmp ch, 0 ;zero means name not valid
jz error_handler
mov NetNum, cl ;NETBIOS number
Get Machine Name (Function 5E00h) returns the network name of the local computer (machine).
NetworkName
Points to a 16-byte buffer to receive the zero-terminated ASCII network name. For information about network drives, see Chapter 3, “File Systems.”
If the function is successful, the carry flag is clear, the 16-byte buffer is filled in with the zero-terminated ASCII network name, and the CX register contains the local computer's identification number. Otherwise, the carry flag is set and the AX register contains an error value, which may be 0001h (ERROR_INVALID_FUNCTION).
This function returns 0001h (ERROR_INVALID_FUNCTION) if the network is not running. If the network was never installed, the function returns zero in the CH register.
The local computer's identification number is returned in the following format:
Register | Description |
CH | Specifies whether the network name is valid (CH contains a value other than zero) or not valid (CH contains zero). |
CL | Specifies the NETBIOS number assigned to the local computer. |
Function 5F03h Make Network Connection
Interrupt 2Fh Function 1100h Get Network Installed State