Recovery of release 990110 after disk crash.
[wine.git] / include / msdos.h
blobca68cf2711b7acd2dfcaef8621c788fb306c2062
1 #ifndef __WINE_MSDOS_H
2 #define __WINE_MSDOS_H
4 #include <sys/types.h>
5 #include <dirent.h>
6 #include "windows.h"
7 #include "comm.h"
8 #include "winnt.h"
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];
22 /* DTA layout for FindFirst/FindNext */
23 typedef struct
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;
38 /* FCB layout for FindFirstFCB/FindNextFCB */
39 typedef struct
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;
47 /* DOS directory entry for FindFirstFCB/FindNextFCB */
48 typedef struct
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;
59 typedef struct
61 WORD CX_Int21_5e01; /* contents of CX from INT 21/AX=5E01h */
62 WORD LRU_count_FCB_cache;
63 WORD LRU_count_FCB_open;
64 DWORD OEM_func_handler WINE_PACKED; /* OEM function of INT 21/AH=F8h */
65 WORD INT21_offset;/* offset in DOS CS of code to return from INT 21 call */
66 WORD sharing_retry_count;
67 WORD sharing_retry_delay;
68 DWORD ptr_disk_buf; /* ptr to current disk buf */
69 WORD offs_unread_CON; /* pointer in DOS data segment of unread CON input */
70 WORD seg_first_MCB;
71 DWORD ptr_first_DPB;
72 DWORD ptr_first_SysFileTable;
73 DWORD ptr_clock_dev_hdr;
74 DWORD ptr_CON_dev_hdr;
75 WORD max_byte_per_sec; /* maximum bytes per sector of any block device */
76 DWORD ptr_disk_buf_info WINE_PACKED;
77 DWORD ptr_array_CDS WINE_PACKED; /* current directory structure */
78 DWORD ptr_sys_FCB WINE_PACKED;
79 WORD nr_protect_FCB;
80 BYTE nr_block_dev;
81 BYTE nr_avail_drive_letters;
82 BYTE NUL_dev_header[18];
83 BYTE nr_drives_JOINed;
84 WORD ptr_spec_prg_names WINE_PACKED;
85 DWORD ptr_SETVER_prg_list WINE_PACKED;
86 WORD DOS_HIGH_A20_func_offs WINE_PACKED;
87 WORD PSP_last_exec WINE_PACKED; /* if DOS in HMA: PSP of program executed last; if DOS low: 0000h */
88 WORD BUFFERS_val WINE_PACKED;
89 WORD BUFFERS_nr_lookahead WINE_PACKED;
90 BYTE boot_drive WINE_PACKED;
91 BYTE flag_DWORD_moves WINE_PACKED; /* 01h for 386+, 00h otherwise */
92 WORD size_extended_mem WINE_PACKED; /* size of extended mem in KB */
93 } DOS_LISTOFLISTS;
95 #define MAX_DOS_DRIVES 26
97 extern struct DosDeviceStruct COM[MAX_PORTS];
98 extern struct DosDeviceStruct LPT[MAX_PORTS];
100 #define setword(a,b) do { *(BYTE*)(a) = (b) & 0xff; \
101 *((BYTE*)((a)+1)) = ((b)>>8) & 0xff;\
102 } while(0)
105 /* dos file attributes */
107 #define FA_NORMAL 0x00 /* Normal file, no attributes */
108 #define FA_RDONLY 0x01 /* Read only attribute */
109 #define FA_HIDDEN 0x02 /* Hidden file */
110 #define FA_SYSTEM 0x04 /* System file */
111 #define FA_LABEL 0x08 /* Volume label */
112 #define FA_DIRECTORY 0x10 /* Directory */
113 #define FA_ARCHIVE 0x20 /* Archive */
114 #define FA_UNUSED 0x40 /* Unused */
117 extern WORD DOS_ExtendedError;
118 extern BYTE DOS_ErrorClass, DOS_ErrorAction, DOS_ErrorLocus;
120 #define DOS_ERROR(err,class,action,locus) \
121 ( SetLastError(err), \
122 DOS_ErrorClass = (class), DOS_ErrorAction = (action), \
123 DOS_ErrorLocus = (locus), DOS_ExtendedError = (err) )
125 /* Error codes */
127 #define ER_NoError 0x00
128 #define ER_InvalidFunction 0x01
129 #define ER_FileNotFound 0x02
130 #define ER_PathNotFound 0x03
131 #define ER_TooManyOpenFiles 0x04
132 #define ER_AccessDenied 0x05
133 #define ER_InvalidHandle 0x06
134 #define ER_MCBDestroyed 0x07
135 #define ER_OutOfMemory 0x08
136 #define ER_MCBInvalid 0x09
137 #define ER_EnvironInvalid 0x0a
138 #define ER_FormatInvalid 0x0b
139 #define ER_AccessCodeInvalid 0x0c
140 #define ER_DataInvalid 0x0d
141 #define ER_InvalidDrive 0x0f
142 #define ER_CanNotRemoveCwd 0x10
143 #define ER_NotSameDevice 0x11
144 #define ER_NoMoreFiles 0x12
145 #define ER_WriteProtected 0x13
146 #define ER_UnknownUnit 0x14
147 #define ER_DriveNotReady 0x15
148 #define ER_UnknownCommand 0x16
149 #define ER_CRCError 0x17
150 #define ER_BadRqLength 0x18
151 #define ER_SeekError 0x19
152 #define ER_UnknownMedia 0x1a
153 #define ER_SectorNotFound 0x1b
154 #define ER_OutOfPaper 0x1c
155 #define ER_WriteFault 0x1d
156 #define ER_ReadFault 0x1e
157 #define ER_GeneralFailure 0x1f
158 #define ER_ShareViolation 0x20
159 #define ER_LockViolation 0x21
160 #define ER_DiskFull 0x27
161 #define ER_NoNetwork 0x49
162 #define ER_FileExists 0x50
163 #define ER_CanNotMakeDir 0x52
165 /* Error classes */
167 #define EC_OutOfResource 0x01
168 #define EC_Temporary 0x02
169 #define EC_AccessDenied 0x03
170 #define EC_InternalError 0x04
171 #define EC_HardwareFailure 0x05
172 #define EC_SystemFailure 0x06
173 #define EC_ProgramError 0x07
174 #define EC_NotFound 0x08
175 #define EC_MediaError 0x0b
176 #define EC_Exists 0x0c
177 #define EC_Unknown 0x0d
179 /* Suggested actions */
181 #define SA_Retry 0x01
182 #define SA_DelayedRetry 0x02
183 #define SA_Abort 0x04
184 #define SA_Ignore 0x06
185 #define SA_Ask4Retry 0x07
187 /* Error locus */
189 #define EL_Unknown 0x01
190 #define EL_Disk 0x02
191 #define EL_Network 0x03
192 #define EL_Serial 0x04
193 #define EL_Memory 0x05
195 void WINAPI DOS3Call( CONTEXT *context );
196 void do_mscdex( CONTEXT *context );
197 void do_mscdex_dd (CONTEXT * context, int dorealmode);
199 #define DOSCONF_MEM_HIGH 0x0001
200 #define DOSCONF_MEM_UMB 0x0002
201 #define DOSCONF_NUMLOCK 0x0004
202 #define DOSCONF_KEYB_CONV 0x0008
204 typedef struct {
205 char lastdrive;
206 int brk_flag;
207 int files;
208 int stacks_nr;
209 int stacks_sz;
210 int buf;
211 int buf2;
212 int fcbs;
213 int flags;
214 char *shell;
215 char *country;
216 } DOSCONF;
218 extern DOSCONF DOSCONF_config;
220 #endif /* __WINE_MSDOS_H */