summaryrefslogtreecommitdiffstats
path: root/private/utils/ifsutil/inc/supera.hxx
blob: c1c25c5859f96b0ee06f78bb4408b8ef9702763e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
/*++

Copyright (c) 1991 Microsoft Corporation

Module Name:

    supera.hxx

Abstract:

    This class models the root of a file system.  This abstract class is
    currently the base class of an HPFS and a FAT super area.

Author:

    Norbert Kusters (norbertk) 25-July-91

--*/

#if !defined(SUPERA_DEFN)

#define SUPERA_DEFN


#include "secrun.hxx"
#include "volume.hxx"

#if defined ( _AUTOCHECK_ )
#define IFSUTIL_EXPORT
#elif defined ( _IFSUTIL_MEMBER_ )
#define IFSUTIL_EXPORT    __declspec(dllexport)
#else
#define IFSUTIL_EXPORT    __declspec(dllimport)
#endif


enum PHYSTYPE { // ptype
        PHYS_REMOVABLE,         // physical drive is removable
        PHYS_FIXED = 0x80       // physical drive is fixed
};

//
// These symbols are used by Chkdsk functions to return an appropriate
// exit status to the chkdsk program.
//

#define CHKDSK_EXIT_SUCCESS         0
#define CHKDSK_EXIT_ERRS_FIXED      1
#define CHKDSK_EXIT_MINOR_ERRS      2       // whether or not "/f"
#define CHKDSK_EXIT_COULD_NOT_CHK   3
#define CHKDSK_EXIT_ERRS_NOT_FIXED  3
#define CHKDSK_EXIT_COULD_NOT_FIX   3


DECLARE_CLASS( SUPERAREA );
DECLARE_CLASS( NUMBER_SET );
DECLARE_CLASS( MESSAGE );
DECLARE_CLASS( WSTRING );


class SUPERAREA : public SECRUN {

    public:

            VIRTUAL
            IFSUTIL_EXPORT
        ~SUPERAREA(
            );

        VIRTUAL
        PVOID
        GetBuf(
            );

        VIRTUAL
        BOOLEAN
        Create(
            IN      PCNUMBER_SET    BadSectors,
            IN OUT  PMESSAGE        Message,
            IN      PCWSTRING       Label       DEFAULT NULL,
            IN      ULONG           ClusterSize DEFAULT 0,
            IN      ULONG           VirtualSize DEFAULT 0
            ) PURE;

        VIRTUAL
        BOOLEAN
        VerifyAndFix(
            IN      FIX_LEVEL   FixLevel,
            IN OUT  PMESSAGE    Message,
            IN      BOOLEAN     Verbose         DEFAULT FALSE,
            IN      BOOLEAN     OnlyIfDirty     DEFAULT FALSE,
            IN      BOOLEAN     RecoverFree     DEFAULT FALSE,
            IN      BOOLEAN     RecoverAlloc    DEFAULT FALSE,
            IN      BOOLEAN     ResizeLogFile   DEFAULT FALSE,
            IN      ULONG       LogFileSize     DEFAULT 0,
            OUT     PULONG      ExitStatus      DEFAULT NULL,
            IN      PCWSTRING   DriveLetter     DEFAULT NULL
            ) PURE;

        VIRTUAL
        BOOLEAN
        RecoverFile(
            IN      PCWSTRING   FullPathFileName,
            IN OUT  PMESSAGE    Message
            ) PURE;

        VIRTUAL
        PARTITION_SYSTEM_ID
            QuerySystemId(
            ) CONST PURE;

        STATIC
        IFSUTIL_EXPORT
        VOLID
        ComputeVolId(
            IN  VOLID   Seed    DEFAULT 0
            );

    protected:

                IFSUTIL_EXPORT
                DECLARE_CONSTRUCTOR( SUPERAREA );

        NONVIRTUAL
        IFSUTIL_EXPORT
        BOOLEAN
        Initialize(
            IN OUT  PMEM                Mem,
            IN OUT  PLOG_IO_DP_DRIVE    Drive,
            IN      SECTORCOUNT         NumberOfSectors,
            IN OUT  PMESSAGE            Message
            );

#if !defined( _SETUP_LOADER_ )

            NONVIRTUAL
            BOOLEAN
            SetSystemId(
            );

#endif // _SETUP_LOADER_

        PLOG_IO_DP_DRIVE    _drive;

    private:

                NONVIRTUAL
                VOID
                Construct(
                        );

        NONVIRTUAL
        VOID
        Destroy(
            );

};


INLINE
PVOID
SUPERAREA::GetBuf(
    )
/*++

Routine Description:

    This routine returns a pointer to the beginning of the read/write
    buffer.

Arguments:

    None.

Return Value:

    A pointer to a read/write buffer.

--*/
{
    return SECRUN::GetBuf();
}


#if !defined( _SETUP_LOADER_ )

INLINE
BOOLEAN
SUPERAREA::SetSystemId(
    )
/*++

Routine Description:

    Set the current volume's file system sub-type.

    The volume stores the file system type on disk with a
    strong bias to the FAT.  However, this may not continue
    in the future so a common interface to this type  is supported.

    The current on disk file system subtypes are:

                UNKNOWN, no format done yet
                12 bit fat
                16 bit fat on a < 32M volume
                16 bit fat on a >= 32M volume
                IFS

   OS/2 2.0 does not support this interface so we must set the
   information via the MBR, NT will provide an ioctl to set this
   information.

   This information MUST be maintained to stay disk compatable.

   This activity should only be done by format so this is
   a protected method.

Arguments:

    None.

Return Value:

    FALSE   - Failure.
    TRUE    - Success.

--*/
{
    return _drive->SetSystemId(QuerySystemId());
}

#endif // _SETUP_LOADER_
#endif // SUPERA_DEFN