Release 980301
[wine] / include / msdos.h
1 #ifndef __WINE_MSDOS_H
2 #define __WINE_MSDOS_H
3
4 #include <sys/types.h>
5 #include <dirent.h>
6 #include "windows.h"
7 #include "comm.h"
8 #include "winnt.h"
9
10 struct fcb {
11         BYTE drive;
12         char name[8];
13         char extension[3];
14         BYTE dummy1[4];
15         int filesize;
16         WORD date_write;
17         WORD time_write;
18         struct dosdirent *directory;
19         BYTE dummy2[9];
20 };
21
22 /* DTA layout for FindFirst/FindNext */
23 typedef struct
24 {
25     BYTE   drive;                /* 00 drive letter */
26     char   mask[11];             /* 01 search template */
27     BYTE   search_attr;          /* 0c search attributes */
28     WORD   count WINE_PACKED;    /* 0d entry count within directory */
29     WORD   cluster WINE_PACKED;  /* 0f cluster of parent directory */
30     char  *unixPath WINE_PACKED; /* 11 unix path (was: reserved) */
31     BYTE   fileattr;             /* 15 file attributes */
32     WORD   filetime;             /* 16 file time */
33     WORD   filedate;             /* 18 file date */
34     DWORD  filesize WINE_PACKED; /* 1a file size */
35     char   filename[13];         /* 1e file name + extension */
36 } FINDFILE_DTA;
37
38 /* FCB layout for FindFirstFCB/FindNextFCB */
39 typedef struct
40 {
41     BYTE   drive;                /* 00 drive letter */
42     char   filename[11];         /* 01 filename 8+3 format */
43     int    count;                /* 0c entry count (was: reserved) */
44     char  *unixPath;             /* 10 unix path (was: reserved) */
45 } FINDFILE_FCB;
46
47 /* DOS directory entry for FindFirstFCB/FindNextFCB */
48 typedef struct
49 {
50     char   filename[11];         /* 00 filename 8+3 format */
51     BYTE   fileattr;             /* 0b file attributes */
52     BYTE   reserved[10];         /* 0c reserved */
53     WORD   filetime;             /* 16 file time */
54     WORD   filedate;             /* 18 file date */
55     WORD   cluster;              /* 1a file first cluster */
56     DWORD  filesize;             /* 1c file size */
57 } DOS_DIRENTRY_LAYOUT;
58
59 #define MAX_DOS_DRIVES  26
60
61 extern struct DosDeviceStruct COM[MAX_PORTS];
62 extern struct DosDeviceStruct LPT[MAX_PORTS];
63
64 #define setword(a,b)    do { *(BYTE*)(a)          = (b) & 0xff; \
65                              *((BYTE*)((a)+1)) = ((b)>>8) & 0xff;\
66                         } while(0)
67                         
68
69 /* dos file attributes */
70
71 #define FA_NORMAL    0x00        /* Normal file, no attributes */
72 #define FA_RDONLY    0x01        /* Read only attribute */
73 #define FA_HIDDEN    0x02        /* Hidden file */
74 #define FA_SYSTEM    0x04        /* System file */
75 #define FA_LABEL     0x08        /* Volume label */
76 #define FA_DIRECTORY 0x10        /* Directory */
77 #define FA_ARCHIVE   0x20        /* Archive */
78 #define FA_UNUSED    0x40        /* Unused */
79
80
81 extern WORD DOS_ExtendedError;
82 extern BYTE DOS_ErrorClass, DOS_ErrorAction, DOS_ErrorLocus;
83
84 #define DOS_ERROR(err,class,action,locus) \
85     ( SetLastError(err), \
86       DOS_ErrorClass = (class), DOS_ErrorAction = (action), \
87       DOS_ErrorLocus = (locus), DOS_ExtendedError = (err) )
88
89 /* Error codes */
90
91 #define ER_NoError           0x00
92 #define ER_InvalidFunction   0x01
93 #define ER_FileNotFound      0x02
94 #define ER_PathNotFound      0x03
95 #define ER_TooManyOpenFiles  0x04
96 #define ER_AccessDenied      0x05
97 #define ER_InvalidHandle     0x06
98 #define ER_MCBDestroyed      0x07
99 #define ER_OutOfMemory       0x08
100 #define ER_MCBInvalid        0x09
101 #define ER_EnvironInvalid    0x0a
102 #define ER_FormatInvalid     0x0b
103 #define ER_AccessCodeInvalid 0x0c
104 #define ER_DataInvalid       0x0d
105 #define ER_InvalidDrive      0x0f
106 #define ER_CanNotRemoveCwd   0x10
107 #define ER_NotSameDevice     0x11
108 #define ER_NoMoreFiles       0x12
109 #define ER_WriteProtected    0x13
110 #define ER_UnknownUnit       0x14
111 #define ER_DriveNotReady     0x15
112 #define ER_UnknownCommand    0x16
113 #define ER_CRCError          0x17
114 #define ER_BadRqLength       0x18
115 #define ER_SeekError         0x19
116 #define ER_UnknownMedia      0x1a
117 #define ER_SectorNotFound    0x1b
118 #define ER_OutOfPaper        0x1c
119 #define ER_WriteFault        0x1d
120 #define ER_ReadFault         0x1e
121 #define ER_GeneralFailure    0x1f
122 #define ER_ShareViolation    0x20
123 #define ER_LockViolation     0x21
124 #define ER_DiskFull          0x27
125 #define ER_NoNetwork         0x49
126 #define ER_FileExists        0x50
127 #define ER_CanNotMakeDir     0x52
128
129 /* Error classes */
130
131 #define EC_OutOfResource     0x01
132 #define EC_Temporary         0x02
133 #define EC_AccessDenied      0x03
134 #define EC_InternalError     0x04
135 #define EC_HardwareFailure   0x05
136 #define EC_SystemFailure     0x06
137 #define EC_ProgramError      0x07
138 #define EC_NotFound          0x08
139 #define EC_MediaError        0x0b
140 #define EC_Exists            0x0c
141 #define EC_Unknown           0x0d
142
143 /* Suggested actions */
144
145 #define SA_Retry             0x01
146 #define SA_DelayedRetry      0x02
147 #define SA_Abort             0x04
148 #define SA_Ignore            0x06
149 #define SA_Ask4Retry         0x07
150
151 /* Error locus */
152
153 #define EL_Unknown           0x01
154 #define EL_Disk              0x02
155 #define EL_Network           0x03
156 #define EL_Serial            0x04
157 #define EL_Memory            0x05
158
159 void WINAPI DOS3Call( CONTEXT *context );
160 void do_mscdex( CONTEXT *context );
161
162 #endif /* __WINE_MSDOS_H */