mov bx, Handle ;handle of file or device
mov ax, 440Ah ;Is File or Device Remote
int 21h
jc error_handler ;carry set means error
test dx, 8000h ;bit 15 set means device is remote
jnz remote_device
Is File or Device Remote (Function 440Ah) determines whether the specified handle refers to a file or device that is local (on the computer running the program) or remote (on a network server).
Handle
Specifies the file or device to check.
If the function is successful, the carry flag is clear and the DX register contains the device-attribute value. 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 |
0006h | ERROR_INVALID_HANDLE |
Bit 15 of the device-attribute value indicates whether the file or device is local (bit is clear) or remote (bit is set).
Other bits in the DX register contain additional information about the file or device. In particular, bit 7 in the DX register specifies whether the handle identifies a file or a device. If bit 7 is 0, the handle identifies a file, and the other bits in the DX register have the following meaning:
Bit | Meaning |
0–5 | Drive number (0 = A, 1 = B, 2 = C, etc.) |
6 | 1 = File has not been written to |
12 | 1 = No inherit |
14 | 1 = Date/time not set at close |
15 | 1 = Remote file, 0 = local file |
All other bits are zero.
If bit 7 is 1, the handle identifies a device, and the other bits in the DX register have the following meaning:
Bit | Meaning |
0 | 1 = Console input device |
1 | 1 = Console output device |
2 | 1 = Null device |
3 | 1 = Clock device |
4 | 1 = Special device |
5 | 1 = Binary mode, 0 = ASCII mode |
6 | 0 = End of file returned if device is read |
11 | 1 = Network spooler |
12 | 1 = No inherit |
13 | 1 = Pipe (reserved) |
15 | 1 = Remote device, 0 = local device |
All other bits are zero.