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