OSDN Git Service

Correct project name references in mingwrt source files.
[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, 2022, MinGW.OSDN 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 /* If the user does include <dos.h> directly, we should raise an alert
48  * to advise that <direct.h> is the preferred alternative; however, the
49  * warning will interfere with the testsuite result...
50  */
51 #ifndef __IN_MINGWRT_TESTSUITE__
52 /* ...so we suppress it in this specific instance.
53  */
54 #warning "<dos.h> is obsolete; consider using <direct.h> instead."
55 #endif
56 #endif  /* !__DIRECT_H_SOURCED__ */
57
58 /* All MinGW headers are required to include <_mingw.h>; additionally,
59  * for DOS file attributes, we must include <io.h>.  By unconditionally
60  * including <io.h> here, we may delegate the inclusion of <_mingw.h> to
61  * it, while also allowing <direct.h> to delegate responsibility for the
62  * inclusion of both <_mingw.h> and <io.h> to us.
63  */
64 #include "io.h"
65
66 #ifndef RC_INVOKED
67
68 _BEGIN_C_DECLS
69
70 /* The following declarations are to be visible ONLY when <dos.h>
71  * is included in its own right; they represent entities which are
72  * present in CRTDLL.DLL, but not in MSVCRT.DLL
73  */
74 #if defined _DOS_H && ! defined __MSVCRT__
75 #ifndef __DECLSPEC_SUPPORTED
76
77 # define _basemajor    (*_imp___basemajor_dll)
78 # define _baseminor    (*_imp___baseminor_dll)
79 # define _baseversion  (*_imp___baseversion_dll)
80 # define _osmajor      (*_imp___osmajor_dll)
81 # define _osminor      (*_imp___osminor_dll)
82 # define _osmode       (*_imp___osmode_dll)
83
84 extern unsigned int *_imp___basemajor_dll;
85 extern unsigned int *_imp___baseminor_dll;
86 extern unsigned int *_imp___baseversion_dll;
87 extern unsigned int *_imp___osmajor_dll;
88 extern unsigned int *_imp___osminor_dll;
89 extern unsigned int *_imp___osmode_dll;
90
91 #else /* __DECLSPEC_SUPPORTED */
92
93 # define _basemajor    _basemajor_dll
94 # define _baseminor    _baseminor_dll
95 # define _baseversion  _baseversion_dll
96 # define _osmajor      _osmajor_dll
97 # define _osminor      _osminor_dll
98 # define _osmode       _osmode_dll
99
100 __MINGW_IMPORT unsigned int _basemajor_dll;
101 __MINGW_IMPORT unsigned int _baseminor_dll;
102 __MINGW_IMPORT unsigned int _baseversion_dll;
103 __MINGW_IMPORT unsigned int _osmajor_dll;
104 __MINGW_IMPORT unsigned int _osminor_dll;
105 __MINGW_IMPORT unsigned int _osmode_dll;
106
107 #endif  /* __DECLSPEC_SUPPORTED */
108 #endif  /* _DOS_H && !__MSVCRT__ */
109
110 /* The following section, which declares the _getdiskfree() function
111  * prototype, and also defines its associated _diskfree_t data structure,
112  * is to be processed both when including <dos.h> in its own right, and
113  * when selectively included by <direct.h>; however...
114  */
115 #if ! (defined _DOS_H && defined _DIRECT_H)
116  /* ...when both the _DOS_H guard, and the _DIRECT_H multiple inclusion
117   * guards have been defined, by the time we get to here, then this is
118   * <dos.h> inclusion in its own right, and we have ALREADY processed
119   * these definitions through selective inclusion by <direct.h>; we
120   * MUST NOT process them a second time.
121   */
122 #ifndef _NO_OLDNAMES
123 # define diskfree_t  _diskfree_t
124 #endif
125
126 struct _diskfree_t
127 { /* A structure in which to store information about disk
128    * free space, as returned by the _getdiskfree() function.
129    */
130   unsigned total_clusters;
131   unsigned avail_clusters;
132   unsigned sectors_per_cluster;
133   unsigned bytes_per_sector;
134 };
135
136 _CRTIMP __cdecl __MINGW_NOTHROW
137 unsigned _getdiskfree (unsigned, struct _diskfree_t *);
138
139 #endif  /* ! ( _DOS_H && _DIRECT_H) */
140
141 _END_C_DECLS
142
143 #endif  /* ! RC_INVOKED */
144 #endif  /* !_DOS_H: $RCSfile$: end of file */