Release 950319
[wine] / include / msdos.h
1 #ifndef __MSDOS_H
2 #define __MSDOS_H
3
4 #include <dirent.h>
5 #include <windows.h>
6 #include "comm.h"
7
8 struct dosdirent {
9         int  inuse;
10         DIR *ds;
11         char unixpath[256];
12         char filename[256];
13         char filemask[12];
14         char attribute;
15         char search_attribute;
16         long filesize;
17         long filetime;
18         short entnum;           /* Directory entry number */
19 };
20
21 struct fcb {
22         BYTE drive;
23         char name[8];
24         char extension[3];
25         BYTE dummy1[4];
26         int filesize;
27         WORD date_write;
28         WORD time_write;
29         struct dosdirent *directory;
30         BYTE dummy2[9];
31 };
32
33 #define DOSVERSION 0x0500;      /* Might as well pretend we're DOS 5.0 */
34 #define MAX_DOS_DRIVES  26
35
36 extern WORD ExtendedError;
37 extern struct DosDeviceStruct COM[MAX_PORTS];
38 extern struct DosDeviceStruct LPT[MAX_PORTS];
39
40 #define setword(a,b)    *(BYTE*)(a)       = (b) & 0xff; \
41                         *((BYTE*)((a)+1)) = ((b)>>8) & 0xff;
42                         
43 #define setdword(a,b)   *(BYTE*)(a)     = (b) & 0xff; \
44                         *((BYTE*)(a)+1) = ((b)>>8) & 0xff; \
45                         *((BYTE*)(a)+2) = ((b)>>16) & 0xff; \
46                         *((BYTE*)(a)+3) = ((b)>>24) & 0xff;
47
48 #define getword(a)      (WORD) *(BYTE*)(a) + \
49                         (*((BYTE*)(a) + 1) << 8)
50
51 #define getdword(a)     (DWORD) (*(BYTE*)(a) + \
52                         (*((BYTE*)(a) + 1) << 8) + \
53                         (*((BYTE*)(a) + 2) << 16) + \
54                         (*((BYTE*)(a) + 3) << 24))
55
56 /* dos file attributes */
57
58 #define FA_NORMAL   0x00        /* Normal file, no attributes */
59 #define FA_RDONLY   0x01        /* Read only attribute */
60 #define FA_HIDDEN   0x02        /* Hidden file */
61 #define FA_SYSTEM   0x04        /* System file */
62 #define FA_LABEL    0x08        /* Volume label */
63 #define FA_DIREC    0x10        /* Directory */
64 #define FA_ARCH     0x20        /* Archive */
65
66 /* extended error codes */
67
68 #define NoError         0x00
69 #define InvalidFunction 0x01
70 #define FileNotFound    0x02
71 #define PathNotFound    0x03
72 #define AccessDenied    0x05
73 #define InvalidHandle   0x06
74 #define MCBDestroyed    0x07
75 #define OutOfMemory     0x08
76 #define MCBInvalid      0x09
77 #define DataInvalid     0x0d
78 #define InvalidDrive    0x0f
79 #define CanNotRemoveCwd 0x10
80 #define NotSameDevice   0x11
81 #define NoMoreFiles     0x12
82 #define WriteProtected  0x13
83 #define UnknownUnit     0x14
84 #define DriveNotReady   0x15
85 #define UnknownCommand  0x16
86 #define CRCError        0x17
87 #define BadRqLength     0x18
88 #define SeekError       0x19
89 #define UnknownMedia    0x1a
90 #define SectorNotFound  0x1b
91 #define OutOfPaper      0x1c
92 #define WriteFault      0x1d
93 #define ReadFault       0x1e
94 #define GeneralFailure  0x1f
95 #define ShareViolation  0x20
96 #define LockViolation   0x21
97 #define DiskFull        0x27
98 #define NoNetwork       0x49
99 #define FileExists      0x50
100 #define CanNotMakeDir   0x52
101
102 /* Error classes */
103
104 #define EC_Temporary    0x02
105 #define EC_AccessDenied 0x03
106 #define EC_AppError     0x04
107 #define EC_SystemFailure 0x06
108 #define EC_NotFound     0x08
109 #define EC_MediaError   0x0b
110 #define EC_Exists       0x0c
111 #define EC_Unknown      0x0d
112
113 /* Suggested actions */
114
115 #define SA_Retry        0x01
116 #define SA_Abort        0x04
117 #define SA_Ignore       0x06
118 #define SA_Ask4Retry    0x07
119
120 /* Error locus */
121
122 #define EL_Unknown      0x01
123 #define EL_Disk         0x02
124 #define EL_Network      0x03
125 #define EL_Memory       0x05
126
127 #endif /* __MSDOS_H */