root/Apple Wireless Keyboard Helper/trunk/Misuzilla.Applications.AppleWirelessKeyboardHelper/Win32.cs

Revision 346, 26.7 kB (checked in by tomoyo, 14 months ago)

* 暫定的にJIS配列に対応した
* その他修正

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