blob: cda62f89822d88dc36ba569a4c32b0becf8308d4 [file] [log] [blame]
Alexandre Julliard0799c1a2002-03-09 23:29:33 +00001/*
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
Alexandre Julliardc6c09441997-01-12 18:32:19 +000020#ifndef __WINE_MSDOS_H
21#define __WINE_MSDOS_H
Alexandre Julliard234bc241994-12-10 13:02:28 +000022
Jukka Heinonen1cfc8502002-12-07 23:46:41 +000023#include "wine/windef16.h"
Alexandre Julliard5f721f81994-01-04 20:14:34 +000024
Andreas Mohr64295972001-12-26 19:42:20 +000025#include "pshpack1.h"
26
Alexandre Julliard940d58c1994-09-16 09:24:37 +000027struct 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
Alexandre Julliard4f8c37b1996-01-14 18:12:01 +000039/* DTA layout for FindFirst/FindNext */
40typedef struct
41{
Andreas Mohr64295972001-12-26 19:42:20 +000042 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 */
Alexandre Julliard4f8c37b1996-01-14 18:12:01 +000053} FINDFILE_DTA;
54
Alexandre Julliard0c126c71996-02-18 18:44:41 +000055/* FCB layout for FindFirstFCB/FindNextFCB */
56typedef 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 */
65typedef 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;
Alexandre Julliard808cb041995-08-17 17:11:36 +000075
Alexandre Julliarda69b88b1998-03-15 20:29:56 +000076typedef struct
77{
Ove Kaaven07d2a781999-05-08 10:54:04 +000078 DWORD next_dev;
79 WORD attr;
80 WORD strategy;
81 WORD interrupt;
82 char name[8];
83} DOS_DEVICE_HEADER;
84
Andreas Mohr64295972001-12-26 19:42:20 +000085/* Warning: need to return LOL ptr w/ offset 0 (&ptr_first_DPB) to programs ! */
Ove Kaaven07d2a781999-05-08 10:54:04 +000086typedef struct _DOS_LISTOFLISTS
87{
Andreas Mohr64295972001-12-26 19:42:20 +000088 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 */
Jukka Heinonen1cfc8502002-12-07 23:46:41 +0000120 SEGPTR wine_rm_lol; /* -- wine: Real mode pointer to LOL */
121 SEGPTR wine_pm_lol; /* -- wine: Protected mode pointer to LOL */
Alexandre Julliarda69b88b1998-03-15 20:29:56 +0000122} DOS_LISTOFLISTS;
123
Andreas Mohr64295972001-12-26 19:42:20 +0000124#include "poppack.h"
125
Alexandre Julliard58199531994-04-21 01:20:00 +0000126#define MAX_DOS_DRIVES 26
Alexandre Julliard0e607781993-11-03 19:23:37 +0000127
Alexandre Julliarde2991ea1995-07-29 13:09:43 +0000128#define setword(a,b) do { *(BYTE*)(a) = (b) & 0xff; \
129 *((BYTE*)((a)+1)) = ((b)>>8) & 0xff;\
130 } while(0)
Vincent BĂ©ron9a624912002-05-31 23:06:46 +0000131
Alexandre Julliard8d24ae61994-04-05 21:42:43 +0000132
133/* dos file attributes */
134
Alexandre Julliard4f8c37b1996-01-14 18:12:01 +0000135#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 */
Alexandre Julliard8d24ae61994-04-05 21:42:43 +0000143
Alexandre Julliard4f8c37b1996-01-14 18:12:01 +0000144/* 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
Alexandre Julliard0e607781993-11-03 19:23:37 +0000183
184/* Error classes */
185
Alexandre Julliard4f8c37b1996-01-14 18:12:01 +0000186#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
Alexandre Julliard0e607781993-11-03 19:23:37 +0000197
198/* Suggested actions */
199
Alexandre Julliard4f8c37b1996-01-14 18:12:01 +0000200#define SA_Retry 0x01
201#define SA_DelayedRetry 0x02
202#define SA_Abort 0x04
203#define SA_Ignore 0x06
204#define SA_Ask4Retry 0x07
Alexandre Julliard0e607781993-11-03 19:23:37 +0000205
206/* Error locus */
207
Alexandre Julliard4f8c37b1996-01-14 18:12:01 +0000208#define EL_Unknown 0x01
209#define EL_Disk 0x02
210#define EL_Network 0x03
211#define EL_Serial 0x04
212#define EL_Memory 0x05
Alexandre Julliard0e607781993-11-03 19:23:37 +0000213
Alexandre Julliard638f1691999-01-17 16:32:32 +0000214#define DOSCONF_MEM_HIGH 0x0001
215#define DOSCONF_MEM_UMB 0x0002
216#define DOSCONF_NUMLOCK 0x0004
217#define DOSCONF_KEYB_CONV 0x0008
218
219typedef 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
233extern DOSCONF DOSCONF_config;
234
Alexandre Julliardc6c09441997-01-12 18:32:19 +0000235#endif /* __WINE_MSDOS_H */