]> wirehaze git hosting - MS-DOS.git/blob - v4.0/src/TOOLS/BLD/INC/DOS.H

wirehaze git hosting

MZ is back!
[MS-DOS.git] / v4.0 / src / TOOLS / BLD / INC / DOS.H
1 /***
2 *dos.h - definitions for MS-DOS interface routines
3 *
4 * Copyright (c) 1985-1988, Microsoft Corporation. All rights reserved.
5 *
6 *Purpose:
7 * Defines the structs and unions used for the direct DOS interface
8 * routines; includes macros to access the segment and offset
9 * values of far pointers, so that they may be used by the routines; and
10 * provides function prototypes for direct DOS interface functions.
11 *
12 *******************************************************************************/
13
14
15 #ifndef NO_EXT_KEYS /* extensions enabled */
16 #define _CDECL cdecl
17 #define _NEAR near
18 #else /* extensions not enabled */
19 #define _CDECL
20 #define _NEAR
21 #endif /* NO_EXT_KEYS */
22
23
24 #ifndef _REGS_DEFINED
25
26 /* word registers */
27
28 struct WORDREGS {
29 unsigned int ax;
30 unsigned int bx;
31 unsigned int cx;
32 unsigned int dx;
33 unsigned int si;
34 unsigned int di;
35 unsigned int cflag;
36 };
37
38
39 /* byte registers */
40
41 struct BYTEREGS {
42 unsigned char al, ah;
43 unsigned char bl, bh;
44 unsigned char cl, ch;
45 unsigned char dl, dh;
46 };
47
48
49 /* general purpose registers union -
50 * overlays the corresponding word and byte registers.
51 */
52
53 union REGS {
54 struct WORDREGS x;
55 struct BYTEREGS h;
56 };
57
58
59 /* segment registers */
60
61 struct SREGS {
62 unsigned int es;
63 unsigned int cs;
64 unsigned int ss;
65 unsigned int ds;
66 };
67
68 #define _REGS_DEFINED
69
70 #endif
71
72
73 /* dosexterror structure */
74
75 #ifndef _DOSERROR_DEFINED
76
77 struct DOSERROR {
78 int exterror;
79 char class;
80 char action;
81 char locus;
82 };
83
84 #define _DOSERROR_DEFINED
85
86 #endif
87
88
89 /* _dos_findfirst structure */
90
91 #ifndef _FIND_T_DEFINED
92
93 struct find_t {
94 char reserved[21];
95 char attrib;
96 unsigned wr_time;
97 unsigned wr_date;
98 long size;
99 char name[13];
100 };
101
102 #define _FIND_T_DEFINED
103
104 #endif
105
106
107 /* _dos_getdate/_dossetdate and _dos_gettime/_dos_settime structures */
108
109 #ifndef _DATETIME_T_DEFINED
110
111 struct dosdate_t {
112 unsigned char day; /* 1-31 */
113 unsigned char month; /* 1-12 */
114 unsigned int year; /* 1980-2099 */
115 unsigned char dayofweek; /* 0-6, 0=Sunday */
116 };
117
118 struct dostime_t {
119 unsigned char hour; /* 0-23 */
120 unsigned char minute; /* 0-59 */
121 unsigned char second; /* 0-59 */
122 unsigned char hsecond; /* 0-99 */
123 };
124
125 #define _DATETIME_T_DEFINED
126
127 #endif
128
129
130 /* _dos_getdiskfree structure */
131
132 #ifndef _DISKFREE_T_DEFINED
133
134 struct diskfree_t {
135 unsigned total_clusters;
136 unsigned avail_clusters;
137 unsigned sectors_per_cluster;
138 unsigned bytes_per_sector;
139 };
140
141 #define _DISKFREE_T_DEFINED
142
143 #endif
144
145
146 /* manifest constants for _hardresume result parameter */
147
148 #define _HARDERR_IGNORE 0 /* Ignore the error */
149 #define _HARDERR_RETRY 1 /* Retry the operation */
150 #define _HARDERR_ABORT 2 /* Abort program issuing Interrupt 23h */
151 #define _HARDERR_FAIL 3 /* Fail the system call in progress */
152 /* _HARDERR_FAIL is not supported on DOS 2.x */
153
154 /* File attribute constants */
155
156 #define _A_NORMAL 0x00 /* Normal file - No read/write restrictions */
157 #define _A_RDONLY 0x01 /* Read only file */
158 #define _A_HIDDEN 0x02 /* Hidden file */
159 #define _A_SYSTEM 0x04 /* System file */
160 #define _A_VOLID 0x08 /* Volume ID file */
161 #define _A_SUBDIR 0x10 /* Subdirectory */
162 #define _A_ARCH 0x20 /* Archive file */
163
164 /* macros to break MS C "far" pointers into their segment and offset
165 * components
166 */
167
168 #define FP_SEG(fp) (*((unsigned *)&(fp) + 1))
169 #define FP_OFF(fp) (*((unsigned *)&(fp)))
170
171
172 /* external variable declarations */
173
174 extern unsigned int _NEAR _CDECL _osversion;
175
176
177 /* function prototypes */
178
179 int _CDECL bdos(int, unsigned int, unsigned int);
180 void _CDECL _disable(void);
181 unsigned _CDECL _dos_allocmem(unsigned, unsigned *);
182 unsigned _CDECL _dos_close(int);
183 unsigned _CDECL _dos_creat(char *, unsigned, int *);
184 unsigned _CDECL _dos_creatnew(char *, unsigned, int *);
185 unsigned _CDECL _dos_findfirst(char *, unsigned, struct find_t *);
186 unsigned _CDECL _dos_findnext(struct find_t *);
187 unsigned _CDECL _dos_freemem(unsigned);
188 void _CDECL _dos_getdate(struct dosdate_t *);
189 void _CDECL _dos_getdrive(unsigned *);
190 unsigned _CDECL _dos_getdiskfree(unsigned, struct diskfree_t *);
191 unsigned _CDECL _dos_getfileattr(char *, unsigned *);
192 unsigned _CDECL _dos_getftime(int, unsigned *, unsigned *);
193 void _CDECL _dos_gettime(struct dostime_t *);
194 void _CDECL _dos_keep(unsigned, unsigned);
195 unsigned _CDECL _dos_open(char *, unsigned, int *);
196 unsigned _CDECL _dos_setblock(unsigned, unsigned, unsigned *);
197 unsigned _CDECL _dos_setdate(struct dosdate_t *);
198 void _CDECL _dos_setdrive(unsigned, unsigned *);
199 unsigned _CDECL _dos_setfileattr(char *, unsigned);
200 unsigned _CDECL _dos_setftime(int, unsigned, unsigned);
201 unsigned _CDECL _dos_settime(struct dostime_t *);
202 int _CDECL dosexterr(struct DOSERROR *);
203 void _CDECL _enable(void);
204 void _CDECL _hardresume(int);
205 void _CDECL _hardretn(int);
206 int _CDECL intdos(union REGS *, union REGS *);
207 int _CDECL intdosx(union REGS *, union REGS *, struct SREGS *);
208 int _CDECL int86(int, union REGS *, union REGS *);
209 int _CDECL int86x(int, union REGS *, union REGS *, struct SREGS *);
210 void _CDECL segread(struct SREGS *);
211
212
213 #ifndef NO_EXT_KEYS /* extensions enabled */
214 void _CDECL _chain_intr(void (_CDECL interrupt far *)());
215 void (_CDECL interrupt far * _CDECL _dos_getvect(unsigned))();
216 unsigned _CDECL _dos_read(int, void far *, unsigned, unsigned *);
217 void _CDECL _dos_setvect(unsigned, void (_CDECL interrupt far *)());
218 unsigned _CDECL _dos_write(int, void far *, unsigned, unsigned *);
219 void _CDECL _harderr(void (far *)());
220 #endif /* NO_EXT_KEYS */