421 |
mateuszvis |
1 |
/* This file is part of the SvarCOM project and is published under the terms
|
|
|
2 |
* of the MIT license.
|
|
|
3 |
*
|
|
|
4 |
* Copyright (C) 2021 Mateusz Viste
|
|
|
5 |
*
|
|
|
6 |
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
7 |
* copy of this software and associated documentation files (the "Software"),
|
|
|
8 |
* to deal in the Software without restriction, including without limitation
|
|
|
9 |
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
10 |
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
11 |
* Software is furnished to do so, subject to the following conditions:
|
|
|
12 |
*
|
|
|
13 |
* The above copyright notice and this permission notice shall be included in
|
|
|
14 |
* all copies or substantial portions of the Software.
|
|
|
15 |
*
|
|
|
16 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
17 |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
18 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
19 |
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
20 |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
21 |
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
22 |
* DEALINGS IN THE SOFTWARE.
|
|
|
23 |
*/
|
|
|
24 |
|
364 |
mateuszvis |
25 |
/*
|
|
|
26 |
* translates a DOS extended error into a human string
|
|
|
27 |
* (as defined by INT 21/AH=59h/BX=0000h)
|
|
|
28 |
*/
|
|
|
29 |
|
|
|
30 |
#include <stdio.h>
|
|
|
31 |
|
|
|
32 |
#include "doserr.h"
|
|
|
33 |
|
|
|
34 |
const char *doserr(unsigned short err) {
|
471 |
mateuszvis |
35 |
static char buf[18] = "DOS ERROR 0x";
|
364 |
mateuszvis |
36 |
switch (err) {
|
|
|
37 |
case 0x00: return("Success");
|
|
|
38 |
case 0x01: return("Function number invalid");
|
|
|
39 |
case 0x02: return("File not found");
|
|
|
40 |
case 0x03: return("Path not found");
|
|
|
41 |
case 0x04: return("Too many open files (no handles available)");
|
|
|
42 |
case 0x05: return("Access denied");
|
|
|
43 |
case 0x06: return("Invalid handle");
|
|
|
44 |
case 0x07: return("Memory control block destroyed");
|
|
|
45 |
case 0x08: return("Insufficient memory");
|
|
|
46 |
case 0x09: return("Memory block address invalid");
|
|
|
47 |
case 0x0A: return("Environment invalid");
|
|
|
48 |
case 0x0B: return("Format invalid");
|
|
|
49 |
case 0x0C: return("Access code invalid");
|
|
|
50 |
case 0x0D: return("Data invalid");
|
|
|
51 |
case 0x0F: return("Invalid drive");
|
|
|
52 |
case 0x10: return("Attemted to remove current directory");
|
|
|
53 |
case 0x11: return("Not same device");
|
|
|
54 |
case 0x12: return("No more files");
|
|
|
55 |
case 0x13: return("Disk write-protected");
|
|
|
56 |
case 0x14: return("Unknown unit");
|
|
|
57 |
case 0x15: return("Drive not ready");
|
|
|
58 |
case 0x16: return("Unknown command");
|
|
|
59 |
case 0x17: return("Data error (CRC)");
|
|
|
60 |
case 0x18: return("Bad request structure length");
|
|
|
61 |
case 0x19: return("Seek error");
|
|
|
62 |
case 0x1A: return("Unknown media type (non-DOS disk)");
|
|
|
63 |
case 0x1B: return("Sector not found");
|
|
|
64 |
case 0x1C: return("Printer out of paper");
|
|
|
65 |
case 0x1D: return("Write fault");
|
|
|
66 |
case 0x1E: return("Read fault");
|
|
|
67 |
case 0x1F: return("General failure");
|
|
|
68 |
case 0x20: return("Sharing violation");
|
|
|
69 |
case 0x21: return("Lock violation");
|
|
|
70 |
case 0x22: return("Disk change invalid");
|
|
|
71 |
case 0x23: return("FCB unavailable");
|
|
|
72 |
case 0x24: return("Sharing buffer overflow");
|
|
|
73 |
case 0x25: return("Code page mismatch");
|
|
|
74 |
case 0x26: return("Cannot complete file operations (EOF / out of input)");
|
|
|
75 |
case 0x27: return("Insufficient disk space");
|
|
|
76 |
default:
|
471 |
mateuszvis |
77 |
sprintf(buf + 12, "%02X", err);
|
364 |
mateuszvis |
78 |
return(buf);
|
|
|
79 |
}
|
|
|
80 |
}
|