root/lang/csharp/Misuzilla.Build.Tasks.Eject/Misuzilla.Build.Tasks.Eject/Eject.cs

Revision 349, 26.5 kB (checked in by mayuki, 15 months ago)

lang/csharp: import Misuzilla.Build.Tasks.Eject

  • Property svn:keywords set to Id
Line 
1// $Id$
2using System;
3using System.IO;
4using System.Text;
5using System.Threading;
6using System.Resources;
7using System.Collections.Generic;
8using System.Runtime.InteropServices;
9using Microsoft.Build.Framework;
10using Microsoft.Win32.SafeHandles;
11
12namespace Misuzilla.Build.Tasks
13{
14    public class Eject : Microsoft.Build.Utilities.Task
15    {
16        private String _drive;
17
18        [Required]
19        public String Drive
20        {
21            get { return _drive;  }
22            set { _drive = value.Trim(); }
23        }
24
25        public override bool Execute()
26        {
27            if (_drive.Length != 1 && !Char.IsLetter(_drive[0]))
28            {
29                Log.LogWarning(Resource.InvalidDrive, _drive);
30                return true;
31            }
32
33            try
34            {
35                DriveInfo driveInfo = new DriveInfo(_drive);
36                if (driveInfo.DriveType != DriveType.CDRom)
37                {
38                    Log.LogWarning(Resource.DriveIsNotCDRom, _drive);
39                    return true;
40                    //return false;
41                }
42            }
43            catch (IOException e)
44            {
45                Log.LogWarningFromException(e);
46                return true;
47                //return false;
48            }
49
50            Log.LogMessage(Resource.EjectDrive, _drive);
51            using (SafeFileHandle hDevice = Win32.CreateFile(String.Format(@"\\.\{0}:", _drive), FileAccess.Read, FileShare.Read, IntPtr.Zero, FileMode.Open, Win32.EFileAttributes.Normal, IntPtr.Zero))
52            {
53                UInt32 retVal = 0;
54                NativeOverlapped retOverlapped = new NativeOverlapped();
55                Win32.DeviceIoControl(hDevice, Win32.EIOControlCode.StorageEjectMedia, null, 0, null, 0, ref retVal, ref retOverlapped);
56            }
57            return true;
58        }
59    }
60
61    internal static class Win32
62    {
63        [DllImport("Kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
64        public static extern SafeFileHandle CreateFile(
65            string fileName,
66            [MarshalAs(UnmanagedType.U4)] FileAccess fileAccess,
67            [MarshalAs(UnmanagedType.U4)] FileShare fileShare,
68            IntPtr securityAttributes,
69            [MarshalAs(UnmanagedType.U4)] FileMode creationDisposition,
70            [MarshalAs(UnmanagedType.U4)] EFileAttributes flags,
71            IntPtr template);
72        [DllImport("Kernel32.dll", SetLastError = false, CharSet = CharSet.Auto)]
73        public static extern bool DeviceIoControl(
74            Microsoft.Win32.SafeHandles.SafeFileHandle hDevice,
75            EIOControlCode IoControlCode,
76            [MarshalAs(UnmanagedType.AsAny)]
77            [In] object InBuffer,
78            uint nInBufferSize,
79            [MarshalAs(UnmanagedType.AsAny)]
80            [Out] object OutBuffer,
81            uint nOutBufferSize,
82            ref uint pBytesReturned,
83            [In] ref System.Threading.NativeOverlapped Overlapped
84        );
85
86        [Flags]
87        public enum EFileAccess : uint
88        {
89            /// <summary>
90            ///
91            /// </summary>
92            GenericRead = 0x80000000,
93            /// <summary>
94            ///
95            /// </summary>
96            GenericWrite = 0x40000000,
97            /// <summary>
98            ///
99            /// </summary>
100            GenericExecute = 0x20000000,
101            /// <summary>
102            ///
103            /// </summary>
104            GenericAll = 0x10000000
105        }
106
107        [Flags]
108        public enum EFileShare : uint
109        {
110            /// <summary>
111            ///
112            /// </summary>
113            None = 0x00000000,
114            /// <summary>
115            /// Enables subsequent open operations on an object to request read access.
116            /// Otherwise, other processes cannot open the object if they request read access.
117            /// If this flag is not specified, but the object has been opened for read access, the function fails.
118            /// </summary>
119            Read = 0x00000001,
120            /// <summary>
121            /// Enables subsequent open operations on an object to request write access.
122            /// Otherwise, other processes cannot open the object if they request write access.
123            /// If this flag is not specified, but the object has been opened for write access, the function fails.
124            /// </summary>
125            Write = 0x00000002,
126            /// <summary>
127            /// Enables subsequent open operations on an object to request delete access.
128            /// Otherwise, other processes cannot open the object if they request delete access.
129            /// If this flag is not specified, but the object has been opened for delete access, the function fails.
130            /// </summary>
131            Delete = 0x00000004
132        }
133
134        public enum ECreationDisposition : uint
135        {
136            /// <summary>
137            /// Creates a new file. The function fails if a specified file exists.
138            /// </summary>
139            New = 1,
140            /// <summary>
141            /// Creates a new file, always.
142            /// If a file exists, the function overwrites the file, clears the existing attributes, combines the specified file attributes,
143            /// and flags with FILE_ATTRIBUTE_ARCHIVE, but does not set the security descriptor that the SECURITY_ATTRIBUTES structure specifies.
144            /// </summary>
145            CreateAlways = 2,
146            /// <summary>
147            /// Opens a file. The function fails if the file does not exist.
148            /// </summary>
149            OpenExisting = 3,
150            /// <summary>
151            /// Opens a file, always.
152            /// If a file does not exist, the function creates a file as if dwCreationDisposition is CREATE_NEW.
153            /// </summary>
154            OpenAlways = 4,
155            /// <summary>
156            /// Opens a file and truncates it so that its size is 0 (zero) bytes. The function fails if the file does not exist.
157            /// The calling process must open the file with the GENERIC_WRITE access right.
158            /// </summary>
159            TruncateExisting = 5
160        }
161
162        [Flags]
163        public enum EFileAttributes : uint
164        {
165            Readonly = 0x00000001,
166            Hidden = 0x00000002,
167            System = 0x00000004,
168            Directory = 0x00000010,
169            Archive = 0x00000020,
170            Device = 0x00000040,
171            Normal = 0x00000080,
172            Temporary = 0x00000100,
173            SparseFile = 0x00000200,
174            ReparsePoint = 0x00000400,
175            Compressed = 0x00000800,
176            Offline = 0x00001000,
177            NotContentIndexed = 0x00002000,
178            Encrypted = 0x00004000,
179            Write_Through = 0x80000000,
180            Overlapped = 0x40000000,
181            NoBuffering = 0x20000000,
182            RandomAccess = 0x10000000,
183            SequentialScan = 0x08000000,
184            DeleteOnClose = 0x04000000,
185            BackupSemantics = 0x02000000,
186            PosixSemantics = 0x01000000,
187            OpenReparsePoint = 0x00200000,
188            OpenNoRecall = 0x00100000,
189            FirstPipeInstance = 0x00080000
190        }
191
192        [Flags]
193        public enum EMethod : uint
194        {
195            Buffered    = 0,
196            InDirect    = 1,
197            OutDirect    = 2,
198            Neither        = 3
199        }   
200
201        [Flags]
202        public enum EFileDevice : uint
203        {
204            Beep                = 0x00000001,
205            CDRom                = 0x00000002,
206            CDRomFileSytem        = 0x00000003,
207            Controller            = 0x00000004,
208            Datalink            = 0x00000005,
209            Dfs                    = 0x00000006,
210            Disk                = 0x00000007,
211            DiskFileSystem        = 0x00000008,
212            FileSystem            = 0x00000009,
213            InPortPort            = 0x0000000a,
214            Keyboard            = 0x0000000b,
215            Mailslot            = 0x0000000c,
216            MidiIn                = 0x0000000d,
217            MidiOut                = 0x0000000e,
218            Mouse                = 0x0000000f,
219            MultiUncProvider    = 0x00000010,
220            NamedPipe            = 0x00000011,
221            Network                = 0x00000012,
222            NetworkBrowser        = 0x00000013,
223            NetworkFileSystem    = 0x00000014,
224            Null                = 0x00000015,
225            ParellelPort        = 0x00000016,
226            PhysicalNetcard        = 0x00000017,
227            Printer                = 0x00000018,
228            Scanner                = 0x00000019,
229            SerialMousePort        = 0x0000001a,
230            SerialPort            = 0x0000001b,
231            Screen                = 0x0000001c,
232            Sound                = 0x0000001d,
233            Streams                = 0x0000001e,
234            Tape                = 0x0000001f,
235            TapeFileSystem        = 0x00000020,
236            Transport            = 0x00000021,
237            Unknown                = 0x00000022,
238            Video                = 0x00000023,
239            VirtualDisk            = 0x00000024,
240            WaveIn                = 0x00000025,
241            WaveOut                = 0x00000026,
242            Port8042            = 0x00000027,
243            NetworkRedirector    = 0x00000028,
244            Battery                = 0x00000029,
245            BusExtender            = 0x0000002a,
246            Modem                = 0x0000002b,
247            Vdm                    = 0x0000002c,
248            MassStorage            = 0x0000002d,
249            Smb                    = 0x0000002e,
250            Ks                    = 0x0000002f,
251            Changer                = 0x00000030,
252            Smartcard            = 0x00000031,
253            Acpi                = 0x00000032,
254            Dvd                    = 0x00000033,
255            FullscreenVideo        = 0x00000034,
256            DfsFileSystem        = 0x00000035,
257            DfsVolume            = 0x00000036,
258            Serenum                = 0x00000037,
259            Termsrv                = 0x00000038,
260            Ksec                = 0x00000039
261        }
262
263        [Flags]
264        public enum EIOControlCode : uint
265        {
266            // STORAGE
267            StorageBase                     = EFileDevice.MassStorage,
268            StorageCheckVerify                 = (StorageBase<<16) | (0x0200<<2) | EMethod.Buffered | (FileAccess.Read<<14),
269            StorageCheckVerify2             = (StorageBase<<16) | (0x0200<<2) | EMethod.Buffered | (0<<14), // FileAccess.Any
270            StorageMediaRemoval                = (StorageBase<<16) | (0x0201<<2) | EMethod.Buffered | (FileAccess.Read<<14),
271            StorageEjectMedia                = (StorageBase<<16) | (0x0202<<2) | EMethod.Buffered | (FileAccess.Read<<14),
272            StorageLoadMedia                = (StorageBase<<16) | (0x0203<<2) | EMethod.Buffered | (FileAccess.Read<<14),
273            StorageLoadMedia2                  = (StorageBase<<16) | (0x0203<<2) | EMethod.Buffered | (0<<14),
274            StorageReserve                    = (StorageBase<<16) | (0x0204<<2) | EMethod.Buffered | (FileAccess.Read<<14),
275            StorageRelease                    = (StorageBase<<16) | (0x0205<<2) | EMethod.Buffered | (FileAccess.Read<<14),
276            StorageFindNewDevices            = (StorageBase<<16) | (0x0206<<2) | EMethod.Buffered | (FileAccess.Read<<14),
277            StorageEjectionControl            = (StorageBase<<16) | (0x0250<<2) | EMethod.Buffered | (0<<14),
278            StorageMcnControl                = (StorageBase<<16) | (0x0251<<2) | EMethod.Buffered | (0<<14),
279            StorageGetMediaTypes            = (StorageBase<<16) | (0x0300<<2) | EMethod.Buffered | (0<<14),
280            StorageGetMediaTypesEx            = (StorageBase<<16) | (0x0301<<2) | EMethod.Buffered | (0<<14),
281            StorageResetBus                    = (StorageBase<<16) | (0x0400<<2) | EMethod.Buffered | (FileAccess.Read<<14),
282            StorageResetDevice                = (StorageBase<<16) | (0x0401<<2) | EMethod.Buffered | (FileAccess.Read<<14),
283            StorageGetDeviceNumber            = (StorageBase<<16) | (0x0420<<2) | EMethod.Buffered | (0<<14),
284            StoragePredictFailure            = (StorageBase<<16) | (0x0440<<2) | EMethod.Buffered | (0<<14),
285            StorageObsoleteResetBus            = (StorageBase<<16) | (0x0400<<2) | EMethod.Buffered | ((FileAccess.Read | FileAccess.Write)<<14),
286            StorageObsoleteResetDevice        = (StorageBase<<16) | (0x0401<<2) | EMethod.Buffered | ((FileAccess.Read | FileAccess.Write)<<14),
287            // DISK
288            DiskBase                        = EFileDevice.Disk,
289            DiskGetDriveGeometry            = (DiskBase<<16)|(0x0000<<2)|EMethod.Buffered|(0<<14),
290            DiskGetPartitionInfo            = (DiskBase<<16)|(0x0001<<2)|EMethod.Buffered|(FileAccess.Read<<14),
291            DiskSetPartitionInfo            = (DiskBase<<16)|(0x0002<<2)|EMethod.Buffered|((FileAccess.Read | FileAccess.Write)<<14),
292            DiskGetDriveLayout                = (DiskBase<<16)|(0x0003<<2)|EMethod.Buffered|(FileAccess.Read<<14),
293            DiskSetDriveLayout                = (DiskBase<<16)|(0x0004<<2)|EMethod.Buffered|((FileAccess.Read | FileAccess.Write)<<14),
294            DiskVerify                        = (DiskBase<<16)|(0x0005<<2)|EMethod.Buffered|(0<<14),
295            DiskFormatTracks                = (DiskBase<<16)|(0x0006<<2)|EMethod.Buffered|((FileAccess.Read | FileAccess.Write)<<14),
296            DiskReassignBlocks                = (DiskBase<<16)|(0x0007<<2)|EMethod.Buffered|((FileAccess.Read | FileAccess.Write)<<14),
297            DiskPerformance                    = (DiskBase<<16)|(0x0008<<2)|EMethod.Buffered|(0<<14),
298            DiskIsWritable                    = (DiskBase<<16)|(0x0009<<2)|EMethod.Buffered|(0<<14),
299            DiskLogging                        = (DiskBase<<16)|(0x000a<<2)|EMethod.Buffered|(0<<14),
300            DiskFormatTracksEx                = (DiskBase<<16)|(0x000b<<2)|EMethod.Buffered|((FileAccess.Read | FileAccess.Write)<<14),
301            DiskHistogramStructure            = (DiskBase<<16)|(0x000c<<2)|EMethod.Buffered|(0<<14),
302            DiskHistogramData                = (DiskBase<<16)|(0x000d<<2)|EMethod.Buffered|(0<<14),
303            DiskHistogramReset                = (DiskBase<<16)|(0x000e<<2)|EMethod.Buffered|(0<<14),
304            DiskRequestStructure            = (DiskBase<<16)|(0x000f<<2)|EMethod.Buffered|(0<<14),
305            DiskRequestData                    = (DiskBase<<16)|(0x0010<<2)|EMethod.Buffered|(0<<14),
306            DiskControllerNumber            = (DiskBase<<16)|(0x0011<<2)|EMethod.Buffered|(0<<14),
307            DiskSmartGetVersion                = (DiskBase<<16)|(0x0020<<2)|EMethod.Buffered|(FileAccess.Read<<14),
308            DiskSmartSendDriveCommand        = (DiskBase<<16)|(0x0021<<2)|EMethod.Buffered|((FileAccess.Read | FileAccess.Write)<<14),
309            DiskSmartRcvDriveData            = (DiskBase<<16)|(0x0022<<2)|EMethod.Buffered|((FileAccess.Read | FileAccess.Write)<<14),
310            DiskUpdateDriveSize                = (DiskBase<<16)|(0x0032<<2)|EMethod.Buffered|((FileAccess.Read | FileAccess.Write)<<14),
311            DiskGrowPartition                = (DiskBase<<16)|(0x0034<<2)|EMethod.Buffered|((FileAccess.Read | FileAccess.Write)<<14),
312            DiskGetCacheInformation            = (DiskBase<<16)|(0x0035<<2)|EMethod.Buffered|(FileAccess.Read<<14),
313            DiskSetCacheInformation            = (DiskBase<<16)|(0x0036<<2)|EMethod.Buffered|((FileAccess.Read | FileAccess.Write)<<14),
314            DiskDeleteDriveLayout            = (DiskBase<<16)|(0x0040<<2)|EMethod.Buffered|((FileAccess.Read | FileAccess.Write)<<14),
315            DiskFormatDrive                    = (DiskBase<<16)|(0x00f3<<2)|EMethod.Buffered|((FileAccess.Read | FileAccess.Write)<<14),
316            DiskSenseDevice                    = (DiskBase<<16)|(0x00f8<<2)|EMethod.Buffered|(0<<14),
317            DiskCheckVerify                    = (DiskBase<<16)|(0x0200<<2)|EMethod.Buffered|(FileAccess.Read<<14),
318            DiskMediaRemoval                = (DiskBase<<16)|(0x0201<<2)|EMethod.Buffered|(FileAccess.Read<<14),
319            DiskEjectMedia                    = (DiskBase<<16)|(0x0202<<2)|EMethod.Buffered|(FileAccess.Read<<14),
320            DiskLoadMedia                    = (DiskBase<<16)|(0x0203<<2)|EMethod.Buffered|(FileAccess.Read<<14),
321            DiskReserve                        = (DiskBase<<16)|(0x0204<<2)|EMethod.Buffered|(FileAccess.Read<<14),
322            DiskRelease                        = (DiskBase<<16)|(0x0205<<2)|EMethod.Buffered|(FileAccess.Read<<14),
323            DiskFindNewDevices                = (DiskBase<<16)|(0x0206<<2)|EMethod.Buffered|(FileAccess.Read<<14),
324            DiskGetMediaTypes                = (DiskBase<<16)|(0x0300<<2)|EMethod.Buffered|(0<<14),
325            // CHANGER
326            ChangerBase                        = EFileDevice.Changer,
327            ChangerGetParameters            = (ChangerBase<<16)|(0x0000<<2)|EMethod.Buffered|(FileAccess.Read<<14),
328            ChangerGetStatus                = (ChangerBase<<16)|(0x0001<<2)|EMethod.Buffered|(FileAccess.Read<<14),
329            ChangerGetProductData            = (ChangerBase<<16)|(0x0002<<2)|EMethod.Buffered|(FileAccess.Read<<14),
330            ChangerSetAccess                = (ChangerBase<<16)|(0x0004<<2)|EMethod.Buffered|((FileAccess.Read | FileAccess.Write)<<14),
331            ChangerGetElementStatus            = (ChangerBase<<16)|(0x0005<<2)|EMethod.Buffered|((FileAccess.Read | FileAccess.Write)<<14),
332            ChangerInitializeElementStatus    = (ChangerBase<<16)|(0x0006<<2)|EMethod.Buffered|(FileAccess.Read<<14),
333            ChangerSetPosition                = (ChangerBase<<16)|(0x0007<<2)|EMethod.Buffered|(FileAccess.Read<<14),
334            ChangerExchangeMedium            = (ChangerBase<<16)|(0x0008<<2)|EMethod.Buffered|(FileAccess.Read<<14),
335            ChangerMoveMedium                = (ChangerBase<<16)|(0x0009<<2)|EMethod.Buffered|(FileAccess.Read<<14),
336            ChangerReinitializeTarget        = (ChangerBase<<16)|(0x000A<<2)|EMethod.Buffered|(FileAccess.Read<<14),
337            ChangerQueryVolumeTags            = (ChangerBase<<16)|(0x000B<<2)|EMethod.Buffered|((FileAccess.Read | FileAccess.Write)<<14),
338            // FILESYSTEM
339            FsctlRequestOplockLevel1        = (EFileDevice.FileSystem<<16) | (0<<2) | EMethod.Buffered | (0<<14),
340            FsctlRequestOplockLevel2        = (EFileDevice.FileSystem<<16) | (1<<2) | EMethod.Buffered | (0<<14),
341            FsctlRequestBatchOplock            = (EFileDevice.FileSystem<<16) | (2<<2) | EMethod.Buffered | (0<<14),
342            FsctlOplockBreakAcknowledge        = (EFileDevice.FileSystem<<16) | (3<<2) | EMethod.Buffered | (0<<14),
343            FsctlOpBatchAckClosePending        = (EFileDevice.FileSystem<<16) | (4<<2) | EMethod.Buffered | (0<<14),
344            FsctlOplockBreakNotify            = (EFileDevice.FileSystem<<16) | (5<<2) | EMethod.Buffered | (0<<14),
345            FsctlLockVolume                    = (EFileDevice.FileSystem<<16) | (6<<2) | EMethod.Buffered | (0<<14),
346            FsctlUnlockVolume                = (EFileDevice.FileSystem<<16) | (7<<2) | EMethod.Buffered | (0<<14),
347            FsctlDismountVolume                = (EFileDevice.FileSystem<<16) | (8<<2) | EMethod.Buffered | (0<<14),
348            FsctlIsVolumeMounted            = (EFileDevice.FileSystem<<16) | (10<<2) | EMethod.Buffered | (0<<14),
349            FsctlIsPathnameValid            = (EFileDevice.FileSystem<<16) | (11<<2) | EMethod.Buffered | (0<<14),
350            FsctlMarkVolumeDirty            = (EFileDevice.FileSystem<<16) | (12<<2) | EMethod.Buffered | (0<<14),
351            FsctlQueryRetrievalPointers        = (EFileDevice.FileSystem<<16) | (14<<2) | EMethod.Neither | (0<<14),
352            FsctlGetCompression                = (EFileDevice.FileSystem<<16) | (15<<2) | EMethod.Buffered | (0<<14),
353            FsctlSetCompression                = (EFileDevice.FileSystem<<16) | (16<<2) | EMethod.Buffered | ((FileAccess.Read | FileAccess.Write)<<14),
354            FsctlMarkAsSystemHive            = (EFileDevice.FileSystem<<16) | (19<<2) | EMethod.Neither | (0<<14),
355            FsctlOplockBreakAckNo2            = (EFileDevice.FileSystem<<16) | (20<<2) | EMethod.Buffered | (0<<14),
356            FsctlInvalidateVolumes            = (EFileDevice.FileSystem<<16) | (21<<2) | EMethod.Buffered | (0<<14),
357            FsctlQueryFatBpb                = (EFileDevice.FileSystem<<16) | (22<<2) | EMethod.Buffered | (0<<14),
358            FsctlRequestFilterOplock        = (EFileDevice.FileSystem<<16) | (23<<2) | EMethod.Buffered | (0<<14),
359            FsctlFileSystemGetStatistics    = (EFileDevice.FileSystem<<16) | (24<<2) | EMethod.Buffered | (0<<14),
360            FsctlGetNtfsVolumeData            = (EFileDevice.FileSystem<<16) | (25<<2) | EMethod.Buffered | (0<<14),
361            FsctlGetNtfsFileRecord            = (EFileDevice.FileSystem<<16) | (26<<2) | EMethod.Buffered | (0<<14),
362            FsctlGetVolumeBitmap            = (EFileDevice.FileSystem<<16) | (27<<2) | EMethod.Neither | (0<<14),
363            FsctlGetRetrievalPointers        = (EFileDevice.FileSystem<<16) | (28<<2) | EMethod.Neither | (0<<14),
364            FsctlMoveFile                    = (EFileDevice.FileSystem<<16) | (29<<2) | EMethod.Buffered | (0<<14),
365            FsctlIsVolumeDirty                = (EFileDevice.FileSystem<<16) | (30<<2) | EMethod.Buffered | (0<<14),
366            FsctlGetHfsInformation            = (EFileDevice.FileSystem<<16) | (31<<2) | EMethod.Buffered | (0<<14),
367            FsctlAllowExtendedDasdIo        = (EFileDevice.FileSystem<<16) | (32<<2) | EMethod.Neither | (0<<14),
368            FsctlReadPropertyData            = (EFileDevice.FileSystem<<16) | (33<<2) | EMethod.Neither | (0<<14),
369            FsctlWritePropertyData            = (EFileDevice.FileSystem<<16) | (34<<2) | EMethod.Neither | (0<<14),
370            FsctlFindFilesBySid                = (EFileDevice.FileSystem<<16) | (35<<2) | EMethod.Neither | (0<<14),
371            FsctlDumpPropertyData            = (EFileDevice.FileSystem<<16) | (37<<2) | EMethod.Neither | (0<<14),
372            FsctlSetObjectId                = (EFileDevice.FileSystem<<16) | (38<<2) | EMethod.Buffered | (0<<14),
373            FsctlGetObjectId                = (EFileDevice.FileSystem<<16) | (39<<2) | EMethod.Buffered | (0<<14),
374            FsctlDeleteObjectId                = (EFileDevice.FileSystem<<16) | (40<<2) | EMethod.Buffered | (0<<14),
375            FsctlSetReparsePoint            = (EFileDevice.FileSystem<<16) | (41<<2) | EMethod.Buffered | (0<<14),
376            FsctlGetReparsePoint            = (EFileDevice.FileSystem<<16) | (42<<2) | EMethod.Buffered | (0<<14),
377            FsctlDeleteReparsePoint            = (EFileDevice.FileSystem<<16) | (43<<2) | EMethod.Buffered | (0<<14),
378            FsctlEnumUsnData                = (EFileDevice.FileSystem<<16) | (44<<2) | EMethod.Neither | (0<<14),
379            FsctlSecurityIdCheck            = (EFileDevice.FileSystem<<16) | (45<<2) | EMethod.Neither | (FileAccess.Read<<14),
380            FsctlReadUsnJournal                = (EFileDevice.FileSystem<<16) | (46<<2) | EMethod.Neither | (0<<14),
381            FsctlSetObjectIdExtended        = (EFileDevice.FileSystem<<16) | (47<<2) | EMethod.Buffered | (0<<14),
382            FsctlCreateOrGetObjectId        = (EFileDevice.FileSystem<<16) | (48<<2) | EMethod.Buffered | (0<<14),
383            FsctlSetSparse                    = (EFileDevice.FileSystem<<16) | (49<<2) | EMethod.Buffered | (0<<14),
384            FsctlSetZeroData                = (EFileDevice.FileSystem<<16) | (50<<2) | EMethod.Buffered | (FileAccess.Write<<14),
385            FsctlQueryAllocatedRanges        = (EFileDevice.FileSystem<<16) | (51<<2) | EMethod.Neither | (FileAccess.Read<<14),
386            FsctlEnableUpgrade                = (EFileDevice.FileSystem<<16) | (52<<2) | EMethod.Buffered | (FileAccess.Write<<14),
387            FsctlSetEncryption                = (EFileDevice.FileSystem<<16) | (53<<2) | EMethod.Neither | (0<<14),
388            FsctlEncryptionFsctlIo            = (EFileDevice.FileSystem<<16) | (54<<2) | EMethod.Neither | (0<<14),
389            FsctlWriteRawEncrypted            = (EFileDevice.FileSystem<<16) | (55<<2) | EMethod.Neither | (0<<14),
390            FsctlReadRawEncrypted            = (EFileDevice.FileSystem<<16) | (56<<2) | EMethod.Neither | (0<<14),
391            FsctlCreateUsnJournal            = (EFileDevice.FileSystem<<16) | (57<<2) | EMethod.Neither | (0<<14),
392            FsctlReadFileUsnData            = (EFileDevice.FileSystem<<16) | (58<<2) | EMethod.Neither | (0<<14),
393            FsctlWriteUsnCloseRecord        = (EFileDevice.FileSystem<<16) | (59<<2) | EMethod.Neither | (0<<14),
394            FsctlExtendVolume                = (EFileDevice.FileSystem<<16) | (60<<2) | EMethod.Buffered | (0<<14),
395            FsctlQueryUsnJournal            = (EFileDevice.FileSystem<<16) | (61<<2) | EMethod.Buffered | (0<<14),
396            FsctlDeleteUsnJournal            = (EFileDevice.FileSystem<<16) | (62<<2) | EMethod.Buffered | (0<<14),
397            FsctlMarkHandle                    = (EFileDevice.FileSystem<<16) | (63<<2) | EMethod.Buffered | (0<<14),
398            FsctlSisCopyFile                = (EFileDevice.FileSystem<<16) | (64<<2) | EMethod.Buffered | (0<<14),
399            FsctlSisLinkFiles                = (EFileDevice.FileSystem<<16) | (65<<2) | EMethod.Buffered | ((FileAccess.Read | FileAccess.Write)<<14),
400            FsctlHsmMsg                        = (EFileDevice.FileSystem<<16) | (66<<2) | EMethod.Buffered | ((FileAccess.Read | FileAccess.Write)<<14),
401            FsctlNssControl                    = (EFileDevice.FileSystem<<16) | (67<<2) | EMethod.Buffered | (FileAccess.Write<<14),
402            FsctlHsmData                    = (EFileDevice.FileSystem<<16) | (68<<2) | EMethod.Neither | ((FileAccess.Read | FileAccess.Write)<<14),
403            FsctlRecallFile                    = (EFileDevice.FileSystem<<16) | (69<<2) | EMethod.Neither | (0<<14),
404            FsctlNssRcontrol                = (EFileDevice.FileSystem<<16) | (70<<2) | EMethod.Buffered | (FileAccess.Read<<14),
405            // VIDEO
406             VideoQuerySupportedBrightness         = (EFileDevice.Video << 16) | (0x0125 << 2) | EMethod.Buffered | (0 << 14),
407             VideoQueryDisplayBrightness         = (EFileDevice.Video << 16) | (0x0126 << 2) | EMethod.Buffered | (0 << 14),
408             VideoSetDisplayBrightness             = (EFileDevice.Video << 16) | (0x0127 << 2) | EMethod.Buffered | (0 << 14)
409        }
410    }
411}
Note: See TracBrowser for help on using the browser.