OSDN Git Service

468af73c89d615af1ef5426dbca9a8485fbef25f
[mingw/mingw-org-wsl.git] / mingwrt / include / dos.h
1 /*
2  * dos.h
3  *
4  * Functions and structures inherited from MS-DOS.
5  *
6  * $Id$
7  *
8  * Written by Jan-Jaap van der Heijden
9  * Copyright (C) 1997-1999, 2001-2004, 2007, 2016, MinGW.org Project.
10  *
11  *
12  * Permission is hereby granted, free of charge, to any person obtaining a
13  * copy of this software and associated documentation files (the "Software"),
14  * to deal in the Software without restriction, including without limitation
15  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16  * and/or sell copies of the Software, and to permit persons to whom the
17  * Software is furnished to do so, subject to the following conditions:
18  *
19  * The above copyright notice, this permission notice, and the following
20  * disclaimer shall be included in all copies or substantial portions of
21  * the Software.
22  *
23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
26  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OF OR OTHER
29  * DEALINGS IN THE SOFTWARE.
30  *
31  */
32 #ifndef _DOS_H
33 #pragma GCC system_header
34
35 /* This header supports selective inclusion by <direct.h>, for delegated
36  * access to the content of <io.h>, and for declaration of the prototype
37  * and associated data structure for the _getdiskfree() function; since
38  * including <dos.h> in this manner does not make all of its content
39  * visible, we defer definition of its multiple inclusion guard...
40  */
41 #ifndef __DIRECT_H_SOURCED__
42  /* ...until we have determined that this inclusion is NOT a selective
43   * request from <direct.h>; in spite of it being obsolete, it appears
44   * that the user may have included <dos.h> directly.
45   */
46 #define _DOS_H
47 #warning "<dos.h> is obsolete; consider using <direct.h> instead."
48 #endif  /* !__DIRECT_H_SOURCED__ */
49
50 /* All MinGW headers are required to include <_mingw.h>; additionally,
51  * for DOS file attributes, we must include <io.h>.  By unconditionally
52  * including <io.h> here, we may delegate the inclusion of <_mingw.h> to
53  * it, while also allowing <direct.h> to delegate responsibility for the
54  * inclusion of both <_mingw.h> and <io.h> to us.
55  */
56 #include <io.h>
57
58 #ifndef RC_INVOKED
59
60 _BEGIN_C_DECLS
61
62 /* The following declarations are to be visible ONLY when <dos.h>
63  * is included in its own right; they represent entities which are
64  * present in CRTDLL.DLL, but not in MSVCRT.DLL
65  */
66 #if defined _DOS_H && ! defined __MSVCRT__
67 #ifndef __DECLSPEC_SUPPORTED
68
69 # define _basemajor    (*_imp___basemajor_dll)
70 # define _baseminor    (*_imp___baseminor_dll)
71 # define _baseversion  (*_imp___baseversion_dll)
72 # define _osmajor      (*_imp___osmajor_dll)
73 # define _osminor      (*_imp___osminor_dll)
74 # define _osmode       (*_imp___osmode_dll)
75
76 extern unsigned int *_imp___basemajor_dll;
77 extern unsigned int *_imp___baseminor_dll;
78 extern unsigned int *_imp___baseversion_dll;
79 extern unsigned int *_imp___osmajor_dll;
80 extern unsigned int *_imp___osminor_dll;
81 extern unsigned int *_imp___osmode_dll;
82
83 #else /* __DECLSPEC_SUPPORTED */
84
85 # define _basemajor    _basemajor_dll
86 # define _baseminor    _baseminor_dll
87 # define _baseversion  _baseversion_dll
88 # define _osmajor      _osmajor_dll
89 # define _osminor      _osminor_dll
90 # define _osmode       _osmode_dll
91
92 __MINGW_IMPORT unsigned int _basemajor_dll;
93 __MINGW_IMPORT unsigned int _baseminor_dll;
94 __MINGW_IMPORT unsigned int _baseversion_dll;
95 __MINGW_IMPORT unsigned int _osmajor_dll;
96 __MINGW_IMPORT unsigned int _osminor_dll;
97 __MINGW_IMPORT unsigned int _osmode_dll;
98
99 #endif  /* __DECLSPEC_SUPPORTED */
100 #endif  /* _DOS_H && !__MSVCRT__ */
101
102 /* The following section, which declares the _getdiskfree() function
103  * prototype, and also defines its associated _diskfree_t data structure,
104  * is to be processed both when including <dos.h> in its own right, and
105  * when selectively included by <direct.h>; however...
106  */
107 #if ! (defined _DOS_H && defined _DIRECT_H)
108  /* ...when both the _DOS_H guard, and the _DIRECT_H multiple inclusion
109   * guards have been defined, by the time we get to here, then this is
110   * <dos.h> inclusion in its own right, and we have ALREADY processed
111   * these definitions through selective inclusion by <direct.h>; we
112   * MUST NOT process them a second time.
113   */
114 #ifndef _NO_OLDNAMES
115 # define diskfree_t  _diskfree_t
116 #endif
117
118 struct _diskfree_t
119 { /* A structure in which to store information about disk
120    * free space, as returned by the _getdiskfree() function.
121    */
122   unsigned total_clusters;
123   unsigned avail_clusters;
124   unsigned sectors_per_cluster;
125   unsigned bytes_per_sector;
126 };
127
128 _CRTIMP __cdecl __MINGW_NOTHROW
129 unsigned _getdiskfree (unsigned, struct _diskfree_t *);
130
131 #endif  /* ! ( _DOS_H && _DIRECT_H) */
132
133 _END_C_DECLS
134
135 #endif  /* ! RC_INVOKED */
136 #endif  /* !_DOS_H: $RCSfile$: end of file */