mov bl, DevCode ;device code
mov cx, UserVal ;user value
mov si, seg LocalBuffer
mov ds, si
mov si, offset LocalBuffer ;ds:si points to buffer for local name
mov di, seg NetBuffer
mov es, di
mov di, offset NetBuffer ;es:di points to buffer for network name
mov ax, 5F03h ;Make Network Connection
int 21h
jc error_handler ;carry set means error
Make Network Connection (Function 5F03h) creates a connection to a network device or drive, or redirects a local device or drive if a local name is specified.
DevCode
Specifies the local-device code (03h = printer, 04h = disk drive).
UserVal
Specifies a user value to be saved and returned to a program that calls Get Assign-List Entry (Function 5F02h).
LocalBuffer
Points to a zero-terminated ASCII string that specifies the local device to redirect.
If the DevCode parameter is 03h, the local device is a printer and the device the LocalBuffer parameter points to must be PRN, LPT1, LPT2, or LPT3.
If DevCode is 04h, the local device is a disk drive and LocalBuffer must specify either a drive letter followed by a colon or a null string (a string whose first character is zero). If LocalBuffer specifies a drive letter, MS-DOS redirects the drive to the network device. If LocalBuffer is a null string, MS-DOS attempts to provide access to the network device without redirecting a local disk drive.
NetBuffer
Points to two consecutive zero-terminated ASCII strings that specify the network name and the password for the network drive or device. If the network device has no password, the second string must be a null string. For information about network drives, see Chapter 3, “File Systems.”
If the function is successful, the carry flag is clear. Otherwise, the carry flag is set and the AX register contains an error value, which may be one of the following:
Value | Name |
0001h | ERROR_INVALID_FUNCTION |
0003h | ERROR_PATH_NOT_FOUND |
0005h | ERROR_ACCESS_DENIED |
0008h | ERROR_NOT_ENOUGH_MEMORY |
000Fh | ERROR_INVALID_DRIVE |
0012h | ERROR_NO_MORE_FILES |
0057h | ERROR_INVALID_PARAMETER |
This function returns 0001h (ERROR_INVALID_FUNCTION) if the network is not running.
If the function returns 0005h (ERROR_ACCESS_DENIED), it may mean either that the password is not valid or that the specified device or drive could not be found on the server.
Function 5F02h Get Assign-List Entry
Function 5F04h Delete Network Connection
Interrupt 2Fh Function 1100h Get Network Installed State