1 |
/*
|
1 |
/*
|
2 |
* translates a DOS extended error into a human string
|
2 |
* translates a DOS extended error into a human string
|
3 |
* (as defined by INT 21/AH=59h/BX=0000h)
|
3 |
* (as defined by INT 21/AH=59h/BX=0000h)
|
4 |
*/
|
4 |
*/
|
5 |
|
5 |
|
6 |
#include <stdio.h>
|
6 |
#include <stdio.h>
|
7 |
|
7 |
|
8 |
#include "doserr.h"
|
8 |
#include "doserr.h"
|
9 |
|
9 |
|
10 |
const char *doserr(unsigned short err) {
|
10 |
const char *doserr(unsigned short err) {
|
11 |
static char buf[24];
|
11 |
static char buf[24];
|
12 |
switch (err) {
|
12 |
switch (err) {
|
13 |
case 0x00: return("Success");
|
13 |
case 0x00: return("Success");
|
14 |
case 0x01: return("Function number invalid");
|
14 |
case 0x01: return("Function number invalid");
|
15 |
case 0x02: return("File not found");
|
15 |
case 0x02: return("File not found");
|
16 |
case 0x03: return("Path not found");
|
16 |
case 0x03: return("Path not found");
|
17 |
case 0x04: return("Too many open files (no handles available)");
|
17 |
case 0x04: return("Too many open files (no handles available)");
|
18 |
case 0x05: return("Access denied");
|
18 |
case 0x05: return("Access denied");
|
19 |
case 0x06: return("Invalid handle");
|
19 |
case 0x06: return("Invalid handle");
|
20 |
case 0x07: return("Memory control block destroyed");
|
20 |
case 0x07: return("Memory control block destroyed");
|
21 |
case 0x08: return("Insufficient memory");
|
21 |
case 0x08: return("Insufficient memory");
|
22 |
case 0x09: return("Memory block address invalid");
|
22 |
case 0x09: return("Memory block address invalid");
|
23 |
case 0x0A: return("Environment invalid");
|
23 |
case 0x0A: return("Environment invalid");
|
24 |
case 0x0B: return("Format invalid");
|
24 |
case 0x0B: return("Format invalid");
|
25 |
case 0x0C: return("Access code invalid");
|
25 |
case 0x0C: return("Access code invalid");
|
26 |
case 0x0D: return("Data invalid");
|
26 |
case 0x0D: return("Data invalid");
|
27 |
case 0x0F: return("Invalid drive");
|
27 |
case 0x0F: return("Invalid drive");
|
28 |
case 0x10: return("Attemted to remove current directory");
|
28 |
case 0x10: return("Attemted to remove current directory");
|
29 |
case 0x11: return("Not same device");
|
29 |
case 0x11: return("Not same device");
|
30 |
case 0x12: return("No more files");
|
30 |
case 0x12: return("No more files");
|
31 |
case 0x13: return("Disk write-protected");
|
31 |
case 0x13: return("Disk write-protected");
|
32 |
case 0x14: return("Unknown unit");
|
32 |
case 0x14: return("Unknown unit");
|
33 |
case 0x15: return("Drive not ready");
|
33 |
case 0x15: return("Drive not ready");
|
34 |
case 0x16: return("Unknown command");
|
34 |
case 0x16: return("Unknown command");
|
35 |
case 0x17: return("Data error (CRC)");
|
35 |
case 0x17: return("Data error (CRC)");
|
36 |
case 0x18: return("Bad request structure length");
|
36 |
case 0x18: return("Bad request structure length");
|
37 |
case 0x19: return("Seek error");
|
37 |
case 0x19: return("Seek error");
|
38 |
case 0x1A: return("Unknown media type (non-DOS disk)");
|
38 |
case 0x1A: return("Unknown media type (non-DOS disk)");
|
39 |
case 0x1B: return("Sector not found");
|
39 |
case 0x1B: return("Sector not found");
|
40 |
case 0x1C: return("Printer out of paper");
|
40 |
case 0x1C: return("Printer out of paper");
|
41 |
case 0x1D: return("Write fault");
|
41 |
case 0x1D: return("Write fault");
|
42 |
case 0x1E: return("Read fault");
|
42 |
case 0x1E: return("Read fault");
|
43 |
case 0x1F: return("General failure");
|
43 |
case 0x1F: return("General failure");
|
44 |
case 0x20: return("Sharing violation");
|
44 |
case 0x20: return("Sharing violation");
|
45 |
case 0x21: return("Lock violation");
|
45 |
case 0x21: return("Lock violation");
|
46 |
case 0x22: return("Disk change invalid");
|
46 |
case 0x22: return("Disk change invalid");
|
47 |
case 0x23: return("FCB unavailable");
|
47 |
case 0x23: return("FCB unavailable");
|
48 |
case 0x24: return("Sharing buffer overflow");
|
48 |
case 0x24: return("Sharing buffer overflow");
|
49 |
case 0x25: return("Code page mismatch");
|
49 |
case 0x25: return("Code page mismatch");
|
50 |
case 0x26: return("Cannot complete file operations (EOF / out of input)");
|
50 |
case 0x26: return("Cannot complete file operations (EOF / out of input)");
|
51 |
case 0x27: return("Insufficient disk space");
|
51 |
case 0x27: return("Insufficient disk space");
|
52 |
default:
|
52 |
default:
|
53 |
snprintf(buf, sizeof(buf), "DOS ERROR 0x%02X", err);
|
53 |
snprintf(buf, sizeof(buf), "DOS ERROR 0x%02X", err);
|
54 |
return(buf);
|
54 |
return(buf);
|
55 |
}
|
55 |
}
|
56 |
}
|
56 |
}
|
57 |
|
57 |
|