source: Daodan/MinGW/include/winioctl.h@ 1161

Last change on this file since 1161 was 1046, checked in by alloc, 8 years ago

Daodan: Added Windows MinGW and build batch file

File size: 9.7 KB
Line 
1/*
2 * winioctl.h
3 *
4 * Windows IOCTL subsystem declarations and definitions; includes some
5 * elements in common with the Windows Device Driver Kit.
6 *
7 * $Id: winioctl.h,v ed94503bab84 2016/05/04 19:34:24 keithmarshall $
8 *
9 * Written by Anders Norlander <anorland@hem2.passagen.se>
10 * Copyright (C) 1999-2005, 2009-2011, 2015, MinGW.org Project.
11 *
12 *
13 * Permission is hereby granted, free of charge, to any person obtaining a
14 * copy of this software and associated documentation files (the "Software"),
15 * to deal in the Software without restriction, including without limitation
16 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
17 * and/or sell copies of the Software, and to permit persons to whom the
18 * Software is furnished to do so, subject to the following conditions:
19 *
20 * The above copyright notice, this permission notice, and the following
21 * disclaimer shall be included in all copies or substantial portions of
22 * the Software.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OF OR OTHER
30 * DEALINGS IN THE SOFTWARE.
31 *
32 */
33#ifndef _WINIOCTL_H
34#define _WINIOCTL_H
35#pragma GCC system_header
36
37#define __WINIOCTL_H_SOURCED__
38
39#ifndef _WINDOWS_H
40/* FIXME: MSDN says that including <windows.h> should suffice to expose
41 * the content of this header, but this implementation does not satisfy
42 * that requirement. Furthermore, this implementation cannot itself be
43 * included, unless <windows.h>, (or at least the content from those of
44 * its subsidiary headers which define Microsoft's peculiar, obfuscated
45 * data types), has been included first; enforce this requirement.
46 */
47#include <windows.h>
48#endif
49
50/* This file is required to provide a number of definitions which are
51 * duplicated in the Windows DDK headers; retrieve these definitions by
52 * selective inclusion from the appropriate DDK header files...
53 */
54#include <ddk/winddk.h>
55#include <ddk/ntdddisk.h>
56
57_BEGIN_C_DECLS
58
59#define HIST_NO_OF_BUCKETS 24
60#define HISTOGRAM_BUCKET_SIZE sizeof(HISTOGRAM_BUCKET)
61#define DISK_HISTOGRAM_SIZE sizeof(DISK_HISTOGRAM)
62
63#define IOCTL_DISK_LOGGING CTL_CODE(IOCTL_DISK_BASE,10,METHOD_BUFFERED,FILE_ANY_ACCESS)
64#define IOCTL_DISK_HISTOGRAM_STRUCTURE CTL_CODE(IOCTL_DISK_BASE,12,METHOD_BUFFERED,FILE_ANY_ACCESS)
65#define IOCTL_DISK_HISTOGRAM_DATA CTL_CODE(IOCTL_DISK_BASE,13,METHOD_BUFFERED,FILE_ANY_ACCESS)
66#define IOCTL_DISK_HISTOGRAM_RESET CTL_CODE(IOCTL_DISK_BASE,14,METHOD_BUFFERED,FILE_ANY_ACCESS)
67#define IOCTL_DISK_REQUEST_STRUCTURE CTL_CODE(IOCTL_DISK_BASE,15,METHOD_BUFFERED,FILE_ANY_ACCESS)
68#define IOCTL_DISK_REQUEST_DATA CTL_CODE(IOCTL_DISK_BASE,16,METHOD_BUFFERED,FILE_ANY_ACCESS)
69#define IOCTL_DISK_UPDATE_PROPERTIES CTL_CODE(IOCTL_DISK_BASE,0x50,METHOD_BUFFERED,FILE_ANY_ACCESS)
70#define IOCTL_DISK_MEDIA_REMOVAL CTL_CODE(IOCTL_DISK_BASE,0x201,METHOD_BUFFERED,FILE_READ_ACCESS)
71#define IOCTL_DISK_EJECT_MEDIA CTL_CODE(IOCTL_DISK_BASE,0x202,METHOD_BUFFERED,FILE_READ_ACCESS)
72#define IOCTL_DISK_LOAD_MEDIA CTL_CODE(IOCTL_DISK_BASE,0x203,METHOD_BUFFERED,FILE_READ_ACCESS)
73#define IOCTL_DISK_RELEASE CTL_CODE(IOCTL_DISK_BASE,0x205,METHOD_BUFFERED,FILE_READ_ACCESS)
74#define IOCTL_DISK_REMOVE_DEVICE CTL_CODE(IOCTL_DISK_BASE,0x207,METHOD_BUFFERED,FILE_READ_ACCESS)
75#define IOCTL_SERIAL_LSRMST_INSERT CTL_CODE(FILE_DEVICE_SERIAL_PORT,31,METHOD_BUFFERED,FILE_ANY_ACCESS)
76
77/* FIXME: also in ddk/ntddvol.h; should be factored out.
78 */
79#define IOCTL_VOLUME_BASE ((ULONG)('V'))
80#define IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS CTL_CODE(IOCTL_VOLUME_BASE, 0, METHOD_BUFFERED, FILE_ANY_ACCESS)
81#define IOCTL_VOLUME_IS_CLUSTERED CTL_CODE(IOCTL_VOLUME_BASE, 12, METHOD_BUFFERED, FILE_ANY_ACCESS)
82
83#define FSCTL_LOCK_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM,6,METHOD_BUFFERED,FILE_ANY_ACCESS)
84#define FSCTL_UNLOCK_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM,7,METHOD_BUFFERED,FILE_ANY_ACCESS)
85#define FSCTL_DISMOUNT_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM,8,METHOD_BUFFERED,FILE_ANY_ACCESS)
86#define FSCTL_MOUNT_DBLS_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM,13,METHOD_BUFFERED,FILE_ANY_ACCESS)
87#define FSCTL_GET_COMPRESSION CTL_CODE(FILE_DEVICE_FILE_SYSTEM,15,METHOD_BUFFERED,FILE_ANY_ACCESS)
88#define FSCTL_SET_COMPRESSION CTL_CODE(FILE_DEVICE_FILE_SYSTEM,16,METHOD_BUFFERED,FILE_READ_DATA|FILE_WRITE_DATA)
89#define FSCTL_READ_COMPRESSION CTL_CODE(FILE_DEVICE_FILE_SYSTEM,17,METHOD_NEITHER,FILE_READ_DATA)
90#define FSCTL_WRITE_COMPRESSION CTL_CODE(FILE_DEVICE_FILE_SYSTEM,18,METHOD_NEITHER,FILE_WRITE_DATA)
91#define FSCTL_GET_NTFS_VOLUME_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM,25,METHOD_BUFFERED,FILE_ANY_ACCESS)
92#define FSCTL_GET_VOLUME_BITMAP CTL_CODE(FILE_DEVICE_FILE_SYSTEM,27,METHOD_NEITHER,FILE_ANY_ACCESS)
93#define FSCTL_GET_RETRIEVAL_POINTERS CTL_CODE(FILE_DEVICE_FILE_SYSTEM,28,METHOD_NEITHER,FILE_ANY_ACCESS)
94#define FSCTL_MOVE_FILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM,29,METHOD_BUFFERED,FILE_ANY_ACCESS)
95#define FSCTL_GET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM,42,METHOD_BUFFERED,FILE_ANY_ACCESS)
96#define FSCTL_SET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM,41,METHOD_BUFFERED,FILE_ANY_ACCESS)
97#define FSCTL_DELETE_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM,43,METHOD_BUFFERED,FILE_ANY_ACCESS)
98#define FSCTL_SET_SPARSE CTL_CODE(FILE_DEVICE_FILE_SYSTEM,49,METHOD_BUFFERED,FILE_SPECIAL_ACCESS)
99#define FSCTL_ALLOW_EXTENDED_DASD_IO CTL_CODE(FILE_DEVICE_FILE_SYSTEM,32,METHOD_NEITHER,FILE_ANY_ACCESS)
100
101typedef DWORD DEVICE_TYPE;
102
103enum
104{ SERIAL_LSRMST_ESCAPE = 0,
105 SERIAL_LSRMST_LSR_DATA = 1,
106 SERIAL_LSRMST_LSR_NODATA = 2,
107 SERIAL_LSRMST_MST = 3
108};
109
110enum
111{ DISK_LOGGING_START = 0,
112 DISK_LOGGING_STOP = 1,
113 DISK_LOGGING_DUMP = 2,
114 DISK_BINNING = 3
115};
116
117typedef WORD BAD_TRACK_NUMBER, *PBAD_TRACK_NUMBER;
118typedef enum _BIN_TYPES {RequestSize, RequestLocation} BIN_TYPES;
119
120typedef
121struct _BIN_RANGE
122{ LARGE_INTEGER StartValue;
123 LARGE_INTEGER Length;
124} BIN_RANGE, *PBIN_RANGE;
125
126typedef
127struct _BIN_COUNT
128{ BIN_RANGE BinRange;
129 DWORD BinCount;
130} BIN_COUNT, *PBIN_COUNT;
131
132typedef
133struct _BIN_RESULTS
134{ DWORD NumberOfBins;
135 BIN_COUNT BinCounts[1];
136} BIN_RESULTS, *PBIN_RESULTS;
137
138typedef
139struct _DISK_RECORD
140{ LARGE_INTEGER ByteOffset;
141 LARGE_INTEGER StartTime;
142 LARGE_INTEGER EndTime;
143 PVOID VirtualAddress;
144 DWORD NumberOfBytes;
145 BYTE DeviceNumber;
146 BOOLEAN ReadRequest;
147} DISK_RECORD, *PDISK_RECORD;
148
149typedef
150struct _DISK_LOGGING
151{ BYTE Function;
152 PVOID BufferAddress;
153 DWORD BufferSize;
154} DISK_LOGGING, *PDISK_LOGGING;
155
156typedef
157struct DiskQuotaUserInformation
158{ LONGLONG QuotaUsed;
159 LONGLONG QuotaThreshold;
160 LONGLONG QuotaLimit;
161} DISKQUOTA_USER_INFORMATION, *PDISKQUOTA_USER_INFORMATION;
162
163typedef
164struct _HISTOGRAM_BUCKET
165{ DWORD Reads;
166 DWORD Writes;
167} HISTOGRAM_BUCKET, *PHISTOGRAM_BUCKET;
168
169typedef
170struct _DISK_HISTOGRAM
171{ LARGE_INTEGER DiskSize;
172 LARGE_INTEGER Start;
173 LARGE_INTEGER End;
174 LARGE_INTEGER Average;
175 LARGE_INTEGER AverageRead;
176 LARGE_INTEGER AverageWrite;
177 DWORD Granularity;
178 DWORD Size;
179 DWORD ReadCount;
180 DWORD WriteCount;
181 PHISTOGRAM_BUCKET Histogram;
182} DISK_HISTOGRAM, *PDISK_HISTOGRAM;
183
184typedef
185struct _DISK_EXTENT
186{ DWORD DiskNumber;
187 LARGE_INTEGER StartingOffset;
188 LARGE_INTEGER ExtentLength;
189} DISK_EXTENT, *PDISK_EXTENT;
190
191typedef
192struct _VOLUME_DISK_EXTENTS
193{ DWORD NumberOfDiskExtents;
194 DISK_EXTENT Extents[1];
195} VOLUME_DISK_EXTENTS, *PVOLUME_DISK_EXTENTS;
196
197typedef
198struct _DRIVE_LAYOUT_INFORMATION
199{ DWORD PartitionCount;
200 DWORD Signature;
201 PARTITION_INFORMATION PartitionEntry[1];
202} DRIVE_LAYOUT_INFORMATION, *PDRIVE_LAYOUT_INFORMATION;
203
204typedef
205struct _DRIVE_LAYOUT_INFORMATION_EX
206{ DWORD PartitionStyle;
207 DWORD PartitionCount;
208 _ANONYMOUS_UNION union
209 { DRIVE_LAYOUT_INFORMATION_MBR Mbr;
210 DRIVE_LAYOUT_INFORMATION_GPT Gpt;
211 };
212 PARTITION_INFORMATION_EX PartitionEntry[1];
213} DRIVE_LAYOUT_INFORMATION_EX, *PDRIVE_LAYOUT_INFORMATION_EX;
214
215typedef struct
216{ HANDLE FileHandle;
217 LARGE_INTEGER StartingVcn;
218 LARGE_INTEGER StartingLcn;
219 DWORD ClusterCount;
220} MOVE_FILE_DATA, *PMOVE_FILE_DATA;
221
222typedef
223struct _PERF_BIN
224{ DWORD NumberOfBins;
225 DWORD TypeOfBin;
226 BIN_RANGE BinsRanges[1];
227} PERF_BIN, *PPERF_BIN;
228
229typedef
230struct _PREVENT_MEDIA_REMOVAL
231{ BOOLEAN PreventMediaRemoval;
232} PREVENT_MEDIA_REMOVAL, *PPREVENT_MEDIA_REMOVAL;
233
234typedef
235struct RETRIEVAL_POINTERS_BUFFER
236{ DWORD ExtentCount;
237 LARGE_INTEGER StartingVcn;
238 struct
239 { LARGE_INTEGER NextVcn;
240 LARGE_INTEGER Lcn;
241 } Extents[1];
242} RETRIEVAL_POINTERS_BUFFER, *PRETRIEVAL_POINTERS_BUFFER;
243
244typedef struct
245{ LARGE_INTEGER StartingLcn;
246} STARTING_LCN_INPUT_BUFFER, *PSTARTING_LCN_INPUT_BUFFER;
247
248typedef struct
249{ LARGE_INTEGER StartingVcn;
250} STARTING_VCN_INPUT_BUFFER, *PSTARTING_VCN_INPUT_BUFFER;
251
252typedef struct
253{ LARGE_INTEGER StartingLcn;
254 LARGE_INTEGER BitmapSize;
255 BYTE Buffer[1];
256} VOLUME_BITMAP_BUFFER, *PVOLUME_BITMAP_BUFFER;
257
258typedef struct
259{ LARGE_INTEGER VolumeSerialNumber;
260 LARGE_INTEGER NumberSectors;
261 LARGE_INTEGER TotalClusters;
262 LARGE_INTEGER FreeClusters;
263 LARGE_INTEGER TotalReserved;
264 DWORD BytesPerSector;
265 DWORD BytesPerCluster;
266 DWORD BytesPerFileRecordSegment;
267 DWORD ClustersPerFileRecordSegment;
268 LARGE_INTEGER MftValidDataLength;
269 LARGE_INTEGER MftStartLcn;
270 LARGE_INTEGER Mft2StartLcn;
271 LARGE_INTEGER MftZoneStart;
272 LARGE_INTEGER MftZoneEnd;
273} NTFS_VOLUME_DATA_BUFFER, *PNTFS_VOLUME_DATA_BUFFER;
274
275_END_C_DECLS
276
277#undef __WINIOCTL_H_SOURCED__
278#endif /* _WINIOCTL_H: $RCSfile: winioctl.h,v $: end of file */
Note: See TracBrowser for help on using the repository browser.