Capture thread checks queue for more headers before giving error.
[wine] / include / msdos.h
1 /*
2  * Copyright 1994 Erik Bos
3  * Copyright 1999 Ove Kaaven
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  */
19
20 #ifndef __WINE_MSDOS_H
21 #define __WINE_MSDOS_H
22
23 #include "wine/windef16.h"
24
25 #include "pshpack1.h"
26
27 struct fcb {
28         BYTE drive;
29         char name[8];
30         char extension[3];
31         BYTE dummy1[4];
32         int filesize;
33         WORD date_write;
34         WORD time_write;
35         struct dosdirent *directory;
36         BYTE dummy2[9];
37 };
38
39 /* DTA layout for FindFirst/FindNext */
40 typedef struct
41 {
42     BYTE   drive;        /* 00 drive letter */
43     char   mask[11];     /* 01 search template */
44     BYTE   search_attr;  /* 0c search attributes */
45     WORD   count;        /* 0d entry count within directory */
46     WORD   cluster;      /* 0f cluster of parent directory */
47     char  *unixPath;     /* 11 unix path (was: reserved) */
48     BYTE   fileattr;     /* 15 file attributes */
49     WORD   filetime;     /* 16 file time */
50     WORD   filedate;     /* 18 file date */
51     DWORD  filesize;     /* 1a file size */
52     char   filename[13]; /* 1e file name + extension */
53 } FINDFILE_DTA;
54
55 /* FCB layout for FindFirstFCB/FindNextFCB */
56 typedef struct
57 {
58     BYTE   drive;                /* 00 drive letter */
59     char   filename[11];         /* 01 filename 8+3 format */
60     int    count;                /* 0c entry count (was: reserved) */
61     char  *unixPath;             /* 10 unix path (was: reserved) */
62 } FINDFILE_FCB;
63
64 /* DOS directory entry for FindFirstFCB/FindNextFCB */
65 typedef struct
66 {
67     char   filename[11];         /* 00 filename 8+3 format */
68     BYTE   fileattr;             /* 0b file attributes */
69     BYTE   reserved[10];         /* 0c reserved */
70     WORD   filetime;             /* 16 file time */
71     WORD   filedate;             /* 18 file date */
72     WORD   cluster;              /* 1a file first cluster */
73     DWORD  filesize;             /* 1c file size */
74 } DOS_DIRENTRY_LAYOUT;
75
76 typedef struct
77 {
78     DWORD next_dev;
79     WORD  attr;
80     WORD  strategy;
81     WORD  interrupt;
82     char  name[8];
83 } DOS_DEVICE_HEADER;
84
85 /* Warning: need to return LOL ptr w/ offset 0 (&ptr_first_DPB) to programs ! */
86 typedef struct _DOS_LISTOFLISTS
87 {
88     WORD  CX_Int21_5e01;        /* -24d contents of CX from INT 21/AX=5E01h */
89     WORD  LRU_count_FCB_cache;  /* -22d */
90     WORD  LRU_count_FCB_open;   /* -20d */
91     DWORD OEM_func_handler;     /* -18d OEM function of INT 21/AH=F8h */
92     WORD  INT21_offset;         /* -14d offset in DOS CS of code to return from INT 21 call */
93     WORD  sharing_retry_count;  /* -12d */
94     WORD  sharing_retry_delay;  /* -10d */
95     DWORD ptr_disk_buf;         /* -8d ptr to current disk buf */
96     WORD  offs_unread_CON;      /* -4d pointer in DOS data segment of unread CON input */
97     WORD  seg_first_MCB;        /* -2d */
98     DWORD ptr_first_DPB;        /* 00 */
99     DWORD ptr_first_SysFileTable; /* 04 */
100     DWORD ptr_clock_dev_hdr;    /* 08 */
101     DWORD ptr_CON_dev_hdr;      /* 0C */
102     WORD  max_byte_per_sec;     /* 10 maximum bytes per sector of any block device */
103     DWORD ptr_disk_buf_info;    /* 12 */
104     DWORD ptr_array_CDS;        /* 16 current directory structure */
105     DWORD ptr_sys_FCB;          /* 1A */
106     WORD  nr_protect_FCB;       /* 1E */
107     BYTE  nr_block_dev;         /* 20 */
108     BYTE  nr_avail_drive_letters; /* 21 */
109     DOS_DEVICE_HEADER NUL_dev;  /* 22 */
110     BYTE  nr_drives_JOINed;     /* 34 */
111     WORD  ptr_spec_prg_names;   /* 35 */
112     DWORD ptr_SETVER_prg_list;  /* 37 */
113     WORD DOS_HIGH_A20_func_offs;/* 3B */
114     WORD PSP_last_exec;         /* 3D if DOS in HMA: PSP of program executed last; if DOS low: 0000h */
115     WORD BUFFERS_val;           /* 3F */
116     WORD BUFFERS_nr_lookahead;  /* 41 */
117     BYTE boot_drive;            /* 43 */
118     BYTE flag_DWORD_moves;      /* 44 01h for 386+, 00h otherwise */
119     WORD size_extended_mem;     /* 45 size of extended mem in KB */
120     SEGPTR wine_rm_lol;         /* -- wine: Real mode pointer to LOL */
121     SEGPTR wine_pm_lol;         /* -- wine: Protected mode pointer to LOL */
122 } DOS_LISTOFLISTS;
123
124 #include "poppack.h"
125
126 #define MAX_DOS_DRIVES  26
127
128 #define setword(a,b)    do { *(BYTE*)(a)          = (b) & 0xff; \
129                              *((BYTE*)((a)+1)) = ((b)>>8) & 0xff;\
130                         } while(0)
131
132
133 /* dos file attributes */
134
135 #define FA_NORMAL    0x00        /* Normal file, no attributes */
136 #define FA_RDONLY    0x01        /* Read only attribute */
137 #define FA_HIDDEN    0x02        /* Hidden file */
138 #define FA_SYSTEM    0x04        /* System file */
139 #define FA_LABEL     0x08        /* Volume label */
140 #define FA_DIRECTORY 0x10        /* Directory */
141 #define FA_ARCHIVE   0x20        /* Archive */
142 #define FA_UNUSED    0x40        /* Unused */
143
144 /* Error codes */
145
146 #define ER_NoError           0x00
147 #define ER_InvalidFunction   0x01
148 #define ER_FileNotFound      0x02
149 #define ER_PathNotFound      0x03
150 #define ER_TooManyOpenFiles  0x04
151 #define ER_AccessDenied      0x05
152 #define ER_InvalidHandle     0x06
153 #define ER_MCBDestroyed      0x07
154 #define ER_OutOfMemory       0x08
155 #define ER_MCBInvalid        0x09
156 #define ER_EnvironInvalid    0x0a
157 #define ER_FormatInvalid     0x0b
158 #define ER_AccessCodeInvalid 0x0c
159 #define ER_DataInvalid       0x0d
160 #define ER_InvalidDrive      0x0f
161 #define ER_CanNotRemoveCwd   0x10
162 #define ER_NotSameDevice     0x11
163 #define ER_NoMoreFiles       0x12
164 #define ER_WriteProtected    0x13
165 #define ER_UnknownUnit       0x14
166 #define ER_DriveNotReady     0x15
167 #define ER_UnknownCommand    0x16
168 #define ER_CRCError          0x17
169 #define ER_BadRqLength       0x18
170 #define ER_SeekError         0x19
171 #define ER_UnknownMedia      0x1a
172 #define ER_SectorNotFound    0x1b
173 #define ER_OutOfPaper        0x1c
174 #define ER_WriteFault        0x1d
175 #define ER_ReadFault         0x1e
176 #define ER_GeneralFailure    0x1f
177 #define ER_ShareViolation    0x20
178 #define ER_LockViolation     0x21
179 #define ER_DiskFull          0x27
180 #define ER_NoNetwork         0x49
181 #define ER_FileExists        0x50
182 #define ER_CanNotMakeDir     0x52
183
184 /* Error classes */
185
186 #define EC_OutOfResource     0x01
187 #define EC_Temporary         0x02
188 #define EC_AccessDenied      0x03
189 #define EC_InternalError     0x04
190 #define EC_HardwareFailure   0x05
191 #define EC_SystemFailure     0x06
192 #define EC_ProgramError      0x07
193 #define EC_NotFound          0x08
194 #define EC_MediaError        0x0b
195 #define EC_Exists            0x0c
196 #define EC_Unknown           0x0d
197
198 /* Suggested actions */
199
200 #define SA_Retry             0x01
201 #define SA_DelayedRetry      0x02
202 #define SA_Abort             0x04
203 #define SA_Ignore            0x06
204 #define SA_Ask4Retry         0x07
205
206 /* Error locus */
207
208 #define EL_Unknown           0x01
209 #define EL_Disk              0x02
210 #define EL_Network           0x03
211 #define EL_Serial            0x04
212 #define EL_Memory            0x05
213
214 #define DOSCONF_MEM_HIGH        0x0001
215 #define DOSCONF_MEM_UMB         0x0002
216 #define DOSCONF_NUMLOCK         0x0004
217 #define DOSCONF_KEYB_CONV       0x0008
218
219 typedef struct {
220         char lastdrive;
221         int brk_flag;
222         int files;
223         int stacks_nr;
224         int stacks_sz;
225         int buf;
226         int buf2;
227         int fcbs;
228         int flags;
229         char *shell;
230         char *country;
231 } DOSCONF;
232
233 extern DOSCONF DOSCONF_config;
234
235 #endif /* __WINE_MSDOS_H */