Removed dependencies on the internals of the region object.
[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 "winnt.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 } DOS_LISTOFLISTS;
121
122 #include "poppack.h"
123
124 #define MAX_DOS_DRIVES  26
125
126 #define setword(a,b)    do { *(BYTE*)(a)          = (b) & 0xff; \
127                              *((BYTE*)((a)+1)) = ((b)>>8) & 0xff;\
128                         } while(0)
129                         
130
131 /* dos file attributes */
132
133 #define FA_NORMAL    0x00        /* Normal file, no attributes */
134 #define FA_RDONLY    0x01        /* Read only attribute */
135 #define FA_HIDDEN    0x02        /* Hidden file */
136 #define FA_SYSTEM    0x04        /* System file */
137 #define FA_LABEL     0x08        /* Volume label */
138 #define FA_DIRECTORY 0x10        /* Directory */
139 #define FA_ARCHIVE   0x20        /* Archive */
140 #define FA_UNUSED    0x40        /* Unused */
141
142 /* Error codes */
143
144 #define ER_NoError           0x00
145 #define ER_InvalidFunction   0x01
146 #define ER_FileNotFound      0x02
147 #define ER_PathNotFound      0x03
148 #define ER_TooManyOpenFiles  0x04
149 #define ER_AccessDenied      0x05
150 #define ER_InvalidHandle     0x06
151 #define ER_MCBDestroyed      0x07
152 #define ER_OutOfMemory       0x08
153 #define ER_MCBInvalid        0x09
154 #define ER_EnvironInvalid    0x0a
155 #define ER_FormatInvalid     0x0b
156 #define ER_AccessCodeInvalid 0x0c
157 #define ER_DataInvalid       0x0d
158 #define ER_InvalidDrive      0x0f
159 #define ER_CanNotRemoveCwd   0x10
160 #define ER_NotSameDevice     0x11
161 #define ER_NoMoreFiles       0x12
162 #define ER_WriteProtected    0x13
163 #define ER_UnknownUnit       0x14
164 #define ER_DriveNotReady     0x15
165 #define ER_UnknownCommand    0x16
166 #define ER_CRCError          0x17
167 #define ER_BadRqLength       0x18
168 #define ER_SeekError         0x19
169 #define ER_UnknownMedia      0x1a
170 #define ER_SectorNotFound    0x1b
171 #define ER_OutOfPaper        0x1c
172 #define ER_WriteFault        0x1d
173 #define ER_ReadFault         0x1e
174 #define ER_GeneralFailure    0x1f
175 #define ER_ShareViolation    0x20
176 #define ER_LockViolation     0x21
177 #define ER_DiskFull          0x27
178 #define ER_NoNetwork         0x49
179 #define ER_FileExists        0x50
180 #define ER_CanNotMakeDir     0x52
181
182 /* Error classes */
183
184 #define EC_OutOfResource     0x01
185 #define EC_Temporary         0x02
186 #define EC_AccessDenied      0x03
187 #define EC_InternalError     0x04
188 #define EC_HardwareFailure   0x05
189 #define EC_SystemFailure     0x06
190 #define EC_ProgramError      0x07
191 #define EC_NotFound          0x08
192 #define EC_MediaError        0x0b
193 #define EC_Exists            0x0c
194 #define EC_Unknown           0x0d
195
196 /* Suggested actions */
197
198 #define SA_Retry             0x01
199 #define SA_DelayedRetry      0x02
200 #define SA_Abort             0x04
201 #define SA_Ignore            0x06
202 #define SA_Ask4Retry         0x07
203
204 /* Error locus */
205
206 #define EL_Unknown           0x01
207 #define EL_Disk              0x02
208 #define EL_Network           0x03
209 #define EL_Serial            0x04
210 #define EL_Memory            0x05
211
212 void WINAPI DOS3Call( CONTEXT86 *context );
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 */